# Conservation laws

The calculation of flow in 3Di is based on two fundamental laws of physics: conservation of mass and conservation of momentum.

## Conservation of mass

To capture or predict flow under varying conditions, one is often forced to use the computational power of computers. Since the introduction of computers various methods have been introduced and improved. Some aspects are true for all types of methods. Here, we will limit ourselves to the methods used in the computational core of 3Di.

3Di is a two-layer, subgrid based hydrodynamical model, where a surface and a subsurface layer can be defined in combination with a 1D network. The computations of flow in each domain are based on two fundamental laws of physics; i) Conservation of mass and ii) Conservation of momentum. In this section we will describe how we deal with conservation of mass.

Conservation of mass states that mass cannot disappear or appear in a certain domain without clear source. For a defined domain, when all fluxes in and out of that domain are known, the change in mass can be computed. This can be described mathematically as:

(12)$\frac{\Delta \rho V}{\Delta t}=\sum_i^{in} \rho Q_i -\sum_k^{out} \rho Q_k + \sum_j \rho S_j$
In which:
$$\rho$$ is the density,
$$V_\Omega$$ is the volume,
$$Q$$ discharge,
$$S$$ source or sink term.

The counters i, j, k count over all existing discharges, sink and source terms. In 3Di we do not account for density variations, so the density $$\rho$$ is assumed uniform and constant. This simplifies the equation for conservation of mass to the following equation for conservation of volume:
(13)$\frac{\Delta V}{\Delta t}=\sum_i^{in} Q_i -\sum_k^{out} Q_k + \sum_i S_j$