File InitialConditions.cu
FileList > src > InitialConditions.cu
Go to the source code of this file
#include "InitialConditions.h"
#include "Input.h"
Public Functions
Type | Name |
---|---|
void | Calcbndblks (Param & XParam, Forcing< float > & XForcing, BlockP< T > XBlock) Calculates the number of blocks on each boundary of the domain. |
void | FindTSoutNodes (Param & XParam, BlockP< T > XBlock, BndblockP< T > & bnd) Finds and assigns output nodes to blocks for time series output. |
template void | FindTSoutNodes< double > (Param & XParam, BlockP< double > XBlock, BndblockP< double > & bnd) |
template void | FindTSoutNodes< float > (Param & XParam, BlockP< float > XBlock, BndblockP< float > & bnd) |
void | Findbndblks (Param XParam, Model< T > XModel, Forcing< float > & XForcing) Finds which blocks on the model edge belong to a side boundary. |
void | Findoutzoneblks (Param & XParam, BlockP< T > & XBlock) Finds and assigns blocks to output zones based on user-defined rectangular areas. |
template void | Findoutzoneblks< double > (Param & XParam, BlockP< double > & XBlock) |
template void | Findoutzoneblks< float > (Param & XParam, BlockP< float > & XBlock) |
std::vector< double > | GetTimeOutput (T_output time_info) Creates a vector of output times from the input time structure. |
void | InitRivers (Param XParam, Forcing< float > & XForcing, Model< T > & XModel) Initializes river discharge areas and assigns river information to model blocks. |
template void | InitRivers< double > (Param XParam, Forcing< float > & XForcing, Model< double > & XModel) |
template void | InitRivers< float > (Param XParam, Forcing< float > & XForcing, Model< float > & XModel) |
void | InitTSOutput (Param XParam) Initializes time series output files for specified nodes. |
void | Initbndblks (Param & XParam, Forcing< float > & XForcing, BlockP< T > XBlock) Initializes boundary block assignments and segment information. |
void | InitialConditions (Param & XParam, Forcing< float > & XForcing, Model< T > & XModel) Initializes model parameters, bathymetry, friction, initial conditions, and output variables. |
template void | InitialConditions< double > (Param & XParam, Forcing< float > & XForcing, Model< double > & XModel) |
template void | InitialConditions< float > (Param & XParam, Forcing< float > & XForcing, Model< float > & XModel) |
void | Initmaparray (Model< T > & XModel) Initializes output variable maps and metadata for the simulation. |
template void | Initmaparray< double > (Model< double > & XModel) |
template void | Initmaparray< float > (Model< float > & XModel) |
void | Initoutzone (Param & XParam, BlockP< T > & XBlock) Initializes output zones for the simulation domain. |
template void | Initoutzone< double > (Param & XParam, BlockP< double > & XBlock) |
template void | Initoutzone< float > (Param & XParam, BlockP< float > & XBlock) |
void | InitzbgradientCPU (Param XParam, Model< T > XModel) Initializes bathymetry gradient and halo on CPU. |
template void | InitzbgradientCPU< double > (Param XParam, Model< double > XModel) |
template void | InitzbgradientCPU< float > (Param XParam, Model< float > XModel) |
void | InitzbgradientGPU (Param XParam, Model< T > XModel) Initializes bathymetry gradient and halo on GPU. |
template void | InitzbgradientGPU< double > (Param XParam, Model< double > XModel) |
template void | InitzbgradientGPU< float > (Param XParam, Model< float > XModel) |
void | RectCornerBlk (Param & XParam, BlockP< T > & XBlock, double xo, double yo, double xmax, double ymax, bool isEps, std::vector< int > & cornerblk) Finds the blocks containing the corners of a rectangular box (for output zone definition). |
void | calcactiveCellCPU (Param XParam, BlockP< T > XBlock, Forcing< float > & XForcing, T * zb) Calculates active cells in the domain based on mask elevation and area of interest. |
__global__ void | calcactiveCellGPU (Param XParam, BlockP< T > XBlock, T * zb) CUDA kernel to calculate active cells on the GPU based on mask elevation. |
void | initOutputTimes (Param XParam, std::vector< double > & OutputT, BlockP< T > & XBlock) Compiles and sorts output times for map outputs, including zone outputs. |
void | initinfiltration (Param XParam, BlockP< T > XBlock, T * h, T * initLoss, T * hgw) Initializes infiltration loss array for each cell. |
void | initoutput (Param & XParam, Model< T > & XModel) Initializes output arrays and maps for the simulation. |
Public Functions Documentation
function Calcbndblks
Calculates the number of blocks on each boundary of the domain.
template<class T>
void Calcbndblks (
Param & XParam,
Forcing < float > & XForcing,
BlockP < T > XBlock
)
Updates counts for left, right, top, and bottom boundaries and stores them in the forcing and parameter structures.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXForcing
Forcing data (float)XBlock
Block parameters
function FindTSoutNodes
Finds and assigns output nodes to blocks for time series output.
template<class T>
void FindTSoutNodes (
Param & XParam,
BlockP < T > XBlock,
BndblockP < T > & bnd
)
Determines which block each output node belongs to and updates the boundary block structure.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parametersbnd
Boundary block structure
function FindTSoutNodes< double >
template void FindTSoutNodes< double > (
Param & XParam,
BlockP < double > XBlock,
BndblockP < double > & bnd
)
function FindTSoutNodes< float >
template void FindTSoutNodes< float > (
Param & XParam,
BlockP < float > XBlock,
BndblockP < float > & bnd
)
function Findbndblks
Finds which blocks on the model edge belong to a side boundary.
template<class T>
void Findbndblks (
Param XParam,
Model < T > XModel,
Forcing < float > & XForcing
)
Populates arrays for blocks on each side boundary and updates the forcing structure.
Template parameters:
T
Data type
Parameters:
Find which block on the model edge belongs to a "side boundary"
function Findoutzoneblks
Finds and assigns blocks to output zones based on user-defined rectangular areas.
Determines which blocks belong to each output zone, computes zone boundaries, and updates the block structure. Initialise all storage involving parameters of the outzone objects
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parameters
function Findoutzoneblks< double >
function Findoutzoneblks< float >
function GetTimeOutput
Creates a vector of output times from the input time structure.
Combines independent values and time steps from the input structure.
Parameters:
time_info
Time output structure
Returns:
Vector of output times
function InitRivers
Initializes river discharge areas and assigns river information to model blocks.
template<class T>
void InitRivers (
Param XParam,
Forcing < float > & XForcing,
Model < T > & XModel
)
Identifies grid cells affected by river discharge, calculates discharge areas, and sets up river-block relationships.
Template parameters:
T
Data type
Parameters:
function InitRivers< double >
template void InitRivers< double > (
Param XParam,
Forcing < float > & XForcing,
Model < double > & XModel
)
function InitRivers< float >
template void InitRivers< float > (
Param XParam,
Forcing < float > & XForcing,
Model < float > & XModel
)
function InitTSOutput
Initializes time series output files for specified nodes.
Creates and overwrites output files for each node in the time series output list.
Parameters:
XParam
Simulation parameters
function Initbndblks
Initializes boundary block assignments and segment information.
template<class T>
void Initbndblks (
Param & XParam,
Forcing < float > & XForcing,
BlockP < T > XBlock
)
Finds boundary blocks, assigns them to segments, and allocates arrays for segment sides and flow.
-
Initialise bnd blk assign block to their relevant segment allocate memory...
-
Find all the boundary blocks(block with themselves as neighbours)
- make an array to store which segment they belong to
If any bnd segment was specified * scan each block and find which (if any) segment they belong to For each segment Calculate bbox if inbbox calc inpoly if inpoly overwrite assingned segment with new one * Calculate nblk per segment & allocate (do for each segment) * fill segment and side arrays for each segments
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXForcing
Forcing data (float)XBlock
Block parameters
function InitialConditions
Initializes model parameters, bathymetry, friction, initial conditions, and output variables.
template<class T>
void InitialConditions (
Param & XParam,
Forcing < float > & XForcing,
Model < T > & XModel
)
Sets up the initial state of the simulation, including bathymetry, friction maps, evolving variables, river forcing, boundary blocks, active cells, and output arrays.
Template parameters:
T
Data type
Parameters:
function InitialConditions< double >
template void InitialConditions< double > (
Param & XParam,
Forcing < float > & XForcing,
Model < double > & XModel
)
function InitialConditions< float >
template void InitialConditions< float > (
Param & XParam,
Forcing < float > & XForcing,
Model < float > & XModel
)
function Initmaparray
Initializes output variable maps and metadata for the simulation.
Sets up output variable names, units, and long names for all tracked quantities in the model.
Template parameters:
T
Data type
Parameters:
XModel
Model data
function Initmaparray< double >
function Initmaparray< float >
function Initoutzone
Initializes output zones for the simulation domain.
Sets up output zones based on user input or defaults to the full domain if none specified.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parameters
function Initoutzone< double >
function Initoutzone< float >
function InitzbgradientCPU
Initializes bathymetry gradient and halo on CPU.
Computes gradients and refines bathymetry for the model blocks on the CPU.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXModel
Model data
function InitzbgradientCPU< double >
function InitzbgradientCPU< float >
function InitzbgradientGPU
Initializes bathymetry gradient and halo on GPU.
Computes gradients and refines bathymetry for the model blocks using CUDA streams and kernels.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXModel
Model data
function InitzbgradientGPU< double >
function InitzbgradientGPU< float >
function RectCornerBlk
Finds the blocks containing the corners of a rectangular box (for output zone definition).
template<class T>
void RectCornerBlk (
Param & XParam,
BlockP < T > & XBlock,
double xo,
double yo,
double xmax,
double ymax,
bool isEps,
std::vector< int > & cornerblk
)
Returns indices of blocks through "cornerblk" at the corners of the rectangle, starting from bottom left and turning clockwise.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parametersxo
X startyo
Y startxmax
X endymax
Y endisEps
Whether to use epsilon margincornerblk
Vector to store corner block indices
Find the block containing the border of a rectangular box (used for the defining the output zones) The indice of the blocks are returned through "cornerblk" from bottom left turning in the clockwise direction
function calcactiveCellCPU
Calculates active cells in the domain based on mask elevation and area of interest.
template<class T>
void calcactiveCellCPU (
Param XParam,
BlockP < T > XBlock,
Forcing < float > & XForcing,
T * zb
)
Sets the active cell flag for each cell, removing rain from masked and boundary cells as needed.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parametersXForcing
Forcing data (float)zb
Bathymetry array
function calcactiveCellGPU
CUDA kernel to calculate active cells on the GPU based on mask elevation.
Sets the active cell flag for each cell in the block using GPU parallelism.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parameterszb
Bathymetry array
function initOutputTimes
Compiles and sorts output times for map outputs, including zone outputs.
template<class T>
void initOutputTimes (
Param XParam,
std::vector< double > & OutputT,
BlockP < T > & XBlock
)
Combines times from the main output structure and all zone outputs, sorts and removes duplicates, and assigns to output arrays.
Creation of a vector for times requiering a map output Compilations of vectors and independent times from the general input and the different zones outputs
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersOutputT
Output times vectorXBlock
Block parameters
function initinfiltration
Initializes infiltration loss array for each cell.
template<class T>
void initinfiltration (
Param XParam,
BlockP < T > XBlock,
T * h,
T * initLoss,
T * hgw
)
Sets initial infiltration loss to zero for wet cells.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXBlock
Block parametersh
Water depth arrayinitLoss
Initial loss arrayhgw
Groundwater head array
function initoutput
Initializes output arrays and maps for the simulation.
Sets up storage for evolving parameters, output zones, and output files.
Template parameters:
T
Data type
Parameters:
XParam
Simulation parametersXModel
Model data
The documentation for this class was generated from the following file src/InitialConditions.cu