Skip to content

Commit f5a8483

Browse files
Adds option to write restart files
1 parent 8745b4b commit f5a8483

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

config_src/mct_driver/ocn_comp_mct.F90

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module ocn_comp_mct
2626

2727
! MOM6 modules
2828
use ocean_model_mod, only: ocean_state_type, ocean_public_type, ocean_model_init_sfc
29-
use ocean_model_mod, only: ocean_model_init, get_state_pointers
29+
use ocean_model_mod, only: ocean_model_init, get_state_pointers, ocean_model_restart
3030
use ocean_model_mod, only: ice_ocean_boundary_type, update_ocean_model
3131
use MOM_domains, only: MOM_infra_init, num_pes, root_pe, pe_here
3232
use MOM_grid, only: ocean_grid_type, get_global_grid_size
@@ -38,7 +38,6 @@ module ocn_comp_mct
3838
use coupler_indices, only: coupler_indices_init, cpl_indices
3939
use coupler_indices, only: ocn_export, fill_ice_ocean_bnd
4040

41-
4241
! By default make data private
4342
implicit none; private
4443
! Public member functions
@@ -362,6 +361,7 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
362361
type(time_type) :: time_start !< Start of coupled time interval to pass to MOM6
363362
type(time_type) :: coupling_timestep !< Coupled time interval to pass to MOM6
364363
character(len=128) :: err_msg
364+
character(len=32) :: timestamp !< Name of intermediate restart file
365365

366366
! Compute the time at the start of this coupling interval
367367
call ESMF_ClockGet(EClock, PrevTime=time_start_ESMF, rc=rc)
@@ -388,19 +388,14 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
388388
endif
389389

390390
! Translate the coupling time interval
391-
call ESMF_ClockGet(EClock, TimeStep=ocn_cpl_interval, rc=rc)
391+
call ESMF_ClockGet(EClock, TimeStep=ocn_cpl_interval, rc=rc)
392392
call ESMF_TimeIntervalGet(ocn_cpl_interval, yy=year, mm=month, d=day, s=seconds, sn=seconds_n, sd=seconds_d, rc=rc)
393393
coupling_timestep = set_time(seconds, days=day, err_msg=err_msg)
394394

395395
! set (actually, get from mct) the cdata pointers:
396396
! \todo this was done in _init_, is it needed again. Does this infodata need to be in glb%?
397397
call seq_cdata_setptrs(cdata_o, infodata=glb%infodata)
398398

399-
! Check alarms for flag to write restart at end of day
400-
write_restart_at_eod = seq_timemgr_RestartAlarmIsOn(EClock)
401-
! \todo Let MOM6 know to write restart...
402-
if (debug .and. is_root_pe()) write(6,*) 'ocn_run_mct, write_restart_at_eod=', write_restart_at_eod
403-
404399
! fill ice ocean boundary
405400
call fill_ice_ocean_bnd(glb%ice_ocean_boundary, glb%grid, x2o_o%rattr, glb%ind, glb%sw_decomp, &
406401
glb%c1, glb%c2, glb%c3, glb%c4)
@@ -409,6 +404,18 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
409404
call update_ocean_model(glb%ice_ocean_boundary, glb%ocn_state, glb%ocn_public, &
410405
time_start, coupling_timestep)
411406

407+
!--- write out intermediate restart file when needed.
408+
! Check alarms for flag to write restart at end of day
409+
write_restart_at_eod = seq_timemgr_RestartAlarmIsOn(EClock)
410+
if (debug .and. is_root_pe()) write(6,*) 'ocn_run_mct, write_restart_at_eod=', write_restart_at_eod
411+
412+
if (write_restart_at_eod) then
413+
!timestamp = date_to_string(EClock)
414+
! \todo add time stamp to ocean_model_restart
415+
!call ocean_model_restart(glb%ocn_state, timestamp)
416+
call ocean_model_restart(glb%ocn_state)
417+
endif
418+
412419
end subroutine ocn_run_mct
413420

414421
!> Finalizes MOM6

0 commit comments

Comments
 (0)