Skip to content

Conversation

cbegeman
Copy link
Contributor

@cbegeman cbegeman commented May 20, 2025

Here we add a new capability to transition between centered and upwinded horizontal thickness advection as a function of column thickness.

Formerly, either thickness advection was centered or upwinded everywhere. With this PR, when config_use_spatially_variable_upwinding is .true., advection is fully upwinded when the column thickness is less than config_spatially_variable_upwind_hmin and fully centered when column thickness is greater than config_spatially_variable_upwind_hmax. Between these values, there is a linear transition layerThickEdgeFlux

[NML]
[BFB] stealth feature

@cbegeman cbegeman requested review from sbrus89 and xylar May 20, 2025 20:26
@cbegeman cbegeman added the Stealth PR has feature which, if turned on, could change climate. fka FCC label May 20, 2025
@cbegeman
Copy link
Contributor Author

cbegeman commented May 20, 2025

Testing

Parabolic bowl test has been run and found to have similar convergence and error.

Drying slope ramp test also qualitatively similar when ramp extends from thin film thickness to 1m and upwinded to centered transitions between water column thickness of 1m - 5m.

IcoswISC240/WOA23/performance_test runs with diffs when spatially variable upwinding is on between 5m - 50m

Passes the e3sm_cryo_developer suite on Chrysalis with the feature off

Passes the SMS_D_Ld1.TL319_IcoswISC30E3r5.GMPAS-JRA1p5.chrysalis_intel.mpaso-upwind_advection with the feature on, ramping between 10 and 50m, and the time integration scheme changed to split_explicit. Fails with split_explicit_ab2 with CFL violation in MPAS-Seaice indicating an instability.

@cbegeman
Copy link
Contributor Author

@sbrus89 Would you mind giving the code a look and letting me know whether you would be satisfied for this to go in without the results of your hurricane test?

@cbegeman cbegeman added mpas-ocean BFB PR leaves answers BFB labels May 20, 2025
@cbegeman
Copy link
Contributor Author

cbegeman commented Jun 3, 2025

@sbrus89 Let me know if you have any questions about this PR

@cbegeman
Copy link
Contributor Author

@xylar and @sbrus89 please review when you have a chance. Thanks!

Copy link
Contributor

@sbrus89 sbrus89 left a comment

Choose a reason for hiding this comment

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

@cbegeman, This looks good by inspection. I just have one minor comment. Sorry for the delay on the review.

