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 <basic.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.
Macros | |
#define | _MINIMUM_GHOSTS_ 3 |
Functions | |
static int | WENOFifthOrderCalculateWeightsJS (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsM (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsZ (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsYC (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsCharJS (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsCharM (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsCharZ (double *, double *, double *, int, void *, void *) |
static int | WENOFifthOrderCalculateWeightsCharYC (double *, double *, double *, int, void *, void *) |
int | WENOFifthOrderCalculateWeights (double *fC, double *uC, double *x, int dir, void *s, void *m) |
int | WENOFifthOrderCalculateWeightsChar (double *fC, double *uC, double *x, int dir, void *s, void *m) |
Functions to compute the nonlinear weights for WENO-type schemes.
Definition in file WENOFifthOrderCalculateWeights.c.
#define _MINIMUM_GHOSTS_ 3 |
Minimum number of ghost points required for this interpolation method.
Definition at line 25 of file WENOFifthOrderCalculateWeights.c.
|
static |
Computes the nonlinear weights for the 5th order component-wise WENO-type schemes using the original formulation of Jiang & Shu:
\begin{equation} \omega_k = \frac {a_k} {\sum_{j=1}^3 a_j },\ a_k = \frac {c_k} {\left(\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}
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 111 of file WENOFifthOrderCalculateWeights.c.
|
static |
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 265 of file WENOFifthOrderCalculateWeights.c.
|
static |
Computes the nonlinear weights for the 5th order component-wise WENO-type schemes using the WENO-Z formulation:
\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|\beta_1 - \beta_3 \right|\).
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 434 of file WENOFifthOrderCalculateWeights.c.
|
static |
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 590 of file WENOFifthOrderCalculateWeights.c.
|
static |
Computes the nonlinear weights for the 5th order characteristic-based WENO-type schemes using the original formulation of Jiang & Shu:
\begin{equation} \omega_k = \frac {a_k} {\sum_{j=1}^3 a_j },\ a_k = \frac {c_k} {\left(\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(\alpha_{j-2}-2\alpha_{j-1}+\alpha_j\right)^2 + \frac{1}{4}\left(\alpha_{j-2}-4\alpha_{j-1}+3\alpha_j\right)^2 \\ \beta_2 &=& \frac{13}{12} \left(\alpha_{j-1}-2\alpha_j+\alpha_{j+1}\right)^2 + \frac{1}{4}\left(\alpha_{j-1}-\alpha_{j+1}\right)^2 \\ \beta_3 &=& \frac{13}{12} \left(\alpha_j-2\alpha_{j+1}+\alpha_{j+2}\right)^2 + \frac{1}{4}\left(3\alpha_j-4\alpha_{j+1}+\alpha_{j+2}\right)^2 \end{eqnarray}
where \(\alpha\) is the characteristic flux or the solution.
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 760 of file WENOFifthOrderCalculateWeights.c.
|
static |
Computes the nonlinear weights for the 5th order characteristic-based 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(\alpha_{j-2}-2\alpha_{j-1}+\alpha_j\right)^2 + \frac{1}{4}\left(\alpha_{j-2}-4\alpha_{j-1}+3\alpha_j\right)^2 \\ \beta_2 &=& \frac{13}{12} \left(\alpha_{j-1}-2\alpha_j+\alpha_{j+1}\right)^2 + \frac{1}{4}\left(\alpha_{j-1}-\alpha_{j+1}\right)^2 \\ \beta_3 &=& \frac{13}{12} \left(\alpha_j-2\alpha_{j+1}+\alpha_{j+2}\right)^2 + \frac{1}{4}\left(3\alpha_j-4\alpha_{j+1}+\alpha_{j+2}\right)^2 \end{eqnarray}
where \(\alpha\) is the characteristic flux or the solution.
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 930 of file WENOFifthOrderCalculateWeights.c.
|
static |
Computes the nonlinear weights for the 5th order characteristic-based WENO-type schemes using the WENO-Z formulation:
\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(\alpha_{j-2}-2\alpha_{j-1}+\alpha_j\right)^2 + \frac{1}{4}\left(\alpha_{j-2}-4\alpha_{j-1}+3\alpha_j\right)^2 \\ \beta_2 &=& \frac{13}{12} \left(\alpha_{j-1}-2\alpha_j+\alpha_{j+1}\right)^2 + \frac{1}{4}\left(\alpha_{j-1}-\alpha_{j+1}\right)^2 \\ \beta_3 &=& \frac{13}{12} \left(\alpha_j-2\alpha_{j+1}+\alpha_{j+2}\right)^2 + \frac{1}{4}\left(3\alpha_j-4\alpha_{j+1}+\alpha_{j+2}\right)^2 \end{eqnarray}
and \(\tau_5 = \left|\beta_1 - \beta_3 \right|\), and \(\alpha\) is the characteristic flux or the solution.
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 1101 of file WENOFifthOrderCalculateWeights.c.
|
static |
Computes the nonlinear weights for the 5th order characteristic-based 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(\alpha_{j-2}-2\alpha_{j-1}+\alpha_j\right)^2 + \frac{1}{4}\left(\alpha_{j-2}-4\alpha_{j-1}+3\alpha_j\right)^2 \\ \beta_2 &=& \frac{13}{12} \left(\alpha_{j-1}-2\alpha_j+\alpha_{j+1}\right)^2 + \frac{1}{4}\left(\alpha_{j-1}-\alpha_{j+1}\right)^2 \\ \beta_3 &=& \frac{13}{12} \left(\alpha_j-2\alpha_{j+1}+\alpha_{j+2}\right)^2 + \frac{1}{4}\left(3\alpha_j-4\alpha_{j+1}+\alpha_{j+2}\right)^2 \end{eqnarray}
and \(\tau_5 = \left( \alpha_{j-2}-4\alpha_{j-1}+6\alpha_j-4\alpha_{j+1}+\alpha_{j+2} \right)^2\) and \(\alpha\) is the characteristic flux or the solution.
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 1272 of file WENOFifthOrderCalculateWeights.c.
int WENOFifthOrderCalculateWeights | ( | 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 40 of file WENOFifthOrderCalculateWeights.c.
int WENOFifthOrderCalculateWeightsChar | ( | 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 66 of file WENOFifthOrderCalculateWeights.c.