diff --git a/config_src/solo_driver/MOM_driver.F90 b/config_src/solo_driver/MOM_driver.F90 index 6095761247..ed8df7f91b 100644 --- a/config_src/solo_driver/MOM_driver.F90 +++ b/config_src/solo_driver/MOM_driver.F90 @@ -171,13 +171,13 @@ program MOM_main logical :: unit_in_use integer :: initClock, mainClock, termClock - logical :: do_online ! If true, use the model in prognostic mode where - ! the barotropic and baroclinic dynamics, thermodynamics, - ! etc. are stepped forward integrated in time. - ! If false, then all of the above are bypassed with all - ! fields necessary to integrate only the tracer advection - ! and diffusion equation are read in from files stored from - ! a previous integration of the prognostic model + logical :: offline_tracer_mode ! If false, use the model in prognostic mode where + ! the barotropic and baroclinic dynamics, thermodynamics, + ! etc. are stepped forward integrated in time. + ! If true, then all of the above are bypassed with all + ! fields necessary to integrate only the tracer advection + ! and diffusion equation are read in from files stored from + ! a previous integration of the prognostic model type(MOM_control_struct), pointer :: MOM_CSp => NULL() type(surface_forcing_CS), pointer :: surface_forcing_CSp => NULL() @@ -266,12 +266,12 @@ program MOM_main segment_start_time = set_date(date(1),date(2),date(3),date(4),date(5),date(6)) Time = segment_start_time ! Note the not before CS%d - call initialize_MOM(Time, param_file, dirs, MOM_CSp, segment_start_time, do_online_out = do_online) + call initialize_MOM(Time, param_file, dirs, MOM_CSp, segment_start_time, offline_tracer_mode = offline_tracer_mode) else ! In this case, the segment starts at a time read from the MOM restart file ! or left as Start_time by MOM_initialize. Time = Start_time - call initialize_MOM(Time, param_file, dirs, MOM_CSp, do_online_out=do_online) + call initialize_MOM(Time, param_file, dirs, MOM_CSp, offline_tracer_mode=offline_tracer_mode) endif fluxes%C_p = MOM_CSp%tv%C_p ! Copy the heat capacity for consistency. @@ -310,7 +310,7 @@ program MOM_main "The time step for changing forcing, coupling with other \n"//& "components, or potentially writing certain diagnostics. \n"//& "The default value is given by DT.", units="s", default=dt) - if (.not. do_online) then + if (offline_tracer_mode) then call get_param(param_file, mod, "DT_OFFLINE", time_step, & "Time step for the offline time step") dt = time_step @@ -415,7 +415,7 @@ program MOM_main call callTree_enter("Main loop, MOM_driver.F90",n) ! Set the forcing for the next steps. - if (do_online) then + if (.not. offline_tracer_mode) then call set_forcing(state, fluxes, Time, Time_step_ocean, grid, & surface_forcing_CSp) endif @@ -441,11 +441,14 @@ program MOM_main ! This call steps the model over a time time_step. Time1 = Master_Time ; Time = Master_Time - if (do_online) call step_MOM(fluxes, state, Time1, time_step, MOM_CSp) - if (.not. do_online) call step_tracers(fluxes, state, Time1, time_step, MOM_CSp) + if (offline_tracer_mode) then + call step_tracers(fluxes, state, Time1, time_step, MOM_CSp) + else + call step_MOM(fluxes, state, Time1, time_step, MOM_CSp) + endif -! Time = Time + Time_step_ocean -! This is here to enable fractional-second time steps. +! Time = Time + Time_step_ocean +! This is here to enable fractional-second time steps. elapsed_time = elapsed_time + time_step if (elapsed_time > 2e9) then ! This is here to ensure that the conversion from a real to an integer @@ -469,7 +472,7 @@ program MOM_main surface_forcing_CSp%handles) call disable_averaging(MOM_CSp%diag) - if (do_online) then + if (.not. offline_tracer_mode) then if (fluxes%fluxes_used) then call enable_averaging(fluxes%dt_buoy_accum, Time, MOM_CSp%diag) call forcing_diagnostics(fluxes, state, fluxes%dt_buoy_accum, grid, & @@ -482,8 +485,6 @@ program MOM_main endif endif - - ! See if it is time to write out the energy. if ((Time + (Time_step_ocean/2) > write_energy_time) .and. & (MOM_CSp%dt_trans == 0.0)) then @@ -525,7 +526,8 @@ program MOM_main if (Restart_control>=0) then if (MOM_CSp%dt_trans > 0.0) call MOM_error(WARNING, "End of MOM_main reached "//& "with a non-zero dt_trans. Additional restart fields are required.") - if (.not.fluxes%fluxes_used .and. do_online) call MOM_error(FATAL, "End of MOM_main reached "//& + if (.not.fluxes%fluxes_used .and. .not. offline_tracer_mode) call MOM_error(FATAL, & + "End of MOM_main reached "//& "with unused buoyancy fluxes. For conservation, the ocean restart "//& "files can only be created after the buoyancy forcing is applied.") diff --git a/src/core/MOM.F90 b/src/core/MOM.F90 index 6e821a7e26..1c988290c5 100644 --- a/src/core/MOM.F90 +++ b/src/core/MOM.F90 @@ -201,7 +201,8 @@ module MOM !! MOM_regridding module. logical :: do_dynamics !< If false, does not call step_MOM_dyn_*. This is an !! undocumented run-time flag that is fragile. - logical :: do_online !< If false, step_tracers is called instead of step_MOM. + logical :: offline_tracer_mode = .false. + !< If true, step_tracers() is called instead of step_MOM(). !! This is intended for running MOM6 in offline tracer mode real :: dt !< (baroclinic) dynamics time step (seconds) real :: dt_therm !< thermodynamics time step (seconds) @@ -1459,9 +1460,9 @@ subroutine step_tracers(fluxes, state, Time_start, time_interval, CS) integer :: IsdB, IedB, JsdB, JedB logical :: z_first, x_before_y - ! Fail out if do_online is true - if(CS%do_online) call MOM_error(FATAL,"DO_ONLINE=True when calling step_tracers") - + ! Fail out if offline_tracer_mode is not true + if (.not.CS%offline_tracer_mode) call MOM_error(FATAL,"OFFLINE_TRACER_MODE=False when calling step_tracers") + ! Grid-related pointer assignments G => CS%G GV => CS%GV @@ -1538,8 +1539,8 @@ subroutine step_tracers(fluxes, state, Time_start, time_interval, CS) ! Do horizontal diffusion first (but only half of it), remainder will be applied after advection call tracer_hordiff(h_pre, CS%offline_CSp%dt_offline*0.5, CS%MEKE, CS%VarMix, G, GV, & - CS%tracer_diff_CSp, CS%tracer_Reg, CS%tv, do_online_flag=CS%do_online, read_khdt_x=khdt_x*0.5, & - read_khdt_y=khdt_y*0.5) + CS%tracer_diff_CSp, CS%tracer_Reg, CS%tv, do_online_flag=.not.CS%offline_tracer_mode, & + read_khdt_x=khdt_x*0.5, read_khdt_y=khdt_y*0.5) do j=jsd,jed ; do i=isd,ied fluxes%netMassOut(i,j) = 0.5*fluxes%netMassOut(i,j) @@ -1821,14 +1822,14 @@ end subroutine step_tracers !> This subroutine initializes MOM. -subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in, do_online_out) +subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in, offline_tracer_mode) type(time_type), target, intent(inout) :: Time !< model time, set in this routine type(param_file_type), intent(out) :: param_file !< structure indicating paramater file to parse type(directories), intent(out) :: dirs !< structure with directory paths type(MOM_control_struct), pointer :: CS !< pointer set in this routine to MOM control structure type(time_type), optional, intent(in) :: Time_in !< time passed to MOM_initialize_state when !! model is not being started from a restart file - logical, optional, intent(out) :: do_online_out !< .false. if tracers are being run offline + logical, optional, intent(out) :: offline_tracer_mode !< True if tracers are being run offline ! local type(ocean_grid_type), pointer :: G => NULL() ! A pointer to a structure with metrics and related @@ -1941,15 +1942,14 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in, do_online_out) "If False, skips the dynamics calls that update u & v, as well as\n"//& "the gravity wave adjustment to h. This is a fragile feature and\n"//& "thus undocumented.", default=.true., do_not_log=.true. ) - call get_param(param_file, "MOM", "DO_ONLINE", CS%do_online, & - "If false, use the model in prognostic mode where\n"//& - "the barotropic and baroclinic dynamics, thermodynamics,\n"//& - "etc. are stepped forward integrated in time.\n"//& - "If true, the all of the above are bypassed with all\n"//& - "fields necessary to integrate only the tracer advection\n"//& - "and diffusion equation are read in from files stored from\n"//& - "a previous integration of the prognostic model\n"//& - "NOTE: This option only used in the ocean_solo_driver.", default=.true.) + if (present(offline_tracer_mode)) then ! Only read this parameter in solo mode + call get_param(param_file, "MOM", "OFFLINE_TRACER_MODE", CS%offline_tracer_mode, & + "If true, barotropic and baroclinic dynamics, thermodynamics\n"//& + "are all bypassed with all the fields necessary to integrate\n"//& + "the tracer advection and diffusion equation are read in from\n"//& + "files stored from a previous integration of the prognostic model.\n"//& + "NOTE: This option only used in the ocean_solo_driver.", default=.false.) + endif call get_param(param_file, "MOM", "USE_REGRIDDING", CS%use_ALE_algorithm , & "If True, use the ALE algorithm (regridding/remapping).\n"//& "If False, use the layered isopycnal algorithm.", default=.false. ) @@ -2534,9 +2534,9 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in, do_online_out) ! If running in offline tracer mode, initialize the necessary control structure and ! parameters - if(present(do_online_out)) do_online_out=CS%do_online + if(present(offline_tracer_mode)) offline_tracer_mode=CS%offline_tracer_mode - if(.not. CS%do_online) then + if(CS%offline_tracer_mode) then call offline_transport_init(param_file, CS%offline_CSp, CS%diabatic_CSp%diabatic_aux_CSp, G, GV) call register_diags_offline_transport(Time, CS%diag, CS%offline_CSp) endif