Skip to content

Commit

Permalink
Merge branch 'dev/ncar' into merge_GME
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-marques committed May 17, 2019
2 parents eda43c4 + e0a8b9b commit 03386c0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config_src/nuopc_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
call get_param(param_file, mdl, "USE_NET_FW_ADJUSTMENT_SIGN_BUG", &
CS%use_net_FW_adjustment_sign_bug, &
"If true, use the wrong sign for the adjustment to\n"//&
"the net fresh-water.", default=.true.)
"the net fresh-water.", default=.false.)
call get_param(param_file, mdl, "ADJUST_NET_FRESH_WATER_BY_SCALING", &
CS%adjust_net_fresh_water_by_scaling, &
"If true, adjustments to net fresh water to achieve zero net are\n"//&
Expand Down
46 changes: 44 additions & 2 deletions config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,7 @@ subroutine ModelAdvance(gcomp, rc)
! local variables
integer :: userRc
logical :: existflag, isPresent, isSet
logical :: do_advance = .true.
type(ESMF_Clock) :: clock!< ESMF Clock class definition
type(ESMF_Alarm) :: alarm
type(ESMF_State) :: importState, exportState
Expand Down Expand Up @@ -1846,8 +1847,47 @@ subroutine ModelAdvance(gcomp, rc)
file=__FILE__)) &
return ! bail out

Time = esmf2fms_time(currTime)
Time_step_coupled = esmf2fms_time(timeStep)
Time = esmf2fms_time(currTime)

!---------------
! Apply ocean lag for startup runs:
!---------------

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

! 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)
endif
endif
endif


!---------------
! Write diagnostics for import
Expand Down Expand Up @@ -1890,7 +1930,9 @@ subroutine ModelAdvance(gcomp, rc)
!---------------

if(profile_memory) call ESMF_VMLogMemInfo("Entering MOM update_ocean_model: ")
call update_ocean_model(Ice_ocean_boundary, ocean_state, ocean_public, Time, Time_step_coupled)
if (do_advance) then
call update_ocean_model(Ice_ocean_boundary, ocean_state, ocean_public, Time, Time_step_coupled)
endif
if(profile_memory) call ESMF_VMLogMemInfo("Leaving MOM update_ocean_model: ")

!---------------
Expand Down

0 comments on commit 03386c0

Please sign in to comment.