-
Notifications
You must be signed in to change notification settings - Fork 434
Description
@jonschwenk and I have been troubleshooting an unhandled condition in the coupler bypass logic that results in only shortwave radiation and precipitation advancing through a time series if the resolution of the forcing dataset is exactly half the ELM timestep.
Looking at lnd_import_export.F90 L. 503-519, and assuming hourly forcing data (e.g., ERA5) and a half-hour ELM time step, atm2lnd_vars%npf(v))
evaluates to 2.0. For variables that are not v = 4 or 5 (8 to 13 only come from EAM output, L. 237-238), this puts us in the L. 510-514 block, where there is a conditional that tests: mod(tod/get_step_size()-1,nint(atm2lnd_vars%npf(v))) <= atm2lnd_vars%npf(v)/2._r8 .and. mod(tod/get_step_size(),nint(atm2lnd_vars%npf(v))) > atm2lnd_vars%npf(v)/2._r8
. mod(tod/get_step_size()-1,nint(atm2lnd_vars%npf(v)))
can only evaluate to 1 or 0 if npf = 2, and since the right hand side evaluates to 1, there is no way for this condition to be met.
If there remains a need to treat v = 4, 5, 8-13 differently than v = 1-3, 6, 7, one potential fix would be:
do v=1,met_nvars
if (atm2lnd_vars%npf(v) - 1._r8 .gt. 1e-3) then
if (v .eq. 4 .or. v .eq. 5 .or. (v .ge. 8 .and. v .le. 13)) then !rad/Precipitation
if (mod(tod/get_step_size(),nint(atm2lnd_vars%npf(v))) == 1 .and. nstep .gt. 3) then
atm2lnd_vars%tindex(g,v,1) = atm2lnd_vars%tindex(g,v,1)+1
atm2lnd_vars%tindex(g,v,2) = atm2lnd_vars%tindex(g,v,2)+1
end if
else
if (atm2lnd_vars%npf(v) .ne. 2._r8) then
if (mod(tod/get_step_size()-1,nint(atm2lnd_vars%npf(v))) <= atm2lnd_vars%npf(v)/2._r8 .and. &
mod(tod/get_step_size(),nint(atm2lnd_vars%npf(v))) > atm2lnd_vars%npf(v)/2._r8) then
atm2lnd_vars%tindex(g,v,1) = atm2lnd_vars%tindex(g,v,1)+1
atm2lnd_vars%tindex(g,v,2) = atm2lnd_vars%tindex(g,v,2)+1
end if
else
if (mod(tod/get_step_size(),nint(atm2lnd_vars%npf(v))) == 1 .and. nstep .gt. 3) then
atm2lnd_vars%tindex(g,v,1) = atm2lnd_vars%tindex(g,v,1)+1
atm2lnd_vars%tindex(g,v,2) = atm2lnd_vars%tindex(g,v,2)+1
end if
end if
end if
else
atm2lnd_vars%tindex(g,v,1) = atm2lnd_vars%tindex(g,v,1)+nint(1/atm2lnd_vars%npf(v))
atm2lnd_vars%tindex(g,v,2) = atm2lnd_vars%tindex(g,v,2)+nint(1/atm2lnd_vars%npf(v))
end if
I could add this to #7480 if desired, or let me know if a different approach would be preferred here.