GEOS-ESM / FVdycoreCubed_GridComp

MAPL/ESMF wrapper for the cubed-sphere finite volume dynamical core
Apache License 2.0
3 stars 10 forks source link

Fix use of npz before being set #280

Closed mathomp4 closed 4 months ago

mathomp4 commented 4 months ago

NOTE: View changes with whitespace off:

https://github.com/GEOS-ESM/FVdycoreCubed_GridComp/pull/280/files?w=1

as my editor cleans up trailing spaces.


This PR fixes a small bug in FV_StateMod found by @atrayano where this:

  if (FV_Atm(1)%flagstruct%npz == 1) SW_DYNAMICS = .true.

was being called before:

      call MAPL_GetResource( MAPL, FV_Atm(1)%flagstruct%npz, 'AGCM_LM:', default= 72, RC=STATUS )

This is an obvious bug as you shouldn't refer to a variable before it's set.

I will test this along with https://github.com/GEOS-ESM/GFDL_atmos_cubed_sphere/pull/96 with both Intel and GCC to make sure it is zero diff.