modeling multiphase flow in porous mediaide/data/teaching/amsc663/14... · 2017-06-28 ·...
TRANSCRIPT
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Modeling Multiphase Flow in Porous Media
Quan Bui
Applied Math, Statistics, and Scientific Computation,University of Maryland - College Park
December 9th, 2014
AdvisorsDr. Amir Riaz, Department of Mechanical Engineering, UMCP
Dr. David Moulton, Applied Math Group (T-5), Los Alamos National Lab
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Applications of Multiphase Flow
Carbon sequestrationGroundwater managementContaminant transportOil and gas recovery
Source: Groundwater/Vadose Zone Integration ProjectSpecification. DOE/RL-98-48, Draft C, U.S. Department of Energy,Richland, WA, 1988.
Source: Wikipedia
1 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Overall Goals
Implement the nonlinear complimentarity constraints approach to solvea system of PDEs and constraint equations modeling multiphase flowin Amanzi.Provide a capability to model fully coupled 2-phase, 2-component,non-isothermal, miscible flow with phase transitions.Develop unit tests for verification.Pursue application to realistic problem such as desiccation.
2 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Phase I
Develop confidence working with Amanzi.Formulate a coupled system of pressure and saturation equations.Implement a fully implicit approach to solve this system of equations.Develop unit tests for pressure and saturation equations.
3 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
System of Equations
∂
∂t
(φ∑α=w,n
ρmol,αXKαSα
)+∇ ·
(−∑α=w,n
(ρmol,αXK
αvα + DKpm,αρmol,α∇XK
α
))= f K
∂
∂t
(φ∑α=l,g
ρmass,αuαSα + (1− φ)ρscsT)
+
∇ ·(−
M∑α=1
(ρmass,αhK
αvα)
+
N∑K=1
∑α=w,n
(DKpm,αρmol,αhK
αMK∇XKα)− λpm∇T
)= f h
vα =κrα
µαK(∇pα − ρmass,αg)
pc(Sl) = pn − pw,
Sw + Sn = 1, 0 ≤ Sα ≤ 1,N∑
K=1
XKα = 1, 0 ≤ XK
α ≤ 1
4 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Simplied Model
We made the following simplification
Immiscibility, no phase transition.No molar fractions.No additional constraints for local thermal dynamic equilibrium.
IsothermalNo energy equation.Densities, porosity, and viscosities independent of temperature.
IncompressibilityThe fluid and solid structure (rock matrix) is incompressible.Densities and porosity constant in space and time.
5 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Mass Balance
For phase α, we have
∂(φραSα)
∂t+∇ ·
(ραvα
)= qα, α = w, n (1)
in whichφ is the porosityρα is the density of phase αSα is the saturation of phase αvα is the Darcy’s velocity of phase αqα is the source term of phase α.
In addition, we have the constraint∑α
Sα = 1 (2)
6 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Constitutive Relations
We use extended Darcy’s law for multiphase flow
vα = −krα
µαK(∇Pα − ραg), α = w, n (3)
whereK is the absolute permeabilitykrα is the relative permeability of phase αµα is the viscosity of phase αPα is the pressure of phase αg is gravity
The phase pressures are related through capillary pressure Pc
Pc = Pn − Pw (4)
7 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Relative Permeability
Common models for relative permeability krα
Power law (Brooks-Corey type)
Seα =Sα − Srα
1−∑β Srβ
(5)
krα =(
Seα
)n(6)
Van Genuchten [Genuchten, 1980]
krw(Sw) =√
Sew
(1−
(1− S1/m
ew
)m)2(7)
krn(Sw) =√
1− Sew
(1− S1/m
ew
)2m(8)
8 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Capillary Pressure
Models for capillary pressure Pc
Brooks-Corey [Brooks and Corey, 1964]
Pc(Sw) = PdS−1/λw (9)
Van Genuchten [Genuchten, 1980]
Pc(Sw) = Pr
(S−1/m
ew − 1)1/n
(10)
m = 1− 1/n (11)
9 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Pressure Equation
Sum the mass balance equations, with∑α Sα = 1,
∇ ·(∑
α
krα
µαραvα)
)=∑α
qαρα
(12)
In short form
∇ · v = q (13)
where v = vw + vn is the total velocity and q is the total source term.
v = −(
Kλw(∇Pw − ρwg) + Kλn(∇Pn − ρng))
(14)
q =qw
ρw+
qn
ρn, λw =
krw
µw, λn =
krn
µn(15)
10 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Fractional Flow Formulation
Introducing fractional flow of the wetting phase fw, with total mobilityλ = λw + λn
fw =λw
λ(16)
Total velocity becomes
v = λK(∇Pn − fw∇Pc −G) (17)
G =λwρw + λnρn
λg (18)
Define global pressure such that
∇P = ∇Pn − fw∇Pc (19)
11 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Fractional Flow (cont.)
One common choice for global pressure P [Chavent and Jaffre, 1978] is
P = Pn − π(Sw) (20)
π(Sw) =
∫ Sw
S0
fw(ξ)∂Pc
∂Sw(ξ)dξ + π0 (21)
Then the total velocity is reduced to
v = λK(∇P−G) (22)
The pressure equation only depends on the global pressure P
−∇ ·(λK(∇P−G)
)= q (23)
⇒ Diffusion equation
12 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Applications of Multiphase FlowGoalsContinuum ModelIncompressible Two-phase Flow
Saturation Equation
Using the mass balance equation for the wetting phase,
φ∂Sw
∂t+∇ · vw =
qw
ρw(24)
Rewrite the Darcy’s velocity of the wetting phase vw using total velocity vand fractional flow fw
vw = fwv + λnfwK(∇Pc + (ρw − ρn)g) (25)
⇒ Nonlinear advection equation
13 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
ApproachDiscretization
Approach
We have a coupled system ofPressure equation: linear elliptic PDE.Saturation equation: nonlinear scalar hyperbolic PDE.
Common approachImplicit pressure explicit saturation (IMPES) in which the saturationequation is solved explicitly.Semi-implicit schemes.Fully implicit approach in which the saturation is solved implicitly. (Ourproject)
For simulation, we solve pressure and saturation equations sequentially inthat order, with some initial condition for saturation.
14 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
ApproachDiscretization
Pressure Equation
We use finite volume method in space
−∑j∈ηi
∫γij
λK∇P · ndS = Viq (26)
On each face, the pressure gradient is approximated with two point fluxapproximation (TPFA)
−∫γij
λK∇P · ndS = −|γij|2(Pi − Pj)
∆xi + ∆xj(λK)ij (27)
We compute the transmissibility using harmonic average.
(λK)ij = (∆xi + ∆xj)( (λK)i(λK)j
∆xi(λK)j + ∆xj(λK)i
)(28)
15 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
ApproachDiscretization
Saturation Equation
We use finite volume in space and backward Euler in time. For each controlvolume,
VφSn+1
w − Snw
∆t+
∫∂V
fw(Smw)v · n = V
qmw
ρw
In IMPES approach, m = n, and for fully implicit approach, m = n + 1.
The fractional flow is upwinded
fw(Sw)ij =
{fw(Sw)i if vij · n ≥ 0fw(Sw)j if vij · n < 0
The total velocity v is calculated from the solution of the pressure equation.
16 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Amanzi: The ASCEM Multi-Process HPC Simulator
Wide Range of Complexity
Wide Range of Platforms
Modular HPC simulationcapability for waste formdegradation, multiphaseflow and reactive transport.
Efficient, robust simulationfrom supercomputers tolaptops.
Design and build foremerging multi-core andaccelerator-based systems.
Open-source project withstrong communityengagement.
17 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Amanzi: Approach and Features
Structured / Unstructured mesh capability:Leverages mesh frameworks (MSTK, STKmesh)for general unstructured meshes.Leverages structured AMR techniques andlibraries (BoxLib)
Leverages the Trilinos framework (Epetra,Thyra) and supporting tools/solvers.
Leverages advances in Mimetic FiniteDifference (MFD) methods to enableaccurate solutions.
mixed-hybrid (or local) formulationarbitrary polyhedra (layered media, pinch-outs)distorted meshes (capture topography andhydrostratigraphy)discontinous and highly variable anisotropiccoefficients (permeability)
18 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Amanzi Design
driver
Visualization
Checkpoint
Observations
process tree
MPC
strong coupler
PK:: Flow PK:: Energy
State
Mesh
FieldMap
• ...
• ...
dependency graph
Components of Amanzi. [Coonet al., 2014]
Process-Kernel TreeHierarchical view of themathematical modelSelect PKs at run-timePKs use high-level operatorclasses to encapsulatediscretizations, solvers
Directed Acyclic Graph (DAG)Dynamic plug-and-play PKs viaself-registering factories.Automated Multi-Process Couplers(MPC) for both “weakly” and“strongly” coupled systems.Customization of strong couplers isusually required.
Goal: Ensure domain scientists can easily understand,extend, and develop PK implementations.
19 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Amanzi Design (cont.)
MPC
strong or weak coupler
PK:: Flow
Richards
PK:: Energy
advection-diffusion
PK:: Surface Flow
diffusion wave eqn
PK:: Surface Energy
advection-diffusion
PK:: Surface Balance
precipitation,radiation, evaporation
MPC
customstrongcoupler
An example of a process kernel tree for amodel of thermal hydrology in the arctic.[Coon et al., 2014]
Arctic thermal-hydrology model:Thermal hydrology withsurface and suburface flow isstrongly coupled.This MPC is weakly coupledto the surface energybalance.The hierarchical use of MPCsto makes these couplingscenarios easy to expresss.
20 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
What have we accomplished?
For phase I, we have implemented in AmanziA pressure PK to solve the pressure equation.A saturation PK to solve the saturation equation.Coupled pressure PK and saturation PK (the equations are solvedsequentially).Unit tests and convergence test for pressure equation.
21 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Example Code for Pressure PK
// New interface for a PKvirtual void Initialize();virtual bool AdvanceStep(double t_old, double t_new);virtual void CommitStep(double t_old, double t_new){};virtual void CalculateDiagnostics(){};
// Main methods of this PKvoid InitializeFields();void InitializePressure();void InitTimeInterval(Teuchos::ParameterList& ti_list);void CommitState(const Teuchos::Ptr<State>& S);
// Time integration interface new_mpc, implemented in Pressure_PK_TI.cc// computes the non-linear functional f = f(t,u,udot)virtual void Functional(double t_old, double t_new,
Teuchos::RCP<TreeVector> u_old,Teuchos::RCP<TreeVector> u_new,Teuchos::RCP<TreeVector> f);
// applies preconditioner to u and returns the result in Puvirtual void ApplyPreconditioner(Teuchos::RCP<const TreeVector> u,
Teuchos::RCP<TreeVector> Pu);// updates the preconditionervirtual void UpdatePreconditioner(double t,
Teuchos::RCP<const TreeVector> up, double h);
22 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Pressure Equation
Unit test for pressure equation.
−∇ · (λ∇P) = f
Example problem
λ = 1
f = 5π2 sin (πx) sin (2πy)
P = sin (πx) sin (2πy)
23 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Presure Equation (cont.)
Analytic solution (left) and numeric solution (right) for test problem
24 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Presure Equation (cont.)
Convergence rate for test problem, with mesh size h = 8, 16, 32, 64, 128.
25 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
HPC FrameworkMilestonesUnit Tests for Verification
Unit test for saturation equation
Unit test for 1D advection.
ut + f (u)x = 0
Buckley-Leverett problem for one-dimensional 2-phase, 2-component,immiscible, incompressible flow in 1D
St = U(S)Sx
U(S) =QφA
dfdS
where S is the saturation, Q is the flux, A is the surface area, φ is theporosity, and f is the fractional flow.This is basically a nonlinear advection equation with non-convex fluxf (S).
26 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Timeline
Timeline
Phase IOctober
Gain confidence working with Amanzi coding standard, build tools,interfacing with other libraries, etc. 3
Get this new PK to interface correctly with both the multi-processcoordinator (MPC) and input files. 3
Start with building a simple solver for the pressure equation. 3
NovemberImplement a simulator for incompressible 2-phase flow. 3
Fully coupled approach for incompressible 2-phase flow. 7
Unit tests for pressure equation. 3
Unit tests for saturation equation. 7
DecemberAdd nonlinear complementarity constraints for phase transitions. (Inprogress)Prepare mid-year report and presentation. 3
27 / 28
lamed-fixed
BackgroundMethods
ImplementationProject Outcome
Timeline
Timeline (cont.)
Phase IIJanuary: Develop active sets and semi-smooth Newton method.February: Add miscibility effect.March: Incorporate energy equation for thermal effect.April
Collect the unit tests and make a test suite.Benchmark with existing codes or pursue realistic problems, such asdesiccation if time permits.
May: Prepare final report and presentation.
28 / 28
lamed-fixed
References
R. Brooks and A. Corey. Hydraulic properties of porous media. 1964.G. Chavent and J. Jaffre. Mathematical Models and Finite Elements for
Reservoir Simulation. 1978.E. Coon, J. D. Moulton, and S. Painter. Managing complexity in simulations
of land surface and near-surface processes. Technical Report LA-UR14-25386, Applied Mathematics and Plasma Physics Group, Los AlamosNational Laboratory, 2014. submitted to Environmental Modelling &Software.
M. Van Genuchten. A closed form equation for predicting the hydraulicconductivity of unsaturated soils. 25:551–564, 1980.
28 / 28