Skip to content

File Boundary.cu

FileList > src > Boundary.cu

Go to the source code of this file

  • #include "Boundary.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.
template void Flowbnd< double > (Param XParam, Loop< double > & XLoop, BlockP< double > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< double > XEv)
template void Flowbnd< float > (Param XParam, Loop< float > & XLoop, BlockP< float > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< float > XEv)
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.
template void FlowbndFlux< double > (Param XParam, double totaltime, BlockP< double > XBlock, bndsegment bndseg, DynForcingP< float > Atmp, EvolvingP< double > XEv, FluxP< double > XFlux)
template void FlowbndFlux< float > (Param XParam, double totaltime, BlockP< float > XBlock, bndsegment bndseg, DynForcingP< float > Atmp, EvolvingP< float > XEv, FluxP< float > 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.
template void FlowbndFluxML< double > (Param XParam, double totaltime, BlockP< double > XBlock, bndsegment bndseg, DynForcingP< float > Atmp, EvolvingP< double > XEv, FluxMLP< double > XFlux)
template void FlowbndFluxML< float > (Param XParam, double totaltime, BlockP< float > XBlock, bndsegment bndseg, DynForcingP< float > Atmp, EvolvingP< float > XEv, FluxMLP< float > XFlux)
void FlowbndFluxold (Param XParam, double totaltime, BlockP< T > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< T > XEv, FluxP< T > XFlux)
Applies legacy boundary conditions for flux variables on a given side of the domain.
template void FlowbndFluxold< double > (Param XParam, double totaltime, BlockP< double > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< double > XEv, FluxP< double > XFlux)
template void FlowbndFluxold< float > (Param XParam, double totaltime, BlockP< float > XBlock, bndparam side, DynForcingP< float > Atmp, EvolvingP< float > XEv, FluxP< float > XFlux)
__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.
template __host__ void bndCPU< double > (Param XParam, bndparam side, BlockP< double > XBlock, std::vector< double > zsbndvec, std::vector< double > uubndvec, std::vector< double > vvbndvec, DynForcingP< float > Atmp, double * zs, double * h, double * un, double * ut)
template __host__ void bndCPU< float > (Param XParam, bndparam side, BlockP< float > XBlock, std::vector< double > zsbndvec, std::vector< double > uubndvec, std::vector< double > vvbndvec, DynForcingP< float > Atmp, float * zs, float * h, float * un, float * ut)
__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).
void bndFluxGPUSideCPU (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)
CPU implementation for applying boundary fluxes on a segment side.
__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).
template __global__ void bndGPU< double > (Param XParam, bndparam side, BlockP< double > XBlock, DynForcingP< float > Atmp, float itime, double * zs, double * h, double * un, double * ut)
template __global__ void bndGPU< float > (Param XParam, bndparam side, BlockP< float > XBlock, DynForcingP< float > Atmp, float itime, float * zs, float * h, float * un, float * ut)
__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).
template __host__ void maskbnd< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > Xev, double * zb)
template __host__ void maskbnd< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > Xev, float * zb)
__global__ void maskbndGPUFluxbot (Param XParam, BlockP< T > XBlock, FluxP< T > Flux)
CUDA kernel for applying masked flux boundary conditions on the bottom side.
template __global__ void maskbndGPUFluxbot< double > (Param XParam, BlockP< double > XBlock, FluxP< double > Flux)
template __global__ void maskbndGPUFluxbot< float > (Param XParam, BlockP< float > XBlock, FluxP< float > Flux)
__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.
template __global__ void maskbndGPUFluxleft< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > Xev, FluxP< double > Flux)
template __global__ void maskbndGPUFluxleft< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > Xev, FluxP< float > Flux)
__global__ void maskbndGPUFluxright (Param XParam, BlockP< T > XBlock, FluxP< T > Flux)
CUDA kernel for applying masked flux boundary conditions on the right side.
template __global__ void maskbndGPUFluxright< double > (Param XParam, BlockP< double > XBlock, FluxP< double > Flux)
template __global__ void maskbndGPUFluxright< float > (Param XParam, BlockP< float > XBlock, FluxP< float > Flux)
__global__ void maskbndGPUFluxtop (Param XParam, BlockP< T > XBlock, FluxP< T > Flux)
CUDA kernel for applying masked flux boundary conditions on the top side.
template __global__ void maskbndGPUFluxtop< double > (Param XParam, BlockP< double > XBlock, FluxP< double > Flux)
template __global__ void maskbndGPUFluxtop< float > (Param XParam, BlockP< float > XBlock, FluxP< float > Flux)
__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.
template __global__ void maskbndGPUbot< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > Xev, double * zb)
template __global__ void maskbndGPUbot< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > Xev, float * zb)
__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.
template __global__ void maskbndGPUleft< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > Xev, double * zb)
template __global__ void maskbndGPUleft< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > Xev, float * zb)
__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.
template __global__ void maskbndGPUright< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > Xev, double * zb)
template __global__ void maskbndGPUright< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > Xev, float * zb)
__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.
template __global__ void maskbndGPUtop< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > Xev, double * zb)
template __global__ void maskbndGPUtop< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > Xev, float * zb)
__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 Gravity
  • sign Side sign
  • zsbnd Boundary zs value
  • zsinside Inside zs value
  • hinside Inside h value
  • utbnd Tangential boundary velocity
  • unbnd Normal boundary velocity
  • un 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 Gravity
  • sign Side sign
  • factime Filter time factor
  • facrel Relaxation time factor
  • zs zs value
  • zsbnd Boundary zs value
  • zsinside Inside zs value
  • h h value
  • qmean 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 Gravity
  • sign Side sign
  • zsbnd Boundary zs value
  • zsinside Inside zs value
  • hinside Inside h value
  • uninside Inside normal velocity
  • un 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 Gravity
  • sign Side sign
  • zsbnd Boundary zs value
  • zsinside Inside zs value
  • hinside Inside h value
  • uninside Inside normal velocity
  • q 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 parameters
  • XLoop Loop control structure
  • XBlock Block data structure
  • side Boundary parameter (side info)
  • Atmp Dynamic forcing data
  • XEv Evolving variables

