File Mainloop.cu
FileList > src > Mainloop.cu
Go to the source code of this file
#include "Mainloop.h"
Public Functions
| Type | Name |
|---|---|
| __host__ void | CalcInitdtCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEvolv, T * dtmax) Calculate initial time step values on the CPU for all blocks and nodes. |
| __global__ void | CalcInitdtGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEvolv, T * dtmax) CUDA kernel to calculate initial time step values on the GPU for all blocks and nodes. |
| void | CrashDetection (Param & XParam, Loop< T > XLoop, Model< T > XModel, Model< T > XModel_g) Detects simulation crash due to small time steps and generates a crash report. |
| void | DebugLoop (Param & XParam, Forcing< float > XForcing, Model< T > & XModel, Model< T > & XModel_g) Debugging loop for the flood model. |
| template void | DebugLoop< double > (Param & XParam, Forcing< float > XForcing, Model< double > & XModel, Model< double > & XModel_g) |
| template void | DebugLoop< float > (Param & XParam, Forcing< float > XForcing, Model< float > & XModel, Model< float > & XModel_g) |
| 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. |
| template void | MainLoop< double > (Param & XParam, Forcing< float > XForcing, Model< double > & XModel, Model< double > & XModel_g) |
| template void | MainLoop< float > (Param & XParam, Forcing< float > XForcing, Model< float > & XModel, Model< float > & XModel_g) |
| __host__ double | initdt (Param XParam, Loop< T > XLoop, Model< T > XModel) Initialize the simulation time step. |
| template __host__ double | initdt< double > (Param XParam, Loop< double > XLoop, Model< double > XModel) |
| template __host__ double | initdt< float > (Param XParam, Loop< float > XLoop, Model< float > XModel) |
| void | mapoutput (Param XParam, Loop< T > & XLoop, Model< T > & XModel, Model< T > XModel_g) Output map data at specified simulation times. |
| void | pointoutputstep (Param XParam, Loop< T > & XLoop, Model< T > XModel, Model< T > XModel_g) Output time series data for specified nodes. |
| 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. |
| void | updateBnd (Param XParam, Loop< T > XLoop, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g) Update boundary conditions for the simulation. |
Public Functions Documentation
function CalcInitdtCPU
Calculate initial time step values on the CPU for all blocks and nodes.
template<class T>
__host__ void CalcInitdtCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEvolv,
T * dtmax
)
Computes the maximum allowable time step for each cell based on local water depth and cell resolution.
Template parameters:
TData type (float or double)
Parameters:
XParamModel parametersXBlockBlock dataXEvolvEvolving state variablesdtmaxOutput array for maximum time step per cell
function CalcInitdtGPU
CUDA kernel to calculate initial time step values on the GPU for all blocks and nodes.
template<class T>
__global__ void CalcInitdtGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEvolv,
T * dtmax
)
Computes the maximum allowable time step for each cell using GPU parallelism.
Template parameters:
TData type (float or double)
Parameters:
XParamModel parametersXBlockBlock dataXEvolvEvolving state variablesdtmaxOutput array for maximum time step per cell
function CrashDetection
Detects simulation crash due to small time steps and generates a crash report.
template<class T>
void CrashDetection (
Param & XParam,
Loop < T > XLoop,
Model < T > XModel,
Model < T > XModel_g
)
If the time step falls below the minimum allowed value before the simulation end time, stops the model and writes output variables to a crash report file. Handles both CPU and GPU data transfer for output variables.
Template parameters:
TData type (float or double)
Parameters:
XParamModel parameters (may be modified)XLoopLoop control structureXModelModel state (CPU)XModel_gModel state (GPU)
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:
TData type (float or double)
Parameters:
XParamModel parametersXForcingForcing data (float)XModelModel state (CPU)XModel_gModel state (GPU)
function DebugLoop< double >
template void DebugLoop< double > (
Param & XParam,
Forcing < float > XForcing,
Model < double > & XModel,
Model < double > & XModel_g
)
function DebugLoop< float >
template void DebugLoop< float > (
Param & XParam,
Forcing < float > XForcing,
Model < float > & XModel,
Model < float > & XModel_g
)
function InitLoop
Initialize the simulation loop structure.
Sets up loop control variables, output buffers, and initial time step.
Template parameters:
TData 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:
TData type (float or double)
Parameters:
XParamModel parametersXForcingForcing data (float)XModelModel state (CPU)XModel_gModel state (GPU)
function MainLoop< double >
template void MainLoop< double > (
Param & XParam,
Forcing < float > XForcing,
Model < double > & XModel,
Model < double > & XModel_g
)
function MainLoop< float >
template void MainLoop< float > (
Param & XParam,
Forcing < float > XForcing,
Model < float > & XModel,
Model < float > & XModel_g
)
function initdt
Initialize the simulation time step.
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:
TData type (float or double)
Parameters:
Returns:
Initial time step value
function initdt< double >
template __host__ double initdt< double > (
Param XParam,
Loop < double > XLoop,
Model < double > XModel
)
function initdt< float >
template __host__ double initdt< float > (
Param XParam,
Loop < float > XLoop,
Model < float > XModel
)
function mapoutput
Output map data at specified simulation times.
template<class T>
void mapoutput (
Param XParam,
Loop < T > & XLoop,
Model < T > & XModel,
Model < T > XModel_g
)
Saves model state to NetCDF files when output times are reached, handling both CPU and GPU data transfer.
Template parameters:
TData type (float or double)
Parameters:
XParamModel parametersXLoopLoop control structureXModelModel state (CPU)XModel_gModel state (GPU)
function pointoutputstep
Output time series data for specified nodes.
template<class T>
void pointoutputstep (
Param XParam,
Loop < T > & XLoop,
Model < T > XModel,
Model < T > XModel_g
)
Collects and writes time series output for selected nodes, handling both CPU and GPU data paths and buffer management.
Template parameters:
TData type (float or double)
Parameters:
XParamModel parametersXLoopLoop control structureXModelModel state (CPU)XModel_gModel state (GPU)
function printstatus
Print the current simulation time and time step to the console.
Displays the total simulation time and current time step in a formatted manner.
Template parameters:
TData type (float or double)
Parameters:
totaltimeCurrent simulation timedtCurrent 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:
TData type (float or double)
Parameters:
XParamModel parametersnoutnodesNumber of output nodesoutnodeOutput node indexistepTime step indexblknodeBlock indexinodeNode i-indexjnodeNode j-indexblkTSBlock time series mappingXEvEvolving state variablesstoreOutput storage array
function updateBnd
Update boundary conditions for the simulation.
template<class T>
void updateBnd (
Param XParam,
Loop < T > XLoop,
Forcing < float > XForcing,
Model < T > XModel,
Model < T > XModel_g
)
Applies boundary flows for each segment, handling both CPU and GPU execution paths.
Template parameters:
TData type (float or double)
Parameters:
XParamModel parametersXLoopLoop control structureXForcingForcing data (float)XModelModel state (CPU)XModel_gModel state (GPU)
The documentation for this class was generated from the following file src/Mainloop.cu