AMReX-Hydro
AMReX-based hydro routines for low Mach number flows
Loading...
Searching...
No Matches
PLIC Namespace Reference

Classes

struct  Youngs
 Youngs' finite-difference normal. More...
struct  MixedYoungsCentered
 Mixed Youngs-Centered normal (Aulisa et al., JCP 225, 2007). More...
struct  HeightFunctionMYC
 The height-function normal along the dominant direction of the Mixed Youngs-Centered normal, or the latter where the heights are not defined (thin or strongly curved structures). Exact for a planar interface wherever the heights are defined. More...

Functions

void CheckMesh (amrex::MultiFab const &F, amrex::Geometry const &geom)
 Abort unless the mesh is supported: Cartesian coordinates and no embedded boundaries.
int nGrowF (std::string const &reconstruction)
 The ghost cells of F that the operators of this library read, with the given reconstruction. Allocate and fill at least this many.
void FitPlanes (amrex::MultiFab &plane, amrex::MultiFab const &F, int ngrow, std::string const &reconstruction)
 Fit the plane of each mixed cell, and zero the others.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_mixed (const amrex::Real f) noexcept
 Whether a cell with volume fraction f holds the interface.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void sort3 (const amrex::Real a, const amrex::Real b, const amrex::Real c, amrex::Real &lo, amrex::Real &mid, amrex::Real &hi) noexcept
 a, b and c in ascending order, as lo <= mid <= hi.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real trig_root (const amrex::Real p, const amrex::Real q) noexcept
 The root of the cubic of volume_intercept in its two upper volume ranges, in the trigonometric form of Scardovelli & Zaleski, without the constant offset of the range.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real volume_intercept (const amrex::Real b1, const amrex::Real b2, const amrex::Real b3, const amrex::Real volF)
 Analytic plane constant alpha such that the region m1*x1 + m2*x2 + m3*x3 <= alpha of the unit cube has volume volF. Requires m1,m2,m3 >= 0 and m1+m2+m3 = 1. Any one (2D) or two (grid-aligned) coefficients may be zero.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real cut_volume (const amrex::Real m1, const amrex::Real m2, const amrex::Real m3, const amrex::Real alpha, const amrex::Real r0, const amrex::Real dr0)
 Liquid volume fraction of the sub-box [r0, r0+dr0] x [0,1] x [0,1] of the unit cube cut by m1*x1 + m2*x2 + m3*x3 <= alpha. The result is normalized by the sub-box volume dr0. Coefficients may have any sign; m3 = 0 gives the 2D result.
template<typename Phi>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real cell_fraction (const int i, const int j, const int k, amrex::GeometryData const &geomdata, Phi const &phi, const int nsub=8)
 Liquid volume fraction of cell (i,j,k) for an implicit surface phi(x) > 0 inside the liquid, by midpoint sampling on nsub^dim sub-cells. Intended for problem initialization.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real plane_fraction (const int i, const int j, const int k, amrex::GeometryData const &geomdata, const amrex::Real n[AMREX_SPACEDIM], const amrex::Real d)
 Exact liquid volume fraction of cell (i,j,k) for the half space n.x <= d (physical coordinates, n need not be normalized). Intended for problem initialization.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void youngs_normal (const int i, const int j, const int k, amrex::Array4< amrex::Real const > const &F, amrex::Real &mx, amrex::Real &my, amrex::Real &mz)
 Youngs' finite-difference normal on the 9-point stencil, scaled by -8 (i.e. m = -8 grad F).
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void myc_normal (const int i, const int j, const int k, amrex::Array4< amrex::Real const > const &F, amrex::Real &mx, amrex::Real &my, amrex::Real &mz)
 Mixed Youngs-Centered normal (2D). Returns an L1-normalized normal pointing out of the liquid.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool height_normal (const int i, const int j, const int k, const int d, amrex::Array4< amrex::Real const > const &F, amrex::Real m[3])
 Height-function normal with height direction d: the liquid heights of the 7-cell columns through (i,j,k) and its neighbors in the tangential directions, differenced centrally. Exact for a planar interface whose slope relative to d is at most 1, which holds for the dominant normal direction. Returns false (m untouched) unless each column, the center one included, crosses the interface once: from pure liquid to pure gas in the orientation of the center column, with F monotone in between. A thin gas gap with a liquid sliver inside a column is not a height, and the caller falls back to another normal.
