Adaption of the BOX scheme to the non-\/isothermal two-\/phase two-\/component flow model. This model implements a non-\/isothermal two-\/phase flow of two compressible and partly miscible fluids $\alpha\in\{ w, n \}$. Thus each component $\kappa\{ w, a \}$ can be present in each phase. Using the standard multiphase Darcy approach a mass balance equation is solved: \begin{eqnarray*}&&\phi\frac{\partial (\sum_\alpha\varrho_\alpha X_\alpha^\kappa S_\alpha )}{\partial t} - \sum_\alpha\text{div}\left\{\varrho_\alpha X_\alpha^\kappa\frac{k_{r\alpha}}{\mu_\alpha}\mbox{\bf K} (\text{grad}\, p_\alpha - \varrho_{\alpha}\mbox{\bf g}) \right\}\\&-&\sum_\alpha\text{div}\left\{{\bf D_{\alpha, pm}^\kappa}\varrho_{\alpha}\text{grad}\, X^\kappa_{\alpha}\right\} - \sum_\alpha q_\alpha^\kappa = 0 \qquad\kappa\in\{w, a\}\, , \alpha\in\{w, n\}\end{eqnarray*} For the energy balance, local thermal equilibrium is assumed which results in one energy conservation equation for the porous solid matrix and the fluids: \begin{eqnarray*}&&\phi\frac{\partial\left( \sum_\alpha\varrho_\alpha u_\alpha S_\alpha\right)}{\partial t} + \left( 1 - \phi\right) \frac{\partial (\varrho_s c_s T)}{\partial t} - \sum_\alpha\text{div}\left\{\varrho_\alpha h_\alpha\frac{k_{r\alpha}}{\mu_\alpha}\mathbf{K}\left( \text{grad}\, p_\alpha - \varrho_\alpha\mathbf{g}\right) \right\}\\&-&\text{div}\left( \lambda_{pm}\text{grad}\, T \right) - q^h = 0 \qquad\alpha\in\{w, n\}\end{eqnarray*}
This is discretized using a fully-\/coupled vertex centered finite volume (box) scheme as spatial and the implicit Euler method as temporal discretization.
By using constitutive relations for the capillary pressure $p_c = p_n - p_w$ and relative permeability $k_{r\alpha}$ and taking advantage of the fact that $S_w + S_n =1$ and $X^\kappa_w + X^\kappa_n =1$, the number of unknowns can be reduced to two. If both phases are present the primary variables are, like in the nonisothermal two-\/phase model, either $p_w$, $S_n$ and temperature or $p_n$, $S_w$ and temperature. The formulation which ought to be used can be specified by setting the {\ttfamily Formulation} property to either {\ttfamily TwoPTwoIndices::pWsN} or {\ttfamily TwoPTwoCIndices::pNsW}. By default, the model uses $p_w$ and $S_n$. In case that only one phase (nonwetting or wetting phase) is present the second primary variable represents a mass fraction. The correct assignment of the second primary variable is performed by a phase state dependent primary variable switch. The phase state is stored for all nodes of the system. The following cases can be distinguished: