diff --git a/config_src/nuopc_driver/MOM_surface_forcing.F90 b/config_src/nuopc_driver/MOM_surface_forcing.F90 index 57da9d5a31..aecfd419da 100644 --- a/config_src/nuopc_driver/MOM_surface_forcing.F90 +++ b/config_src/nuopc_driver/MOM_surface_forcing.F90 @@ -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"//& diff --git a/config_src/nuopc_driver/mom_cap.F90 b/config_src/nuopc_driver/mom_cap.F90 index 09af1d4cba..3992aae530 100644 --- a/config_src/nuopc_driver/mom_cap.F90 +++ b/config_src/nuopc_driver/mom_cap.F90 @@ -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 @@ -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 @@ -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: ") !---------------