File Boundary.h
FileList > src > Boundary.h
Go to the source code of this file
#include "General.h"
#include "MemManagement.h"
#include "Util_CPU.h"
#include "Updateforcing.h"
Public Functions
Type | Name |
---|---|
__device__ __host__ void | ABS1D (T g, T sign, T zsbnd, T zsinside, T hinside, T utbnd, T unbnd, T & un, T & ut, T & zs, T & h) Device/host function for 1D absorbing boundary condition. |
__device__ __host__ void | ABS1DQ (T g, T sign, T factime, T facrel, T zs, T zsbnd, T zsinside, T h, T & qmean, T & q, T & G, T & S) Device/host function for 1D absorbing boundary condition for flux variables. |
__device__ __host__ void | Dirichlet1D (T g, T sign, T zsbnd, T zsinside, T hinside, T uninside, T & un, T & ut, T & zs, T & h) Device/host function for 1D Dirichlet boundary condition. |
__device__ __host__ void | Dirichlet1Q (T g, T sign, T zsbnd, T zsinside, T hinside, T uninside, T & q) Device/host function for 1D Dirichlet boundary condition for flux variables. |
void | Flowbnd (Param XParam, Loop< T > & XLoop, BlockP< T > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< T > XEv) Applies boundary conditions for flow variables on a given side of the domain. |
void | FlowbndFlux (Param XParam, double totaltime, BlockP< T > XBlock, bndsegment bndseg, DynForcingP< float > Atmp, EvolvingP< T > XEv, FluxP< T > XFlux) Applies boundary conditions for flux variables on a given segment of the domain. |
void | FlowbndFlux (Param XParam, double totaltime, BlockP< T > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< T > XEv, FluxP< T > XFlux) |
void | FlowbndFluxML (Param XParam, double totaltime, BlockP< T > XBlock, bndsegment bndseg, DynForcingP< float > Atmp, EvolvingP< T > XEv, FluxMLP< T > XFlux) Applies boundary conditions for flux ML variables on a given segment of the domain. |
__host__ __device__ int | Inside (int halowidth, int blkmemwidth, int isright, int istop, int ix, int iy, int ib) Helper to compute the index of the inside cell for a boundary cell. |
__host__ void | bndCPU (Param XParam, bndparam side, BlockP< T > XBlock, std::vector< double > zsbndvec, std::vector< double > uubndvec, std::vector< double > vvbndvec, DynForcingP< float > Atmp, T * zs, T * h, T * un, T * ut) CPU implementation for applying boundary conditions on a side. |
__global__ void | bndFluxGPUSide (Param XParam, bndsegmentside side, BlockP< T > XBlock, DynForcingP< float > Atmp, DynForcingP< float > Zsmap, bool uniform, int type, float zsbnd, T taper, T * zs, T * h, T * un, T * ut, T * Fh, T * Fq, T * Ss) CUDA kernel for applying boundary fluxes on a segment side (GPU version). |
__global__ void | bndGPU (Param XParam, bndparam side, BlockP< T > XBlock, DynForcingP< float > Atmp, float itime, T * zs, T * h, T * un, T * ut) CUDA kernel for applying boundary conditions on a side (GPU version). |
__device__ __host__ void | findmaskside (int side, bool & isleftbot, bool & islefttop, bool & istopleft, bool & istopright, bool & isrighttop, bool & isrightbot, bool & isbotright, bool & isbotleft) Helper to decode mask side bitfield into booleans for each boundary/corner. |
__device__ __host__ void | halowall (T zsinside, T & un, T & ut, T & zs, T & h, T & zb) Device/host function to apply wall boundary in halo region. |
__host__ __device__ bool | isbnd (int isright, int istop, int blkwidth, int ix, int iy) Helper to check if a cell is at the boundary. |
__host__ void | maskbnd (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb) CPU implementation for applying masked blocks boundary conditions (halo walls). |
__global__ void | maskbndGPUFluxbot (Param XParam, BlockP< T > XBlock, FluxP< T > Flux) CUDA kernel for applying masked flux boundary conditions on the bottom side. |
__global__ void | maskbndGPUFluxleft (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, FluxP< T > Flux) CUDA kernel for applying masked flux boundary conditions on the left side. |
__global__ void | maskbndGPUFluxright (Param XParam, BlockP< T > XBlock, FluxP< T > Flux) CUDA kernel for applying masked flux boundary conditions on the right side. |
__global__ void | maskbndGPUFluxtop (Param XParam, BlockP< T > XBlock, FluxP< T > Flux) CUDA kernel for applying masked flux boundary conditions on the top side. |
__global__ void | maskbndGPUbot (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb) CUDA kernel for applying masked boundary conditions (halo walls) on the bottom side. |
__global__ void | maskbndGPUleft (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb) CUDA kernel for applying masked boundary conditions (halo walls) on the left side. |
__global__ void | maskbndGPUright (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb) CUDA kernel for applying masked boundary conditions (halo walls) on the right side. |
__global__ void | maskbndGPUtop (Param XParam, BlockP< T > XBlock, EvolvingP< T > Xev, T * zb) CUDA kernel for applying masked boundary conditions (halo walls) on the top side. |
__device__ __host__ void | noslipbnd (T zsinside, T hinside, T & un, T & ut, T & zs, T & h) Device/host function to apply no-slip boundary condition. |
__device__ __host__ void | noslipbndQ (T & F, T & G, T & S) Device/host function to apply no-slip boundary for flux variables. |
Public Functions Documentation
function ABS1D
Device/host function for 1D absorbing boundary condition.
template<class T>
__device__ __host__ void ABS1D (
T g,
T sign,
T zsbnd,
T zsinside,
T hinside,
T utbnd,
T unbnd,
T & un,
T & ut,
T & zs,
T & h
)
Template parameters:
T
Data type
Parameters:
g
Gravitysign
Side signzsbnd
Boundary zs valuezsinside
Inside zs valuehinside
Inside h valueutbnd
Tangential boundary velocityunbnd
Normal boundary velocityun
Normal velocity (output)ut
Tangential velocity (output)zs
zs value (output)h
h value (output)
Computes absorbing boundary for normal/tangential velocity and updates zs, h.
function ABS1DQ
Device/host function for 1D absorbing boundary condition for flux variables.
template<class T>
__device__ __host__ void ABS1DQ (
T g,
T sign,
T factime,
T facrel,
T zs,
T zsbnd,
T zsinside,
T h,
T & qmean,
T & q,
T & G,
T & S
)
Template parameters:
T
Data type
Parameters:
g
Gravitysign
Side signfactime
Filter time factorfacrel
Relaxation time factorzs
zs valuezsbnd
Boundary zs valuezsinside
Inside zs valueh
h valueqmean
Mean flux (output)q
Flux q (output)G
Flux G (output)S
Source term (output)
Computes absorbing boundary for flux variables and updates qmean, q, G, S.
function Dirichlet1D
Device/host function for 1D Dirichlet boundary condition.
template<class T>
__device__ __host__ void Dirichlet1D (
T g,
T sign,
T zsbnd,
T zsinside,
T hinside,
T uninside,
T & un,
T & ut,
T & zs,
T & h
)
Template parameters:
T
Data type
Parameters:
g
Gravitysign
Side signzsbnd
Boundary zs valuezsinside
Inside zs valuehinside
Inside h valueuninside
Inside normal velocityun
Normal velocity (output)ut
Tangential velocity (output)zs
zs value (output)h
h value (output)
Computes Dirichlet boundary for normal/tangential velocity and updates zs, h.
function Dirichlet1Q
Device/host function for 1D Dirichlet boundary condition for flux variables.
template<class T>
__device__ __host__ void Dirichlet1Q (
T g,
T sign,
T zsbnd,
T zsinside,
T hinside,
T uninside,
T & q
)
Template parameters:
T
Data type
Parameters:
g
Gravitysign
Side signzsbnd
Boundary zs valuezsinside
Inside zs valuehinside
Inside h valueuninside
Inside normal velocityq
Flux q (output)
Computes Dirichlet boundary for flux variable q.
function Flowbnd
Applies boundary conditions for flow variables on a given side of the domain.
template<class T>
void Flowbnd (
Param XParam,
Loop < T > & XLoop,
BlockP < T > XBlock,
bndparam side,
DynForcingP < float > Atmp,
EvolvingP < T > XEv
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXLoop
Loop control structureXBlock
Block data structureside
Boundary parameter (side info)Atmp
Dynamic forcing dataXEv
Evolving variables
Handles boundary values for water level, velocity, and applies interpolation in time and space. Integrates any existing comments and logic.
function FlowbndFlux
Applies boundary conditions for flux variables on a given segment of the domain.
template<class T>
void FlowbndFlux (
Param XParam,
double totaltime,
BlockP < T > XBlock,
bndsegment bndseg,
DynForcingP < float > Atmp,
EvolvingP < T > XEv,
FluxP < T > XFlux
)
Template parameters:
T
Data type
Parameters:
XParam
Model parameterstotaltime
Current simulation timeXBlock
Block data structurebndseg
Boundary segment infoAtmp
Dynamic forcing dataXEv
Evolving variablesXFlux
Flux variables
Handles boundary fluxes, applies tapers, and manages GPU/CPU execution for boundary segments. Integrates any existing comments and logic.
function FlowbndFlux
template<class T>
void FlowbndFlux (
Param XParam,
double totaltime,
BlockP < T > XBlock,
bndparam side,
DynForcingP < float > Atmp,
EvolvingP < T > XEv,
FluxP < T > XFlux
)
function FlowbndFluxML
Applies boundary conditions for flux ML variables on a given segment of the domain.
template<class T>
void FlowbndFluxML (
Param XParam,
double totaltime,
BlockP < T > XBlock,
bndsegment bndseg,
DynForcingP < float > Atmp,
EvolvingP < T > XEv,
FluxMLP < T > XFlux
)
Template parameters:
T
Data type
Parameters:
XParam
Model parameterstotaltime
Current simulation timeXBlock
Block data structurebndseg
Boundary segment infoAtmp
Dynamic forcing dataXEv
Evolving variablesXFlux
Machine learning flux variables
Handles boundary fluxes for ML variables, applies tapers, and manages GPU/CPU execution for boundary segments. Integrates any existing comments and logic.
function Inside
Helper to compute the index of the inside cell for a boundary cell.
__host__ __device__ int Inside (
int halowidth,
int blkmemwidth,
int isright,
int istop,
int ix,
int iy,
int ib
)
Parameters:
halowidth
Halo widthblkmemwidth
Block memory widthisright
Side infoistop
Top infoix
x-indexiy
y-indexib
Block index
Returns:
Index of the inside cell
function bndCPU
CPU implementation for applying boundary conditions on a side.
template<class T>
__host__ void bndCPU (
Param XParam,
bndparam side,
BlockP < T > XBlock,
std::vector< double > zsbndvec,
std::vector< double > uubndvec,
std::vector< double > vvbndvec,
DynForcingP < float > Atmp,
T * zs,
T * h,
T * un,
T * ut
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersside
Boundary parameter infoXBlock
Block data structurezsbndvec
Vector of boundary zs valuesuubndvec
Vector of boundary u valuesvvbndvec
Vector of boundary v valuesAtmp
Dynamic forcing datazs
Array of zs valuesh
Array of h valuesun
Array of normal velocitiesut
Array of tangential velocities
Applies boundary conditions for each block/thread on the CPU, using provided boundary vectors and dynamic forcing data. Handles no-slip, Dirichlet, ABS, and Neumann boundary types. Integrates any existing comments and logic.
function bndFluxGPUSide
CUDA kernel for applying boundary fluxes on a segment side (GPU version).
template<class T>
__global__ void bndFluxGPUSide (
Param XParam,
bndsegmentside side,
BlockP < T > XBlock,
DynForcingP < float > Atmp,
DynForcingP < float > Zsmap,
bool uniform,
int type,
float zsbnd,
T taper,
T * zs,
T * h,
T * un,
T * ut,
T * Fh,
T * Fq,
T * Ss
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersside
Boundary segment side infoXBlock
Block data structureAtmp
Dynamic forcing dataZsmap
Dynamic forcing data for zsuniform
Whether boundary is uniformtype
Boundary typezsbnd
Boundary zs valuetaper
Taper value for smoothingzs
Array of zs valuesh
Array of h valuesun
Array of normal velocitiesut
Array of tangential velocitiesFh
Array for flux hFq
Array for flux qSs
Array for source terms
Applies boundary conditions and fluxes for each thread/block on the GPU, handling tapers, Dirichlet, and ABS boundary types.
function bndGPU
CUDA kernel for applying boundary conditions on a side (GPU version).
template<class T>
__global__ void bndGPU (
Param XParam,
bndparam side,
BlockP < T > XBlock,
DynForcingP < float > Atmp,
float itime,
T * zs,
T * h,
T * un,
T * ut
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersside
Boundary parameter infoXBlock
Block data structureAtmp
Dynamic forcing dataitime
Interpolated time for boundary datazs
Array of zs valuesh
Array of h valuesun
Array of normal velocitiesut
Array of tangential velocities
Applies boundary conditions for each thread/block on the GPU, using interpolated time and dynamic forcing data.
function findmaskside
Helper to decode mask side bitfield into booleans for each boundary/corner.
__device__ __host__ void findmaskside (
int side,
bool & isleftbot,
bool & islefttop,
bool & istopleft,
bool & istopright,
bool & isrighttop,
bool & isrightbot,
bool & isbotright,
bool & isbotleft
)
Parameters:
side
Bitfield encoding mask sidesisleftbot
Is left-bottom activeislefttop
Is left-top activeistopleft
Is top-left activeistopright
Is top-right activeisrighttop
Is right-top activeisrightbot
Is right-bottom activeisbotright
Is bottom-right activeisbotleft
Is bottom-left active
function halowall
Device/host function to apply wall boundary in halo region.
template<class T>
__device__ __host__ void halowall (
T zsinside,
T & un,
T & ut,
T & zs,
T & h,
T & zb
)
Template parameters:
T
Data type
Parameters:
zsinside
Inside zs valueun
Normal velocity (output)ut
Tangential velocity (output)zs
zs value (output)h
h value (output)zb
Mask value (output)
Sets normal/tangential velocity and h to zero, copies zsinside to zs and zb.
function isbnd
Helper to check if a cell is at the boundary.
Parameters:
isright
Side infoistop
Top infoblkwidth
Block widthix
x-indexiy
y-index
Returns:
True if cell is at the boundary, false otherwise
function maskbnd
CPU implementation for applying masked blocks boundary conditions (halo walls).
template<class T>
__host__ void maskbnd (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > Xev,
T * zb
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureXev
Evolving variableszb
Array of mask values
Applies wall boundary conditions in the halo region for masked blocks, updating velocities, zs, h, and mask values. Handles all four sides and corners. Integrates any existing comments and logic.
function maskbndGPUFluxbot
CUDA kernel for applying masked flux boundary conditions on the bottom side.
template<class T>
__global__ void maskbndGPUFluxbot (
Param XParam,
BlockP < T > XBlock,
FluxP < T > Flux
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureFlux
Flux variables
Applies flux boundary conditions in the halo region for masked blocks on the bottom side.
function maskbndGPUFluxleft
CUDA kernel for applying masked flux boundary conditions on the left side.
template<class T>
__global__ void maskbndGPUFluxleft (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > Xev,
FluxP < T > Flux
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureXev
Evolving variablesFlux
Flux variables
Applies flux boundary conditions in the halo region for masked blocks on the left side.
function maskbndGPUFluxright
CUDA kernel for applying masked flux boundary conditions on the right side.
template<class T>
__global__ void maskbndGPUFluxright (
Param XParam,
BlockP < T > XBlock,
FluxP < T > Flux
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureFlux
Flux variables
Applies flux boundary conditions in the halo region for masked blocks on the right side.
function maskbndGPUFluxtop
CUDA kernel for applying masked flux boundary conditions on the top side.
template<class T>
__global__ void maskbndGPUFluxtop (
Param XParam,
BlockP < T > XBlock,
FluxP < T > Flux
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureFlux
Flux variables
Applies flux boundary conditions in the halo region for masked blocks on the top side.
function maskbndGPUbot
CUDA kernel for applying masked boundary conditions (halo walls) on the bottom side.
template<class T>
__global__ void maskbndGPUbot (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > Xev,
T * zb
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureXev
Evolving variableszb
Array of mask values
Applies wall boundary conditions in the halo region for masked blocks on the bottom side.
function maskbndGPUleft
CUDA kernel for applying masked boundary conditions (halo walls) on the left side.
template<class T>
__global__ void maskbndGPUleft (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > Xev,
T * zb
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureXev
Evolving variableszb
Array of mask values
Applies wall boundary conditions in the halo region for masked blocks on the left side.
function maskbndGPUright
CUDA kernel for applying masked boundary conditions (halo walls) on the right side.
template<class T>
__global__ void maskbndGPUright (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > Xev,
T * zb
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureXev
Evolving variableszb
Array of mask values
Applies wall boundary conditions in the halo region for masked blocks on the right side.
function maskbndGPUtop
CUDA kernel for applying masked boundary conditions (halo walls) on the top side.
template<class T>
__global__ void maskbndGPUtop (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > Xev,
T * zb
)
Template parameters:
T
Data type
Parameters:
XParam
Model parametersXBlock
Block data structureXev
Evolving variableszb
Array of mask values
Applies wall boundary conditions in the halo region for masked blocks on the top side.
function noslipbnd
Device/host function to apply no-slip boundary condition.
template<class T>
__device__ __host__ void noslipbnd (
T zsinside,
T hinside,
T & un,
T & ut,
T & zs,
T & h
)
Template parameters:
T
Data type
Parameters:
zsinside
Inside zs valuehinside
Inside h valueun
Normal velocity (output)ut
Tangential velocity (output)zs
zs value (output)h
h value (output)
Sets normal velocity to zero, copies zsinside and hinside.
function noslipbndQ
Device/host function to apply no-slip boundary for flux variables.
Template parameters:
T
Data type
Parameters:
F
Flux F (output)G
Flux G (input)S
Source term (output)
Sets F to zero, S to G.
The documentation for this class was generated from the following file src/Boundary.h