Handles boundary values for water level, velocity, and applies interpolation in time and space. Integrates any existing comments and logic.


function Flowbnd< double >

template void Flowbnd< double > (
    Param XParam,
    Loop < double > & XLoop,
    BlockP < double > XBlock,
    bndparam side,
    DynForcingP < float > Atmp,
    EvolvingP < double > XEv
) 

function Flowbnd< float >

template void Flowbnd< float > (
    Param XParam,
    Loop < float > & XLoop,
    BlockP < float > XBlock,
    bndparam side,
    DynForcingP < float > Atmp,
    EvolvingP < float > XEv
) 

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 parameters
  • totaltime Current simulation time
  • XBlock Block data structure
  • bndseg Boundary segment info
  • Atmp Dynamic forcing data
  • XEv Evolving variables
  • XFlux Flux variables

Handles boundary fluxes, applies tapers, and manages GPU/CPU execution for boundary segments. Integrates any existing comments and logic.


function FlowbndFlux< double >

template void FlowbndFlux< double > (
    Param XParam,
    double totaltime,
    BlockP < double > XBlock,
    bndsegment bndseg,
    DynForcingP < float > Atmp,
    EvolvingP < double > XEv,
    FluxP < double > XFlux
) 

function FlowbndFlux< float >

template void FlowbndFlux< float > (
    Param XParam,
    double totaltime,
    BlockP < float > XBlock,
    bndsegment bndseg,
    DynForcingP < float > Atmp,
    EvolvingP < float > XEv,
    FluxP < float > 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 parameters
  • totaltime Current simulation time
  • XBlock Block data structure
  • bndseg Boundary segment info
  • Atmp Dynamic forcing data
  • XEv Evolving variables
  • XFlux 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 FlowbndFluxML< double >

template void FlowbndFluxML< double > (
    Param XParam,
    double totaltime,
    BlockP < double > XBlock,
    bndsegment bndseg,
    DynForcingP < float > Atmp,
    EvolvingP < double > XEv,
    FluxMLP < double > XFlux
) 

function FlowbndFluxML< float >

template void FlowbndFluxML< float > (
    Param XParam,
    double totaltime,
    BlockP < float > XBlock,
    bndsegment bndseg,
    DynForcingP < float > Atmp,
    EvolvingP < float > XEv,
    FluxMLP < float > XFlux
) 

function FlowbndFluxold

Applies legacy boundary conditions for flux variables on a given side of the domain.

template<class T>
void FlowbndFluxold (
    Param XParam,
    double totaltime,
    BlockP < T > XBlock,
    bndparam side,
    DynForcingP < float > Atmp,
    EvolvingP < T > XEv,
    FluxP < T > XFlux
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • totaltime Current simulation time
  • XBlock Block data structure
  • side Boundary parameter (side info)
  • Atmp Dynamic forcing data
  • XEv Evolving variables
  • XFlux Flux variables

Handles boundary fluxes using older logic, applies tapers, and manages GPU/CPU execution for boundary sides. Integrates any existing comments and logic.


function FlowbndFluxold< double >

template void FlowbndFluxold< double > (
    Param XParam,
    double totaltime,
    BlockP < double > XBlock,
    bndparam side,
    DynForcingP < float > Atmp,
    EvolvingP < double > XEv,
    FluxP < double > XFlux
) 

function FlowbndFluxold< float >

template void FlowbndFluxold< float > (
    Param XParam,
    double totaltime,
    BlockP < float > XBlock,
    bndparam side,
    DynForcingP < float > Atmp,
    EvolvingP < float > XEv,
    FluxP < float > XFlux
) 

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 width
  • blkmemwidth Block memory width
  • isright Side info
  • istop Top info
  • ix x-index
  • iy y-index
  • ib 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 parameters
  • side Boundary parameter info
  • XBlock Block data structure
  • zsbndvec Vector of boundary zs values
  • uubndvec Vector of boundary u values
  • vvbndvec Vector of boundary v values
  • Atmp Dynamic forcing data
  • zs Array of zs values
  • h Array of h values
  • un Array of normal velocities
  • ut 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 bndCPU< double >

template __host__ void bndCPU< double > (
    Param XParam,
    bndparam side,
    BlockP < double > XBlock,
    std::vector< double > zsbndvec,
    std::vector< double > uubndvec,
    std::vector< double > vvbndvec,
    DynForcingP < float > Atmp,
    double * zs,
    double * h,
    double * un,
    double * ut
) 

function bndCPU< float >

template __host__ void bndCPU< float > (
    Param XParam,
    bndparam side,
    BlockP < float > XBlock,
    std::vector< double > zsbndvec,
    std::vector< double > uubndvec,
    std::vector< double > vvbndvec,
    DynForcingP < float > Atmp,
    float * zs,
    float * h,
    float * un,
    float * ut
) 

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 parameters
  • side Boundary segment side info
  • XBlock Block data structure
  • Atmp Dynamic forcing data
  • Zsmap Dynamic forcing data for zs
  • uniform Whether boundary is uniform
  • type Boundary type
  • zsbnd Boundary zs value
  • taper Taper value for smoothing
  • zs Array of zs values
  • h Array of h values
  • un Array of normal velocities
  • ut Array of tangential velocities
  • Fh Array for flux h
  • Fq Array for flux q
  • Ss Array for source terms

Applies boundary conditions and fluxes for each thread/block on the GPU, handling tapers, Dirichlet, and ABS boundary types.


function bndFluxGPUSideCPU

CPU implementation for applying boundary fluxes on a segment side.

template<class T>
void bndFluxGPUSideCPU (
    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 parameters
  • side Boundary segment side info
  • XBlock Block data structure
  • Atmp Dynamic forcing data
  • Zsmap Dynamic forcing data for zs
  • uniform Whether boundary is uniform
  • type Boundary type
  • zsbnd Boundary zs value
  • taper Taper value for smoothing
  • zs Array of zs values
  • h Array of h values
  • un Array of normal velocities
  • ut Array of tangential velocities
  • Fh Array for flux h
  • Fq Array for flux q
  • Ss Array for source terms

Applies boundary conditions and fluxes for each block/thread on the CPU, 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 parameters
  • side Boundary parameter info
  • XBlock Block data structure
  • Atmp Dynamic forcing data
  • itime Interpolated time for boundary data
  • zs Array of zs values
  • h Array of h values
  • un Array of normal velocities
  • ut Array of tangential velocities

Applies boundary conditions for each thread/block on the GPU, using interpolated time and dynamic forcing data.


function bndGPU< double >

template __global__ void bndGPU< double > (
    Param XParam,
    bndparam side,
    BlockP < double > XBlock,
    DynForcingP < float > Atmp,
    float itime,
    double * zs,
    double * h,
    double * un,
    double * ut
) 

function bndGPU< float >

template __global__ void bndGPU< float > (
    Param XParam,
    bndparam side,
    BlockP < float > XBlock,
    DynForcingP < float > Atmp,
    float itime,
    float * zs,
    float * h,
    float * un,
    float * ut
) 

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 sides
  • isleftbot Is left-bottom active
  • islefttop Is left-top active
  • istopleft Is top-left active
  • istopright Is top-right active
  • isrighttop Is right-top active
  • isrightbot Is right-bottom active
  • isbotright Is bottom-right active
  • isbotleft 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 value
  • un 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.

__host__ __device__ bool isbnd (
    int isright,
    int istop,
    int blkwidth,
    int ix,
    int iy
) 

Parameters:

  • isright Side info
  • istop Top info
  • blkwidth Block width
  • ix x-index
  • iy 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 parameters
  • XBlock Block data structure
  • Xev Evolving variables
  • zb 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 maskbnd< double >

template __host__ void maskbnd< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > Xev,
    double * zb
) 

function maskbnd< float >

template __host__ void maskbnd< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > Xev,
    float * zb
) 

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 parameters
  • XBlock Block data structure
  • Flux Flux variables

Applies flux boundary conditions in the halo region for masked blocks on the bottom side.


function maskbndGPUFluxbot< double >

template __global__ void maskbndGPUFluxbot< double > (
    Param XParam,
    BlockP < double > XBlock,
    FluxP < double > Flux
) 

function maskbndGPUFluxbot< float >

template __global__ void maskbndGPUFluxbot< float > (
    Param XParam,
    BlockP < float > XBlock,
    FluxP < float > Flux
) 

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 parameters
  • XBlock Block data structure
  • Xev Evolving variables
  • Flux Flux variables

Applies flux boundary conditions in the halo region for masked blocks on the left side.


function maskbndGPUFluxleft< double >

template __global__ void maskbndGPUFluxleft< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > Xev,
    FluxP < double > Flux
) 

