# Conservation of Mass

The finite element formulation of the Lagrangian form of the mass conservation equation is given by:

$\frac{d\rho }{dt}|x=-\left(\rho /V\right)\frac{dV}{dt}|x$

When transformed into the ALE formulation it gives:

Applying a Galerkin variation form for the solution of Equation 2:

Where, $\psi$ is the Weighting function.

Using a finite volume formulation

Where, $\psi$ =1

$\rho$ = constant density over control volume $V$ .

Therefore:

$\underset{V}{\int }\frac{\partial \rho }{\partial t}dV+\underset{V}{\int }\rho \frac{\partial {\nu }_{K}}{\partial {x}_{K}}dV=0$

Using the divergence theorem leads to:

$\underset{V}{\int }\frac{\partial \rho }{\partial t}dV+\underset{S}{\int }\rho \left(\nu {}_{j}\cdot \text{\hspace{0.17em}}\text{ }{n}_{j}\right)dS=0$

Further expansion gives:

$\frac{d}{dt}\underset{v}{\int }\rho dV=\underset{s}{\int }\underset{mass\text{\hspace{0.17em}}flux}{\underbrace{\rho \left({w}_{j}-{v}_{j}\right){n}_{j}dS}}$

This formula is still valid if density $\rho$ is not assumed uniform over volume $V$ .

The density, ${\rho }_{i}$ , is given computed:

Where, $0\le \eta \le 1$ is the upwind coefficient given on the input card.

If $\eta$ =0, there is no upwind.

Therefore, ${\rho }_{i}=\frac{{\rho }_{I}+{\rho }_{J}}{2}$ .

If $\eta$ =1, there is full upwind.

The smaller the upwind factor, the faster the solution; however, the solution is more stable with a large upwind factor. This upwind coefficient can be tuned with parameter from /UPWIND keyword (not recommended, this keyword has been obsolete as of version 2018).

For a free surface: ${\rho }_{J}$ = ${\rho }_{I}$