RunCLEO¶
Header file: <libs/runcleo/runcleo.hpp>
[source]
-
template<CoupledDynamics CD, GridboxMaps GbxMaps, MicrophysicalProcess Microphys, Motion<GbxMaps> M, typename BoundaryConditions, Observer Obs, CouplingComms<GbxMaps, CD> Comms>
class RunCLEO¶ Generic templated class for timestepping CLEO SDM coupled (one-way/two-way) a Dynamics Solver.
This class orchestrates the timestepping of CLEO coupled model, which consists of
SDM Methods
coupled one-way or two-way toCoupled Dynamics
with communication handled byCoupling Comms
.- Template Parameters:
CD – Type of CoupledDynamics.
GbxMaps – Type of GridboxMaps.
Microphys – Type of MicrophysicalProcess.
M – Type of Motion.
Obs – Type of Observer.
Comms – Type of CouplingComms.
Public Functions
-
inline RunCLEO(const SDMMethods<GbxMaps, Microphys, M, BoundaryConditions, Obs> &sdm, CD &coupldyn, const Comms &comms)¶
Constructor for RunCLEO.
Initializes the RunCLEO object with the provided SDMMethods, CoupledDynamics, and CouplingComms objects. Checks if coupling between SDM and Dynamics is correct.
- Parameters:
sdm – SDMMethods object.
coupldyn – CoupledDynamics object.
comms – CouplingComms object.
-
inline ~RunCLEO()¶
Destructor for RunCLEO.
Calls the after_timestepping function of the SDM observer.
-
inline int operator()(const InitialConditions auto &initconds, const unsigned int t_end) const¶
Operator () for RunCLEO.
Creates runtime objects, gridboxes, superdrops and random number generators using initial conditions, then prepares and performs CLEO timestepping.
Kokkos::Profiling are null pointers unless a Kokkos profiler library has been exported to “KOKKOS_TOOLS_LIBS” prior to runtime so the lib gets dynamically loaded.
- Parameters:
initconds – InitialConditions object containing initial conditions.
t_end – End time for timestepping.
- Returns:
0 on success.
Private Functions
-
inline int prepare_to_timestep(const dualview_constgbx gbxs) const¶
Prepare SDM and Coupled Dynamics for timestepping.
This function prepares the SDM and Coupled Dynamics for timestepping. It calls the
prepare_to_timestep
function of both the Coupled Dynamics and SDMMethods objects.- Parameters:
gbxs – DualView of gridboxes.
- Returns:
0 on success.
-
inline void check_coupling() const¶
Check if coupling between SDM and Coupled Dynamics is correct.
This function checks if the coupling timestep of the Dynamics Solver and SDM are equal. Throws an exception if they are not.
-
inline int timestep_cleo(const unsigned int t_end, const dualview_gbx gbxs, const viewd_supers totsupers) const¶
Timestep CLEO from t=0 to t=t_end.
This function performs the main timestepping loop for CLEO from the initial time (t_mdl=0) to the specified end time (t_mdl=t_end). It calls RunCLEO’s
start_step
,coupldyn_step
,sdm_step
, andproceed_to_next_step
functions in a loop until timestepping is complete.- Parameters:
t_end – End time for timestepping.
gbxs – DualView of gridboxes.
totsupers – View of all superdroplets (both in and out of bounds of domain).
- Returns:
0 on success.
-
inline unsigned int start_step(const unsigned int t_mdl, dualview_gbx gbxs) const¶
Start of every timestep.
This function is called at the start of every timestep. It includes 1) communication of dynamics fields from the Dynamics Solver to the States of CLEO’s Gridboxes, 2) calling the
at_start_step
function of SDMMethods (e.g. to make observations), and 3) returning the size of the timestep to take now given the current timestept_mdl
.- Parameters:
t_mdl – Current timestep of the coupled model.
gbxs – DualView of gridboxes.
- Returns:
Size of the next timestep.
-
inline unsigned int get_next_step(const unsigned int t_mdl) const¶
Get the size of the next timestep.
This function calculates and returns the next step size to take based on the current model time,
t_mdl
and the coupling and obs times obtained from thesdm
object;t_coupl
andt_obs
respectively.The size of the next timestep is determined by finding the smaller out of the step to the next coupling time and the next observation time. The next coupling time is calculated after receiving the size of the coupling timestep (a constant) using the
sdm.get_couplstep()
function. The time of the next observation is obtained from thesdm.obs.next_obs()
function.The size of the next timestep is then calculated as
t_next - t_mdl
, wheret_next
is the time closer tot_mdl
out ofnext_coupl
andnext_obs
. The function uses Kokkos’ version of C++ standard library’sstd::min
to findt_next
(also GPU compatible).See also
- Parameters:
t_mdl – The current timestep of the model.
- Returns:
The size of the next timestep.
-
inline void sdm_step(const unsigned int t_mdl, unsigned int t_next, dualview_gbx gbxs, const viewd_supers totsupers) const¶
Run timestep of CLEO’s Super-Droplet Model (SDM).
This function runs SDM on both host and device from
t_mdl
tot_next
.Kokkos::Profiling are null pointers unless a Kokkos profiler library has been exported to “KOKKOS_TOOLS_LIBS” prior to runtime so the lib gets dynamically loaded.
- Parameters:
t_mdl – Current timestep of the coupled model.
t_next – Next timestep of the coupled model.
gbxs – DualView of gridboxes.
totsupers – View of all superdrops (both in and out of bounds of domain).
-
inline void coupldyn_step(const unsigned int t_mdl, const unsigned int t_next) const¶
Run timestep of Coupled Dynamics.
This function runs the Coupled Dynamics on host from t_mdl to t_next.
Kokkos::Profiling are null pointers unless a Kokkos profiler library has been exported to “KOKKOS_TOOLS_LIBS” prior to runtime so the lib gets dynamically loaded.
- Parameters:
t_mdl – Current timestep of the coupled model.
t_next – Next timestep of the coupled model.
-
inline unsigned int proceed_to_next_step(unsigned int t_next, dualview_gbx gbxs) const¶
Proceed to the next timestep.
This function returns the incremented timestep (
t_mdl
tot_next
). It is also where communication from the States of CLEO’s Gridboxes to the Coupled Dynamics may occur.- Parameters:
t_next – Next timestep of the coupled model.
gbxs – DualView of gridboxes.
- Returns:
Incremented timestep.
Private Members
-
const SDMMethods<GbxMaps, Microphys, M, BoundaryConditions, Obs> &sdm¶
SDMMethods object.
-
CD &coupldyn¶
CoupledDynamics object.
-
const Comms &comms¶
CouplingComms object.