How to Make Implicit Upwind Schemes as Efficient as Streamline … · 2014. 11. 17. · How to Make...
Transcript of How to Make Implicit Upwind Schemes as Efficient as Streamline … · 2014. 11. 17. · How to Make...
How to Make Implicit Upwind Schemes asEfficient as Streamline Methods
J. R. Natvig†, K.-A. Lie† B. Eikemo‡
†SINTEF, Department of Applied Mathematics
‡Department of Mathematics, University of Bergen
CMWR XVI, Copenhagen, June 20 2006
CMWR, Copenhagen 1/ 22
Topic of this talk
Aim:To construct fast implicit solver for
φ∂S
∂t+ v · ∇f(S) = Q(S), (1)
assuming no gravity and no capillary pressure.
Method:Decompose (1) in sequence of local problems.
CMWR, Copenhagen 2/ 22
Implicit First-Order Upwind Scheme 1D
S1 S2v
Q1 Q2
φ
∆t(Sn
1 −Sn−11 )− v
∆xf(Sn
1 ) = Q1(Sn1 ),
φ
∆t(Sn
2 −Sn−12 ) +
v
∆xf(Sn
1 ) = Q2(Sn2 ),
CMWR, Copenhagen 3/ 22
Implicit First-Order Upwind Scheme 1D
S1 S2v
Q1 Q2
φ
∆t(Sn
1 −Sn−11 )− v
∆xf(Sn
1 ) = Q1(Sn1 ),
φ
∆t(Sn
2 −Sn−12 ) +
v
∆xf(Sn
1 ) = Q2(Sn2 ),
CMWR, Copenhagen 3/ 22
Implicit First-Order Upwind Scheme 1D
S1 · · · Sk−1 Sk Sk+1 · · · Sm
v1 vk−1 vk vm−1
Consider the scheme
φ
∆t(Sn
k−Sn−1k ) +
1
∆x
(vk−1f(Sn
k−1)− vkf(Snk )
)= Qk(Sn
k ),
where we have assumed vk > 0.
CMWR, Copenhagen 4/ 22
Implicit First-Order Upwind Scheme 1D
S1 · · · Sk−1 Sk Sk+1 · · · Sm
v1 vk−1 vk vm−1
Consider the scheme
φ
∆t(Sn − Sn−1) +
1
∆x
−v1
v1 −v2
. . . . . .vm−1 0
f(Sn
1 )...
f(Snm)
= Q(S).
where we have assumed vk > 0.
CMWR, Copenhagen 4/ 22
Implicit First-Order Upwind Scheme 1D
S1 · · · Sk−1 Sk Sk+1 · · · Sm
v1 vk−1 vk vm−1
Consider the scheme
φ
∆t(Sn − Sn−1) +
1
∆x
−v1
v1 −v2
. . . . . .vm−1 0
f(Sn
1 )...
f(Snm)
= Q(S).
where we have assumed vk > 0.
Lower triangular matrix =⇒ equations can be solved in sequence.
CMWR, Copenhagen 4/ 22
Implicit First-Order Upwind Scheme 2D
Then consider the same scheme in 2D withm grid cells and fluxes given by the (sparse)m×m-matrix v.
k jvkj
Snk − Sn−1
k
∆t− 1
h
( ∑j
max(vkj , 0)f(Snk ) +
∑j
min(vkj , 0)f(Snj )
)= Qk(Sn
k ).
Again, this can be written in matrix notation
1
∆t(Sn − Sn−1) + V
f(Sn1 )
...f(Sn
m)
= Q(Sn).
where
Vkk = − 1
h
∑j
max(vkj , 0), Vkj = − 1
hmin(vkj , 0).
Is V triangular?
CMWR, Copenhagen 5/ 22
Implicit First-Order Upwind Scheme 2D
Then consider the same scheme in 2D withm grid cells and fluxes given by the (sparse)m×m-matrix v.
k jvkj
Again, this can be written in matrix notation
1
∆t(Sn − Sn−1) + V
f(Sn1 )
...f(Sn
m)
= Q(Sn).
where
Vkk = − 1
h
∑j
max(vkj , 0), Vkj = − 1
hmin(vkj , 0).
Is V triangular?
CMWR, Copenhagen 5/ 22
Implicit First-Order Upwind Scheme 2D
Then consider the same scheme in 2D withm grid cells and fluxes given by the (sparse)m×m-matrix v.
k jvkj
Again, this can be written in matrix notation
1
∆t(Sn − Sn−1) + V
f(Sn1 )
...f(Sn
m)
= Q(Sn).
where
Vkk = − 1
h
∑j
max(vkj , 0), Vkj = − 1
hmin(vkj , 0).
Is V triangular?
CMWR, Copenhagen 5/ 22
“Homogeneous” Quarter five-spot
What does V look like?
1 2 3
4 5 6
7 8 9
V =
∗∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗∗ ∗ ∗
∗ ∗∗ ∗ ∗
∗ ∗ ∗
Lower triangular
CMWR, Copenhagen 6/ 22
“Homogeneous” Quarter five-spot
What does V look like?
1 2 3
4 5 6
7 8 9
V =
∗∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗∗ ∗ ∗
∗ ∗∗ ∗ ∗
∗ ∗ ∗
Lower triangular
CMWR, Copenhagen 6/ 22
“Heterogeneous” Quarter five-spot
What does V look like now?
1 2 3
4 5 6
7 8 9
V =
∗∗ ∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗∗ ∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗
Not lower triangular
CMWR, Copenhagen 7/ 22
“Heterogeneous” Quarter five-spot
What does V look like now?
1 2 3
4 5 6
7 8 9
V =
∗∗ ∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗∗ ∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗
Not lower triangular
CMWR, Copenhagen 7/ 22
Graph Interpretation
What can be done?
CMWR, Copenhagen 8/ 22
Graph Interpretation Continued
“Homogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
Can this directed graph be flattenedsuch that all arrows point to the right?
1 2 3 4 5 6 7 8 9
Yes!
CMWR, Copenhagen 9/ 22
Graph Interpretation Continued
“Homogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
Can this directed graph be flattenedsuch that all arrows point to the right?
1 2 3 4 5 6 7 8 9
Yes!
CMWR, Copenhagen 9/ 22
Graph Interpretation Continued
“Homogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
Can this directed graph be flattenedsuch that all arrows point to the right?
1 2 3 4 5 6 7 8 9
Yes!
CMWR, Copenhagen 9/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
What about this directed graph?
CMWR, Copenhagen 10/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
What about this directed graph?
1 2 3 4 5 6 7 8 9
CMWR, Copenhagen 10/ 22
Topological sorting
Topological sorting:
Find sequence of vertex numbers (p1, . . . , pm) such that
pi < pj
whenever there is a directed edge from vertex i to vertex j.
A topological sort of the vertices in a directed graph can be found inlinear time as the post-order of the depth-first traversal of thereversed graph.
CMWR, Copenhagen 11/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 999
87
4
1
4
7 8
6
32
5
2 3
6
9
1 4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9988
7
4
1
4
7 8
6
32
5
2 3
6
9
1 4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 99877
4
1
4
7 8
6
32
5
2 3
6
9
1 4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9987
44
1
4
7 8
6
32
5
2 3
6
9
1 4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9987
4
1
1
4
7 8
6
32
5
2 3
6
9
1 4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9987
4
1
4
4
7 8
6
32
5
2 3
6
9
1
4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 998
7
4
1
4
7
7 8
6
32
5
2 3
6
9
1 4
7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 998
7
4
1
4
7 8
8
6
32
5
2 3
6
9
1 4 7
8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 998
7
4
1
4
7 8 9
6
32
5
2 3
6
9
1 4 7 8
5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 998
7
4
1
4
7 8
66
32
5
2 3
6
9
1 4 7 8
5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 998
7
4
1
4
7 8
6
33
2
5
2 3
6
9
1 4 7 8
5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 99
87
4
1
4
7 8
6
322
5
2 3
6
9
1 4 7 8
5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 99
87
4
1
4
7 8
6
32
5
5
2 3
6
9
1 4 7 8
5 2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 99
87
4
1
4
7 8
6
32
5
2
2 3
6
9
1 4 7 8 5
2 3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 99
87
4
1
4
7 8
6
3
2
5
2 3
3
6
9
1 4 7 8 5 2
3 6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 99
87
4
1
4
7 8
6
32
5
2 3
6
6
9
1 4 7 8 5 2 3
6 9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
987
4
1
4
7 8
6
32
5
2 3
6
9
9
1 4 7 8 5 2 3 6
9
CMWR, Copenhagen 12/ 22
Graph Interpretation Continued
“Heterogeneous” Quarter five-spot as directed graph
1 2 3
4 5 6
7 8 9
987
4
1
4
7 8
6
32
5
2 3
6
9
1 4 7 8 5 2 3 6 9
CMWR, Copenhagen 12/ 22
Triangularisation of the coefficient matrix
By rearranging the rows and columns in the order(1, 4, 7, 8, 5, 2, 3, 6, 9), we obtain a triangular V :
1 2 3
4 5 6
7 8 9
1 4 7 8 5 2 3 6 9147852369
∗∗ ∗
∗ ∗∗ ∗
∗ ∗ ∗∗ ∗ ∗
∗ ∗∗ ∗ ∗
∗ ∗ ∗
Duff and Reid. An implementation of Tarjans algorithm for block triangularisation of a matrix. 1978.
Dennis, Martinez and Zhang. Triangular decomposition methods for solving reducible nonlinear systems. 1994.
CMWR, Copenhagen 13/ 22
Triangularisation of the coefficient matrix
Again, this can be written in matrix notation
1
∆t(S̃n − S̃n−1) + L
f(S̃n1 )
...f(S̃n
m)
= PQ(S̃n).
where S̃ = PS, L = PV P T and P is a permutation matrixobtained from a topological ordering of the grid cells.
CMWR, Copenhagen 14/ 22
Implicit First-Order Upwind Scheme 2D
k jvkj
Snk − Sn−1
k
∆t− 1
h
( ∑j
max(vkj , 0)f(Snk ) +
∑j
min(vkj , 0)f(Snj )
)= Qk(Sn
k ).
CMWR, Copenhagen 15/ 22
Implicit First-Order Upwind Scheme 2D
k jvkj
Find uh ∈ Vh such that∫K
Snk − Sn−1
k
∆tvh−
∫K
f(Snk ) v·∇vh+
∑j
∫∂K
vhf̂(Snk , Sn
j , vkj)=
∫K
Qk(Snk )vh,
For all vh ∈ Vh.
Here f̂ is the upwind flux given by
f̂(Sk, Sj , vkj) = f(Sk) max(vkj , 0) + f(Sj) min(vkj , 0).
CMWR, Copenhagen 15/ 22
Delineation of Reservoirs
Consider a domain with multiple injectors at positions (x1, . . . ,xn).Solve
v · ∇Ci = Qi
where Qi > 0 for the injector at injector xi and zero elsewhere.
Ci(x) =
{1 x on streamline from injector i,
0 otherwise.
CMWR, Copenhagen 16/ 22
Porosity of the model 2 of the SPE Comparative Solution Project.
CMWR, Copenhagen 17/ 22
Delineation of Reservoirs ContinuedModel 2 of the SPE Comparative Solution Project*.
Size: 60× 220× 85 (1.122 mill. grid blocks)Simulation time: a few minutes.
Christie and Blunt Tenth SPE Comparative Solution Project: A Comparison of Upscaling Techniques
CMWR, Copenhagen 18/ 22
Twophase Flow in 2D
First-order upwind 2nd-order discontinuous Galerkin
Solution after 0.2 PVI .
Solution after 0.3 PVI.
Water flooding in layer 6 of the same model computed with 3 pressureupdates.
CMWR, Copenhagen 19/ 22
Twophase Flow in 2D
0.15 PVI 0.24 PVI 0.36 PVI
Water flooding in homogeneous domain with highly permeablefractures computed with the first-order upwind scheme.
CMWR, Copenhagen 20/ 22
Model 2 of the SPE Comparative Solution Project
∆t=1 day, 40 minutes ∆t=20 days, 2 minutes
0 500 1000 1500 20000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 500 1000 1500 20000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Watercut curves computed with the first-order upwind scheme (solidline) and with FrontSim (dashed).
CMWR, Copenhagen 21/ 22
Highlights
Why is this a good ideaExtremely fast solvers: O(n) operations for n unknowns.Local control over Newton iteration.Small memory requirements.Based on well-known conservative discretisation.
Similar to streamline methods in performance: millions of gridcells on desktop computers!
CMWR, Copenhagen 22/ 22