template<typename Normal>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void fit_plane (const int i, const int j, const int k, amrex::Array4< amrex::Real const > const &F, amrex::Real &mx, amrex::Real &my, amrex::Real &mz, amrex::Real &alpha)
 Reconstruct the PLIC plane m.x = alpha in cell (i,j,k), in unit-cube cell coordinates with sum|m| = 1. Reads up to Normal::stencil cells away. Only meaningful in mixed cells (is_mixed).
void unknown_reconstruction (std::string const &reconstruction)
template<typename Fn>
decltype(auto) dispatch_normal (std::string const &reconstruction, Fn &&fn)
 Call fn with the normal scheme of a reconstruction name, as fn(Normal{}), and return what it returns. The one place that names the schemes; it aborts on an unknown name. Each path calls fn once, so it is forwarded there.
template<typename Normal>
void FitPlanesImpl (amrex::MultiFab &plane, amrex::MultiFab const &F, int ngrow)

Variables

static constexpr amrex::Real pure_tol = 1.0e-8_rt
static constexpr int hf_half = 3
static constexpr amrex::Real hf_pure_tol = 1.0e-6_rt

Function Documentation

◆ cell_fraction()

template<typename Phi>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real PLIC::cell_fraction ( const int i,
const int j,
const int k,
amrex::GeometryData const & geomdata,
Phi const & phi,
const int nsub = 8 )

Liquid volume fraction of cell (i,j,k) for an implicit surface phi(x) > 0 inside the liquid, by midpoint sampling on nsub^dim sub-cells. Intended for problem initialization.

Here is the call graph for this function:

◆ CheckMesh()

void PLIC::CheckMesh ( amrex::MultiFab const & F,
amrex::Geometry const & geom )

Abort unless the mesh is supported: Cartesian coordinates and no embedded boundaries.

Here is the call graph for this function:

◆ cut_volume()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real PLIC::cut_volume ( const amrex::Real m1,
const amrex::Real m2,
const amrex::Real m3,
const amrex::Real alpha,
const amrex::Real r0,
const amrex::Real dr0 )

Liquid volume fraction of the sub-box [r0, r0+dr0] x [0,1] x [0,1] of the unit cube cut by m1*x1 + m2*x2 + m3*x3 <= alpha. The result is normalized by the sub-box volume dr0. Coefficients may have any sign; m3 = 0 gives the 2D result.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dispatch_normal()

template<typename Fn>
decltype(auto) PLIC::dispatch_normal ( std::string const & reconstruction,
Fn && fn )

Call fn with the normal scheme of a reconstruction name, as fn(Normal{}), and return what it returns. The one place that names the schemes; it aborts on an unknown name. Each path calls fn once, so it is forwarded there.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fit_plane()

template<typename Normal>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PLIC::fit_plane ( const int i,
const int j,
const int k,
amrex::Array4< amrex::Real const > const & F,
amrex::Real & mx,
amrex::Real & my,
amrex::Real & mz,
amrex::Real & alpha )

Reconstruct the PLIC plane m.x = alpha in cell (i,j,k), in unit-cube cell coordinates with sum|m| = 1. Reads up to Normal::stencil cells away. Only meaningful in mixed cells (is_mixed).

Template Parameters
Normalthe normal scheme
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FitPlanes()

void PLIC::FitPlanes ( amrex::MultiFab & plane,
amrex::MultiFab const & F,
int ngrow,
std::string const & reconstruction )

Fit the plane of each mixed cell, and zero the others.

