# Reduced gravity

We re-express gravity in two-phase flows as an interfacial force as $-\nabla p+\rho \mathbf{\text{g}}=-\nabla pʹ-\left[\rho \right]\mathbf{\text{g}}\cdot \mathbf{\text{x}}\mathbf{\text{n}}{\delta }_{s}$ with $pʹ=p-\rho \mathbf{\text{g}}\cdot \mathbf{\text{x}}$ the dynamic pressure and $\rho \mathbf{\text{g}}\cdot \mathbf{\text{x}}$ the hydrostatic pressure. The corresponding potential is $\varphi =\left[\rho \right]\mathbf{\text{G}}\cdot \left(\mathbf{\text{x}}-\mathbf{\text{Z}}\right)$ with $\mathbf{\text{G}}$ the gravity vector and $\mathbf{\text{Z}}$ an optional reference level.

``coord G = {0.,0.,0.}, Z = {0.,0.,0.};``

We need the interfacial force module as well as some functions to compute the position of the interface.

``````#include "iforce.h"
#include "curvature.h"
``````

We overload the acceleration() event to add the contribution of gravity to the interfacial potential $\varphi$.

If $\varphi$ is already allocated, we add the contribution of gravity, otherwise we allocate a new field and set it to the contribution of gravity.

``````event acceleration (i++)
{
scalar φ = f.φ;
coord G1;
foreach_dimension()
G1.x = (rho2 - rho1)*G.x;

if (φ.i)
position (f, φ, G1, Z, add = true);
else {
φ = new scalar;
position (f, φ, G1, Z, add = false);
f.φ = φ;
}
}``````