Open raphaeldussin opened 4 years ago
Upon further reflection, I am beginning to think that the test in this error message is right, but there is a bug elsewhere in the code with keeping track of time and the phases of the solver. The advective and thermodynamic timesteps are supposed to be the same, and this is a test that they are.
I think that the central problem here is that dtdia should be equal to dt_therm in this case, but it is not.
going further down the rabbit hole, I found out that step_MOM is called with time interval = coupled timestep and not dt_therm. This comes from the coupled driver here:
there is some logic using thermo_spans_coupling several lines down (after the last else) but it doesn't look like that this condition is realized.
At least this explains why dtdia is not set properly. Do we miss a .not. thermo_spans_coupling in line 574?
https://github.com/NOAA-GFDL/MOM6/blob/12853fa5581c7b8c4605c94dccafca64c332863a/src/core/MOM.F90#L775
I think this should be:
using THERMO_SPANS_COUPLING = True and dt_cpld = 3600 with dt_therm = 7200 and dt = 900, dtdia is set to 3600. t_dyn_rel_thermo varies between - dtdia and dtdia and t_dyn_rel_adv between 0 and 2*dtdia. t_dyn_rel_thermo is one dtdia behind t_dyn_rel_adv at all times so the test should check for t_dyn_rel_thermo -dtdia not being > 0 (it should be zero actually). In which case t_dyn_rel_thermo is exactly between 2 thermodynamics steps when do_advection happens.
@Hallberg-NOAA thoughts?