Skip to content

File Mainloop.h

FileList > src > Mainloop.h

Go to the source code of this file

  • #include "General.h"
  • #include "Param.h"
  • #include "Arrays.h"
  • #include "Forcing.h"
  • #include "Mesh.h"
  • #include "Write_netcdf.h"
  • #include "InitialConditions.h"
  • #include "MemManagement.h"
  • #include "Boundary.h"
  • #include "FlowGPU.h"
  • #include "FlowCPU.h"
  • #include "Meanmax.h"
  • #include "Updateforcing.h"
  • #include "FlowMLGPU.h"

Public Functions

Type Name
void DebugLoop (Param & XParam, Forcing< float > XForcing, Model< T > & XModel, Model< T > & XModel_g)
Debugging loop for the flood model.
Loop< T > InitLoop (Param & XParam, Model< T > & XModel)
Initialize the simulation loop structure.
void MainLoop (Param & XParam, Forcing< float > XForcing, Model< T > & XModel, Model< T > & XModel_g)
Main simulation loop for the flood model.
__host__ double initdt (Param XParam, Loop< T > XLoop, Model< T > XModel)
Initialize the simulation time step.
void printstatus (T totaltime, T dt)
Print the current simulation time and time step to the console.
__global__ void storeTSout (Param XParam, int noutnodes, int outnode, int istep, int blknode, int inode, int jnode, int * blkTS, EvolvingP< T > XEv, T * store)
CUDA kernel to store time series output for specified nodes.

Public Functions Documentation

function DebugLoop

Debugging loop for the flood model.

template<class T>
void DebugLoop (
    Param & XParam,
    Forcing < float > XForcing,
    Model < T > & XModel,
    Model < T > & XModel_g
) 

Used to debug and wrap the debug flow engine. Runs a fixed number of steps and outputs diagnostic information. Handles both CPU and GPU execution paths.

Template parameters:

  • T Data type (float or double)

Parameters:


function InitLoop

Initialize the simulation loop structure.

template<class T>
Loop < T > InitLoop (
    Param & XParam,
    Model < T > & XModel
) 

Sets up loop control variables, output buffers, and initial time step.

Template parameters:

  • T Data type (float or double)

Parameters:

Returns:

Initialized loop control structure


function MainLoop

Main simulation loop for the flood model.

template<class T>
void MainLoop (
    Param & XParam,
    Forcing < float > XForcing,
    Model < T > & XModel,
    Model < T > & XModel_g
) 

Advances the simulation in time, applying boundary conditions, forcing, core engine, output, and crash detection. Handles both CPU and GPU execution paths.

Template parameters:

  • T Data type (float or double)

Parameters:


function initdt

Initialize the simulation time step.

template<class T>
__host__ double initdt (
    Param XParam,
    Loop < T > XLoop,
    Model < T > XModel
) 

Calculates the initial time step based on user input or model parameters. Uses either a user-specified value or computes a safe initial value based on water depth and cell resolution.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • XLoop Loop control structure
  • XModel Model state

Returns:

Initial time step value


function printstatus

Print the current simulation time and time step to the console.

template<class T>
void printstatus (
    T totaltime,
    T dt
) 

Displays the total simulation time and current time step in a formatted manner.

Template parameters:

  • T Data type (float or double)

Parameters:

  • totaltime Current simulation time
  • dt Current time step

function storeTSout

CUDA kernel to store time series output for specified nodes.

template<class T>
__global__ void storeTSout (
    Param XParam,
    int noutnodes,
    int outnode,
    int istep,
    int blknode,
    int inode,
    int jnode,
    int * blkTS,
    EvolvingP < T > XEv,
    T * store
) 

Writes evolving variables for selected nodes and time steps to output storage array.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Model parameters
  • noutnodes Number of output nodes
  • outnode Output node index
  • istep Time step index
  • blknode Block index
  • inode Node i-index
  • jnode Node j-index
  • blkTS Block time series mapping
  • XEv Evolving state variables
  • store Output storage array


The documentation for this class was generated from the following file src/Mainloop.h