Skip to content

Commit

Permalink
apply ocean lag to cesm runs only
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed May 14, 2019
1 parent eb301fe commit 0ae751e
Showing 1 changed file with 35 additions and 29 deletions.
64 changes: 35 additions & 29 deletions config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1851,39 +1851,45 @@ subroutine ModelAdvance(gcomp, rc)
! Apply ocean lag at startup:
!---------------

if (trim(runtype) == "initial") then
if (cesm_coupled) then
if (trim(runtype) == "initial") then

! Do not call MOM6 timestepping routine if the first cpl tstep of a startup run
if (currTime == startTime) then
call ESMF_LogWrite("MOM6 - Skipping the first coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
do_advance = .false.
else
do_advance = .true.
endif
! Do not call MOM6 timestepping routine if the first cpl tstep of a startup run
if (currTime == startTime) then
call ESMF_LogWrite("MOM6 - Skipping the first coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
do_advance = .false.
else
do_advance = .true.
endif

! If the second cpl tstep of a startup run, step back a cpl tstep and advance for two cpl tsteps
if (currTime == startTime + timeStep) then
call ESMF_LogWrite("MOM6 - Stepping back one coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
Time = esmf2fms_time(currTime-timeStep) ! i.e., startTime
! If the second cpl tstep of a startup run, step back a cpl tstep and advance for two cpl tsteps
if (currTime == startTime + timeStep) then
call ESMF_LogWrite("MOM6 - Stepping back one coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
Time = esmf2fms_time(currTime-timeStep) ! i.e., startTime

call ESMF_LogWrite("MOM6 - doubling the coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
Time_step_coupled = 2 * esmf2fms_time(timeStep)
else
Time_step_coupled = esmf2fms_time(timeStep)
Time = esmf2fms_time(currTime)
call ESMF_LogWrite("MOM6 - doubling the coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
Time_step_coupled = 2 * esmf2fms_time(timeStep)
else
Time_step_coupled = esmf2fms_time(timeStep)
Time = esmf2fms_time(currTime)
endif
endif

else ! non-cesm runs:
Time_step_coupled = esmf2fms_time(timeStep)
Time = esmf2fms_time(currTime)
endif


Expand Down

0 comments on commit 0ae751e

Please sign in to comment.