Skip to content

File Friction.cu

FileList > src > Friction.cu

Go to the source code of this file

  • #include "Friction.h"

Public Functions

Type Name
__host__ void TheresholdVelCPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEvolv)
CPU routine for enforcing a velocity threshold.
template __host__ void TheresholdVelCPU< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > XEvolv)
template __host__ void TheresholdVelCPU< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > XEvolv)
__global__ void TheresholdVelGPU (Param XParam, BlockP< T > XBlock, EvolvingP< T > XEvolv)
CUDA kernel for enforcing a velocity threshold. Function Used to prevent crazy velocity on the GPU. The function wraps the main function for the GPU. Updates velocity components to ensure they do not exceed a specified threshold.
template __global__ void TheresholdVelGPU< double > (Param XParam, BlockP< double > XBlock, EvolvingP< double > XEvolv)
template __global__ void TheresholdVelGPU< float > (Param XParam, BlockP< float > XBlock, EvolvingP< float > XEvolv)
__host__ __device__ bool ThresholdVelocity (T Threshold, T & u, T & v)
Function Used to prevent crazy velocity.
__host__ void XiafrictionCPU (Param XParam, BlockP< T > XBlock, T dt, T * cf, EvolvingP< T > XEvolv, EvolvingP< T > XEvolv_o)
CPU routine for applying bottom friction following Xia & Lang (2018).
template __host__ void XiafrictionCPU< double > (Param XParam, BlockP< double > XBlock, double dt, double * cf, EvolvingP< double > XEvolv, EvolvingP< double > XEvolv_o)
template __host__ void XiafrictionCPU< float > (Param XParam, BlockP< float > XBlock, float dt, float * cf, EvolvingP< float > XEvolv, EvolvingP< float > XEvolv_o)
__global__ void XiafrictionGPU (Param XParam, BlockP< T > XBlock, T dt, T * cf, EvolvingP< T > XEvolv, EvolvingP< T > XEvolv_o)
CUDA kernel for applying Xia & Lang (2018) bottom friction to all active blocks.
template __global__ void XiafrictionGPU< double > (Param XParam, BlockP< double > XBlock, double dt, double * cf, EvolvingP< double > XEvolv, EvolvingP< double > XEvolv_o)
template __global__ void XiafrictionGPU< float > (Param XParam, BlockP< float > XBlock, float dt, float * cf, EvolvingP< float > XEvolv, EvolvingP< float > XEvolv_o)
__host__ void bottomfrictionCPU (Param XParam, BlockP< T > XBlock, T dt, T * cf, EvolvingP< T > XEvolv)
CPU routine for applying bottom friction to all active blocks.
template __host__ void bottomfrictionCPU< double > (Param XParam, BlockP< double > XBlock, double dt, double * cf, EvolvingP< double > XEvolv)
template __host__ void bottomfrictionCPU< float > (Param XParam, BlockP< float > XBlock, float dt, float * cf, EvolvingP< float > XEvolv)
__global__ void bottomfrictionGPU (Param XParam, BlockP< T > XBlock, T dt, T * cf, EvolvingP< T > XEvolv)
CUDA kernel for applying bottom friction to all active blocks.
template __global__ void bottomfrictionGPU< double > (Param XParam, BlockP< double > XBlock, double dt, double * cf, EvolvingP< double > XEvolv)
template __global__ void bottomfrictionGPU< float > (Param XParam, BlockP< float > XBlock, float dt, float * cf, EvolvingP< float > XEvolv)
__host__ __device__ T manningfriction (T g, T hi, T n)
Manning friction model.
__host__ __device__ T smartfriction (T hi, T zo)
Smart friction model for roughness height.

Public Functions Documentation

function TheresholdVelCPU

CPU routine for enforcing a velocity threshold.

template<class T>
__host__ void TheresholdVelCPU (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > XEvolv
) 

Updates velocity components to ensure they do not exceed a specified threshold. Function Used to prevent crazy velocity on the CPU

Parameters:

  • XParam Simulation parameters
  • XBlock Block data structure
  • XEvolv Evolving variables structure

function TheresholdVelCPU< double >

template __host__ void TheresholdVelCPU< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > XEvolv
) 

function TheresholdVelCPU< float >

template __host__ void TheresholdVelCPU< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > XEvolv
) 

function TheresholdVelGPU

CUDA kernel for enforcing a velocity threshold. Function Used to prevent crazy velocity on the GPU. The function wraps the main function for the GPU. Updates velocity components to ensure they do not exceed a specified threshold.

template<class T>
__global__ void TheresholdVelGPU (
    Param XParam,
    BlockP < T > XBlock,
    EvolvingP < T > XEvolv
) 

Parameters:

  • XParam Simulation parameters
  • XBlock Block data structure
  • XEvolv Evolving variables structure

function TheresholdVelGPU< double >

template __global__ void TheresholdVelGPU< double > (
    Param XParam,
    BlockP < double > XBlock,
    EvolvingP < double > XEvolv
) 

function TheresholdVelGPU< float >

template __global__ void TheresholdVelGPU< float > (
    Param XParam,
    BlockP < float > XBlock,
    EvolvingP < float > XEvolv
) 

function ThresholdVelocity

Function Used to prevent crazy velocity.

template<class T>
__host__ __device__ bool ThresholdVelocity (
    T Threshold,
    T & u,
    T & v
) 

The function scale velocities so it doesn't exceeds a given threshold. Default threshold is/should be 16.0m/s

Parameters:

  • Threshold Velocity threshold
  • u Velocity component in x direction
  • v Velocity component in y direction

Returns:

true if velocity was above threshold and has been scaled down, false otherwise


function XiafrictionCPU

CPU routine for applying bottom friction following Xia & Lang (2018).

template<class T>
__host__ void XiafrictionCPU (
    Param XParam,
    BlockP < T > XBlock,
    T dt,
    T * cf,
    EvolvingP < T > XEvolv,
    EvolvingP < T > XEvolv_o
) 

Updates velocity components using the Xia & Lang friction model for each cell in all blocks, using both current and previous evolving variables. Reference: Xia and Lang (2018), https://doi.org/10.1016/j.advwatres.2018.05.004

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Simulation parameters
  • XBlock Block data structure
  • dt Time step
  • cf Friction coefficient array
  • XEvolv Current evolving variables structure
  • XEvolv_o Previous evolving variables structure

function XiafrictionCPU< double >

template __host__ void XiafrictionCPU< double > (
    Param XParam,
    BlockP < double > XBlock,
    double dt,
    double * cf,
    EvolvingP < double > XEvolv,
    EvolvingP < double > XEvolv_o
) 

function XiafrictionCPU< float >

template __host__ void XiafrictionCPU< float > (
    Param XParam,
    BlockP < float > XBlock,
    float dt,
    float * cf,
    EvolvingP < float > XEvolv,
    EvolvingP < float > XEvolv_o
) 

function XiafrictionGPU

CUDA kernel for applying Xia & Lang (2018) bottom friction to all active blocks.

template<class T>
__global__ void XiafrictionGPU (
    Param XParam,
    BlockP < T > XBlock,
    T dt,
    T * cf,
    EvolvingP < T > XEvolv,
    EvolvingP < T > XEvolv_o
) 

Updates velocity components using the Xia & Lang friction model for each cell in all blocks, using both current and previous evolving variables.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Simulation parameters
  • XBlock Block data structure
  • dt Time step
  • cf Friction coefficient array
  • XEvolv Current evolving variables structure
  • XEvolv_o Previous evolving variables structure

function XiafrictionGPU< double >

template __global__ void XiafrictionGPU< double > (
    Param XParam,
    BlockP < double > XBlock,
    double dt,
    double * cf,
    EvolvingP < double > XEvolv,
    EvolvingP < double > XEvolv_o
) 

function XiafrictionGPU< float >

template __global__ void XiafrictionGPU< float > (
    Param XParam,
    BlockP < float > XBlock,
    float dt,
    float * cf,
    EvolvingP < float > XEvolv,
    EvolvingP < float > XEvolv_o
) 

function bottomfrictionCPU

CPU routine for applying bottom friction to all active blocks.

template<class T>
__host__ void bottomfrictionCPU (
    Param XParam,
    BlockP < T > XBlock,
    T dt,
    T * cf,
    EvolvingP < T > XEvolv
) 

Updates velocity components using the specified friction model (default, smart, or Manning) for each cell in all blocks.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Simulation parameters
  • XBlock Block data structure
  • dt Time step
  • cf Friction coefficient array
  • XEvolv Evolving variables structure

function bottomfrictionCPU< double >

template __host__ void bottomfrictionCPU< double > (
    Param XParam,
    BlockP < double > XBlock,
    double dt,
    double * cf,
    EvolvingP < double > XEvolv
) 

function bottomfrictionCPU< float >

template __host__ void bottomfrictionCPU< float > (
    Param XParam,
    BlockP < float > XBlock,
    float dt,
    float * cf,
    EvolvingP < float > XEvolv
) 

function bottomfrictionGPU

CUDA kernel for applying bottom friction to all active blocks.

template<class T>
__global__ void bottomfrictionGPU (
    Param XParam,
    BlockP < T > XBlock,
    T dt,
    T * cf,
    EvolvingP < T > XEvolv
) 

Updates velocity components using the specified friction model (default, smart, or Manning) for each cell in all blocks.

Template parameters:

  • T Data type (float or double)

Parameters:

  • XParam Simulation parameters
  • XBlock Block data structure
  • dt Time step
  • cf Friction coefficient array
  • XEvolv Evolving variables structure

function bottomfrictionGPU< double >

template __global__ void bottomfrictionGPU< double > (
    Param XParam,
    BlockP < double > XBlock,
    double dt,
    double * cf,
    EvolvingP < double > XEvolv
) 

function bottomfrictionGPU< float >

template __global__ void bottomfrictionGPU< float > (
    Param XParam,
    BlockP < float > XBlock,
    float dt,
    float * cf,
    EvolvingP < float > XEvolv
) 

function manningfriction

Manning friction model.

template<class T>
__host__ __device__ T manningfriction (
    T g,
    T hi,
    T n
) 

Computes friction coefficient using Manning's equation based on gravity, water depth, and Manning's n.

Template parameters:

  • T Data type (float or double)

Parameters:

  • g Gravity
  • hi Water depth
  • n Manning's n

Returns:

Friction coefficient


function smartfriction

Smart friction model for roughness height.

template<class T>
__host__ __device__ T smartfriction (
    T hi,
    T zo
) 

Computes friction coefficient using a log-law based on water depth and roughness height.

Template parameters:

  • T Data type (float or double)

Parameters:

  • hi Water depth
  • zo Roughness height

Returns:

Friction coefficient



The documentation for this class was generated from the following file src/Friction.cu