HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
GPU implementation of fourth order finite-difference approximation to the first derivative. More...
#include <basic_gpu.h>
#include <firstderivative.h>
#include <arrayfunctions.h>
#include <mpivars.h>
#include <hypar.h>
Go to the source code of this file.
Typedefs | |
typedef MPIVariables | MPIContext |
typedef HyPar | SolverContext |
Functions | |
__global__ void | FirstDerivativeFourthOrderCentral_boundary_kernel (int N_outer, int npoints_local_wghosts, int ghosts, int ndims, int nvars, int dir, const int *dim, const double *f, double *Df) |
__global__ void | FirstDerivativeFourthOrderCentral_interior_kernel (int ngrid_points, int npoints_local_wghosts, int ghosts, int ndims, int nvars, int dir, const int *dim, const double *f, double *Df) |
int | gpuFirstDerivativeFourthOrderCentral (double *Df, double *f, int dir, int bias, void *s, void *m) |
GPU implementation of fourth order finite-difference approximation to the first derivative.
Definition in file FirstDerivativeFourthOrder_GPU.cu.
typedef MPIVariables MPIContext |
Definition at line 11 of file FirstDerivativeFourthOrder_GPU.cu.
typedef HyPar SolverContext |
Definition at line 12 of file FirstDerivativeFourthOrder_GPU.cu.
__global__ void FirstDerivativeFourthOrderCentral_boundary_kernel | ( | int | N_outer, |
int | npoints_local_wghosts, | ||
int | ghosts, | ||
int | ndims, | ||
int | nvars, | ||
int | dir, | ||
const int * | dim, | ||
const double * | f, | ||
double * | Df | ||
) |
Kernel for gpuFirstDerivativeFourthOrderCentral()
Definition at line 223 of file FirstDerivativeFourthOrder_GPU.cu.
__global__ void FirstDerivativeFourthOrderCentral_interior_kernel | ( | int | ngrid_points, |
int | npoints_local_wghosts, | ||
int | ghosts, | ||
int | ndims, | ||
int | nvars, | ||
int | dir, | ||
const int * | dim, | ||
const double * | f, | ||
double * | Df | ||
) |
Kernel for gpuFirstDerivativeFourthOrderCentral()
Definition at line 295 of file FirstDerivativeFourthOrder_GPU.cu.
int gpuFirstDerivativeFourthOrderCentral | ( | double * | Df, |
double * | f, | ||
int | dir, | ||
int | bias, | ||
void * | s, | ||
void * | m | ||
) |
Computes the fourth-order finite-difference approximation to the first derivative (Note: not divided by the grid spacing):
\begin{equation} \left(\partial f\right)_i = \left\{ \begin{array}{ll} \frac{1}{12}\left(-25f_i+48f_{i+1}-36f_{i+2}+16f_{i+3}-3f_{i+4}\right) & i=-g \\ \frac{1}{12}\left(-3f_{i-1}-10f_i+18f_{i+1}-6f_{i+2}+f_{i+3}\right) & i = -g+1 \\ \frac{1}{2}\left( f_{i-2}-8f_{i-1}+8f_{i+1}-f_{i+2} \right) & -g+2 \leq i \leq N+g-3 \\ \frac{1}{12}\left( -f_{i-3}+6f_{i-2}-18f_{i-1}+10f_i+3f_{i+1}\right) & i = N+g-2 \\ \frac{1}{12}\left( 3f_{i-4}-16f_{i-3}+36f_{i-2}-48f_{i-1}+25f_i \right) & i = N+g-1 \end{array}\right. \end{equation}
where \(i\) is the grid index along the spatial dimension of the derivative, \(g\) is the number of ghost points, and \(N\) is the number of grid points (not including the ghost points) in the spatial dimension of the derivative.
Notes:
Df | Array to hold the computed first derivative (with ghost points) |
f | Array containing the grid point function values whose first derivative is to be computed (with ghost points) |
dir | The spatial dimension along which the derivative is computed |
bias | Forward or backward differencing for non-central finite-difference schemes (-1: backward, 1: forward) |
s | Solver object of type SolverContext |
m | MPI object of type MPIContext |
Definition at line 351 of file FirstDerivativeFourthOrder_GPU.cu.