The flow regimes are model elements that describe the geometrical distribution of the various phases. In LedaFlow there are two sets of flow regimes: the gas-liquid flow regime and the oil-water flow regime.

The gas-liquid flow regime describes the geometrical configuration of the gas and liquid. Here the liquid is considered as a mixture of oil and water with its own internal structure represented by the oil-water flow regime. There are three basic gas-liquid flow regimes:

- Separated flow: the flow consists of a gas zone (possibly with liquid droplets) and a liquid zone (possibly with gas bubbles)
- Bubbly flow: the gas exists only as bubbles inside the liquid
- Slug flow: the flow is intermittent, consisting of liquid slugs and slug bubbles. The flow regime inside the slugs is assumed to be bubbly and the flow regime in the slug bubbles is assumed to be separated. As such, slug flow is a mixture of separated and bubbly flows.

In separated flow, the gas and liquid flow in different zones. The liquid may be a mixture of oil and water, which may be fully mixed, completely or partially separated. The gas zone may have droplets of oil and water and the liquid zone may have gas bubbles. Gas entrainment in the liquid film is only modelled in slug capturing.

The separated flow regime is sub-divided into two categories:

- Stratified flow(where the liquid is located at the bottom of the pipe)
- Annular flow (where the liquid is distributed symmetrically around the pipe periphery).

In bubbly flow the gas is assumed to exist only in the form of bubbles entrained inside the liquid, so there is no gas zone. In three-phase flow with separated oil and water, we assume that the geometric distribution of oil and water is the same as in separated flow and that the gas bubbles are uniformly distributed across the pipe cross-section.

Hydrodynamic slug flow is an intermittent transient flow regime, where flow consists of liquid slugs with regions of separated flow in between. In the liquid slugs the local flow regime is assumed to be bubbly. Between the slugs the local flow regime is assumed to be separated. The models used in these two regions are consistent with the modelling used in the bubbly flow and separated flow.

In the standard LedaFlow model, hydrodynamic slug flow is modelled on a sub-grid level, i.e. the slugs are not resolved on the grid. Instead, the steady-state solution to the slug flow equations (called the Unit Cell Model, or UCM) is calculated, and the results are subsequently used to calculate the appropriate friction terms, etc. in the transient code.

The UCM consists of 34 equations and 34 unknowns in the case of three-phase flow. The unknown quantities are:

- 6 field fractions and 6 velocities inside the slug
- 9 field fractions and 9 velocities inside the slug bubble
- The pressure gradient in the slug
- The pressure gradient in the slug bubble
- The slug fraction
- The slug front pressure drop

The UCM equations for three-phase flow are:

- 2 steady state momentum equations in the slug
- 2 oil/water dispersion models in the slug
- 1 void-in-slug model
- 4 slip relations in the slug
- 1 volume constraint in the slug
- 3 steady-state momentum equations in the slug bubble
- 2 oil/water dispersion models in the film
- 1 droplet entrainment model in the slug bubble
- 1 oil/water split model for droplet entrainment
- 6 slip relations in the slug bubble
- 3 global mass conservation equations
- 1 slug bubble velocity correlation
- 1 volume constraint in the slug bubble
- 2 gas entrainment models for the oil/water film in the slug bubble
- 1 model for slug front pressure drop

Slug flow is selected if a physical solution to the UCM is found, that is a solution with a slug fraction between 0 and 1. If no such solution can be found the flow regime is deemed either bubbly flow or separated flow. The flow regime selection logic within LedaFlow is formulated so that the UCM equations are only solved if the flow regime is slug flow.

The logic can be summarised by:

- If the slug gas fraction is greater than the gas fraction in steady state bubbly flow the flow is regime is bubbly
- If the gas-liquid slip velocity in stratified flow is greater than in slug flow the regime is slug flow
- Otherwise the regime is stratified

In LedaFlow we have two basic oil-water flow regimes:

- Separated oil-water flow: the oil and water flow in separate zones, possibly with oil droplets in the water zone and water droplets in the oil zone
- Mixed oil-water flow: the oil and water are completely mixed in the form of oil droplets in the water (water-continuous) or water droplets in the oil (oil-continuous)