function maskbndGPUFluxleft< float >

template __global__ void maskbndGPUFluxleft< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > Xev,
    FluxP < float > Flux
) 

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 parameters
  • XBlock Block data structure
  • Flux Flux variables

Applies flux boundary conditions in the halo region for masked blocks on the right side.


function maskbndGPUFluxright< double >

template __global__ void maskbndGPUFluxright< double > (
    Param XParam,
    BlockP < double > XBlock,
    FluxP < double > Flux
) 

function maskbndGPUFluxright< float >

template __global__ void maskbndGPUFluxright< float > (
    Param XParam,
    BlockP < float > XBlock,
    FluxP < float > Flux
) 

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 parameters
  • XBlock Block data structure
  • Flux Flux variables

Applies flux boundary conditions in the halo region for masked blocks on the top side.


function maskbndGPUFluxtop< double >

template __global__ void maskbndGPUFluxtop< double > (
    Param XParam,
    BlockP < double > XBlock,
    FluxP < double > Flux
) 

function maskbndGPUFluxtop< float >

template __global__ void maskbndGPUFluxtop< float > (
    Param XParam,
    BlockP < float > XBlock,
    FluxP < float > Flux
) 

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 parameters
  • XBlock Block data structure
  • Xev Evolving variables
  • zb Array of mask values

