# Numerical Calculation of Slosh Dissipation
## 4 Volume-of-Fluid Finite Volume Method: The Elemental Solver
### Mechanical Energy Calculation: Elemental
We write these for a finite volume \(V_{i}\) (shown in Figure 3), and to obtain the total for the domain, we simply integrate over all cells in the domain:  
\[E_{C}(t)=\sum_{i}E_{C,i}=\sum_{i}\int_{0}^{t}\mathbf{u}_{a_{i}}\cdot\oint_{\partial \Omega_{i}}p\mathbf{n}_{\Omega_{i}}\,\mathrm{d}\Omega_{i}\,\mathrm{d}t \tag{33}\]  
\[E_{V}(t) =\sum_{i}E_{V,i}=\int_{0}^{t}\Bigl{(}\mathcal{P}_{V}+\mathcal{P}_{V}^{ turb}\Bigr{)}\,\mathrm{d}t \tag{34}\] \[=\sum_{i}\int_{0}^{t}\mathbf{u}_{a_{i}}\cdot\oint_{\partial\Omega_{i} }\Bigl{[}(\mu+\mu_{t})\Bigl{(}\mathbf{\
abla}\mathbf{u}+(\mathbf{\
abla}\mathbf{u})^{T}\Bigr{)} \,\cdot\mathbf{n}_{\Omega_{i}}\Bigr{]}\,\mathrm{d}\Omega_{i}\,\mathrm{d}t\,,\]  
with \(\Omega_{i}\) any internal surface bounding internal volume \(V_{i}\). The external energy addition, or work performed on the fluid by the domain surface \(\Omega\) or work performed on the fluid by non-inertial forces, \(W_{ext}\), is given by  
\[W_{ext}(t) = -\int_{0}^{t}\mathbf{u}_{d}\cdot\oint_{\partial\Omega}p\mathbf{n}_{ \Omega}\,\mathrm{d}\Omega\,\mathrm{d}t+ \tag{35}\] \[+\,\int_{0}^{t}\mathbf{u}_{d}\cdot\oint_{\partial\Omega}\Bigl{[}(\mu +\mu_{t})\Bigl{(}\mathbf{\
abla}\mathbf{u}+(\mathbf{\
abla}\mathbf{u})^{T}\Bigr{)}\,\cdot\mathbf{ n}_{\Omega}\Bigr{]}\,\mathrm{d}\Omega\,\mathrm{d}t\,.\]  
where, in this work, the domain boundary velocity \(\mathbf{u}_{d}\) is constant in space. For a flow field that varies smoothly in time, from (27), the kinetic energy contained in \(V_{i}\) at any time \(t\) is:  
\[ \begin{split}\int_{0}^{t}\mathbf{u}_{a_{i}}\cdot\int_{V_{i}}\Bigl{[} \frac{\partial\rho\mathbf{u}}{\partial t}+\mathbf{\
abla}^{T}(\rho\mathbf{u}\otimes\mathbf{u}) +\rho\mathbf{a}_{d}\Bigr{]}\,\mathrm{d}V\,\mathrm{d}t&=\int_{0}^{t} \int_{V_{i}}\rho\frac{1}{2}\frac{D|\mathbf{u}_{a}|^{2}}{Dt}\,\mathrm{d}V\,\mathrm{ d}t\\ &=\int_{V_{i}}\rho\frac{1}{2}|\mathbf{u}_{a}|^{2}\,\mathrm{d}V+E_{K,0} \,,\end{split}  \tag{36}\]  
with \(E_{K,0}\) the kinetic energy at \(t=0\). However, liquid slosh involves impact events (liquid-liquid and liquid-solid), which results in an immediate loss in kinetic energy [39]. [PERSON] et al. [27] observed that this can be accounted for via the artificial compressibility scheme [40, 41]. For the fractional step method employed in the present work, this irreversible energy loss (\(E_{loss}\)) is calculated as the difference between the left- and right-hand sides of (36) as per [22]:  
\[E_{loss}(t)=E_{K}(t)-\sum_{i}\int_{0}^{t}\mathbf{u}_{a_{i}}\cdot\int_{V_{i}}\Bigl{[} \frac{\partial\rho\mathbf{u}}{\partial t}+\mathbf{\
abla}^{T}(\rho\mathbf{u}\otimes\mathbf{u}) +\rho\mathbf{a}_{d}\Bigr{]}\,\mathrm{d}V\,\mathrm{d}t\,. \tag{37}\]  
where  
\[E_{K}=\sum_{i}\int_{V_{i}}\rho\frac{1}{2}|\mathbf{u}_{a}|^{2}\,\mathrm{d}V-E_{K,0} \tag{38}\]  
The total irreversible dissipated energy is then \[E_{diss}(t)=E_{loss}(t)+E_{V}(t) \tag{39}\]  
We can write (30) at any node \(i\) and re-shuffle to cast in the following form for the mechanical energy computed at any time, assuming the initial energy is zero  
\[W_{ext}=E_{K}+E_{P}+E_{C}+E_{\sigma}-E_{diss}\,, \tag{40}\]  
The terms denote (from left to right) the work performed on the fluid through the non-inertial boundary surface, kinetic energy, potential energy, compressive (or dilatation) work, surface energy and dissipation. Equation (40) states that the total energy added to the fluid through the domain boundary must equal the sum of the stated energy containers on the right-hand side of the equation or the total energy inside the fluid. In Elemental(r), the contribution of each energy container to the total energy balance in (40) is calculated consistently with the respective contribution from each term in the momentum conservation Equation (29). This is completed very carefully when the contributions from each term are added to the fractional step solution method. Since momentum is conserved, this ensures that (40) is satisfied and that all the energy added to the fluid through the accelerating boundary is accounted for.