The oil-water regime is modelled as mixed if the absolute value of the pipe angle exceeds 9 degrees in separated flow or 15 degrees in slug/bubbly flow. In addition, if the no-slip phase fraction of either oil or water is less than 10^{-5} , the oil-water regime is also assumed to be mixed.

For the gas phase

\begin{equation}

\frac{\partial (V_{g}\rho _{g})}{\partial t}=-\frac{1}{A}\frac{\partial (AV_{g}\rho _{g}v_{g})}{\partial z}+\psi _{g}+G_{g}

\end{equation}

For the liquid droplets

\begin{equation}

\frac{\partial (V_{D}\rho _{L})}{\partial t}=-\frac{1}{A}\frac{\partial (AV_{D}\rho _{L}v_{D})}{\partial z}-\psi _{g}\frac{V_{D}}{V_{L}+V_{D}}+\psi _{e}-\psi _{d}+G _{D}

\end{equation}

For the liquid film

\begin{equation}

\frac{\partial (V_{L}\rho _{L})}{\partial t}=-\frac{1}{A}\frac{\partial (AV_{L}\rho _{L}v_{L})}{\partial z}-\psi _{g}\frac{V_{D}}{V_{L}+V_{D}}-\psi _{e}+\psi _{d}+G _{L}

\end{equation}

$g= Gas$

$D=Droplets$

$L=liquid\;film$

$V=Volume\;fraction\;(-)$

$v=velocity\;m/s$

$\rho=density\;(kg/m^3)$

$A=cross-sectional\;area\;of\;the\;pipe\;(m^2)$

$\psi_g=mass\;transfer\;rate\;between\;phases\;(kg/m^3/s)$

$\psi_e=entrainment\;rate\;of\;liquid\;droplets\;(kg/m^3/s)$

$\psi_d=deposition\;rate\;of\;liquid\;droplets\;(kg/m^3/s)$

$G=possible\;mass\;source\;of\;a\;particular\;phase\;(kg/m^3/s)$

For the gas phase

\begin{equation}

\frac{\partial (V_{g}\rho _{g}v_{g})}{\partial t}=-V_{g}\left (\frac{\partial p}{\partial z} \right )-\frac{1}{A}\frac{\partial (AV_{g}\rho _{g}v_{g}^{2})}{\partial z}\\

-\lambda _{g}\frac{1}{2}\rho_{g} \left |v_{g} \right |v_{g}\frac{S_{g}}{4A}-\lambda _{i}\frac{1}{2}\rho_{r} \left |v_{r} \right |v_{r}\frac{S_{i}}{4A}+V_{g}\rho_{g}g\,cos\alpha+\psi_{g}v_{a}-F_D

\end{equation}

For the liquid droplets

\begin{equation}

\frac{\partial (V_{D}\rho _{L}v_{D})}{\partial t}=-V_{D}\left (\frac{\partial p}{\partial z} \right )-\frac{1}{A}\frac{\partial (AV_{D}\rho _{L}v_{D}^{2})}{\partial z}\\+V_{D}\rho_{L}g\,cos\alpha+\psi_g \frac{V_D}{V_L+V_D}v_a+\psi_{e}v_{i}-\psi_{d}v_{D}+F_D

\end{equation}

Eqs. (4) and (5) are combined to yield the following equation.

\begin{equation}

\frac{\partial }{\partial t}\left ( V_g \rho_g v_g+V_D\rho_L v_D \right )=-\left ( V_g+V_D \right )\left ( \frac{\partial p}{\partial z} \right )-\frac{1}{A}\frac{\partial }{\partial z}\left ( AV_g\rho_gv_g^{2} +AV_D\rho_L v_D^2\right )-\lambda_g\frac{1}{2}\rho_g\left | v_g \right |v_g\frac{S_g}{4A}\\-\lambda_i\frac{1}{2}\rho_g\left | v_r \right |v_r\frac{S_i}{4A}+\left ( V_g\rho_g+V_D\rho_L \right )\,g\,cos\alpha+\psi_g\frac{V_D}{V_L+V_D}\,v_a+\psi_e\,v_i-\psi_d\,v_D

\end{equation}

For the liquid film

\begin{equation}

