mom-ocean / MOM6

Modular Ocean Model
Other
185 stars 231 forks source link

coupled timesteps sync test #1100

Open raphaeldussin opened 4 years ago

raphaeldussin commented 4 years ago

https://github.com/NOAA-GFDL/MOM6/blob/12853fa5581c7b8c4605c94dccafca64c332863a/src/core/MOM.F90#L775

I think this should be:

if (CS%diabatic_first .and. abs(CS%t_dyn_rel_thermo -dtdia) > 1e-6*dtdia) call blah

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?

Hallberg-NOAA commented 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.

raphaeldussin commented 4 years ago

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:

https://github.com/NOAA-GFDL/MOM6/blob/70cfd64c8e04bc550eb0603060230a5e2b7ac4f3/config_src/coupled_driver/ocean_model_MOM.F90#L574

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?