Parameters
plane4 components (m_x, m_y, m_z, alpha), in unit-cube cell coordinates, with the liquid on the side m.x <= alpha and sum|m| = 1
Fvolume fraction, with its ghost cells filled
ngrowghost layers of plane to fit
reconstruction"youngs", "myc" or "myc_height"
Here is the call graph for this function:

◆ FitPlanesImpl()

template<typename Normal>
void PLIC::FitPlanesImpl ( amrex::MultiFab & plane,
amrex::MultiFab const & F,
int ngrow )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ height_normal()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool PLIC::height_normal ( const int i,
const int j,
const int k,
const int d,
amrex::Array4< amrex::Real const > const & F,
amrex::Real m[3] )

Height-function normal with height direction d: the liquid heights of the 7-cell columns through (i,j,k) and its neighbors in the tangential directions, differenced centrally. Exact for a planar interface whose slope relative to d is at most 1, which holds for the dominant normal direction. Returns false (m untouched) unless each column, the center one included, crosses the interface once: from pure liquid to pure gas in the orientation of the center column, with F monotone in between. A thin gas gap with a liquid sliver inside a column is not a height, and the caller falls back to another normal.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_mixed()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool PLIC::is_mixed ( const amrex::Real f)
noexcept

Whether a cell with volume fraction f holds the interface.

Here is the caller graph for this function:

◆ myc_normal()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PLIC::myc_normal ( const int i,
const int j,
const int k,
amrex::Array4< amrex::Real const > const & F,
amrex::Real & mx,
amrex::Real & my,
amrex::Real & mz )

Mixed Youngs-Centered normal (2D). Returns an L1-normalized normal pointing out of the liquid.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nGrowF()

int PLIC::nGrowF ( std::string const & reconstruction)
nodiscard

The ghost cells of F that the operators of this library read, with the given reconstruction. Allocate and fill at least this many.

Here is the call graph for this function:

◆ plane_fraction()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real PLIC::plane_fraction ( const int i,
const int j,
const int k,
amrex::GeometryData const & geomdata,
const amrex::Real n[AMREX_SPACEDIM],
const amrex::Real d )

Exact liquid volume fraction of cell (i,j,k) for the half space n.x <= d (physical coordinates, n need not be normalized). Intended for problem initialization.

Here is the call graph for this function:

◆ sort3()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PLIC::sort3 ( const amrex::Real a,
const amrex::Real b,
const amrex::Real c,
amrex::Real & lo,
amrex::Real & mid,
amrex::Real & hi )
noexcept

a, b and c in ascending order, as lo <= mid <= hi.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trig_root()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real PLIC::trig_root ( const amrex::Real p,
const amrex::Real q )
noexcept

The root of the cubic of volume_intercept in its two upper volume ranges, in the trigonometric form of Scardovelli & Zaleski, without the constant offset of the range.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unknown_reconstruction()

void PLIC::unknown_reconstruction ( std::string const & reconstruction)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ volume_intercept()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real PLIC::volume_intercept ( const amrex::Real b1,
const amrex::Real b2,
const amrex::Real b3,
const amrex::Real volF )

Analytic plane constant alpha such that the region m1*x1 + m2*x2 + m3*x3 <= alpha of the unit cube has volume volF. Requires m1,m2,m3 >= 0 and m1+m2+m3 = 1. Any one (2D) or two (grid-aligned) coefficients may be zero.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ youngs_normal()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PLIC::youngs_normal ( const int i,
const int j,
const int k,
amrex::Array4< amrex::Real const > const & F,
amrex::Real & mx,
amrex::Real & my,
amrex::Real & mz )

Youngs' finite-difference normal on the 9-point stencil, scaled by -8 (i.e. m = -8 grad F).

Here is the caller graph for this function:

Variable Documentation

◆ hf_half

int PLIC::hf_half = 3
staticconstexpr

◆ hf_pure_tol

amrex::Real PLIC::hf_pure_tol = 1.0e-6_rt
staticconstexpr

◆ pure_tol

amrex::Real PLIC::pure_tol = 1.0e-8_rt
staticconstexpr