maths in enhanced oil recovery - stanford universityweb.stanford.edu/group/siam/siam-margot.pdf ·...
TRANSCRIPT
![Page 1: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/1.jpg)
MATHS !
in !
ENHANCED OIL RECOVERY!
How to rev up an explicit time solver !
Margot Gerritsen!
Energy Resources Engineering!
Stanford!
![Page 2: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/2.jpg)
Motivated by reservoir processes!Particular interest in Enhanced Oil Recovery processes
Maintains pressure Swells oil phase Reduces oil viscosity
$$$ Components transfer between phases
Burns low percentage of oil Sets up steam flood, gas drive Upgrades oil in-situ
$$$ kinetics
Gas injection
In-situ combustion
![Page 3: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/3.jpg)
1. Global sweep, mainly controlled by heterogeneity & gravity
Low viscosity gas finds high perm flow paths Gravity segregates gas and oil phases
Effectiveness of injection process!
2. Local displacement efficiency, governed by phase behavior
Candidate for adaptivity, tailored computational methods:
tremendously fun area to be for a computational mathematician
Strong nonlinear coupling (e.g. phase behavior) High sensitivity to modeling as well as numerical errors
![Page 4: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/4.jpg)
T So
Burned zone
Vapor zone
Oil bank
Rx. zone
300
700
1100
0 1 2 Distance [ft]
• Upscaled models show large grid dependency
• Stiff reactions require specialized time-stepping
• Implicit methods, though industry standard, are out of the question
Explicit methods desirable!
![Page 5: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/5.jpg)
Need efficient explicit methods!
Not one, but O(100) realizations
*and*
High grid density required for accuracy because of strong sensitivities
Studies performed: • Monte Carlo simulations • History matching • Sensitivities to input parameters • Optimization (eg. well placement)
![Page 6: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/6.jpg)
Governing system of nonlinear DAEs!
Multi-phase extension Darcy’s law
Mass balance equations (transport equations)
Equation of state give mole fractions and densities
φ∂Ci∂t
+∇⋅U i = qi , i = 1,..., Nc .
Ci = xijρ j S j, U i = xijρ ju jj=1
N p∑ , i = 1,..., Nc ,j=1N p∑
u j = −kλ j (∇p + ρmj g), λ j = krj µ j , j = 1,..., N p ,
ct∂p∂t+
∂Vt∂ni
∇⋅U i =∂Vt∂ni
qii=1Nc∑ .i=1
Nc∑
Pressure equation (flow equation)
![Page 7: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/7.jpg)
Asynchronous time stepping (FATI)!
Standard approach
All cells updated for same time step
Asynchronous
Cells have their own update time
Ideal for localized time scales
t
x
![Page 8: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/8.jpg)
Previous work!
Localized time stepping
Adaptive mesh refinement
Iterative Mortar/domain decomposition methods
Streamline methods
Kirby and Dawson
Y. Omelchenko and H. Karimabadi (San Diego)
Self-adaptive flux conservative equations with sources. JCP, 2006.
![Page 9: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/9.jpg)
Using fluxes ensures conservation!
Target update time
Current cell time
Flux between cells
![Page 10: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/10.jpg)
Move cell with smallest update time!
minimum target cell
![Page 11: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/11.jpg)
Update fluxes!
To update fluxes bring neighbors to same time level (partially)
![Page 12: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/12.jpg)
But, are remaining time steps safe?!
![Page 13: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/13.jpg)
If not, synchronize and reschedule!
Synchronization is recursive
![Page 14: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/14.jpg)
Simplified example: mathematics!
1 2 3 4 x t
1 2 3 4 x t
1 2 3 4 x t
1 2 3 4 x t
1 2 3 4 x t
1 2 3 4 x t
)( 5.15.2221
2nnnnn FFSS −−=+ λ
)(
)(
5.35.4441
4
5.25.3331
3nnnnn
nnnnn
FFSSFFSS
−−=
−−=+
+
λ
λ
)(
)(
)(
15.2
15.3
13
13
23
5.115.2
12
12
22
5.05.1112
1
+++++
++++
+
−−=
−−=
−−=
nnnnn
nnnnn
nnnnn
FFSSFFSSFFSS
λ
λ
λ
)(
)(
)(
25.1
25.2
22
22
32
15.3
15.4
14
14
34
25.2
15.3
23
23
33
+++++
+++++
+++++
−−=
−−=
−−=
nnnnn
nnnnn
nnnnn
FFSSFFSSFFSS
λ
λ
λ
i
nin
i xtΔ
Δ=λ
Cell updates
Face synchronization
![Page 15: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/15.jpg)
Patterns can be irregular, but.. !
1 2 3 4 5 6 7 8
x
t
Cells with similar update times
can be projected onto same
time level
Efficiency improves when fast
time scales are localized,
e.g. around fronts/near wells 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
![Page 16: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/16.jpg)
Euler-based scheme is inconsistent!
Linear advection
Single interface where time step jumps
Single point upwind flux
k-1 k k+1 k+2
pn 1+
n
1+n
pn 2+
Skn+1 = Sk
n −ΔtΔx
Gk+ 12−Gk− 12( ),
Gk− 12= Sk−1
n , Gk+ 12= (1− β)Sk
n + β Sk−1n
β =1p
λ
p + λ
1− −
λ
p
p−1
.
![Page 17: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/17.jpg)
First test – linear advection!
Log N
Log
e Lo
g e
p=2
p=4
L2 Error Sync dt Sync dt/p Async
![Page 18: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/18.jpg)
Exaggerate effect inconsistency!
Log N
Log
e
Log N
L2 Error Linf Error
p=2
Sync dt Sync dt/p Async
![Page 19: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/19.jpg)
Two-phase, incompressible flow!
= 27 (0.1 PVI), 13 (1.0 PVI)
= 2.5 (0.1 PVI), 1.0 (1.0 PVI)
Porosity Sync Async
Sync Updates Async Updates
Sync Updates Async Updates
For uniform porosity…
![Page 20: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/20.jpg)
Red is asynchronous Blue is synchronous End time = 2/3 PVI
CH4
C02 C4 C10
K-Values 2.5 1.4 0.5 0.05
Cinj 1.0 0.0 0.0 0.0
Cinit 0.1 0.1809 0.3766 0.3425
x
x
x
x
x
![Page 21: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/21.jpg)
100 Grid Cells
Flash Calculations Flux Calculations
Number Time Number Time
Synchronous 19261 2.8 186000 0.8
Asynchronous 8367 2.1 7157 0.5
500 Grid Cells
Flash Calculations Flux Calculations
Number Time Number Time
Synchronous 466281 58.9 463000 14.0
Asynchronous 149657 33.7 138677 9.1
Asynchronous tends to do about half the flash calculations of synchronous
![Page 22: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/22.jpg)
Turning off recursions seems to have little effect on the solution However, stability analysis still must be performed (ongoing work)
![Page 23: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/23.jpg)
An initial 2D Algorithm!
Miscible and immiscible two phase flow
Incompressible, no gravity or capillarity
Compare sequential algorithms
Polygonal grids with L-method, upstream weighting
dt chosen so that CFL satisfied for 95% of cells
Synchronous vs. Asynchronous
P Solve
P Solve
![Page 24: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/24.jpg)
2D Results !Immiscible Miscible
Saturation
0.4
PVI
Sync updates
Async updates
Sync flux
Async flux
Immiscible 17 20
Misible 12 13
![Page 25: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/25.jpg)
FATI requires a priority queue!
At each iteration, update cell with nearest scheduled final time
(Discrete Event Simulation)
Cells must be kept ordered by scheduled final time time
But must also modify neighbours, which may be anywhere
The priority queue drives FATI and is classically implemented as a minheap
Bottleneck? Parallelization?
![Page 26: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/26.jpg)
Flat Profile (2D code) !
_min_heapify
_swap
_synch
fl_bucklev_f
_residual
mh_set
fl_bucklev_df
_dfds
_flup
fati
_sched
main
0 5 10 15 20 25 30
FATI functions Heap operations
Other simulation Setup
![Page 27: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/27.jpg)
Priority Queue!
Minheap seems expensive
Heap operations are ~50% runtime
But
1D/2D runtimes are only 20-35% of synchronous equivalent
Cell calculations are currently trivial
Heap cost is log(number of cells)
No bottleneck with large domains / more realistic problems
Parallelization (needed) is a different story!
![Page 28: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/28.jpg)
The devil is in the implementation!
So optimistic…..
$$$$ 1970 1980 1990 2000 2010 2020 2030
Multi-core Era: A new paradigm in computing
Vector Era • USA, Japan
Massively Parallel Era • USA, Japan, Europe
1 TF
.001 TF
1,000 TF
1,000,000 TF
1,000,000,000 TF
IAA (Sandia/ORNL)
![Page 29: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/29.jpg)
Silicon valley moves to CMPs!
Flops are free. In most cases we can now compute on the data as fast as we can move them. Doug Miles, Portland Group
Power/cooling limits constrain clock speed
Industry moves to chip-level multiprocessors: • Two or more cores in single package • Cores may share cache (e.g. L2) • Cores share interconnect to rest system
Designed for specific workloads (mail, encryptions, database)
![Page 30: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/30.jpg)
1. Commercial simulators
Eclipse - Schlumberger, GEM/STARS - CMG
Commercial simulators & homebrew!
3. Academic home brews
Commercial codes drivers for first vector machines (eg Cray) Commercial codes are legacy codes, parallelized, Fortran core code
“Next generation” software under development (90s technology) Implemented on large distributed clusters (MPI based mostly)
Academic homebrew heavily rely on MATLAB, C++ Some parallelized (usually MPI, some openMP)
2. Petroleum companies in house codes
![Page 31: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/31.jpg)
![Page 32: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/32.jpg)
• Analyze the nonlinear algorithm
– Monotonicity & stability
• Understand difference between CFL and recursion
– What happens if recursion is limited?
– How “safe” do we need to be?
– Can we break one (or both) methods?
• More complex physics & flux calculation
– Counter current flow
– Higher-order methods
– More phase behavior
• Parallelization
![Page 33: MATHS in ENHANCED OIL RECOVERY - Stanford Universityweb.stanford.edu/group/siam/SIAM-margot.pdf · Motivated by reservoir processes! Particular interest in Enhanced Oil Recovery processes](https://reader034.vdocument.in/reader034/viewer/2022051508/5ab797ac7f8b9a684c8baeb8/html5/thumbnails/33.jpg)
Parallelization strategy FATI?!
Queue-driven boss-worker (or master-slave)
Fixed sub-domain size (at first)
Statically determined extents
Dynamically determined extents
Can experiment with optimum work-unit size to suit cache/comms
Bring sub-domain up to end-time of smallest member cell cheaply?
Workers have their own
minheap whose root is heaped by the boss's heap, distributing heap cost