Approximating upwind gradients on a grid with the following options for the order of accuracy: 1, 3 or 5. More...
#include <cmath>
#include "Grid/grid_dist_id.hpp"
#include "FD_simple.hpp"
#include "Eno_Weno.hpp"
Go to the source code of this file.
Functions | |
template<typename field_type > | |
static field_type | upwinding (field_type dplus, field_type dminus, int sign) |
Upwinding: For a specific dimension, from the forward and backward gradient find the upwind side. More... | |
template<size_t Field, size_t Sign, typename gridtype , typename keytype > | |
auto | FD_upwind (gridtype &grid, keytype &key, size_t d, size_t order) |
Get the upwind finite difference of a scalar property on the current grid node. More... | |
template<size_t Field, size_t Sign, size_t Gradient, typename gridtype > | |
void | upwind_gradient (gridtype &grid, const bool one_sided_BC, size_t order) |
Computes upwind gradient with order of accuracy 1, 3 or 5. More... | |
template<typename gridtype > | |
static bool | ghost_width_is_sufficient (gridtype &grid, size_t required_width) |
Checks if ghost layer is thick enough for a given stencil-width. More... | |
template<size_t Field_in, size_t Sign, size_t Gradient_out, typename gridtype > | |
void | get_upwind_gradient (gridtype &grid, const size_t order=5, const bool one_sided_BC=true) |
Calls upwind_gradient. Computes upwind gradient of desired order {1, 3, 5} for the whole n-dim grid. More... | |
Approximating upwind gradients on a grid with the following options for the order of accuracy: 1, 3 or 5.
For solving hyperbolic PDEs using differencing that is biased by the direction of the wave front. Upwinding is done according to M. Sussman and E. Fatemi, “Efficient, interface-preserving level set redistancing algorithm and its application to interfacial incompressible fluid flow” (1999) ), paragraph 4.1, 2 b). Order 1 is achieved by upwinding of forward and backward finite difference, order 3 and 5 by upwinding the ENO and WENO scheme, respectively.
Definition in file Upwind_gradient.hpp.
auto FD_upwind | ( | gridtype & | grid, |
keytype & | key, | ||
size_t | d, | ||
size_t | order | ||
) |
Get the upwind finite difference of a scalar property on the current grid node.
Order of accuracy can be 1, 3 or 5.
Field | Size_t index of property for which the gradient should be computed. |
Sign | Size_t index of property that contains the initial sign of that property for which the upwind FD should be computed. |
gridtype | Type of input grid. |
keytype | Type of key variable. |
grid | Grid, on which the gradient should be computed. |
key | Key that contains the index of the current grid node. |
d | Variable (size_t) that contains the dimension. |
order | Order of accuracy of the difference scheme. Can be 1, 3 or 5. |
Definition at line 70 of file Upwind_gradient.hpp.
void get_upwind_gradient | ( | gridtype & | grid, |
const size_t | order = 5 , |
||
const bool | one_sided_BC = true |
||
) |
Calls upwind_gradient. Computes upwind gradient of desired order {1, 3, 5} for the whole n-dim grid.
Field | Size_t index of property for which the gradient should be computed. |
Sign | Size_t index of property that contains the initial sign of that property for which the upwind FD should be computed / sign of the velocity. |
Gradient | Size_t index of property where the upwind gradient result should be stored. |
gridtype | Type of input grid. |
grid | Grid, on which the gradient should be computed. |
Definition at line 217 of file Upwind_gradient.hpp.
|
static |
Checks if ghost layer is thick enough for a given stencil-width.
gridtype | Type of input grid. |
grid | Grid, for which ghost layer width should be checked. |
required_width | Size_t variable, number of ghost nodes that are required in one direction. |
Definition at line 188 of file Upwind_gradient.hpp.
void upwind_gradient | ( | gridtype & | grid, |
const bool | one_sided_BC, | ||
size_t | order | ||
) |
Computes upwind gradient with order of accuracy 1, 3 or 5.
Checks if a point lays within the grid or at the boundary. For the internal grid points, it calls upwind finite difference FD_upwind(). For the border points, simply #FD_forward() and #FD_backward() is used, respectively, depending on the side of the border.
Field | Size_t index of property for which the gradient should be computed. |
Sign | Size_t index of property that contains the initial sign of that property for which the upwind FD should be computed. |
Gradient | Size_t index of property where the gradient result should be stored. |
gridtype | Type of input grid. |
grid | Grid, on which the gradient should be computed. |
one_sided_BC | Bool variable, if true, use one-sided kernel for boundary-nodes. If false, extend stencil onto ghost nodes. |
order | Size_t variable, order of accuracy the upwind FD scheme should have. Can be 1, 3 or 5. |
Definition at line 123 of file Upwind_gradient.hpp.
|
static |
Upwinding: For a specific dimension, from the forward and backward gradient find the upwind side.
dplus | Gradient approximated using RHS neighbors. |
dminus | Gradient approximated using LHS neighbors. |
sign | Sign of the velocity with which the wave front is moving. |
Definition at line 39 of file Upwind_gradient.hpp.