Adaption of the BOX scheme to the two-\/phase two-\/component flow model. This model implements two-\/phase two-\/component flow of two compressible and partially miscible fluids $\alpha\in\{ w, n \}$ composed of the two components $\kappa\in\{ w, a \}$. The standard multiphase Darcy approach is used as the equation for the conservation of momentum: \[ v_\alpha=-\frac{k_{r\alpha}}{\mu_\alpha}\mbox{\bf K}\left(\text{grad}\, p_\alpha-\varrho_{\alpha}\mbox{\bf g}\right)\]
By inserting this into the equations for the conservation of the components, one gets one transport equation for each component \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\}\nonumber\\\nonumber\\&-&\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, g\}\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. The used primary variables are, like in the two-\/phase model, either $p_w$ and $S_n$ or $p_n$ and $S_w$. The formulation which ought to be used can be specified by setting the {\ttfamily Formulation} property to either TwoPTwoCIndices::pWsN or TwoPTwoCIndices::pNsW. By default, the model uses $p_w$ and $S_n$. Moreover, the second primary variable depends on the phase state, since a primary variable switch is included. The phase state is stored for all nodes of the system. Following cases can be distinguished:
\begin{itemize}
\item Both phases are present: The saturation is used (either $S_n$ or $S_w$, dependent on the chosen {\ttfamily Formulation}), as long as $0 < S_\alpha < 1$.
\item Only wetting phase is present: The mass fraction of, e.g., air in the wetting phase $X^a_w$ is used, as long as the maximum mass fraction is not exceeded ( $X^a_w<X^a_{w,max}$)
\item Only non-\/wetting phase is present: The mass fraction of, e.g., water in the non-\/wetting phase, $X^w_n$, is used, as long as the maximum mass fraction is not exceeded ( $X^w_n<X^w_{n,max}$)