Skip to content

Commit

Permalink
Add dump_last namelist feature and turn it on for smoke tests. (#221)
Browse files Browse the repository at this point in the history
* Add dump_last namelist feature and turn it on for smoke tests.

* update documentation
  • Loading branch information
apcraig committed Sep 11, 2018
1 parent 87eb863 commit d4d68f1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions configuration/driver/icedrv_calendar.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module icedrv_calendar
new_hour , & ! new hour = .true.
use_leap_years , & ! use leap year functionality if true
write_ic , & ! write initial condition now
dump_last , & ! write restart at end
force_restart_now ! force a restart now

character (len=1), public :: &
Expand Down Expand Up @@ -241,6 +242,7 @@ subroutine calendar(ttime)
end select

if (force_restart_now) write_restart = 1
if (dump_last .and. istep == npt) write_restart = 1

endif ! istep > 1

Expand Down
6 changes: 4 additions & 2 deletions configuration/driver/icedrv_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ subroutine input_data
use icedrv_diagnostics, only: diag_file, nx_names
use icedrv_domain_size, only: nilyr, nslyr, max_ntrcr, ncat, n_aero
use icedrv_calendar, only: year_init, istep0
use icedrv_calendar, only: dumpfreq, diagfreq
use icedrv_calendar, only: dumpfreq, diagfreq, dump_last
use icedrv_calendar, only: npt, dt, ndtd, days_per_year, use_leap_years
use icedrv_restart_shared, only: restart, restart_dir, restart_file
use icedrv_flux, only: update_ocn_f, l_mpond_fresh, cpl_bgc
Expand Down Expand Up @@ -112,7 +112,7 @@ subroutine input_data

namelist /setup_nml/ &
days_per_year, use_leap_years, year_init, istep0, &
dt, npt, ndtd, &
dt, npt, ndtd, dump_last, &
ice_ic, restart, restart_dir, restart_file, &
dumpfreq, diagfreq, diag_file, cpl_bgc

Expand Down Expand Up @@ -209,6 +209,7 @@ subroutine input_data
diag_file = 'ice_diag' ! history file name prefix
cpl_bgc = .false. !
dumpfreq='y' ! restart frequency option
dump_last=.false. ! restart at end of run
restart = .false. ! if true, read restart files for initialization
restart_dir = './' ! write to executable dir for default
restart_file = 'iced' ! restart file name prefix
Expand Down Expand Up @@ -459,6 +460,7 @@ subroutine input_data
write(nu_diag,1020) ' diagfreq = ', diagfreq
write(nu_diag,1030) ' dumpfreq = ', &
trim(dumpfreq)
write(nu_diag,1010) ' dump_last = ', dump_last
write(nu_diag,1010) ' restart = ', restart
write(nu_diag,*) ' restart_dir = ', &
trim(restart_dir)
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/icepack_in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
restart = .false.
restart_dir = './restart/'
dumpfreq = 'y'
dump_last = .false.
diagfreq = 24
diag_file = 'ice_diag'
cpl_bgc = .false.
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/options/set_nml.smoke
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#npt = 24
dump_last = .true.
1 change: 1 addition & 0 deletions doc/source/user_guide/ug_case_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ column physics.
"``dumpfreq``", "``y``", "write restart every ``dumpfreq_n`` years", "y"
"", "``m``", "write restart every ``dumpfreq_n`` months", ""
"", "``d``", "write restart every ``dumpfreq_n`` days", ""
"``dump_last``", "true/false", "write restart at end of run", "false"
"", "", "*Model Output*", ""
"``diagfreq``", "integer", "frequency of diagnostic output in ``dt``", "24"
"", "*e.g.*, 10", "once every 10 time steps", ""
Expand Down
2 changes: 2 additions & 0 deletions doc/source/user_guide/ug_implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ for a full, exact restart. The filename begins with the character string
variable ``dumpfreq``. The namelist variable ``ice_ic`` contains the
pointer to the filename from which the restart data is to be read and
the namelist option ``restart`` must be set to ``.true.`` to use the file.
``dump_last`` namelist can also be set to true to trigger restarts automatically
at then end of runs.

.. _bgc-hist:

Expand Down
12 changes: 9 additions & 3 deletions icepack.setup
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ EOF1
endif
endif
foreach name (${grid} ${setsx})
foreach name (${grid} ${test} ${setsx})
set found = 0
if (-e ${ICE_SCRIPTS}/options/set_nml.${name}) then
Expand Down Expand Up @@ -715,8 +715,14 @@ EOF2
set found = 1
endif
if (${found} == 0) then
echo "${0}: ERROR, ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found"
exit -1
if (${name} == ${test}) then
echo "${ICE_SCRIPTS}/options/set_[nml,env].${name} not found"
echo "`date`${0} ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found" >> ${casedir}/README.case
else
echo "${0}: ERROR, ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found"
echo "`date`${0}: ERROR, ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found" >> ${casedir}/README.case
exit -1
endif
endif
end
Expand Down

0 comments on commit d4d68f1

Please sign in to comment.