R A porous multiphase flow toolbox for OpenFOAM
P. Horgue1
C. Soulaine 1 2
1,2
J. Franc
1
R. Guibert
1
G. Debenest
1
Institut de M´ ecanique des Fluides de Toulouse
Department of Energy Resources Engineering, Stanford University
June 25th 2014
P. Horgue (IMFT)
06-25-2014
1 / 21
Introduction
Multiphase flow in heterogeneous porous media Hydrology and groundwater flow Oil and gas reservoirs Gas-liquid contactors
Viscous fingering in an heavy oil reservoir with heterogeneous permeability field
Waste management, biodegradation
Two-phase flow in structured packing with preferential ways for liquid flow (C. Soulaine, 2012 )
P. Horgue (IMFT)
06-25-2014
2 / 21
Introduction
Multiphase flow in heterogeneous porous media Hydrology and groundwater flow Oil and gas reservoirs Gas-liquid contactors
Viscous fingering in an heavy oil reservoir with heterogeneous permeability field
Waste management, biodegradation
Several open-source projects DumuX R MRST (Matlab toolbox)
OpenGeoSys PFlotran
Two-phase flow in structured packing with preferential ways for liquid flow (C. Soulaine, 2012 )
P. Horgue (IMFT)
06-25-2014
2 / 21
Introduction
Usual approach in OpenFOAM “penalization” approach : ∇ · (ρUU) + ∇ · (µ∇U) +
µ U = −∇p K
when K → 0, we get Darcy’s law : U=−
P. Horgue (IMFT)
K ∇p µ
06-25-2014
3 / 21
Introduction
Usual approach in OpenFOAM “penalization” approach : ∇ · (ρUU) + ∇ · (µ∇U) +
µ U = −∇p K
when K → 0, we get Darcy’s law : U=−
K ∇p µ
Recent “porous” works with OpenFOAM Compressible reacting flows (Piscaglia et al., 2010) Mass transfer in solid oxide fuel cells (Novaresio et al., 2013) Interaction of waves and coastal porous structures (Higuera et al., 2014)
P. Horgue (IMFT)
06-25-2014
3 / 21
Introduction
Usual approach in OpenFOAM “penalization” approach : ∇ · (ρUU) + ∇ · (µ∇U) +
µ U = −∇p K
when K → 0, we get Darcy’s law : U=−
K ∇p µ
Recent “porous” works with OpenFOAM Compressible reacting flows (Piscaglia et al., 2010) Mass transfer in solid oxide fuel cells (Novaresio et al., 2013) Interaction of waves and coastal porous structures (Higuera et al., 2014)
Missing essential specific features of multiphase flow Phase saturations Relative permeabilities Capillary pressure Specific boundary conditions...
P. Horgue (IMFT)
06-25-2014
3 / 21
Introduction
1
Introduction
2
Model presentation
3
Numerical implementation
4
Validation cases
5
Performance test
P. Horgue (IMFT)
06-25-2014
4 / 21
Model presentation
1
Introduction
2
Model presentation
3
Numerical implementation
4
Validation cases
5
Performance test
P. Horgue (IMFT)
06-25-2014
5 / 21
Model presentation
General variables (averaged on one cell) Porosity : ε=
Vvoid Vcell
Saturation of fluid phase i : Si =
Vi Vvoid
and
Sa + Sb = 1
Capillary pressure pcap = pa − pb Schematic representation of two-phase flow in porous medium
P. Horgue (IMFT)
06-25-2014
6 / 21
Model presentation
General variables (averaged on one cell) Porosity : ε=
Vvoid Vcell
Saturation of fluid phase i : Si =
Vi Vvoid
and
Sa + Sb = 1
Capillary pressure pcap = pa − pb Schematic representation of two-phase flow in porous medium Conservation equation for each phase i Mass conservation (incompressible phase) : ε
∂Si + ∇ · Ui = qi ∂t
Momentum (generalized Darcy’s law) : Ui = −
P. Horgue (IMFT)
Kkri (Si ) (∇pi − ρi g) µi
06-25-2014
6 / 21
Model presentation
General variables (averaged on one cell) Porosity : ε=
Vvoid Vcell
Saturation of fluid phase i : Si =
Vi Vvoid
and
Sa + Sb = 1
Capillary pressure pcap = pa − pb Schematic representation of two-phase flow in porous medium Conservation equation for each phase i Mass conservation (incompressible phase) : ∂Si ε + ∇ · Ui = qi ∂t
Pressure-Saturation system for two-phase flow Total mass conservation : ∇ · Ua + ∇ · Ub = qa + qb
Momentum (generalized Darcy’s law) : Mass conservation for phase b : Kkri (Si ) Ui = − (∇pi − ρi g) µi
P. Horgue (IMFT)
ε
∂Sb + ∇ · Ub = qb ∂t 06-25-2014
6 / 21
Model presentation
Formulation Phase mobilities Mi =
Kkri (Sb ) Kkri (Sb ) and Li = ρi µi µi
Capillary term pcap = pa − pb ∇pb = ∇pa − ∇pcap = ∇pa −
P. Horgue (IMFT)
∂pcap ∇Sb ∂Sb
06-25-2014
7 / 21
Model presentation
Formulation Phase mobilities Mi =
Kkri (Sb ) Kkri (Sb ) and Li = ρi µi µi
Capillary term pcap = pa − pb ∇pb = ∇pa − ∇pcap = ∇pa −
∂pcap ∇Sb ∂Sb
Final Pressure-Saturation system (pa and Sb ) ∂pcap ∇Sb = qa + qb ∂Sb ∂Sb ∂pcap ∇Sb = qb ε + ∇ · −Mb ∇pa + Lb g + Mb ∂t ∂Sb
−∇ · (Ma + Mb ) ∇pa + ∇ · (La + Lb ) g + ∇ · Mb
P. Horgue (IMFT)
06-25-2014
7 / 21
Model presentation
Formulation Phase mobilities Mi =
Kkri (Sb ) Kkri (Sb ) and Li = ρi µi µi
Capillary term pcap = pa − pb ∇pb = ∇pa − ∇pcap = ∇pa −
∂pcap ∇Sb ∂Sb
Final Pressure-Saturation system (pa and Sb ) ∂pcap ∇Sb = qa + qb ∂Sb ∂Sb ∂pcap ∇Sb = qb ε + ∇ · −Mb ∇pa + Lb g + Mb ∂t ∂Sb
−∇ · (Ma + Mb ) ∇pa + ∇ · (La + Lb ) g + ∇ · Mb
Fluxes definition (for code readibility) φp = (Ma + Mb ) ∇pa · Sf φg = (La + Lb ) g · Sf φpcap = Mb P. Horgue (IMFT)
∂pcap · Sf ∂Sb
kri (Sb ) and
∂pcap ∂Sb
(Sb ) models
Brooks and Corey (1964) Van Genuchten (1980) Linear 06-25-2014
7 / 21
Model presentation
the darcyGradPressure boundary condition Global velocity/flux computed as : Ufixed = Ua,fixed + Ub,fixed = − (Ma + Mb ) ∇pa + (La + Lb ) g − Mb
∂pc ∇Sb ∂Sb
Fixed gradient pressure condition : ∂pc −1 n.∇pa = n. (Ma + Mb ) Ufixed − (La + Lb ) g + Mb ∇Sb ∂Sb
Ub file example
p file example dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0;
}
internalField uniform 0; boundaryField {
boundaryField { boundaryExample { type }
dimensions [1 -1 0 0 0 0 0];
darcyGradPressure;
boundaryExample { type value }
fixedValue; uniform (1e-5 0 0);
} P. Horgue (IMFT)
06-25-2014
8 / 21
Numerical implementation
1
Introduction
2
Model presentation
3
Numerical implementation
4
Validation cases
5
Performance test
P. Horgue (IMFT)
06-25-2014
9 / 21
Numerical implementation
porousMultiphaseFoam
porousBoundaryConditions
porousModels
tutorials
darcyGradPressure
relativePermeabilityModels
BuckleyLeverett
darcyGradPressureAniso
capillarityModels
capillaryValidation
phaseModels
injectionExtraction
impesFoam
anisoImpesFoam
Structure of the OpenFOAM porous multiphase toolbox
P. Horgue (IMFT)
06-25-2014
10 / 21
Numerical implementation 1. CourantNo.H 2. SEqn.H
Algorithm : IMPES method, Sheldon (1959) 1
Compute ∆tn+1
2
Solve explicitly saturation :
fvScalarMatrix SbEqn ( eps*fvm::ddt(Sb) + fvc::div(phib) - (SrcInj*Winj-Fb*SrcExt*Wext) ); SbEqn.solve();
ε 3
Sbn+1 − Sbn ∆tn+1
+∇·
n φb
= qb
Update properties depending on saturation : ∂p n+1 cap Mn+1 , Ln+1 , i i ∂S b
Solve implicitly the pressure :
n+1
−∇ · Ma −∇ · 5
n+1 φg
n+1
+ Mb
−∇·
krModel->correct(); kraf = fvc::interpolate(kra,"kra"); krbf = fvc::interpolate(krb,"krb"); Mbf = Kf*krbf/mub; Lbf = rhob*Kf*krbf/mub; 4. pEqn.H
n+1 φn+1 g , φpcap 4
3. updateSbProperties.H
n+1 φpc
∇p
n+1
=
+ qa + qb
Update fluxes related to the pressure : n+1 φn+1 and φn+1 p , φ b
fvScalarMatrix pEqn ( fvm::laplacian(-Mf, p) + fvc::div(phiG) + fvc::div(phiPc) - (-SrcExt*Wext+SrcInj*Winj) ); pEqn.solve(); 5. End of pEqn.H file
phiP = pEqn.flux(); phi = phiP+phiG+phiPc; phib = Fbf*phiP + (Lbf/Lf)*phiG + phiPc;
P. Horgue (IMFT)
06-25-2014
11 / 21
Validation cases
1
Introduction
2
Model presentation
3
Numerical implementation
4
Validation cases
5
Performance test
P. Horgue (IMFT)
06-25-2014
12 / 21
Validation cases
Buckley-Leverett case : kr validation 1D injection in a fully saturated domain Semi-analytical solution for validation
Water saturation without gravity
Two cases : with and without gravity 1
Example : Van Genuchten Model
krb (Sb,eff ) =
1−
1−
1 Sbm
m 2 (1)
Water injection : Vwater = 1.10−5 m.s−1 Oil saturated domain : length L = 1 m
Saturation
kr model : 1 Sb2
t = 6000s t = 12000s t = 20000s
0.8 0.6 0.4 0.2 0 0
0.2
0.4 0.6 Position(m)
0.8
1
1D saturation profile
P. Horgue (IMFT)
06-25-2014
13 / 21
Validation cases
Buckley-Leverett case : kr validation 1D injection in a fully saturated domain Semi-analytical solution for validation Water saturation with gravity
Two cases : with and without gravity
1 t = 10000s t = 20000s t = 30000s
Example : Van Genuchten Model 0.8
krb (Sb,eff ) =
1 Sb2
1−
1−
1 Sbm
m 2 (2)
Water injection : Vwater = 1.10−5 m.s−1 Oil saturated domain : length L = 1 m
Saturation
kr model :
0.6 0.4 0.2 0 0
0.2
0.4 0.6 Position(m)
0.8
1
1D saturation profile
P. Horgue (IMFT)
06-25-2014
14 / 21
Validation cases
Capillary-gravity equilibirum case : pcap validation Air-water system in vertical domain Simulation of the capillary rise of wetting fluid Waiting for stationnary state : Ua = Ub = 0
∂Sb (ρb − ρa ) gy = ∂pc ∂y ∂S (Sb )
→
b
Example : Van Genuchten Model pcap model : −m ∂pc pc,0 1−m − 1+m − 1 (Sb ) m (Sb ) = − (Sb ) m − 1 ∂Sb m Spc ,max − Spc ,irr
40
1
30 dS/dx (m-1)
Saturation
0.8 0.6 0.4
0
0 0
P. Horgue (IMFT)
20
10
0.2
Saturation profile
(3)
0.2
0.4 0.6 Position (m)
0.8
1D saturation profile
1
0
0.2
0.4 0.6 Saturation
0.8
1
Capillary Pressure 06-25-2014
15 / 21
Validation cases
Other test cases of the toolbox Simulation of injection/extraction processes. Permeability field isotropic or anisotropic (permeability is scalar or tensorial) : Ub = −
Kxx = Kyy
P. Horgue (IMFT)
Kxx Kyx
Kxy Kyy
krb (∇pa − ρb g + ∇pcap ) µb
Kxx < Kyy
Kxx > Kyy
06-25-2014
16 / 21
Performance test
1
Introduction
2
Model presentation
3
Numerical implementation
4
Validation cases
5
Performance test
P. Horgue (IMFT)
06-25-2014
17 / 21
Performance test
Viscous fingering in an heavy oil reservoir
Wall
2
reservoir size : 1.6 × 4 m
Water Injection
2000 × 800 = 1.6.106 cells −13
heterogeneous K from 1 to 4.10
2
m
water injection in saturated oil reservoir viscosity fluids : µoil = 100 × µwater
Wall
Heavy oil reservoir permeability field
Water saturation
P. Horgue (IMFT)
06-25-2014
18 / 21
Performance test
Simulations conditions Cluster Hyperion (Universit´ e de Toulouse, France) 1 node composed by 2 quad-core Nehalem (2.8 GHz) Tests from 16 to 1024 processors Cluster not empty and random selection of nodes Time : physical 4000 seconds / computational ∼ 700 hours
P. Horgue (IMFT)
06-25-2014
19 / 21
Performance test
Simulations conditions Cluster Hyperion (Universit´ e de Toulouse, France) 1 node composed by 2 quad-core Nehalem (2.8 GHz) Tests from 16 to 1024 processors Cluster not empty and random selection of nodes Time : physical 4000 seconds / computational ∼ 700 hours
128 64
Speedup
32 16 8 4 2
Viscous fingering (t = 2000 s) 1 16
32
64
128 256 512 1024 Cores
→ at least linear until ∼ 3200 cells per processor
Speedup with the impesFoam solver
P. Horgue (IMFT)
06-25-2014
19 / 21
Conclusions
Current state, a toolbox containing Most common multiphase porous models Two solvers with iso- or anisotropic heterogeneous permeability field Specific boundary conditions to impose phase velocities. Good parallel efficiency tested
Perspectives Include other physical features : phase change, heat transfer, scalar transport... Include most recent developments : subcycling for saturation equation, specific numerical schemes... Coupled solver ? Minor changes needed to be compatible with foam-extend. Release expected in september.
P. Horgue (IMFT)
06-25-2014
20 / 21
Conclusions
Thanks for your attention
contact :
[email protected]
P. Horgue (IMFT)
06-25-2014
21 / 21