# The Mathematical Formulation of TOIL_IMS¶

The mathematical model of the TOIL_IMS module implemented in PFLOTRAN describes the oil/water non-isothermal immiscible fluid flows by a system of three equations (3 degrees of freedom, DOFs): a molar balance equation (1) for each phase, which can be easily recast as mass balance, an energy equation (2) which assumes that the two phases and the rock are in thermal equilibrium and neglects the kinetic and potential energy. Fluxes are modeled using a multi-phase Darcy’s formula (3). See below the equation system

where \(s_{\alpha}\) is the phase saturation, \(\nu_{\alpha}\) is the molar density, \(\phi\) the porosity, \(U_\alpha\) the enthalpy, \(\rho_\alpha\) the internal energy, \(\kappa\) the rock density, the thermal diffusivity coefficient, \(k_\alpha\) the relative permeability, and \(K\) the saturated media permeability.

- Where:
\(\eta_\alpha\) is the molar density of phase \(\alpha\);

\(H_{\alpha}\) is the enthalphy of phase \(\alpha\);

\(U_{\alpha}\) is the internal energy of phase \(\alpha\);

\(s_{\alpha}\) is the phase saturation of phase \(\alpha\);

\(K\) is the saturated media permeability;

\(k_\alpha\) is the relative permeability of phase \(\alpha\);

\(\mu_\alpha\) is the viscosity of phase \(\alpha\);

\(P_\alpha\) is the pressure of phase \(\alpha\);

\(\rho_\alpha\) is the mass density of phase \(\alpha\);

\(g\) is the gravitational constant;

\(z\) is the height coordinate.

The system of equations is discretised in space with a finite volume scheme that uses a two-point flux formula, and in time with a first order fully implicit scheme. The equations are linearised using the Newton-Raphson approach. An adaptive time stepping scheme is adopted. The resulting system features three equations in three unknowns (primary variables) that are chosen as follows: Oil Pressure, Oil Saturation and Temperature.