# Volume Discrepancy Factor

The volume discrepancy term is used in the constraint equation to
force the system back to the equation of state. We write our velocity
constraint equation as

(108)\[\nablab \cdotb (\beta_0 \Ub) = \beta_0 \left(S - \frac{1}{\gammabar p_0} \frac{\partial p_0}{\partial t} - \frac{f}{\gammabar p_0} \frac{p_0 - p_\mathrm{EOS}}{\Delta t} \right ) .\]

Here, \(f\) is the volume discrepancy factor and ranges from 0 to 1, and
\(p_\mathrm{EOS}\) is the thermodynamic pressure as returned by the EOS,
using the full state as input.
In practice we evaluate this as

(109)\[p_\mathrm{EOS} = p(\rho,h,X_k)\]

The idea behind this forcing term is that if \(p_\mathrm{EOS} > p_0\) then
\(\nablab \cdotb (\beta_0 \Ub) > 0\), and the cell will evacuate. This
has the effect of returning us to \(p_\mathrm{EOS} = p_0\).

In MAESTROeX, we decomponse the velocity into a base state component
and a local component. The base state constraint equation is simply
the horizontal average of the full constraint. Starting with
\(\Ub = \Ubt + w_0 \er\) in Eq.108, we have

(110)\[\nablab \cdotb (\beta_0 w_0 \er) + \nablab \cdotb (\beta_0 \Ubt) = \beta_0 \left(S - \frac{1}{\gammabar p_0} \frac{\partial p_0}{\partial t} - \frac{f}{\gammabar p_0} \frac{p_0 - p_\mathrm{EOS}}{\Delta t} \right ) .\]

Averaging this over a layer, we note that \(\overline{\nablab \cdotb (\beta_0 \Ubt)} = 0\),
yielding

(111)\[\nablab \cdotb (\beta_0 w_0 \er) = \beta_0 \left(\overline{S} - \frac{1}{\gammabar p_0} \frac{\partial p_0}{\partial t} - \frac{f}{\gammabar p_0} \frac{p_0 - \overline{p_\mathrm{EOS}}}{\Delta t} \right )\]

and

(112)\[\nablab \cdotb (\beta_0 \Ubt) = \beta_0 \left(S - \overline{S} + \frac{f}{\gammabar p_0} \frac{p_\mathrm{EOS} - \overline{p_\mathrm{EOS}}}{\Delta t} \right ) .\]

In solving the \(w_0\) evolution Eq.111, we expand the divergence, giving

(113)\[\nablab \cdotb (w_0 \er) = \overline{S} - \frac{1}{\gammabar p_0} \frac{\partial p_0}{\partial t} -
w_0 \er \cdotb \frac{1}{\beta_0} \nablab \beta_0 - \frac{f}{\gammabar p_0} \frac{p_0 - \overline{p_\mathrm{EOS}}}{\Delta t} .\]

Recalling that

(114)\[\frac{1}{\gammabar p_0} \frac{\partial p_0}{\partial r} =
\frac{1}{\beta_0} \frac{\partial \beta_0}{\partial r}\]

(see Paper I), and that \(\psi \equiv D_0 p_0 / Dt \equiv \partial p_0 / \partial t +
w_0 \partial p_0 / \partial r\), we have

(115)\[\nablab \cdotb (w_0 \er) = \overline{S} - \frac{1}{\gammabar p_0} \psi -
\frac{f}{\gammabar p_0} \frac{p_0 - \overline{p_\mathrm{EOS}}}{\Delta t} .\]

This is the form that is solved in `make_w0`

.