Changes to SourceMods for Replay¶
Most changes have been labeled with an inline comment “added - sweid” or
something similar. The replay.F90
module is where the core of the replay occurs, and
is likely the only file needed to understand how the replay works.
CIME¶
Module ESMF_ClockMod.F90
Source path: cime/src/share/esmf_wrf_timemgr/
- subroutine ESMF_ClockMod.F90/ESMF_ClockSetOLD()¶
Use replay timing variable ContinueTime.
- subroutine ESMF_ClockMod.F90/ESMF_ClockGetContinueTime()¶
Define replay timing variable ContinueTime and allow other functions to query.
- subroutine ESMF_ClockMod.F90/ESMF_ClockAdvance()¶
Adjust current time and advance time based on whether a replay or corrector step. Turn off sync alarms. Allows for other clock functions to work with replay. Changes clock alarms so the model doesn’t crash when backup occurs.
Module cime_comp_mod.F90
Source path: cime/src/drivers/mct/main/
- subroutine cime_comp_mod.F90/cime_run()¶
Reset time and date to restart time at correct time.
Module seq_timemgr_mod.F90
Source path: cime/src/drivers/mct/shr/
- subroutine seq_timemgr_mod.F90/seq_timemgr_clockAdvance()¶
Change clock advance to replay-specific advance variable continue_tod.
- subroutine seq_timemgr_mod.F90/seq_timemgr_EClockInit()¶
Adjust clock time for restart.
CAM¶
Module cam_comp.F90
Source path: components/cam/src/control
- subroutine cam_comp.F90/cam_run4()¶
Initialize and call variables from the physics buffer, including _old variables. Save buffer variables into “_old” at timestep the model is supposed to back up to (currently 00z, 06z, 12z, 18z). Switch buffer variable back to _old version when time for model to back up (currently 03z, 09z, 15z, 21z). Turns off clock alarm for cam clock out of sync.
Module cam_history.F90
Source path: components/cam/src/control
- subroutine cam_history.F90/wshist()¶
Comment out end run if issue with history file writeout. Allows history files to be overwritten after the model backs up and re-runs with the replay forcing applied.
Module camsrfexch.F90
Source path: components/cam/src/control
- type camsrfexch.F90/cam_out¶
Define _old variables for cam_out (to coupler) variables.
- type camsrfexch.F90/cam_in_t¶
Define _old variables for cam_in_t (from coupler) variables.
- subroutine camsrfexch.F90/hub2atm_alloc()¶
Allocate _old cam_in variables as needed.
- subroutine camsrfexch.F90/hub2atm_dealloc()¶
Deallocate _old cam_in variables as needed.
Module runtime_opts.F90
Source path: components/cam/src/control
- subroutine runtime_opts.F90/read_namelist()¶
Read in replay namelist parameters from user_nl_cam.
Module atm_comp_mct.F90
Source path: components/cam/src/cpl
- subroutine atm_comp_mct.F90/atm_run_mct()¶
Save cam_out and cam_in variables into “_old” at timestep the model is supposed to back up to (currently 00z, 06z, 12z, 18z). Switch variable back to _old version when time for model to back up (currently 03z, 09z, 15z, 21z). Turns off clock alarm for cam clock out of sync.
Module replay.F90
Source path: components/cam/src/physics/cam/
- subroutine replay.F90/replay_readnl()¶
Read replay namelist parameters. End job and throw error if namelist parameters not properly defined. Send parameters to all processors.
- subroutine replay.F90/replay_init()¶
Process windowing parameters if there are any in the namelist and send the updated values to all processors.
- subroutine replay.F90/replay_register()¶
Register _old buffer fields used to store buffer information for model reset.
- subroutine replay.F90/read_netcdf_replay()¶
Read reanalysis file for replay using file path and name defined in namelist. Only valid for fv grids.
- function replay.F90/interpret_filename_replay()¶
Interpret reanalysis filename based on template defined in namelist. Requires year, month, day, and seconds.
- subroutine replay.F90/replay_correction()¶
Set state replay forcing variables to 0 during unforced steps (first 3 hours). When time for model to reset (currently 03z, 09z, 15z, 21z), calls read of reanalysis file for current time. Calculates difference between model state and reanalysis. Sets state replay forcing variables as that difference. Applies replay forcing as tendency (divided by forcing time, which is 6 hours in seconds by default) during replay forcing steps.
- subroutine replay.F90/replaying_set_profile()¶
Set the spatial regions where the replay is being applied using the windowing parameters for the 3D replay varaibles. If no windowing parameters, then the full globe will be replayed.
- subroutine replay.F90/replaying_set_PSprofile()¶
Set the spatial regions where the replay is being applied using the windowing parameters for PS. If no windowing parameters, then the full globe will be replayed.
Module cam_diagnostics.F90
Source path: components/cam/src/physics/cam/
- subroutine cam_diagnostics.F90/diag_init_dry()¶
Add replay difference fields (SDIFF, QDIFF, UDIFF, VDIFF) to default history outfield lists.
- subroutine cam_diagnostics.F90/diag_phys_writeout()¶
Call writeout replay difference fields (SDIFF, QDIFF, UDIFF, VDIFF) when other state variables are also called.
Module physics_types.F90
Source path: components/cam/src/physics/cam/
- subroutine physics_types.F90/physics_state_alloc()¶
Define and allocate state type variables (sforce, qforce, vforce, uforce) for applying replay forcing to state.
Module physpkg.F90
Source path: components/cam/src/physics/cam/
- subroutine physpkg.F90/phys_register()¶
Call register replay variables
- subroutine physpkg.F90/phys_run2()¶
Call replay correction function and physics writeout to save calculated replay forcings.
- subroutine physpkg.F90/tphsbc()¶
Comment out debug checks so model doesn’t crash with replay forcing applied.
Module restart_physics.F90
Source path: components/cam/src/physics/cam/
- subroutine restart_physics.F90/read_restart_physics()¶
Comment out call to read restart file since restart files will not have the right information to restart with a clean replay.
Module dyn_comp.F90
Source path: components/cam/dynamics/fv
- subroutine dyn_comp.F90/dyn_init()¶
Allocate dyn_in and dyn_out variables that are stored in the buffer.
- subroutine dyn_comp.F90/dyn_free_interface()¶
Separate subroutine dyn_free_interface to be public outside of dyn_final for use in other functions. Deallocates _old variables as needed.
Module stepon.F90
Source path: components/cam/dynamics/fv
- subroutine stepon.F90/stepon_run3()¶
Save dynamics buffer variables into “_old” at timestep the model is supposed to back up to (currently 00z, 06z, 12z, 18z). Switch buffer variable back to _old version when time for model to back up (currently 03z, 09z, 15z, 21z). Turns off clock alarm for cam clock out of sync.
Module pft_module.F90
Source path: components/cam/dynamics/fv
- subroutine pft_module.F90/pftinit()¶
Deallocate variable for model reset.
Module restart_dynamics.F90
Source path: components/cam/dynamics/fv
- subroutine restart_dynamics.F90/read_restart_dynamics()¶
Deallocate restart variables and pointers for model reset. Because of these changes, replay cannot restart automatically from restart variables.
Module spmd_dyn.F90
Source path: components/cam/dynamics/fv
- subroutine spmd_dyn.F90/spmdinit_dyn()¶
Deallocate dynamic grid variables as needed.
Module CMakeLists.txt
Source path: components/cam/src/physics/cam
- CAM source files
Include replay.F90 in make file.
Module namelist_definition.xml
Source path: components/cam/bld/namelist_files/namelist_definition.xml
- Namelist defitions
Add definitions for possible namelist parameters defined in user_nl_cam, used to configure the replay.
CICE¶
Module CICE_RunMod.F90
Source path: components/cice/src/drivers/cesm/
- subroutine CICE_RunMod.F90/CICE_Run()¶
Add current time as argument. When current time is time for model to back up, subtract 3 hours from CICE time manager.
Module ice_comp_mct.F90
Source path: components/cice/src/drivers/cesm/
- subroutine ice_comp_mct.F90/ice_run_mct()¶
Save buffer variables into “_old” at timestep the model is supposed to back up to (currently 00z, 06z, 12z, 18z). Switch buffer variable back to _old version when time for model to back up (currently 03z, 09z, 15z, 21z). Turns off clock alarm for cice clock out of sync.
Module ice_flux.F90
Source path: components/cice/src/source/
- Module variable declarations
Define _old variables for active non-zero public buffer variables in the cice.r. file (for the FHIST_DARTC6 compset).
Module ice_state.F90
Source path: components/cice/src/source/
- Module variable declarations
Define _old variables for active non-zero public buffer variables in the cice.r. file (for the FHIST_DARTC6 compset).
Module ice_orbital.F90
Source path: components/cice/src/source/
- subroutine ice_orbital.F90/compute_coszen()¶
Adjust CICE clock when time for model to restart for calculation of coszen based on Earth’s orbit.
Module ice_dyn_shared.F90
Source path: components/cice/src/source/
Deallocate variable in case still has data after model backs up.
CLM¶
Module various
Source path: components/clm/src/biogeophys/ and components/clm/src/main/
- subroutine various/InitAllocate()¶
Define and allocate _old variables for all non-zero public buffer variables in the clm.r. file (for the FHIST_DARTC6 compset). Also deallocates _old variables for grid-type variables if the original buffer variable is also deallocated. Changes in the following files:
Aerosol_Mod.F90
CanopyStateType.F90
EnergyFluxType.F90
FrictionVelocityMod.F90
IrrigationMod.F90
LakeStateType.F90
PhotosynthesisMod.F90
SoilHydrologyType.F90
SoilStateType.F90
SolarAbsorbedType.F90
SurfaceAlbedoType.F90
TemperatureType.F90
WaterStateType.F90
WaterfluxType.F90
ColumnType.F90
LandunitType.F90
PatchType.F90
atm2lndType.F90
Module lnd_comp_mct.F90
Source path: components/clm/src/cpl
- subroutine lnd_comp_mct.F90/lnd_run_mct()¶
Save buffer variables into “_old” at timestep the model is supposed to back up to (currently 00z, 06z, 12z, 18z). Switch buffer variable back to _old version when time for model to back up (currently 03z, 09z, 15z, 21z). Turns off clock alarm for clm clock out of sync.