Applies wall boundary conditions in the halo region for masked blocks on the bottom side.


function maskbndGPUbot< double >

template __global__ void maskbndGPUbot< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > Xev,
    double * zb
) 

function maskbndGPUbot< float >

template __global__ void maskbndGPUbot< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > Xev,
    float * zb
) 

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 parameters
  • XBlock Block data structure
  • Xev Evolving variables
  • zb Array of mask values

Applies wall boundary conditions in the halo region for masked blocks on the left side.


function maskbndGPUleft< double >

template __global__ void maskbndGPUleft< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > Xev,
    double * zb
) 

function maskbndGPUleft< float >

template __global__ void maskbndGPUleft< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > Xev,
    float * zb
) 

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 parameters
  • XBlock Block data structure
  • Xev Evolving variables
  • zb Array of mask values

Applies wall boundary conditions in the halo region for masked blocks on the right side.


function maskbndGPUright< double >

template __global__ void maskbndGPUright< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > Xev,
    double * zb
) 

function maskbndGPUright< float >

template __global__ void maskbndGPUright< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > Xev,
    float * zb
) 

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 parameters
  • XBlock Block data structure
  • Xev Evolving variables
  • zb Array of mask values

Applies wall boundary conditions in the halo region for masked blocks on the top side.


function maskbndGPUtop< double >

template __global__ void maskbndGPUtop< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > Xev,
    double * zb
) 

function maskbndGPUtop< float >

template __global__ void maskbndGPUtop< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > Xev,
    float * zb
) 

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 value
  • hinside Inside h value
  • un 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<class T>
__device__ __host__ void noslipbndQ (
    T & F,
    T & G,
    T & S
) 

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.cu