Helper functions
Notation
\(dx\), \(dy\), \(dz\) : cell sizes in the x-, y- and z- directions, respectively.
\(\vol_{i,j,k}\) : Volume of cell-centered element \((i,j,k)\).
\(\area\) : Area of a cell face. For example, \(\area_{i-\half ,j,k}\) represents the area of the lower x-face of the \((i,j,k)\)-th cell,
For problems with embedded boundaries, we also define
\(\kappa_{i,j,k}\) : Volume fraction of cell \((i,j,k)\). Data are in the range of \([0,1]\) with zero representing covered cells and one for regular cells, so that for regular cells \(\kappa_{i,j,k} \vol_{i,j,k} = dx\ dy\ dz\)
\(\alpha\) : Area fractions. For example, \(\alpha_{i-\half ,j,k}\) corresponds to the the lower x-face of the \((i,j,k)\)-th cell. Data are in the range of \([0,1]\) with zero representing a covered face and one an un-cut face, so that for regular cells \(\alpha_{i-\half ,j,k} \area_{i-\half ,j,k} = dy\ dz\).
Note that EB is only an option for Cartesian geometries as of this writing.
Slopes
AMReX-Hydro’s implementation of the piecewise linear method provides several options, and leverages slopes routines from AMReX. For cells where this calculation would involve all regular cells (i.e. no cut or covered cells), there are second-order and fourth-order stencils along with options to apply limiters. Note that the piecewise parabolic and BDS methods have their own routines for formulating slopes (and these are housed within AMReX-Hydro).
For (EB)Godunov, the default is monotonicity-limited fourth-order slopes. Default limiting is as described in Colella (1985) [Colella and Glaz, 1985], where limiting is done on each component of the velocity individually.
For (EB)MOL, the default is monotonicity-limited second-order slopes. Default is the second order Monotonized Central (MC) limiter (van Leer, 1977 [Van Leer, 1977]), where limiting is applied direction by direction.
NOTE ON BOUNDARY CONDITIONS:
When periodic or Neumann BCs are imposed, schemes can be applied without any change since the ghost cells outside the domain are filled by either periodicity or by extrapolation.
For Dirichlet BCs, the BC value stored in the first ghost cell outside the domain is considered as located directly on the boundary, despite the fact that it is stored in what is otherwise considered a cell-centered array. We then utilize one-sided differencing schemes that use ONLY values from inside or on the domain boundary.
EB Slopes
The procedure for problems with embedded boundaries is detailed below, and attempts to use standard (non-EB) stencils wherever possible.
First, AMReX-Hydro attempts to compute the slope of the desired order (4 for Godunov and 2 for MOL) using standard stencils and limiters.
For cases where a fourth-order slope is desired but the stencil would require the use of cut cells (as happens in EBGodunov), the code next attempts to use the standard second-order slope and limiter.
If the standard second-order slope calculation would require the use of cut cells, then the slope computation will use a least squares approach, involving a linear fit to the at-most 26 (or 8 in 2D) nearest neighbors, with the function going through the centroid of cell (i,j,k) to the face centroid. This does not assume that the cell centroids, where the data is assumed to live, are the same as cell centers. This least-squares slope is then multiplied by a limiter based on the work of Barth-Jespersen that enforces no new maxima or minima when the state is predicted to the face centroids.
Boundary conditions
AMReX-Hydro uses underlying AMReX functionality in implementing boundary conditions
(see AMReX’s documentation section Boundary Conditions).
Physical boundary conditions, such as
inflow, outflow, slip/no-slip walls, etc., and are ultimately linked to
mathematical Dirichlet or Neumann conditions.
See amrex/Src/Base/AMReX_BC_TYPES.H
for common physical and mathematical types.
Domain boundary conditions affect the pre-MAC extrapolated velocities in three ways.
Potential impact to the slope computation in cells adjacent to the domain boundary (see Slopes section).
Direct enforcement of the boundary condition: If the face is on a domain boundary and the boundary condition type is
External Dirichlet (
extdir
): we set \(u_L\) to the boundary value, and then for the normal component of the velocity only, we set \(u_R = u_L\) This is done because for turbulent inflow, there can be times when the inflow face actually has outflowing velocity. In this case, we want to use the normal component as specified by the BC, but then allow that outflowing velocity to transport values that come from the interior.First-order extrapolation (
foextrap
), higher order extrapolation (hoextrap
), or even reflection about the boundary (reflecteven
):on the low side of the domain, we set \(u_L = u_R.\)
on the high side, we set \(u_R = u_L.\)
Odd reflection about the boundary (
reflectodd
) , we set \(u_L = u_R = 0.\)
To prohibit back flow into the domain at an outflow face (
foextrap
orhoextrap
mathematical BCs):on the low side, we set \(u_L = u_R = \min (u_R, 0).\)
on the high side, we set \(u_L = u_R = \max (u_L, 0).\)
For the post-MAC edge state,
Same as pre-MAC
Same as pre-MAC
Here, we do not impose the no-inflow-at-outflow condition quite as described above; instead we enforce that if \(u^{MAC}\) on an outflow face is inflowing, the normal velocity component must be outflowing or zero. We do this by imposing
on the low side, if \(u^{MAC}\ge 0\) (i.e the flow is coming in at an outflow face) and \(s\) is the x-velocity, then \(s_L = s_R = \min(s_R,0).\)
on the high side, if \(u^{MAC}<= 0\) on the domain face, then \(s_L = s_R = \max(s_L,0).\)
Note
Boundary conditions are imposed before the upwinding described in the Advection schemes section.
API documentation can be found in the Doxygen Technical Reference, functions SetXEdgeBCs, SetYEdgeBCs, SetZEdgeBCs .
Computing Fluxes
Doxygen links ComputeFluxes and EB_ComputeFluxes .
AMReX-Hydro has the option to compute intesive or extensive, i.e. area-weighted, fluxes. Extensive fluxes are always used for problems using R-Z geometry, and AMReX has functions for computing the position dependent cell volume and face areas (see Geometry::GetFaceArea and Geometry::GetVolume). We first give the formulas for the EB-regular case, and then those used when embedded boundaries are present.
Intensive
Intensive fluxes are computed from the advective velocity, \(\U^{MAC}\), and edge states, \(s\), by defining
on all x-faces,
on all y-faces, and
on all z-faces.
When embedded boundaries are present, intensive fluxes are computed as
on all x-faces,
on all y-faces,
on all z-faces. Here \(\alpha_{i-\frac{1}{2},j,k}\) is the area fraction of the lower x-face of cell-centered element \((i,j,k)\), etc.
Extensive
Extensive fluxes are computed as
on all x-faces,
on all y-faces,
on all z-faces.
where \(\area_{i-\frac{1}{2},j,k}\) is the area of the lower x-face of cell-centered element \((i,j,k)\), etc.
For EB, we simply scale area the by the area fraction in the above equations. For example, we use \(\alpha_{i-\frac{1}{2},j,k} \area_{i-\frac{1}{2},j,k}\) in place of \(\area_{i-\frac{1}{2},j,k}\), etc.
Constructing the advective term
AMReX-Hydro provides the option to compute the advective term either in conservative (\(\grad \cdot \U s\)) or convective form (\(\U \cdot \grad s\)). The exact equations differ slightly depending on whether the fluxes are intensive or extensive (required for R-Z coordinates).
Intensive fluxes
If the variable, \(s\) is to be updated conservatively, we construct
while if \(s\) is to be updated in convective form, we construct
where
and
Extensive fluxes
Given extensive fluxes we must divide by the cell volume in constructing the advective term. Here, we give the form for EB and note that the EB-regular case is obtained by setting both \(\alpha = 1\) and \(\kappa=1\). If the variable, \(s\) is to be updated conservatively, on all cells with \(\kappa_{i,j,k} > 0\) we construct
while if \(s\) is to be updated in convective form, we construct
where