# Compositional Multiphase Flow Solver¶

## Introduction¶

This flow solver is in charge of implementing the finite-volume discretization (mainly, accumulation and flux terms, boundary conditions) of the equations governing compositional multiphase flow in porous media. The present solver can be combined with the Compositional Multiphase Well Solver which handles the discrete multi-segment well model and provides source/sink terms for the fluid flow solver.

Below, we first review the set of Governing Equations, followed by a discussion of the choice of Primary Variables used in the global variable formulation. Then we give an overview of the Discretization and, finally, we provide a list of the solver Parameters and an input Example.

## Theory¶

### Governing Equations¶

#### Mass Conservation Equations¶

Mass conservation for component is expressed as: where is the porosity of the medium, is the saturation of phase , is the mass fraction of component in phase , is the phase density, and is time. We note that the formulation currently implemented in GEOS is isothermal.

#### Darcy’s Law¶

Using the multiphase extension of Darcy’s law, the phase velocity is written as a function of the phase potential gradient : In this equation, is the rock permeability, is the phase mobility, defined as the phase relative permeability divided by the phase viscosity, is the reference pressure, is the the capillary pressure, is the gravitational acceleration, and is depth. The evaluation of the relative permeabilities, capillary pressures, and viscosities is reviewed in the section about Constitutive Models.

Combining the mass conservation equations with Darcy’s law yields a set of equations written as: #### Constraints and Thermodynamic Equilibrium¶

The volume constraint equation states that the pore space is always completely filled by the phases. The constraint can be expressed as: The system is closed by the following thermodynamic equilibrium constraints: where is the fugacity of component in phase . The flash calculations performed to enforce the thermodynamical equilibrium are reviewed in the section about Constitutive Models.

To summarize, the compositional multiphase flow solver assembles a set of equations in each element, i.e., mass conservation equations and one volume constraint equation. A separate module discussed in the Constitutive Models is responsible for the enforcement of the thermodynamic equilibrium at each nonlinear iteration.

Number of equations

Equation type Mass conservation equations

1

Volume constraint

### Primary Variables¶

The variable formulation implemented in GEOS is a global variable formulation based on primary variables, namely, one pressure, , and component densities, . By default, we use molar component densities. A flag discussed in the section Parameters can be used to select mass component densities instead of molar component densities.

Number of primary variables

Variable type

1

Pressure Component densities

Assembling the residual equations and calling the Constitutive Models requires computing the molar component fractions and saturations. This is done with the relationship: where These secondary variables are used as input to the flash calculations. After the flash calculations, the saturations are computed as: where is the global mole fraction of phase and is the molar density of phase . These steps also involve computing the derivatives of the component fractions and saturations with respect to the pressure and component densities.

### Discretization¶

#### Spatial Discretization¶

The governing equations are discretized using standard cell-centered finite-volume discretization.

In the approximation of the flux term at the interface between two control volumes, the calculation of the pressure stencil is general and will ultimately support a Multi-Point Flux Approximation (MPFA) approach. The current implementation of the transmissibility calculation is reviewed in the section about Numerical Methods.

The approximation of the dynamic transport coefficients multiplying the discrete potential difference (e.g., the phase mobilities) is performed with a first-order phase-per-phase single-point upwinding based on the sign of the phase potential difference at the interface.

#### Temporal Discretization¶

The compositional multiphase solver uses a fully implicit (backward Euler) temporal discretization.

### Solution Strategy¶

The nonlinear solution strategy is based on Newton’s method. At each Newton iteration, the solver assembles a residual vector, , collecting the discrete mass conservation equations and the volume constraint for all the control volumes.

## Parameters¶

The following attributes are supported:

Name

Type

Default

Description

allowLocalCompDensityChopping

integer

1

Flag indicating whether local (cell-wise) chopping of negative compositions is allowed

cflFactor

real64

0.5

Factor to apply to the CFL condition when calculating the maximum allowable time step. Values should be in the interval (0,1]

discretization

string

required

Name of discretization object (defined in the Numerical Methods) to use for this solver. For instance, if this is a Finite Element Solver, the name of a Finite Element Discretization should be specified. If this is a Finite Volume Method, the name of a Finite Volume Discretization discretization should be specified.

initialDt

real64

1e+99

Initial time-step value required by the solver to the event manager.

isThermal

integer

0

Flag indicating whether the problem is thermal or not.

logLevel

integer

0

Log level

maxCompFractionChange

real64

0.5

Maximum (absolute) change in a component fraction in a Newton iteration

maxRelativePressureChange

real64

0.5

Maximum (relative) change in pressure in a Newton iteration (expected value between 0 and 1)

maxRelativeTemperatureChange

real64

0.5

Maximum (relative) change in temperature in a Newton iteration (expected value between 0 and 1)

name

string

required

A name is required for any non-unique nodes

solutionChangeScalingFactor

real64

0.5

Damping factor for solution change targets

targetPhaseVolFractionChangeInTimeStep

real64

0.2

Target (absolute) change in phase volume fraction in a time step

targetRegions

string_array

required

Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager.

targetRelativePressureChangeInTimeStep

real64

0.2

Target (relative) change in pressure in a time step (expected value between 0 and 1)

targetRelativeTemperatureChangeInTimeStep

real64

0.2

Target (relative) change in temperature in a time step (expected value between 0 and 1)

temperature

real64

required

Temperature

useMass

integer

0

Use mass formulation instead of molar

LinearSolverParameters

node

unique

Element: LinearSolverParameters

NonlinearSolverParameters

node

unique

Element: NonlinearSolverParameters

## Example¶

  <Solvers>
<CompositionalMultiphaseFVM
name="compflow"
logLevel="1"
discretization="fluidTPFA"
targetRelativePressureChangeInTimeStep="1"
targetPhaseVolFractionChangeInTimeStep="1"
targetRegions="{ Channel }"
temperature="300">
<NonlinearSolverParameters
newtonTol="1.0e-10"
newtonMaxIter="40"/>
<LinearSolverParameters
directParallel="0"/>
</CompositionalMultiphaseFVM>
</Solvers>


We refer the reader to Multiphase Flow for a complete tutorial illustrating the use of this solver.