File Gradients.cu
FileList > src > Gradients.cu
Go to the source code of this file
#include "Gradients.h"
Public Functions
Type | Name |
---|---|
void | WetsloperesetCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) CPU function to apply wet slope limiters to gradients of surface elevation. Adjusts gradients to prevent non-physical slopes in wet-dry transition zones. |
void | WetsloperesetHaloBotCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) CPU function to reset the wet slope limiter at the bottom halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | WetsloperesetHaloBotGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) GPU kernel to reset the wet slope limiter at the bottom halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
void | WetsloperesetHaloLeftCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) CPU function to apply wet slope limiters to gradients of surface elevation at the left halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | WetsloperesetHaloLeftGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) Device kernel to apply wet slope limiters to gradients of surface elevation at the left halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
void | WetsloperesetHaloRightCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) CPU function to apply wet slope limiters to gradients of surface elevation at the right halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | WetsloperesetHaloRightGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) Device kernel to apply wet slope limiters to gradients of surface elevation at the right halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
void | WetsloperesetHaloTopCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) CPU function to reset the wet slope limiter at the top halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | WetsloperesetHaloTopGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) GPU kernel to reset the wet slope limiter at the top halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | WetsloperesetXGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) Device kernel to apply wet slope limiters to gradients of surface elevation in the x-direction. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | WetsloperesetYGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) Device kernel to apply wet slope limiters to gradients of surface elevation in the y-direction. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones. |
__global__ void | gradient (int halowidth, int * active, int * level, T theta, T dx, T * a, T * dadx, T * dady) Device kernel for calculating gradients for an evolving parameter using the minmod limiter. |
template __global__ void | gradient< double > (int halowidth, int * active, int * level, double theta, double dx, double * a, double * dadx, double * dady) |
template __global__ void | gradient< float > (int halowidth, int * active, int * level, float theta, float dx, float * a, float * dadx, float * dady) |
void | gradientC (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) CPU function for calculating gradients using the minmod limiter. Computes spatial derivatives in x and y directions for a given variable. |
template void | gradientC< double > (Param XParam, BlockP< double > XBlock, double * a, double * dadx, double * dady) |
template void | gradientC< float > (Param XParam, BlockP< float > XBlock, float * a, float * dadx, float * dady) |
void | gradientCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) CPU function to compute gradients for all evolving parameters, handle halo regions, and apply wet-dry fixes. Calculates spatial derivatives for height, surface elevation, and velocity components. Also manages halo regions and applies wet-dry fixes if necessary. |
template void | gradientCPU< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > XEv, GradientsP< double > XGrad, double * zb) |
template void | gradientCPU< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > XEv, GradientsP< float > XGrad, float * zb) |
void | gradientGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) Entry point for gradient of evolving variables calculation on the GPU. |
template void | gradientGPU< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > XEv, GradientsP< double > XGrad, double * zb) |
template void | gradientGPU< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > XEv, GradientsP< float > XGrad, float * zb) |
void | gradientGPUnew (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEv, GradientsP< T > XGrad, T * zb) Alternative GPU gradient calculation using shared memory kernels and CUDA streams. |
template void | gradientGPUnew< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > XEv, GradientsP< double > XGrad, double * zb) |
template void | gradientGPUnew< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > XEv, GradientsP< float > XGrad, float * zb) |
void | gradientHalo (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) CPU function to compute gradients at the halo boundaries of all active blocks. This function iterates over all active blocks and computes the gradients at their halo boundaries using finite difference approximations. |
void | gradientHaloBot (Param XParam, BlockP< T > XBlock, int ib, int ix, T * a, T * dadx, T * dady) CPU function to compute the gradient at the bottom halo boundary of a specific block. This function calculates the x and y derivatives at the bottom edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloBotGPU (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the bottom halo boundary of blocks. This kernel calculates the x and y derivatives at the bottom edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloBotGPUnew (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the bottom halo boundary of blocks. This kernel calculates the x and y derivatives at the bottom edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
void | gradientHaloGPU (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU function to compute gradients at the halo boundaries of all active blocks. This function launches CUDA kernels to compute the gradients at the halo boundaries of all active blocks using parallel processing. |
void | gradientHaloGPUnew (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU function to compute gradients at the halo boundaries of all active blocks using multiple CUDA streams. This function launches CUDA kernels in separate streams to compute the gradients at the halo boundaries of all active blocks, allowing for concurrent execution and improved performance. |
void | gradientHaloLeft (Param XParam, BlockP< T > XBlock, int ib, int iy, T * a, T * dadx, T * dady) CPU function to compute the gradient at the left halo boundary of a specific block. This function calculates the x and y derivatives at the left edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloLeftGPU (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the left halo boundary of blocks. This kernel calculates the x and y derivatives at the left edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloLeftGPUnew (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the left halo boundary of blocks. This kernel calculates the x and y derivatives at the left edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
void | gradientHaloRight (Param XParam, BlockP< T > XBlock, int ib, int iy, T * a, T * dadx, T * dady) CPU function to compute the gradient at the left halo boundary of a specific block. This function calculates the x and y derivatives at the left edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloRightGPU (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the right halo boundary of blocks. This kernel calculates the x and y derivatives at the right edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloRightGPUnew (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the right halo boundary of blocks. This kernel calculates the x and y derivatives at the right edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
void | gradientHaloTop (Param XParam, BlockP< T > XBlock, int ib, int ix, T * a, T * dadx, T * dady) CPU function to compute the gradient at the top halo boundary of a specific block. This function calculates the x and y derivatives at the top edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloTopGPU (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the top halo boundary of blocks. This kernel calculates the x and y derivatives at the top edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientHaloTopGPUnew (Param XParam, BlockP< T > XBlock, T * a, T * dadx, T * dady) GPU kernel to compute the gradient at the top halo boundary of blocks. This kernel calculates the x and y derivatives at the top edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels. |
__global__ void | gradientSM (int halowidth, int * active, int * level, T theta, T dx, T * a, T * dadx, T * dady) Deprecated shared memory device kernel for gradient calculation. |
template __global__ void | gradientSM< double > (int halowidth, int * active, int * level, double theta, double dx, double * a, double * dadx, double * dady) |
template __global__ void | gradientSM< float > (int halowidth, int * active, int * level, float theta, float dx, float * a, float * dadx, float * dady) |
__global__ void | gradientSMB (int halowidth, int * active, int * level, T theta, T dx, T * a, T * dadx, T * dady) Shared memory device kernel for gradient calculation (variant B). |
template __global__ void | gradientSMB< double > (int halowidth, int * active, int * level, double theta, double dx, double * a, double * dadx, double * dady) |
template __global__ void | gradientSMB< float > (int halowidth, int * active, int * level, float theta, float dx, float * a, float * dadx, float * dady) |
__global__ void | gradientSMC (int halowidth, int * active, int * level, T theta, T dx, T * a, T * dadx, T * dady) Shared memory device kernel for gradient calculation (variant C). |
template __global__ void | gradientSMC< double > (int halowidth, int * active, int * level, double theta, double dx, double * a, double * dadx, double * dady) |
template __global__ void | gradientSMC< float > (int halowidth, int * active, int * level, float theta, float dx, float * a, float * dadx, float * dady) |
__global__ void | gradientedgeX (int halowidth, int * active, int * level, T theta, T dx, T * a, T * dadx) Device kernel for calculating gradients for an evolving parameter using the minmod limiter only at a fixed column (i.e. fixed ix). |
template __global__ void | gradientedgeX< double > (int halowidth, int * active, int * level, double theta, double dx, double * a, double * dadx) |
template __global__ void | gradientedgeX< float > (int halowidth, int * active, int * level, float theta, float dx, float * a, float * dadx) |
__global__ void | gradientedgeY (int halowidth, int * active, int * level, T theta, T dx, T * a, T * dady) Device kernel for calculating gradients for an evolving parameter using the minmod limiter only at a fixed row (i.e. fixed iy). |
template __global__ void | gradientedgeY< double > (int halowidth, int * active, int * level, double theta, double dx, double * a, double * dady) |
template __global__ void | gradientedgeY< float > (int halowidth, int * active, int * level, float theta, float dx, float * a, float * dady) |
Public Functions Documentation
function WetsloperesetCPU
CPU function to apply wet slope limiters to gradients of surface elevation. Adjusts gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
void WetsloperesetCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
function WetsloperesetHaloBotCPU
CPU function to reset the wet slope limiter at the bottom halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
void WetsloperesetHaloBotCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This function specifically handles the bottom halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the bottom surface elevation needed for the wet slope limiter.
function WetsloperesetHaloBotGPU
GPU kernel to reset the wet slope limiter at the bottom halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
__global__ void WetsloperesetHaloBotGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This kernel specifically handles the bottom halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the bottom surface elevation needed for the wet slope limiter.
function WetsloperesetHaloLeftCPU
CPU function to apply wet slope limiters to gradients of surface elevation at the left halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
void WetsloperesetHaloLeftCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This function specifically handles the left halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the left surface elevation needed for
function WetsloperesetHaloLeftGPU
Device kernel to apply wet slope limiters to gradients of surface elevation at the left halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
__global__ void WetsloperesetHaloLeftGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This kernel specifically handles the left halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the left surface elevation needed for the wet slope limiter.
function WetsloperesetHaloRightCPU
CPU function to apply wet slope limiters to gradients of surface elevation at the right halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
void WetsloperesetHaloRightCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This function specifically handles the right halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the right surface elevation needed for the wet slope limiter.
function WetsloperesetHaloRightGPU
Device kernel to apply wet slope limiters to gradients of surface elevation at the right halo boundary. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
__global__ void WetsloperesetHaloRightGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This kernel specifically handles the right halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the right surface elevation needed for the wet slope limiter.
function WetsloperesetHaloTopCPU
CPU function to reset the wet slope limiter at the top halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
void WetsloperesetHaloTopCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This function specifically handles the top halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the top surface elevation needed for the wet slope limiter.
function WetsloperesetHaloTopGPU
GPU kernel to reset the wet slope limiter at the top halo boundary. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
__global__ void WetsloperesetHaloTopGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
Note:
This kernel specifically handles the top halo boundary, where special care is needed due to the absence of neighboring blocks on that side. The logic accounts for various configurations of neighboring blocks to correctly compute the top surface elevation needed for the wet slope limiter.
function WetsloperesetXGPU
Device kernel to apply wet slope limiters to gradients of surface elevation in the x-direction. Adjusts x-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
__global__ void WetsloperesetXGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
function WetsloperesetYGPU
Device kernel to apply wet slope limiters to gradients of surface elevation in the y-direction. Adjusts y-derivative gradients to prevent non-physical slopes in wet-dry transition zones.
template<class T>
__global__ void WetsloperesetYGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
function gradient
Device kernel for calculating gradients for an evolving parameter using the minmod limiter.
template<class T>
__global__ void gradient (
int halowidth,
int * active,
int * level,
T theta,
T dx,
T * a,
T * dadx,
T * dady
)
Computes spatial derivatives in x and y directions for a given variable.
Template parameters:
T
Data type (float or double)
Parameters:
halowidth
Width of halo regionactive
Active block indiceslevel
Block refinement levelstheta
Limiter parameterdx
Grid spacinga
Input variable arraydadx
Output gradient in xdady
Output gradient in y
function gradient< double >
template __global__ void gradient< double > (
int halowidth,
int * active,
int * level,
double theta,
double dx,
double * a,
double * dadx,
double * dady
)
function gradient< float >
template __global__ void gradient< float > (
int halowidth,
int * active,
int * level,
float theta,
float dx,
float * a,
float * dadx,
float * dady
)
function gradientC
CPU function for calculating gradients using the minmod limiter. Computes spatial derivatives in x and y directions for a given variable.
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Input variable arraydadx
Output gradient in xdady
Output gradient in y
function gradientC< double >
template void gradientC< double > (
Param XParam,
BlockP < double > XBlock,
double * a,
double * dadx,
double * dady
)
function gradientC< float >
template void gradientC< float > (
Param XParam,
BlockP < float > XBlock,
float * a,
float * dadx,
float * dady
)
function gradientCPU
CPU function to compute gradients for all evolving parameters, handle halo regions, and apply wet-dry fixes. Calculates spatial derivatives for height, surface elevation, and velocity components. Also manages halo regions and applies wet-dry fixes if necessary.
template<class T>
void gradientCPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Parameters:
XParam
Simulation parametersXBlock
Block informationXEv
Evolving parameters (height, surface elevation, velocities)XGrad
Gradient storage for the evolving parameterszb
Bathymetry array
function gradientCPU< double >
template void gradientCPU< double > (
Param XParam,
BlockP < double > XBlock,
EvolvingP < double > XEv,
GradientsP < double > XGrad,
double * zb
)
function gradientCPU< float >
template void gradientCPU< float > (
Param XParam,
BlockP < float > XBlock,
EvolvingP < float > XEv,
GradientsP < float > XGrad,
float * zb
)
function gradientGPU
Entry point for gradient of evolving variables calculation on the GPU.
template<class T>
void gradientGPU (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Calculates gradients of evolving variables using CUDA kernels and synchronizes device operations. Handles halo filling and elevation conservation if required.
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block parametersXEv
Evolving variablesXGrad
Gradient variableszb
Bed elevation array
Wrapping function to calculate gradien of evolving variables on GPU This function is the entry point to the gradient functions on the GPU
function gradientGPU< double >
template void gradientGPU< double > (
Param XParam,
BlockP < double > XBlock,
EvolvingP < double > XEv,
GradientsP < double > XGrad,
double * zb
)
function gradientGPU< float >
template void gradientGPU< float > (
Param XParam,
BlockP < float > XBlock,
EvolvingP < float > XEv,
GradientsP < float > XGrad,
float * zb
)
function gradientGPUnew
Alternative GPU gradient calculation using shared memory kernels and CUDA streams.
template<class T>
void gradientGPUnew (
Param XParam,
BlockP < T > XBlock,
EvolvingP < T > XEv,
GradientsP < T > XGrad,
T * zb
)
Uses gradientSMC kernels and handles halo filling, elevation conservation, and wet/dry prolongation.
Template parameters:
T
Data type (float or double)
Parameters:
XParam
Simulation parametersXBlock
Block parametersXEv
Evolving variablesXGrad
Gradient variableszb
Bed elevation array
function gradientGPUnew< double >
template void gradientGPUnew< double > (
Param XParam,
BlockP < double > XBlock,
EvolvingP < double > XEv,
GradientsP < double > XGrad,
double * zb
)
function gradientGPUnew< float >
template void gradientGPUnew< float > (
Param XParam,
BlockP < float > XBlock,
EvolvingP < float > XEv,
GradientsP < float > XGrad,
float * zb
)
function gradientHalo
CPU function to compute gradients at the halo boundaries of all active blocks. This function iterates over all active blocks and computes the gradients at their halo boundaries using finite difference approximations.
template<class T>
void gradientHalo (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function calls specific functions to handle each of the four halo boundaries (left, right, bottom, top) for each block. It ensures that gradients are accurately computed at the edges of the computational domain, which is crucial for maintaining solution accuracy and stability. The function assumes that the input arrays are properly allocated and sized according to the simulation parameters. The gradient computations are performed using central differences where possible, and one-sided differences at the boundaries. The function is templated to support different data types (e.g., float, double).
See also: gradientHaloLeft, gradientHaloRight, gradientHaloBot, gradientHaloTop
function gradientHaloBot
CPU function to compute the gradient at the bottom halo boundary of a specific block. This function calculates the x and y derivatives at the bottom edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
void gradientHaloBot (
Param XParam,
BlockP < T > XBlock,
int ib,
int ix,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationib
Index of the block for which the bottom halo gradient is to be computedix
x-index within the blocka
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloBotGPU
GPU kernel to compute the gradient at the bottom halo boundary of blocks. This kernel calculates the x and y derivatives at the bottom edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloBotGPU (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloBotGPUnew
GPU kernel to compute the gradient at the bottom halo boundary of blocks. This kernel calculates the x and y derivatives at the bottom edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloBotGPUnew (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloGPU
GPU function to compute gradients at the halo boundaries of all active blocks. This function launches CUDA kernels to compute the gradients at the halo boundaries of all active blocks using parallel processing.
template<class T>
void gradientHaloGPU (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function sets up the CUDA grid and block dimensions and launches specific kernels to handle each of the four halo boundaries (left, right, bottom, top) for all active blocks. It ensures that gradients are accurately computed at the edges of the computational domain, which is crucial for maintaining solution accuracy and stability. The function assumes that the input arrays are properly allocated and sized according to the simulation parameters. The gradient computations are performed using central differences where possible, and one-sided differences at the boundaries. The function is templated to support different data types (e.g., float, double).
See also: gradientHaloLeftGPU, gradientHaloRightGPU, gradientHaloBotGPU, gradientHaloTopGPU
See also: gradientHaloLeft, gradientHaloRight, gradientHaloBot, gradientHaloTop
function gradientHaloGPUnew
GPU function to compute gradients at the halo boundaries of all active blocks using multiple CUDA streams. This function launches CUDA kernels in separate streams to compute the gradients at the halo boundaries of all active blocks, allowing for concurrent execution and improved performance.
template<class T>
void gradientHaloGPUnew (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function sets up multiple CUDA streams and launches specific kernels to handle each of the four halo boundaries (left, right, bottom, top) for all active blocks in separate streams. It ensures that gradients are accurately computed at the edges of the computational domain, which is crucial for maintaining solution accuracy and stability. The function assumes that the input arrays are properly allocated and sized according to the simulation parameters. The gradient computations are performed using central differences where possible, and one-sided differences at the boundaries. The function is templated to support different data types (e.g., float, double).
See also: gradientHaloLeftGPUnew, gradientHaloRightGPUnew, gradientHaloBotGPUnew, gradientHaloTopGPUnew
See also: gradientHaloLeft, gradientHaloRight, gradientHaloBot, gradientHaloTop
function gradientHaloLeft
CPU function to compute the gradient at the left halo boundary of a specific block. This function calculates the x and y derivatives at the left edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
void gradientHaloLeft (
Param XParam,
BlockP < T > XBlock,
int ib,
int iy,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationib
Index of the block for which the left halo gradient is to be computediy
y-index within the blocka
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloLeftGPU
GPU kernel to compute the gradient at the left halo boundary of blocks. This kernel calculates the x and y derivatives at the left edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloLeftGPU (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloLeftGPUnew
GPU kernel to compute the gradient at the left halo boundary of blocks. This kernel calculates the x and y derivatives at the left edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloLeftGPUnew (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloRight
CPU function to compute the gradient at the left halo boundary of a specific block. This function calculates the x and y derivatives at the left edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
void gradientHaloRight (
Param XParam,
BlockP < T > XBlock,
int ib,
int iy,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationib
Index of the block for which the left halo gradient is to be computediy
y-index within the blocka
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloRightGPU
GPU kernel to compute the gradient at the right halo boundary of blocks. This kernel calculates the x and y derivatives at the right edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloRightGPU (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloRightGPUnew
GPU kernel to compute the gradient at the right halo boundary of blocks. This kernel calculates the x and y derivatives at the right edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloRightGPUnew (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloTop
CPU function to compute the gradient at the top halo boundary of a specific block. This function calculates the x and y derivatives at the top edge of the block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
void gradientHaloTop (
Param XParam,
BlockP < T > XBlock,
int ib,
int ix,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationib
Index of the block for which the top halo gradient is to be computedix
x-index within the blocka
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This function handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloTopGPU
GPU kernel to compute the gradient at the top halo boundary of blocks. This kernel calculates the x and y derivatives at the top edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloTopGPU (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientHaloTopGPUnew
GPU kernel to compute the gradient at the top halo boundary of blocks. This kernel calculates the x and y derivatives at the top edge of each block using finite difference approximations, taking into account the presence of neighboring blocks and their levels.
template<class T>
__global__ void gradientHaloTopGPUnew (
Param XParam,
BlockP < T > XBlock,
T * a,
T * dadx,
T * dady
)
Parameters:
XParam
Simulation parametersXBlock
Block informationa
Array containing the variable for which gradients are to be computeddadx
Array to store the computed x-derivative gradientsdady
Array to store the computed y-derivative gradients
Note:
This kernel handles various configurations of neighboring blocks, including cases where neighboring blocks are at different levels of refinement
function gradientSM
Deprecated shared memory device kernel for gradient calculation.
template<class T>
__global__ void gradientSM (
int halowidth,
int * active,
int * level,
T theta,
T dx,
T * a,
T * dadx,
T * dady
)
Uses shared memory for stencil operations; slower than the standard kernel.
Template parameters:
T
Data type (float or double)
Parameters:
halowidth
Width of halo regionactive
Active block indiceslevel
Block refinement levelstheta
Limiter parameterdx
Grid spacinga
Input variable arraydadx
Output gradient in xdady
Output gradient in y
function gradientSM< double >
template __global__ void gradientSM< double > (
int halowidth,
int * active,
int * level,
double theta,
double dx,
double * a,
double * dadx,
double * dady
)
function gradientSM< float >
template __global__ void gradientSM< float > (
int halowidth,
int * active,
int * level,
float theta,
float dx,
float * a,
float * dadx,
float * dady
)
function gradientSMB
Shared memory device kernel for gradient calculation (variant B).
template<class T>
__global__ void gradientSMB (
int halowidth,
int * active,
int * level,
T theta,
T dx,
T * a,
T * dadx,
T * dady
)
Uses a fixed shared memory tile for stencil operations; only computes gradients for interior points.
Template parameters:
T
Data type (float or double)
Parameters:
halowidth
Width of halo regionactive
Active block indiceslevel
Block refinement levelstheta
Limiter parameterdx
Grid spacinga
Input variable arraydadx
Output gradient in xdady
Output gradient in y
function gradientSMB< double >
template __global__ void gradientSMB< double > (
int halowidth,
int * active,
int * level,
double theta,
double dx,
double * a,
double * dadx,
double * dady
)
function gradientSMB< float >
template __global__ void gradientSMB< float > (
int halowidth,
int * active,
int * level,
float theta,
float dx,
float * a,
float * dadx,
float * dady
)
function gradientSMC
Shared memory device kernel for gradient calculation (variant C).
template<class T>
__global__ void gradientSMC (
int halowidth,
int * active,
int * level,
T theta,
T dx,
T * a,
T * dadx,
T * dady
)
Uses a flat shared memory array for stencil operations; computes gradients for all points.
Template parameters:
T
Data type (float or double)
Parameters:
halowidth
Width of halo regionactive
Active block indiceslevel
Block refinement levelstheta
Limiter parameterdx
Grid spacinga
Input variable arraydadx
Output gradient in xdady
Output gradient in y
function gradientSMC< double >
template __global__ void gradientSMC< double > (
int halowidth,
int * active,
int * level,
double theta,
double dx,
double * a,
double * dadx,
double * dady
)
function gradientSMC< float >
template __global__ void gradientSMC< float > (
int halowidth,
int * active,
int * level,
float theta,
float dx,
float * a,
float * dadx,
float * dady
)
function gradientedgeX
Device kernel for calculating gradients for an evolving parameter using the minmod limiter only at a fixed column (i.e. fixed ix).
template<class T>
__global__ void gradientedgeX (
int halowidth,
int * active,
int * level,
T theta,
T dx,
T * a,
T * dadx
)
Computes x-derivative for a specific column using the minmod limiter.
Template parameters:
T
Data type (float or double)
Parameters:
halowidth
Width of halo regionactive
Active block indiceslevel
Block refinement levelstheta
Limiter parameterdx
Grid spacinga
Input variable arraydadx
Output gradient in x
function gradientedgeX< double >
template __global__ void gradientedgeX< double > (
int halowidth,
int * active,
int * level,
double theta,
double dx,
double * a,
double * dadx
)
function gradientedgeX< float >
template __global__ void gradientedgeX< float > (
int halowidth,
int * active,
int * level,
float theta,
float dx,
float * a,
float * dadx
)
function gradientedgeY
Device kernel for calculating gradients for an evolving parameter using the minmod limiter only at a fixed row (i.e. fixed iy).
template<class T>
__global__ void gradientedgeY (
int halowidth,
int * active,
int * level,
T theta,
T dx,
T * a,
T * dady
)
Computes y-derivative for a specific row using the minmod limiter.
Template parameters:
T
Data type (float or double)
Parameters:
halowidth
Width of halo regionactive
Active block indiceslevel
Block refinement levelstheta
Limiter parameterdx
Grid spacinga
Input variable arraydady
Output gradient in y
function gradientedgeY< double >
template __global__ void gradientedgeY< double > (
int halowidth,
int * active,
int * level,
double theta,
double dx,
double * a,
double * dady
)
function gradientedgeY< float >
template __global__ void gradientedgeY< float > (
int halowidth,
int * active,
int * level,
float theta,
float dx,
float * a,
float * dady
)
The documentation for this class was generated from the following file src/Gradients.cu