HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Functions to compute the nonlinear weights for WENO-type schemes. More...
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cuda_profiler_api.h>
#include <basic.h>
#include <basic_gpu.h>
#include <arrayfunctions.h>
#include <matmult_native.h>
#include <mathfunctions.h>
#include <interpolation.h>
#include <mpivars.h>
#include <hypar.h>
#include <arrayfunctions_gpu.h>
Go to the source code of this file.
Functions | |
static int | gpuWENOFifthOrderCalculateWeightsYC (double *, double *, double *, int, void *, void *) |
static int | gpuWENOFifthOrderCalculateWeightsM (double *, double *, double *, int, void *, void *) |
int | gpuWENOFifthOrderCalculateWeights (double *fC, double *uC, double *x, int dir, void *s, void *m) |
__global__ void | WENOFifthOrderCalculateWeightsM_kernel (int npoints_grid, int npoints_local_wghosts, int ndims, int dir, int ghosts, int nvars, int weno_size, int offset, int stride, int is_crweno, int is_mpi_ip_zero, int is_mpi_ip_proc, double weno_eps, const int *dim, const double *fC, const double *uC, double *w1, double *w2, double *w3) |
int | gpuWENOFifthOrderCalculateWeightsM (double *__restrict__ fC, double *__restrict__ uC, double *__restrict__ x, int dir, void *s, void *m) |
__global__ void | WENOFifthOrderCalculateWeightsYC_kernel (int npoints_grid, int npoints_local_wghosts, int ndims, int dir, int ghosts, int nvars, int weno_size, int offset, int stride, int is_crweno, int is_mpi_ip_zero, int is_mpi_ip_proc, double weno_eps, const int *__restrict__ dim, const double *__restrict__ fC, const double *__restrict__ uC, double *__restrict__ w1, double *__restrict__ w2, double *__restrict__ w3) |
int | gpuWENOFifthOrderCalculateWeightsYC (double *__restrict__ fC, double *__restrict__ uC, double *__restrict__ x, int dir, void *s, void *m) |
Functions to compute the nonlinear weights for WENO-type schemes.
Definition in file WENOFifthOrderCalculateWeights_GPU.cu.
|
static |
|
static |
int gpuWENOFifthOrderCalculateWeights | ( | double * | fC, |
double * | uC, | ||
double * | x, | ||
int | dir, | ||
void * | s, | ||
void * | m | ||
) |
Compute the nonlinear weights for 5th order WENO-type schemes. This function is a wrapper that calls the appropriate function, depending on the type of WENO weights.
fC | Array of cell-centered values of the function \({\bf f}\left({\bf u}\right)\) |
uC | Array of cell-centered values of the solution \({\bf u}\) |
x | Grid coordinates |
dir | Spatial dimension along which to interpolation |
s | Object of type HyPar containing solver-related variables |
m | Object of type MPIVariables containing MPI-related variables |
Definition at line 30 of file WENOFifthOrderCalculateWeights_GPU.cu.
__global__ void WENOFifthOrderCalculateWeightsM_kernel | ( | int | npoints_grid, |
int | npoints_local_wghosts, | ||
int | ndims, | ||
int | dir, | ||
int | ghosts, | ||
int | nvars, | ||
int | weno_size, | ||
int | offset, | ||
int | stride, | ||
int | is_crweno, | ||
int | is_mpi_ip_zero, | ||
int | is_mpi_ip_proc, | ||
double | weno_eps, | ||
const int * | dim, | ||
const double * | fC, | ||
const double * | uC, | ||
double * | w1, | ||
double * | w2, | ||
double * | w3 | ||
) |
Kernel for gpuWENOFifthOrderCalculateWeightsM()
Definition at line 485 of file WENOFifthOrderCalculateWeights_GPU.cu.
int gpuWENOFifthOrderCalculateWeightsM | ( | double *__restrict__ | fC, |
double *__restrict__ | uC, | ||
double *__restrict__ | x, | ||
int | dir, | ||
void * | s, | ||
void * | m | ||
) |
Computes the nonlinear weights for the 5th order component-wise WENO-type schemes using the mapped formulation of Henrick, Aslam & Powers:
\begin{eqnarray} \omega_k &=& \frac {a_k} {\sum_{j=1}^3 a_j },\ a_k = \frac {\tilde{\omega}_k \left( c_k + c_k^2 - 3c_k\tilde{\omega}_k + \tilde{\omega}_k^2\right)} {c_k^2 + \tilde{\omega}_k\left(1-2c_k\right)}, \\ \tilde{\omega}_k &=& \frac {\tilde{a}_k} {\sum_{j=1}^3 \tilde{a}_j },\ \tilde{a}_k = \frac {c_k} {\left(\beta_k+\epsilon\right)^p},\ k = 1,2,3, \end{eqnarray}
where \(c_k\) are the optimal weights, \(p\) is hardcoded to \(2\), and \(\epsilon\) is an input parameter (WENOParameters::eps) (typically \(10^{-6}\)). The smoothness indicators \(\beta_k\) are given by:
\begin{eqnarray} \beta_1 &=& \frac{13}{12} \left(f_{j-2}-2f_{j-1}+f_j\right)^2 + \frac{1}{4}\left(f_{j-2}-4f_{j-1}+3f_j\right)^2 \\ \beta_2 &=& \frac{13}{12} \left(f_{j-1}-2f_j+f_{j+1}\right)^2 + \frac{1}{4}\left(f_{j-1}-f_{j+1}\right)^2 \\ \beta_3 &=& \frac{13}{12} \left(f_j-2f_{j+1}+f_{j+2}\right)^2 + \frac{1}{4}\left(3f_j-4f_{j+1}+f_{j+2}\right)^2 \end{eqnarray}
Notes:
Reference:
fC | Array of cell-centered values of the function \({\bf f}\left({\bf u}\right)\) |
uC | Array of cell-centered values of the solution \({\bf u}\) |
x | Grid coordinates |
dir | Spatial dimension along which to interpolation |
s | Object of type HyPar containing solver-related variables |
m | Object of type MPIVariables containing MPI-related variables |
Definition at line 647 of file WENOFifthOrderCalculateWeights_GPU.cu.
__global__ void WENOFifthOrderCalculateWeightsYC_kernel | ( | int | npoints_grid, |
int | npoints_local_wghosts, | ||
int | ndims, | ||
int | dir, | ||
int | ghosts, | ||
int | nvars, | ||
int | weno_size, | ||
int | offset, | ||
int | stride, | ||
int | is_crweno, | ||
int | is_mpi_ip_zero, | ||
int | is_mpi_ip_proc, | ||
double | weno_eps, | ||
const int *__restrict__ | dim, | ||
const double *__restrict__ | fC, | ||
const double *__restrict__ | uC, | ||
double *__restrict__ | w1, | ||
double *__restrict__ | w2, | ||
double *__restrict__ | w3 | ||
) |
Kernel for gpuWENOFifthOrderCalculateWeightsYC()
Definition at line 721 of file WENOFifthOrderCalculateWeights_GPU.cu.
int gpuWENOFifthOrderCalculateWeightsYC | ( | double *__restrict__ | fC, |
double *__restrict__ | uC, | ||
double *__restrict__ | x, | ||
int | dir, | ||
void * | s, | ||
void * | m | ||
) |
Computes the nonlinear weights for the 5th order component-wise WENO-type schemes using the ESWENO formulation of Yamaleev & Carpenter. Note that only the formulation for the nonlinear weights is adopted and implemented here, not the ESWENO scheme as a whole.
\begin{equation} \omega_k = \frac {a_k} {\sum_{j=1}^3 a_j },\ a_k = c_k \left( 1 + \frac{\tau_5}{\beta_k+\epsilon} \right)^p,\ k = 1,2,3, \end{equation}
where \(c_k\) are the optimal weights, \(p\) is hardcoded to \(2\), and \(\epsilon\) is an input parameter (WENOParameters::eps) (typically \(10^{-6}\)). The smoothness indicators \(\beta_k\) are given by:
\begin{eqnarray} \beta_1 &=& \frac{13}{12} \left(f_{j-2}-2f_{j-1}+f_j\right)^2 + \frac{1}{4}\left(f_{j-2}-4f_{j-1}+3f_j\right)^2 \\ \beta_2 &=& \frac{13}{12} \left(f_{j-1}-2f_j+f_{j+1}\right)^2 + \frac{1}{4}\left(f_{j-1}-f_{j+1}\right)^2 \\ \beta_3 &=& \frac{13}{12} \left(f_j-2f_{j+1}+f_{j+2}\right)^2 + \frac{1}{4}\left(3f_j-4f_{j+1}+f_{j+2}\right)^2, \end{eqnarray}
and \(\tau_5 = \left( f_{j-2}-4f_{j-1}+6f_j-4f_{j+1}+f_{j+2} \right)^2\).
Notes:
Reference:
fC | Array of cell-centered values of the function \({\bf f}\left({\bf u}\right)\) |
uC | Array of cell-centered values of the solution \({\bf u}\) |
x | Grid coordinates |
dir | Spatial dimension along which to interpolation |
s | Object of type HyPar containing solver-related variables |
m | Object of type MPIVariables containing MPI-related variables |
Definition at line 884 of file WENOFifthOrderCalculateWeights_GPU.cu.