@@ -985,7 +985,43 @@ subroutine ocn_diagnostic_solve_layerThicknessEdge(normalVelocity, &
#endif

end if

if (config_use_spatially_variable_upwind) then
Copy link
Contributor

@sbrus89 sbrus89 Jun 17, 2025

Choose a reason for hiding this comment

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

There should probably be a check to make sure in the init routine to require config_thickness_flux_type = 'upwind' with config_use_spatially_variable_upwind=.true.. I suppose there's no harm in leaving config_use_spatially_variable_upwind=.true. on for config_thickness_flux_type = 'centered', but right now it will silently do a needless interpolation between the same values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I'll add that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sbrus89 This check is in case (thickEdgeFluxUpwind) so I don't think there is a needless interpolation. Let me know if you see something that I don't.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, you're right; I missed that. Thanks!

Copy link
Contributor

@xylar xylar left a comment

Choose a reason for hiding this comment

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

I think this looks good so far! It needs a stealth test. @cbegeman, would you like help adding one?

@xylar
Copy link
Contributor

xylar commented Jun 18, 2025

@xylar
Copy link
Contributor

xylar commented Jun 18, 2025

I'm going to test this out with a short (5 day) SORRMr4 run where I'm writing out upwindFactor in the history files. Let me know if that sounds reasonable.

@cbegeman
Copy link
Contributor Author

I'm going to test this out with a short (5 day) SORRMr4 run where I'm writing out upwindFactor in the history files. Let me know if that sounds reasonable.

@xylar Go for it. If you want upwinding to be on, just make sure that the upwinding range isn't below the minimum wct for that mesh.

@xylar
Copy link
Contributor

xylar commented Jun 18, 2025

If you want upwinding to be on, just make sure that the upwinding range isn't below the minimum wct for that mesh.

Very good point!

@xylar
Copy link
Contributor

xylar commented Jun 18, 2025

@cbegeman, I tried to run with:

config_thickness_flux_type = 'upwind'
config_use_spatially_variable_upwind = .true.
config_spatially_variable_upwind_hmin = 10.0
config_spatially_variable_upwind_hmax = 20.0

The run is here:

/lcrc/group/e3sm/ac.xylar/scratch/chrys/20250618.GMPAS-JRA1p5-DIB-PISMF.TL319_SOwISC12to30E3r4.upwind_factor.chrysalis/run

It crashed about 10 minutes in with a state validation error.

I can debug on Friday if needed but probably won't get to it before then. Just wanted to point it out in case you want to look into it earlier.

I'll run the same test without upwinding to make completely sure it works.
Update: No, I was able to run fine without upwinding, see:

/lcrc/group/e3sm/ac.xylar/scratch/chrys/20250618.GMPAS-JRA1p5-DIB-PISMF.TL319_SOwISC12to30E3r4.chrysalis/run

@cbegeman cbegeman force-pushed the ocn/use-horiz-field-for-upwinding branch from de06dc1 to d692dad Compare June 18, 2025 15:57
@cbegeman
Copy link
Contributor Author

@xylar I'll see if I can run compass's ocean/global_ocean/SOwISC12to30/MALI_topo_AIS_4to20km. I am not sure whether a new dynamic adjustment would be needed.

@xylar
Copy link
Contributor

xylar commented Jun 18, 2025

I am not sure whether a new dynamic adjustment would be needed.

Ah, that certainly does seem plausible. If so, just running with super short time steps is worth a go.

Update: Reducing the time step even to 10 seconds from 10 minutes didn't help. I'm seeing a crash around 0001-01-01_01:10:00 in every simulation. (So about 40 minutes in, as the simulation appears to start at 30 minutes into day 1.) I misspoke above.

I'm also seeing annoying hangs without the job ending as reported in:
#7447

@xylar
Copy link
Contributor

xylar commented Jun 27, 2025

@cbegeman, I tried running:

./create_test SMS_D_Ld1.TL319_IcoswISC30E3r5.GMPAS-JRA1p5.chrysalis_intel.mpaso-upwind_advection --wait

I'm seeing errors like:

 80: forrtl: error (72): floating overflow
 80: Image              PC                Routine            Line        Source  
 80: libpnetcdf.so.3.0  000015554B27962C  for__signal_handl     Unknown  Unknown
 80: libpthread-2.28.s  00001555473D0CF0  Unknown               Unknown  Unknown
 80: e3sm.exe           0000000005CC1D32  Unknown               Unknown  Unknown
 80: e3sm.exe           0000000003143250  ocn_diagnostics_m        2967  mpas_ocn_diagnostics.f90

This is pointing at the line:

         fracAbsorbed = 1.0_RKIND &
                      - exp( max(-100.0_RKIND, &
                                 -layerThickness(kmin, iCell)/ &
                           config_flux_attenuation_coefficient))

I verified that the test runs fine when I remove .mpaso-upwind_advection. I tried reducing the hmax:

 config_spatially_variable_upwind_hmax = 30.0

But that didn't change the results (perhaps unsurprisingly).

I suspect we might be seeing negative layer thicknesses or something like that, but I haven't yet dived deeper.

Let me know if you have thoughts on this.

@cbegeman
Copy link
Contributor Author

cbegeman commented Jul 1, 2025

@xylar Using the split_explicit time integrator, the IcoswISC mesh passes (1 month simulation) while the SORRM mesh still fails.

Instability with the SORRM mesh likely does not indicate an issue with this feature but rather that we also need wetting-and-drying to be active. As such, I think we can proceed with making this a stealth feature.

@cbegeman cbegeman marked this pull request as ready for review July 1, 2025 18:07
Copy link
Contributor

@xylar xylar left a comment

Choose a reason for hiding this comment

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

@cbegeman, sounds good to me.

I reran:

./create_test SMS_D_Ld1.TL319_IcoswISC30E3r5.GMPAS-JRA1p5.chrysalis_intel.mpaso-upwind_advection --wait

and with the switch to split-explicit time stepping, it now works for me, too.

I agree that we can investigate SORRM further in combination with wetting-and-drying updates that you have waiting in the wings.

Copy link
Contributor

@sbrus89 sbrus89 left a comment

Choose a reason for hiding this comment

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

Approved based on inspection and others' testing.

@cbegeman
Copy link
Contributor Author

cbegeman commented Jul 2, 2025

@xylar and @sbrus89 Thank you both for reviewing!

@jonbob This is ready for your testing.

@jonbob
Copy link
Contributor

jonbob commented Jul 2, 2025

@cbegeman -- if this is a stealth feature, we need to add a test to the e3sm_ocnice_stealth_features suite? Or does this reuse the SMS_D_Ld1.T62_oQU240.GMPAS-IAF.mpaso-upwind_advection test that's already there?

@jonbob
Copy link
Contributor

jonbob commented Jul 2, 2025

@cbegeman -- does this PR need the scripts run to make the bld files consistent with Registry? I don't see changes to build-namelist

@cbegeman
Copy link
Contributor Author

cbegeman commented Jul 2, 2025

@cbegeman -- if this is a stealth feature, we need to add a test to the e3sm_ocnice_stealth_features suite? Or does this reuse the SMS_D_Ld1.T62_oQU240.GMPAS-IAF.mpaso-upwind_advection test that's already there?

It does reuse that case. I think it fulfills testing upwind advection to apply upwinding to part of the domain with spatially vairable upwinding.

@cbegeman
Copy link
Contributor Author

cbegeman commented Jul 2, 2025

@cbegeman -- does this PR need the scripts run to make the bld files consistent with Registry? I don't see changes to build-namelist

@jonbob I changed build-namelist-section. Is there a need to change build-namelist? Maybe it's worth running your script in case I missed something. Thanks!

@jonbob
Copy link
Contributor

jonbob commented Jul 2, 2025

@cbegeman -- yes, it's necessary to make changes to build-namelist. The build-namelist-section file doesn't actually get used for anything but is mostly a product of the generate_e3sm_namelist_files script. It has to get mirrored in build-namelist itself to actually be used.

@cbegeman
Copy link
Contributor Author

cbegeman commented Jul 2, 2025

@jonbob Thanks! I seem to frequently forget at least one of the many places to update the namelist!

@jonbob jonbob added the NML label Jul 9, 2025
jonbob added a commit that referenced this pull request Jul 9, 2025
#7371)

New spatially-variable horizontal upwind capability

Here we add a new capability to transition between centered and upwinded
horizontal thickness advection as a function of column thickness.

Formerly, either thickness advection was centered or upwinded
everywhere. With this PR, when config_use_spatially_variable_upwinding
is .true., advection is fully upwinded when the column thickness is less
than config_spatially_variable_upwind_hmin and fully centered when
column thickness is greater than config_spatially_variable_upwind_hmax.
Between these values, there is a linear transition layerThickEdgeFlux

[NML]
[BFB] stealth feature
@jonbob
Copy link
Contributor

jonbob commented Jul 9, 2025

Passes:

  • SMS_D_Ld1.ne30pg2_r05_IcoswISC30E3r5.WCYCL1850.chrysalis_intel.allactive-wcprod
  • e3sm_cryo_developer

with expected NML DIFFs. Also successfully ran:

  • SMS_D_Ld1.TL319_IcoswISC30E3r5.GMPAS-JRA1p5.chrysalis_intel.mpaso-upwind_advection

merged to next

@jonbob jonbob merged commit dfb364d into E3SM-Project:master Jul 10, 2025
3 checks passed
@jonbob
Copy link
Contributor

jonbob commented Jul 10, 2025

merged to master and expected NML DIFFs blessed on all machine except pm-cpu, which has yet to report

@jonbob
Copy link
Contributor

jonbob commented Jul 15, 2025

also blessed on pm-cpu

@cbegeman cbegeman deleted the ocn/use-horiz-field-for-upwinding branch July 15, 2025 16:20
@cbegeman
Copy link
Contributor Author

Thank you for all your testing and moving this forward, @jonbob!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB mpas-ocean NML Stealth PR has feature which, if turned on, could change climate. fka FCC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants