Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify specification of stop_option, rest_option and history_option (cesm only) #313

Merged
merged 4 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions cesm/driver/esm_time_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ module esm_time_mod

! Clock and alarm options
character(len=*), private, parameter :: &
optNONE = "none" , &
optNever = "never" , &
optNSteps = "nsteps" , &
optNSeconds = "nseconds" , &
optNMinutes = "nminutes" , &
optNHours = "nhours" , &
optNDays = "ndays" , &
optNMonths = "nmonths" , &
optNYears = "nyears" , &
optMonthly = "monthly" , &
optYearly = "yearly" , &
optDate = "date" , &
optNONE = "none" , &
optNever = "never" , &
optNSteps = "nstep" , &
optNSeconds = "nsecond" , &
optNMinutes = "nminute" , &
optNHours = "nhour" , &
optNDays = "nday" , &
optNMonths = "nmonth" , &
optNYears = "nyear" , &
optMonthly = "monthly" , &
optYearly = "yearly" , &
optDate = "date" , &
optGLCCouplingPeriod = "glc_coupling_period"

! Module data
Expand Down Expand Up @@ -434,13 +434,14 @@ subroutine esm_time_alarmInit( clock, alarm, option, &
rc = ESMF_FAILURE
return
end if
else if (trim(option) == optNSteps .or. &
trim(option) == optNSeconds .or. &
trim(option) == optNMinutes .or. &
trim(option) == optNHours .or. &
trim(option) == optNDays .or. &
trim(option) == optNMonths .or. &
trim(option) == optNYears) then
else if (&
trim(option) == optNSteps .or. trim(option) == trim(optNSteps)//'s' .or. &
trim(option) == optNSeconds .or. trim(option) == trim(optNSeconds)//'s' .or. &
trim(option) == optNMinutes .or. trim(option) == trim(optNMinutes)//'s' .or. &
trim(option) == optNHours .or. trim(option) == trim(optNHours)//'s' .or. &
trim(option) == optNDays .or. trim(option) == trim(optNDays)//'s' .or. &
trim(option) == optNMonths .or. trim(option) == trim(optNMonths)//'s' .or. &
trim(option) == optNYears .or. trim(option) == trim(optNYears)//'s' ) then
if (.not.present(opt_n)) then
call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
Expand All @@ -451,7 +452,7 @@ subroutine esm_time_alarmInit( clock, alarm, option, &
rc = ESMF_FAILURE
return
end if
end if
end if

! Determine inputs for call to create alarm
selectcase (trim(option))
Expand Down Expand Up @@ -479,36 +480,36 @@ subroutine esm_time_alarmInit( clock, alarm, option, &
if (ChkErr(rc,__LINE__,u_FILE_u)) return
update_nextalarm = .false.

case (optNSteps)
case (optNSteps,trim(optNSteps)//'s')
call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
AlarmInterval = AlarmInterval * opt_n
update_nextalarm = .true.

case (optNSeconds)
case (optNSeconds,trim(optNSeconds)//'s')
call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
AlarmInterval = AlarmInterval * opt_n
update_nextalarm = .true.

case (optNMinutes)
case (optNMinutes,trim(optNMinutes)//'s')
call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc)
AlarmInterval = AlarmInterval * opt_n
update_nextalarm = .true.

case (optNHours)
case (optNHours,trim(optNHours)//'s')
call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
AlarmInterval = AlarmInterval * opt_n
update_nextalarm = .true.

case (optNDays)
case (optNDays,trim(optNDays)//'s')
call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
AlarmInterval = AlarmInterval * opt_n
update_nextalarm = .true.

case (optNMonths)
case (optNMonths,trim(optNMonths)//'s')
call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
AlarmInterval = AlarmInterval * opt_n
Expand Down
7 changes: 3 additions & 4 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
nmlgen.init_defaults(infile, config, skip_default_for_groups=["modelio"])

#--------------------------------
# Overwrite: wav-ice coupling (assumes cice6 as the ice component
# Set default wav-ice coupling (assumes cice6 as the ice component
#--------------------------------
## commenting out wavice_coupling for now because it causes instabilities. -aa
##if (case.get_value("COMP_WAV") == 'ww3dev' and case.get_value("COMP_ICE") == 'cice'):
## nmlgen.set_value('wavice_coupling', value='.true.')
if (case.get_value("COMP_WAV") == 'ww3dev' and case.get_value("COMP_ICE") == 'cice'):
nmlgen.add_default('wavice_coupling', value='.true.')

#--------------------------------
# Overwrite: set brnch_retain_casename
Expand Down