# Redistribution

This section first describes the “small cell problem” which motivates redistribution. We then discuss the redistribution methods AMReX-Hydro supports.

## Small Volume Embedded Boundary Cells

First, we review finite volume discretizations with embedded boundaries as used by AMReX-Hydro. Then we illustrate the small cell problem.

### Finite Volume Discretizations

Consider a system of PDEs to advance a conserved quantity $$U$$ with fluxes $$F$$:

(16)$\frac{\partial U}{\partial t} + \nabla \cdot F = 0.$

A conservative, finite volume discretization starts with the divergence theorm

$\int_V \nabla \cdot F dV = \int_{\partial V} F \cdot n dA.$

In an embedded boundary cell, the “conservative divergence” is discretized (as $$D^c(F)$$) as follows

(17)$D^c(F) = \frac{1}{\kappa h} \left( \sum^D_{d = 1} (F_{d, \mathrm{hi}} \, \alpha_{d, \mathrm{hi}} - F_{d, \mathrm{lo}}\, \alpha_{d, \mathrm{lo}}) + F^{EB} \alpha^{EB} \right).$

Geometry is discretely represented by volumes ($$V = \kappa h^d$$) and apertures ($$A= \alpha h^{d-1}$$), where $$h$$ is the (uniform) mesh spacing at that AMR level, $$\kappa$$ is the volume fraction and $$\alpha$$ are the area fractions. Without multivalued cells the volume fractions, area fractions and cell and face centroids (see Table 1) are the only geometric information needed to compute second-order fluxes centered at the face centroids, and to infer the connectivity of the cells. Cells are connected if adjacent on the Cartesian mesh, and only via coordinate-aligned faces on the mesh. If an aperture, $$\alpha = 0$$, between two cells, they are not directly connected to each other.

 A typical two-dimensional uniform cell that is cut by the embedded boundary. The grey area represents the region excluded from the calculation. The portion of the cell faces faces (labelled with A) through which fluxes flow are the “uncovered” regions of the full cell faces. The volume (labelled V) is the uncovered region of the interior. Fluxes in a cut cell.

### Small Cells And Stability

In the context of time-explicit advance methods for, say hyperbolic conservation laws, a naive discretization in time of (16) using (17),

$U^{n+1} = U^{n} - \delta t D^c(F)$

would have a time step constraint $$\delta t \sim h \kappa^{1/D}/V_m$$, which goes to zero as the size of the smallest volume fraction $$\kappa$$ in the calculation. Since EB volume fractions can be arbitrarily small, this presents an unacceptable constraint. This is the so-called “small cell problem,” and AMReX-Hydro addresses it with redistribution methods.

## Flux Redistribution

Consider a conservative update in the form:

$(\rho \phi)_t + \nabla \cdot ( \rho \phi u) = RHS$

For each valid cell in the domain, compute the conservative divergence, $$(\nabla \cdot F)^c$$ , of the convective fluxes, $$F$$

$(\nabla \cdot {F})^c_i = \dfrac{1}{\mathcal{V}_i} \sum_{f=1}^{N_f} ({F}_f\cdot{n}_f) A_f$

Here $$N_f$$ is the number of faces of cell $$i$$, $$\vec{n}_f$$ and $$A_f$$ are the unit normal and area of the $$f$$ -th face respectively, and $$\mathcal{V}_i$$ is the volume of cell $$i$$ given by

$\mathcal{V}_i = (\Delta x \Delta y \Delta z)\cdot \mathcal{K}_i$

where $$\mathcal{K}_i$$ is the volume fraction of cell $$i$$ .

Now, a conservative update can be written as

$\frac{ \rho^{n+1} \phi^{n+1} - \rho^{n} \phi^{n} }{\Delta t} = - \nabla \cdot{F}^c$

For each cell cut by the EB geometry, compute the non-conservative update, $$\nabla \cdot {F}^{nc}$$ ,

$\nabla\cdot{F}^{nc}_i = \dfrac{\sum\limits_{j\in N(i) } \mathcal{K}_j\nabla \cdot {F}^c_j} {\sum\limits_{j\in N(i) } {\mathcal{K}}_j}$

where $$N(i)$$ is the index set of cell $$i$$ and its neighbors.

For each cell cut by the EB geometry, compute the convective update $$\nabla \cdot{F}^{EB}$$ follows:

$\nabla \cdot{F}^{EB}_i = \mathcal{K}_i\nabla \cdot{F}^{c}_i +(1-\mathcal{K}_i) \nabla \cdot \mathcal{F}^{nc}_i$

For each cell cut by the EB geometry, redistribute its mass loss, $$\delta M_i$$ , to its neighbors:

$\nabla \cdot {F}^{EB}_j := \nabla \cdot {F}^{EB}_j + w_{ij}\delta M_i\, \qquad \forall j\in N(i)\setminus i$

where the mass loss in cell $$i$$ , $$\delta M_i$$ , is given by

$\delta M_i = \mathcal{K}_i(1- \mathcal{K}_i)[ \nabla \cdot {F}^c_i- \nabla \cdot {F}^{nc}_i]$

and the weights, $$w_{ij}$$ , are

$w_{ij} = \dfrac{1}{\sum\limits_{j\in N(i)\setminus i} \mathcal{K}_j}$

Note that $$\nabla \cdot{F}_i^{EB}$$ gives an update for $$\rho \phi$$ ; i.e.,

$\frac{(\rho \phi_i)^{n+1} - (\rho \phi_i)^{n} }{\Delta t} = - \nabla \cdot{F}^{EB}_i$

Typically, the redistribution neighborhood for each cell is one that can be reached via a monotonic path in each coordinate direction of unit length (see, e.g., Fig. 1)

## State Redistribution

For state redistribution we implement the weighted state redistribution algorithm as described in Guiliani et al (2021), which is available on arxiv . This is an extension of the original state redistribution algorithm of Berger and Guiliani (2020).