Skip to content

File InitialConditions.h

FileList > src > InitialConditions.h

Go to the source code of this file

  • #include "General.h"
  • #include "Param.h"
  • #include "Forcing.h"
  • #include "MemManagement.h"
  • #include "Util_CPU.h"
  • #include "Arrays.h"
  • #include "Write_txtlog.h"
  • #include "GridManip.h"
  • #include "InitEvolv.h"
  • #include "Gradients.h"
  • #include "Spherical.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.
void Findbndblks (Param XParam, Model< T > XModel, Forcing< float > & XForcing)
Finds which blocks on the model edge belong to a side boundary.
void InitRivers (Param XParam, Forcing< float > & XForcing, Model< T > & XModel)
Initializes river discharge areas and assigns river information to model blocks.
void InitTSOutput (Param XParam)
Initializes time series output files for specified nodes.
void InitialConditions (Param & XParam, Forcing< float > & XForcing, Model< T > & XModel)
Initializes model parameters, bathymetry, friction, initial conditions, and output variables.
void Initmaparray (Model< T > & XModel)
Initializes output variable maps and metadata for the simulation.
void Initoutzone (Param & XParam, BlockP< T > & XBlock)
Initializes output zones for the simulation domain.
void InitzbgradientCPU (Param XParam, Model< T > XModel)
Initializes bathymetry gradient and halo on CPU.
void InitzbgradientGPU (Param XParam, Model< T > XModel)
Initializes bathymetry gradient and halo on GPU.
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.
void initOutputTimes (Param XParam, std::vector< double > & OutputT, BlockP< T > & XBlock)
Compiles and sorts output times for map outputs, including zone outputs.
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 parameters
  • XForcing 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 parameters
  • XBlock Block parameters
  • bnd Boundary block structure

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:

  • XParam Simulation parameters
  • XModel Model data
  • XForcing Forcing data (float)

Find which block on the model edge belongs to a "side boundary"


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:

  • XParam Simulation parameters
  • XForcing Forcing data (float)
  • XModel Model data

function InitTSOutput

Initializes time series output files for specified nodes.

void InitTSOutput (
    Param XParam
) 

Creates and overwrites output files for each node in the time series output list.

Parameters:

  • XParam Simulation 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:

  • XParam Simulation parameters
  • XForcing Forcing data (float)
  • XModel Model data

function Initmaparray

Initializes output variable maps and metadata for the simulation.

template<class T>
void Initmaparray (
    Model < T > & XModel
) 

Sets up output variable names, units, and long names for all tracked quantities in the model.

Template parameters:

  • T Data type

Parameters:


function Initoutzone

Initializes output zones for the simulation domain.

template<class T>
void Initoutzone (
    Param & XParam,
    BlockP < T > & XBlock
) 

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 parameters
  • XBlock Block parameters

function InitzbgradientCPU

Initializes bathymetry gradient and halo on CPU.

template<class T>
void InitzbgradientCPU (
    Param XParam,
    Model < T > XModel
) 

Computes gradients and refines bathymetry for the model blocks on the CPU.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XModel Model data

function InitzbgradientGPU

Initializes bathymetry gradient and halo on GPU.

template<class T>
void InitzbgradientGPU (
    Param XParam,
    Model < T > XModel
) 

Computes gradients and refines bathymetry for the model blocks using CUDA streams and kernels.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XModel Model data

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 parameters
  • XBlock Block parameters
  • XForcing Forcing data (float)
  • zb 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 parameters
  • OutputT Output times vector
  • XBlock Block parameters

function initoutput

Initializes output arrays and maps for the simulation.

template<class T>
void initoutput (
    Param & XParam,
    Model < T > & XModel
) 

Sets up storage for evolving parameters, output zones, and output files.

Template parameters:

  • T Data type

Parameters:

  • XParam Simulation parameters
  • XModel Model data


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