Add Spectral Nudging Option and Fix Nudging Behavior When Files Are Missing#1402
Add Spectral Nudging Option and Fix Nudging Behavior When Files Are Missing#1402patcal wants to merge 3 commits into
Conversation
fvitt
left a comment
There was a problem hiding this comment.
Some initial questions and comments. Do you have a test case for spectral nudging that you can point me to? I can implement a regression test case.
|
|
||
| logical :: Nudge_SpectralFilter =.false. | ||
| integer :: Nudge_SpectralNtrunc = -1 | ||
| integer :: Nudge_SpectralNbasis = -1 |
There was a problem hiding this comment.
I am not seeing where Nudge_SpectralNbasis gets sets. Is it always -1?
There was a problem hiding this comment.
Hi @fvitt , for the spherical harmonics, the user specifies the meridional truncation(L). For each index (l < L+1) there are (2l+1) basis functions, so the init() routine sums up the total number of these basis functions and returns the value into Nudge_SpectralNbasis.
There was a problem hiding this comment.
We have these aux_cam tests:
aux_cam : ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s
aux_cam : SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday
and these prealpha and prebeta tests:
prealpha : ERP_Ln9.f09_f09_mg17.FCnudged_GC.derecho_intel.cam-outfrq9s
prealpha : SMS_D_Ln9_P1536x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCnudged.derecho_intel.cam-outfrq9s # "Nudged CAM-Chem on a regionally refined grid"
prebeta : SMS_D_Ln9.f09_f09_mg17.FCnudged.derecho_intel.cam-outfrq3s_zmean_nudging # Zonal Mean Nudged
|
Thanks @patcal I'll see if I can update this to the head of the trunk. |
jtruesdal
left a comment
There was a problem hiding this comment.
This is a nice refactor. I didn't test the code to pull shr_reprosum out of the level loop it was just an example but something like that should work.
|
Hi John,
Sorry for the confusion. The last test I ran last night before pushing
the mods had a 50% increase in runtime, so something I did is causing
problems that I am trying to undo. I thought I might be able to get it
sorted out
before this morning. I will go ahead and update with the current files
shortly
so you and Francis can go through the revisions. The problem seems to be
isolated to one use case, so I will need to add a patch for nudging.F90 to
fix
cases with user-defined nudging windows (Nudge_Xprof=3 cases) as soon
as I get it worked out.
…--> Patrick
On Tue, Jun 23, 2026 at 9:03 AM jtruesdal ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/utils/ug_spectralmethods_mod.F90
<#1402 (comment)>:
> +
+ Csum(:,:) = 0._r8
+ Gcov(:) = 0._r8
+
+ do nn= 1,this%nbas
+ count = 0
+ do lchnk=begchunk,endchunk
+ ncols = get_ncols_p(lchnk)
+ do cc = 1,ncols
+ count=count+1
+ Csum(count,nn) = I_Gdata(cc,ll,lchnk)*this%basis(cc,lchnk,nn)*this%area(cc,lchnk)
+ end do
+ end do
+ end do
+
+ call shr_reprosum_calc(Csum, Gcov, count, nlcols, this%nbas, gbl_count=ngcols_p, commid=mpicom)
Same as above. I don't see the mods.
—
Reply to this email directly, view it on GitHub
<#1402?email_source=notifications&email_token=AJMQHAOZGO77LLLC63HKZXT5BKL3ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGQ2TAOBQGIZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#discussion_r3460760759>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJMQHAICCQL6TZ4V55A7AMT5BKL3ZAVCNFSNUABFKJSXA33TNF2G64TZHMZDANBYGQ2DGNBRHNEXG43VMU5TGNBWG43DGMBWGE42C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AJMQHALGHQZWKTC2ORSIL2T5BKL3ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGQ2TAOBQGIZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AJMQHALAPZLOTCUYOCURL6T5BKL3ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGQ2TAOBQGIZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…er-defined nudging windows
|
Thanks Pat.
jt
…On Tue, Jun 23, 2026 at 10:44 AM patcal ***@***.***> wrote:
*patcal* left a comment (ESCOMP/CAM#1402)
<#1402 (comment)>
Hi John,
Sorry for the confusion. The last test I ran last night before pushing
the mods had a 50% increase in runtime, so something I did is causing
problems that I am trying to undo. I thought I might be able to get it
sorted out
before this morning. I will go ahead and update with the current files
shortly
so you and Francis can go through the revisions. The problem seems to be
isolated to one use case, so I will need to add a patch for nudging.F90 to
fix
cases with user-defined nudging windows (Nudge_Xprof=3 cases) as soon
as I get it worked out.
--> Patrick
On Tue, Jun 23, 2026 at 9:03 AM jtruesdal ***@***.***> wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In src/utils/ug_spectralmethods_mod.F90
> <#1402 (comment)>:
>
> > +
> + Csum(:,:) = 0._r8
> + Gcov(:) = 0._r8
> +
> + do nn= 1,this%nbas
> + count = 0
> + do lchnk=begchunk,endchunk
> + ncols = get_ncols_p(lchnk)
> + do cc = 1,ncols
> + count=count+1
> + Csum(count,nn) =
I_Gdata(cc,ll,lchnk)*this%basis(cc,lchnk,nn)*this%area(cc,lchnk)
> + end do
> + end do
> + end do
> +
> + call shr_reprosum_calc(Csum, Gcov, count, nlcols, this%nbas,
gbl_count=ngcols_p, commid=mpicom)
>
> Same as above. I don't see the mods.
>
> —
> Reply to this email directly, view it on GitHub
> <
#1402?email_source=notifications&email_token=AJMQHAOZGO77LLLC63HKZXT5BKL3ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGQ2TAOBQGIZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#discussion_r3460760759>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AJMQHAICCQL6TZ4V55A7AMT5BKL3ZAVCNFSNUABFKJSXA33TNF2G64TZHMZDANBYGQ2DGNBRHNEXG43VMU5TGNBWG43DGMBWGE42C5QC>
> .
> Triage notifications, keep track of coding agent tasks and review pull
> requests on the go with GitHub Mobile for iOS
> <
https://github.com/notifications/mobile/ios/AJMQHALGHQZWKTC2ORSIL2T5BKL3ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGQ2TAOBQGIZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
> and Android
> <
https://github.com/notifications/mobile/android/AJMQHALAPZLOTCUYOCURL6T5BKL3ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGQ2TAOBQGIZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
> Download it today!
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#1402?email_source=notifications&email_token=ACG3NX3OC7U7VAJ2D4N6MRD5BKXWVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZYGE2DEOBUGE2KM4TFMFZW63VGMFZXG2LHN2SWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4781428414>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACG3NX2J247C3R5EJ7EN4N35BKXWVAVCNFSNUABFKJSXA33TNF2G64TZHMZDANBYGQ2DGNBRHNEXG43VMU5TGNBWG43DGMBWGE42C5QC>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
30ab709 to
9abc12a
Compare
jtruesdal
left a comment
There was a problem hiding this comment.
All looks good now for me.
|
Thanks John,
I will try and get the Nudge_Xprof=3 problem resolved today.
…--> Patrick
On Tue, Jun 23, 2026 at 1:27 PM jtruesdal ***@***.***> wrote:
***@***.**** approved this pull request.
All looks good now for me.
—
Reply to this email directly, view it on GitHub
<#1402?email_source=notifications&email_token=AJMQHANDKVAVL5XRKMZLJZL5BLK23A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGY2DKNBXG422M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-4556454775>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJMQHAIXITRKVMTG6DZ64DT5BLK23AVCNFSNUABFKJSXA33TNF2G64TZHMZDANBYGQ2DGNBRHNEXG43VMU5TGNBWG43DGMBWGE42C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AJMQHAMUUEBNJHBWZAMZYKT5BLK23A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGY2DKNBXG422M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AJMQHAJRD7Z5EJMLHZ4GBZT5BLK23A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJVGY2DKNBXG422M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
fvitt
left a comment
There was a problem hiding this comment.
Looks good to me, assuming the nudged regression tests pass if they are expected to.
This pull request addresses issues #1393 and #1273
For Issue #1273 an error exit with a message is invoked if a missing nudging file is encountered.
For Issue #1393 a module for computing spherical harmonics on the physics grid is implemented. The nudging module has additional functionality that uses this module to optionally filter nudging tendencies to scales larger then a specified truncation scale.
This functionality is controlled by 2 additional variables in the &nudging_nl namelist.
Nudge_SpectralFilter- LOGICAL Option to apply spherical harminic filtering to
the model state and target data so that nudging
tendencies are only applied to scales larger than
the specified truncation.
Nudge_SpectralNtrunc - INT The number of meridional spherical harmonic modes used
for spectral filtering. The nominal horizontal scale of
the filtering can be estimated as: