HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Compute the hyperbolic term of the governing equations. More...
Go to the source code of this file.
Functions | |
static int | ReconstructHyperbolic (double *, double *, double *, double *, int, void *, void *, double, int, int(*)(double *, double *, double *, double *, double *, double *, int, void *, double)) |
static int | DefaultUpwinding (double *, double *, double *, double *, double *, double *, int, void *, double) |
template<int block_size> | |
__global__ void | StageBoundaryIntegral_kernel (int n, int nvars, int sign, const double *__restrict__ FluxI, double *__restrict__ StageBoundaryIntegral) |
__global__ void | HyperbolicFunction_dim3_kernel (int npoints_grid, int npoints_local_wghosts, int npoints_dim_interface, int d, int nvars, int ghosts, int offset, const int *__restrict__ dim, const double *__restrict__ FluxI, const double *__restrict__ dxinv, double *__restrict__ hyp, double *__restrict__ FluxI_p1, double *__restrict__ FluxI_p2) |
int | gpuHyperbolicFunction (double *hyp, double *u, void *s, void *m, double t, int LimFlag, int(*FluxFunction)(double *, double *, int, void *, double), int(*UpwindFunction)(double *, double *, double *, double *, double *, double *, int, void *, double)) |
Compute the hyperbolic term of the governing equations.
Definition in file HyperbolicFunction_GPU.cu.
|
static |
This function computes the numerical flux \(\hat{\bf f}_{j+1/2}\) at the interface from the cell-centered flux function \({\bf f}_j\). This happens in two steps:-
Interpolation: High-order accurate approximations to the flux at the interface \(j+1/2\) are computed from the cell-centered flux with left- and right-biased interpolation methods. This is done by the HyPar::InterpolateInterfacesHyp function. This can be expressed as follows:
\begin{align} \hat{\bf f}^L_{j+1/2} &= \mathcal{I}\left({\bf f}_j,+1\right), \\ \hat{\bf f}^R_{j+1/2} &= \mathcal{I}\left({\bf f}_j,-1\right), \end{align}
where the \(\pm 1\) indicates the interpolation bias, and \(\mathcal{I}\) is the interpolation operator pointed to by HyPar::InterpolateInterfacesHyp (see src/InterpolationFunctions for all the available operators). The interface values of the solution are similarly computed:
\begin{align} \hat{\bf u}^L_{j+1/2} &= \mathcal{I}\left({\bf u}_j,+1\right), \\ \hat{\bf u}^R_{j+1/2} &= \mathcal{I}\left({\bf u}_j,-1\right), \end{align}
The specific choice of \(\mathcal{I}\) is set based on HyPar::spatial_scheme_hyp.
Upwinding: The final flux at the interface is computed as
\begin{equation} \hat{\bf f}_{j+1/2} = \mathcal{U}\left( \hat{\bf f}^L_{j+1/2}, \hat{\bf f}^R_{j+1/2}, \hat{\bf u}^L_{j+1/2}, \hat{\bf u}^R_{j+1/2} \right), \end{equation}
where \(\mathcal{U}\) denotes the upwinding function UpwindFunction() passed as an argument (if NULL, DefaultUpwinding() is used). The upwinding function is specified by the physical model.
Note: Solution-dependent, nonlinear interpolation methods (such as WENO, CRWENO) are implemented in a way that separates the calculation of the nonlinear interpolation weights (based on, say, the smoothness of the flux function), and the actual evaluation of the interpolant, into different functions. This allows the flexibility to choose if and when the nonlinear coefficients are evaluated (or previously computed values are reused). Some possible scenarios are:
The argument LimFlag controls this behavior:
fluxI | Array to hold the computed interface fluxes. This array does not have ghost points. The dimensions are the same as those of u without ghost points in all dimensions, except along dir, where it is one more |
fluxC | Array of the flux function computed at the cell centers (same layout as u) |
u | Solution array |
x | Array of spatial coordinates |
dir | Spatial dimension along which to reconstruct the interface fluxes |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
t | Current solution time |
LimFlag | Flag to indicate if the nonlinear coefficients for solution-dependent interpolation method should be recomputed |
UpwindFunction | Function pointer to the upwinding function for the interface flux computation. If NULL, DefaultUpwinding() will be used. |
Definition at line 629 of file HyperbolicFunction_GPU.cu.
|
static |
If no upwinding scheme is specified, this function defines the "upwind" flux as the arithmetic mean of the left- and right-biased fluxes.
fI | Computed upwind interface flux |
fL | Left-biased reconstructed interface flux |
fR | Right-biased reconstructed interface flux |
uL | Left-biased reconstructed interface solution |
uR | Right-biased reconstructed interface solution |
u | Cell-centered solution |
dir | Spatial dimension |
s | Solver object of type HyPar |
t | Current solution time |
Definition at line 691 of file HyperbolicFunction_GPU.cu.
__global__ void StageBoundaryIntegral_kernel | ( | int | n, |
int | nvars, | ||
int | sign, | ||
const double *__restrict__ | FluxI, | ||
double *__restrict__ | StageBoundaryIntegral | ||
) |
Kernel for stage boundary integral calculation
Definition at line 20 of file HyperbolicFunction_GPU.cu.
__global__ void HyperbolicFunction_dim3_kernel | ( | int | npoints_grid, |
int | npoints_local_wghosts, | ||
int | npoints_dim_interface, | ||
int | d, | ||
int | nvars, | ||
int | ghosts, | ||
int | offset, | ||
const int *__restrict__ | dim, | ||
const double *__restrict__ | FluxI, | ||
const double *__restrict__ | dxinv, | ||
double *__restrict__ | hyp, | ||
double *__restrict__ | FluxI_p1, | ||
double *__restrict__ | FluxI_p2 | ||
) |
int gpuHyperbolicFunction | ( | double * | hyp, |
double * | u, | ||
void * | s, | ||
void * | m, | ||
double | t, | ||
int | LimFlag, | ||
int(*)(double *, double *, int, void *, double) | FluxFunction, | ||
int(*)(double *, double *, double *, double *, double *, double *, int, void *, double) | UpwindFunction | ||
) |
This function computes the hyperbolic term of the governing equations, expressed as follows:-
\begin{equation} {\bf F} \left({\bf u}\right) = \sum_{d=0}^{D-1} \frac {\partial {\bf f}_d\left({\bf u}\right)} {\partial x_d} \end{equation}
using a conservative finite-difference discretization is space:
\begin{equation} \hat{\bf F} \left({\bf u}\right) = \sum_{d=0}^{D-1} \frac {1} {\Delta x_d} \left[ \hat{\bf f}_{d,j+1/2} - \hat{\bf f}_{d,j-1/2} \right] \end{equation}
where \(d\) denotes the spatial dimension, \(D\) denotes the total number of spatial dimensions, the hat denotes the discretized quantity, and \(j\) is the grid coordinate along dimension \(d\). The approximation to the flux function \({\bf f}_d\) at the interfaces \(j\pm1/2\), denoted by \(\hat{\bf f}_{d,j\pm 1/2}\), are computed using the function ReconstructHyperbolic().
hyp | Array to hold the computed hyperbolic term (shares the same layout as u |
u | Solution array |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
t | Current simulation time |
LimFlag | Flag to indicate if the nonlinear coefficients for solution-dependent interpolation method should be recomputed (see ReconstructHyperbolic() for an explanation on why this is needed) |
FluxFunction | Function pointer to the flux function for the hyperbolic term |
UpwindFunction | Function pointer to the upwinding function for the hyperbolic term |
Definition at line 473 of file HyperbolicFunction_GPU.cu.