From d449d37f894f141653266fe2433bc50671ac4579 Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Fri, 10 May 2019 13:22:09 -0600 Subject: [PATCH 1/4] Set default of USE_NET_FW_ADJUSTMENT_SIGN_BUG to false in NUOPC cap --- config_src/nuopc_driver/MOM_surface_forcing.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"//& From eb301fe3976e48fbdbb0715a92404029e239fd2c Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Mon, 13 May 2019 18:21:45 -0600 Subject: [PATCH 2/4] skip first tstep and double second tstep --- config_src/nuopc_driver/mom_cap.F90 | 46 +++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/config_src/nuopc_driver/mom_cap.F90 b/config_src/nuopc_driver/mom_cap.F90 index 09af1d4cba..45c1b9df87 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,45 @@ subroutine ModelAdvance(gcomp, rc) file=__FILE__)) & return ! bail out - Time = esmf2fms_time(currTime) - Time_step_coupled = esmf2fms_time(timeStep) + !--------------- + ! Apply ocean lag at startup: + !--------------- + + 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) + else + Time_step_coupled = esmf2fms_time(timeStep) + Time = esmf2fms_time(currTime) + endif + endif + !--------------- ! Write diagnostics for import @@ -1890,7 +1928,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: ") !--------------- From 0ae751e7b6203c82f22ffc9ed855d53f4eef5bb1 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Mon, 13 May 2019 18:32:28 -0600 Subject: [PATCH 3/4] apply ocean lag to cesm runs only --- config_src/nuopc_driver/mom_cap.F90 | 64 ++++++++++++++++------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/config_src/nuopc_driver/mom_cap.F90 b/config_src/nuopc_driver/mom_cap.F90 index 45c1b9df87..f394f9f5bf 100644 --- a/config_src/nuopc_driver/mom_cap.F90 +++ b/config_src/nuopc_driver/mom_cap.F90 @@ -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 From b2ff365ee3cd256df6bed806d84c4719bda628e2 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Wed, 15 May 2019 13:05:39 -0600 Subject: [PATCH 4/4] fix ocean lag logic for restart runs --- config_src/nuopc_driver/mom_cap.F90 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/config_src/nuopc_driver/mom_cap.F90 b/config_src/nuopc_driver/mom_cap.F90 index f394f9f5bf..3992aae530 100644 --- a/config_src/nuopc_driver/mom_cap.F90 +++ b/config_src/nuopc_driver/mom_cap.F90 @@ -1847,8 +1847,11 @@ subroutine ModelAdvance(gcomp, rc) file=__FILE__)) & return ! bail out + Time_step_coupled = esmf2fms_time(timeStep) + Time = esmf2fms_time(currTime) + !--------------- - ! Apply ocean lag at startup: + ! Apply ocean lag for startup runs: !--------------- if (cesm_coupled) then @@ -1881,15 +1884,8 @@ subroutine ModelAdvance(gcomp, rc) 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