GEOS-ESM / GEOSgcm_GridComp

Repository containing the physics and IAU code for the GEOS Earth System Model
Apache License 2.0
9 stars 7 forks source link

Incorrect comparison to global 'nsplt' instead of local ksplt(k) in fv_tracer_2d #13

Closed kgerheiser closed 5 years ago

kgerheiser commented 5 years ago

I believe I found a bug in fv_tracer2d.F90 when filling the optional dpA in the subroutine tracer_2d. A comparison is made to the global nsplt when it should be compared to the local ksplt(k) value. This leads to dpA not being fully filled if ksplt for that level is less than nsplt

This: https://github.com/GEOS-ESM/GEOSgcm_GridComp/blob/f5fd1e30f4c6ee376c6f799b32cb71e606335dd4/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/FVdycoreCubed_GridComp/fvdycore/model/fv_tracer2d.F90#L546

Should be:

if ( it /= ksplt(k)) then 

because if ksplt(k) == 1 for that level, and nsplt == 2, it will never be 2 because the outer if ( it .le. ksplt(k) ) will fail and therefore dpA won't be assigned.

tclune commented 5 years ago

Assigned to @wmputman .

lizziel commented 5 years ago

Kyle, how would this bug manifest itself in a simulation? The version of FV3 in GEOS-Chem High Performance (GCHP) may need the fix but I am uncertain of the priority without assessing impact. Do you have test results you could share?

kgerheiser commented 5 years ago

I ran into this when running the GEOS-CTM at resolutions greater than C48. The code would just crash in offline_tracer_advection with floating invalid when using dpA to calculate PE because it was half-filled with NaNs.

wmputman commented 5 years ago

It's the correct change, i don't test this case very often if ever since we most exclusively run GEOS with z_tracer = T so we always use the tracer_2d_1L routine above this.

lizziel commented 5 years ago

This fix appears to correct the issue I was having in GEOS-Chem with this version of FV3 where concentrations were blowing up at our default dynamic timestep. I was getting around it by reducing the timestep but now this is no longer necessary. Thank you!!