Skip to content

Commit 6289582

Browse files
committed
Bug fix for write_energy with short dt
Fix a bug with subroutine write_energy when using a DT<2. Otherwise, the energy outputs are written at wrong time steps. The reason was that time type divide is essentially a floor. So DT/2 = 0 if DT<2.
1 parent 79979a9 commit 6289582

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diagnostics/MOM_sum_output.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ module MOM_sum_output
2121
use MOM_io, only : attribute_info, set_attribute_info, delete_attribute_info
2222
use MOM_io, only : APPEND_FILE, SINGLE_FILE, WRITEONLY_FILE
2323
use MOM_spatial_means, only : array_global_min_max
24-
use MOM_time_manager, only : time_type, get_time, get_date, set_time, operator(>)
24+
use MOM_time_manager, only : time_type, get_time, get_date, set_time
2525
use MOM_time_manager, only : operator(+), operator(-), operator(*), operator(/)
26-
use MOM_time_manager, only : operator(/=), operator(<=), operator(>=), operator(<)
26+
use MOM_time_manager, only : operator(/=), operator(<=), operator(>=), operator(<), operator(>)
2727
use MOM_time_manager, only : get_calendar_type, time_type_to_real, NO_CALENDAR
2828
use MOM_tracer_flow_control, only : tracer_flow_control_CS, call_tracer_stocks
2929
use MOM_unit_scaling, only : unit_scale_type
@@ -489,7 +489,7 @@ subroutine write_energy(u, v, h, tv, day, n, G, GV, US, CS, tracer_CSp, dt_forci
489489
CS%write_energy_time = CS%Start_time + CS%energysavedays * &
490490
(1 + (day - CS%Start_time) / CS%energysavedays)
491491
endif
492-
elseif (day + (dt_force/2) <= CS%write_energy_time) then
492+
elseif (day + dt_force/2 < CS%write_energy_time) then
493493
return ! Do not write this step
494494
else ! Determine the next write time before proceeding
495495
if (CS%energysave_geometric) then

0 commit comments

Comments
 (0)