Skip to content

Conversation

@patcal
Copy link
Collaborator

@patcal patcal commented Sep 30, 2025

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:

                                                          Hscale = PI*6350/Nudge_SpectralNtrunc

                                          i.e. Nudge_SpectralNtrunc=40 corresponds to a horizontal 
                                                 nudging scale  Hscale~500km.

@patcal patcal requested a review from fvitt September 30, 2025 05:29
@patcal patcal added bug-fix This PR was created to fix a specific bug. CoupledEval3 labels Sep 30, 2025
@cacraigucar cacraigucar self-assigned this Sep 30, 2025
Copy link

@fvitt fvitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not seeing where Nudge_SpectralNbasis gets sets. Is it always -1?

Comment on lines +1351 to +1355
write(iulog,*) 'NUDGING: WARNING - analyses file NOT FOUND. You can switch nudging '
write(iulog,*) 'NUDGING: OFF to coast thru a known gap in your files '
write(iulog,*) 'NUDGING: by commenting out the following endrun command.'
endif
call endrun('nudging_timestep_init:: ERROR Missing Nudging File')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a namelist switch to turn on / off the abort behavior? I agree that aborting the run should be the default behavior.

!=======================================================================

!=======================================================================
! legacy spherepack routines
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, these spherepack routines are duplicates of the spherepack routines in zonal_mean_mod.F90. If so, the spherepack routines in zonal_mean_mod should be removed and zonal_mean_mod should use the routines here.



!=======================================================================
subroutine Invert_Matrix(I_Mat,Nbas,O_InvMat)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a duplicate of Invert_Matrix in zonal_mean_mod


! Type definitions
!-------------------
type SphericalHarmonic_t
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the existing ZonalMean class be replaced by "special" use of this SphericalHarmonic class (m=0)?

@cacraigucar cacraigucar requested a review from jtruesdal October 13, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This PR was created to fix a specific bug. CoupledEval3

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants