Skip to content

Commit

Permalink
Add option to write restarts each time step, add verification for dum…
Browse files Browse the repository at this point in the history
…pfreq namelist value in ice_init.F90 (#312)

* Add verification for dumpfreq namelist value in ice_init.F90

* Add option to write restarts at each time step

* Update documentation
  • Loading branch information
phil-blain authored and apcraig committed May 9, 2019
1 parent c4ea4de commit 8e0824a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,18 @@ subroutine input_data
if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=F and fbot_xfer_type=Cdn_ocn'
abort_flag = 19
endif

if (.not.(trim(dumpfreq) == 'y' .or. trim(dumpfreq) == 'Y' .or. &
trim(dumpfreq) == 'm' .or. trim(dumpfreq) == 'M' .or. &
trim(dumpfreq) == 'd' .or. trim(dumpfreq) == 'D' .or. &
trim(dumpfreq) == 'h' .or. trim(dumpfreq) == 'H' .or. &
trim(dumpfreq) == '1' )) then
if (my_task == master_task) then
write(nu_diag,*) subname//' WARNING: unrecognized dumpfreq=', trim(dumpfreq)
write(nu_diag,*) subname//' WARNING: No restarts files will be written'
write(nu_diag,*) subname//' WARNING: Allowed values : ''y'', ''m'', ''d'', ''h'', ''1'''
endif
endif

ice_IOUnitsMinUnit = numin
ice_IOUnitsMaxUnit = numax
Expand Down
5 changes: 5 additions & 0 deletions cicecore/shared/ice_calendar.F90
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ subroutine calendar(ttime)
endif
enddo

if (dumpfreq == '1') then
if (mod(istep1, dumpfreq_n)==0) &
write_restart = 1
endif

if (istep > 1) then

do ns = 1, nstreams
Expand Down
2 changes: 1 addition & 1 deletion doc/source/cice_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ either Celsius or Kelvin units).
"dte2T", "dte / 2(damping time scale)", ""
"dtei", "1/dte, where dte is the EVP subcycling time step", "1/s"
"dump_file", ":math:`\bullet` output file for restart dump", ""
"dumpfreq", ":math:`\bullet` dump frequency for restarts, y, m or d", ""
"dumpfreq", ":math:`\bullet` dump frequency for restarts, y, m, d, h or 1", ""
"dumpfreq_n", ":math:`\bullet` restart output frequency", ""
"dump_last", ":math:`\bullet` if true, write restart on last time step of simulation", ""
"dxhy", "combination of HTE values", ""
Expand Down
3 changes: 2 additions & 1 deletion doc/source/user_guide/ug_case_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Table of namelist options
"","", "``m``", "write restart every ``dumpfreq_n`` months", ""
"","", "``d``", "write restart every ``dumpfreq_n`` days", ""
"","", "``h``", "write restart every ``dumpfreq_n`` hours", ""
"","", "``1``", "write restart every ``dumpfreq_n`` time step", ""
"","``dumpfreq_n``", "integer", "frequency restart data is written", "1"
"\*","``dump_last``", "true/false", "if true, write restart on last time step of simulation", ""
"","", "", "**Model Output**", ""
Expand All @@ -130,7 +131,7 @@ Table of namelist options
"","", "``m``", "write history every ``histfreq_n`` months", ""
"","", "``d``", "write history every ``histfreq_n`` days", ""
"","", "``h``", "write history every ``histfreq_n`` hours", ""
"","", "``1``", "write history every time step", ""
"","", "``1``", "write history every ``histfreq_n`` time step", ""
"","", "``x``", "unused frequency stream (not written)", ""
"","``histfreq_n``", "integer array", "frequency history output is written", ""
"","", "0", "do not write to history", ""
Expand Down

0 comments on commit 8e0824a

Please sign in to comment.