\frac{\partial }{\partial t}\left ( V_L\rho_Lv_L \right )=-V_L\left ( \frac{\partial p}{\partial z} \right )-\frac{1}{A}\frac{\partial }{\partial z}\left ( AV_L\rho_Lv_L^2 \right )-\lambda_L\frac{1}{2}\rho_L\left | v_L \right |v_L\frac{S_L}{4A}+\lambda_i\frac{1}{2}\rho_g\left | v_r \right |v_r\frac{S_i}{4A}\\+V_L\rho_L\,g\,cos\alpha-\psi_g\frac{V_L}{V_L+V_D}v_a-\psi_ev_i+\psi_dv_D-V_Ld\left(\rho_L-\rho_g \right )\,g\,\frac{\partial V_L}{\partial z}\,sin\alpha

\end{equation}

where,

$v_a=v_L \;\;for\;\; \psi_g>0\;\; \left(and\; evaporation\; from\; the \;liquid \;film\right)$

$v_a=v_D \;\; for \;\; \psi_g>0\;\; \left(and\; evaporation \; from \; the \;liquid\;droplets\right)$

$v_a=v_g\;\; for \;\; \psi_g<0\;\;\left(condensation\right)$

$alpha\;=\;pipe\; inclination\;from\; the\;vertical\;\left(rad\right)$

$p\; = \; pressure\; \left(Nm^{-2}\right)$

$v_r\;= \;relative\; velocity\; \left(ms^{-1}\right)$

$G\;=\;internal\; mass\; source\; - assumed\; to\; enter\; perpendicular\; to\; the\; pipe\; wall\;, carrying\; no\; moment$

$ S_g\;=\;wetted\; perimeter\; of\; the\; gas\; \left(m\right)$

$S_L\;=\;wetted\; perimeter\; of\; the\; liquid \; \left(m\right)$

$S_i\;=\;wetted\; perimeter\; of\; the\; interface \; \left(m\right)$

The relative velocity is given by the following equation

\begin{equation}

v_g=R_D\left( v_L+v_r\right)

\end{equation}

For the conservation of energy a single mixture energy balance equation is applied

\begin{equation}

\frac{\partial }{\partial t} \left [m_g\left( E_g+\frac{1}{2}v_g^{2}+gh \right)+m_L\,\left(E_L+\frac{1}{2}v_L^{2}+gh \right ) +m_D \left ( E_D+\frac{1}{2}v_D^{2}+gh \right )\right ]\\ =-\frac{\partial }{\partial z}\left [ m_gv_g\left ( H_g+\frac{1}{2}v_g^{2} +gh\right ) + m_Lv_L\left ( H_L+\frac{1}{2}v_L^{2} +gh\right )+ m_Dv_D\left ( H_D+\frac{1}{2}v_D^{2} +gh\right ) \right ]\\+H_S+U

\end{equation}

where,

$m_f=V_f\rho_f\; for \; the \; phase\; f$

$E=internal\; energy\; per \; unit\; mass\; \left( Jkg^{-1} \right)$

$U=heat\; transfer\; per\; unit\; volume\; from\; the \; pipe\; walls\; \left(Jm^{-3} \right)$

Work between the gas and liquid phases are usually negligible when compared to the heat transfer from the pipe walls.

All fluid properties, e.g. densities, compressibilities, viscosities, surface tension, enthalpies, heat capacities, and thermal conductivities, can be provided to LedaFlow by a file that contains a table in which these fluid properties of the phases are given for a number of thermodynamic conditions, i.e. pressure and temperature.

The fluid properties during a simulation are found by interpolating in this table.

The two-fluid model, as formulated above, provides a set of coupled first-order, nonlinear, one-dimensional partial differential equations. LedaFlow uses a finite difference scheme on a staggered grid for the spatial discretization. A semi-implicit time integration method used. The time step is limited by the average phase velocities based on the mass-transfer criterion

\begin{equation}

\Delta t \leq min_{j}\left( \frac{\Delta z_j}{\left | v_{fj} \right |}\right)

\end{equation}

where,

$\Delta z= \:length\: of\: a\: grid\: cell\: (m) $

$v_f = velocity\: of\: phases\:\: f$

$_j=index \: to \: identify\: a\: grid\: cell$