23
Single Shooting and ESDIRK Methods for adjoint-based optimization of an oil reservoir Andrea Capolei, Carsten V¨ olcker, Jan Frydendall, John Bagterp Jørgensen Department of Informatics and Mathematical Modeling Technical University of Denmark 17th Nordic Process Control Workshop 26th of January, 2012 1 / 23

Single Shooting and ESDIRK Methods for adjoint-based

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Single Shooting and ESDIRK Methods for adjoint-basedoptimization of an oil reservoir

Andrea Capolei, Carsten Volcker, Jan Frydendall, John BagterpJørgensen

Department of Informatics and Mathematical ModelingTechnical University of Denmark

17th Nordic Process Control Workshop26th of January, 2012

1 / 23

Outline

1 Introduction

2 Optimal Control ProblemSingle Shooting Optimization

3 ESDIRK integration methods

4 Continuous Adjoint Method

5 Production Optimization for a Conventional Oil Field

6 Conclusions

2 / 23

Introduction

Increasing Oil demand

0

100

90

70

80

20

50

40

30

60

10

Asia Pacific Africa Middle East Europe & Eurasia S. & Cent. America North America

85 9590 0500 10

Production by regionMillion barrels daily

0

100

90

70

80

20

50

40

30

60

10

85 9590 0500 10

Consumption by regionMillion barrels daily

(from BP statistical review 2011)

3 / 23

Introduction

An Offshore Oil Reservoir

4 / 23

Introduction

Closed-loop reservoir management

(after Jansen 2005)

5 / 23

Introduction

Water Flooding Modeled by a Two-Phase Flow Model

The mass conservation of water (i ≡ w) andoil (i ≡ o)

∂tCi(Pi, Si) = −∇ · Fi(Pi, Si) +Qi

The mass concentrations

Ci = φρi(Pi)Si

Fluxes through the porous medium

Fi = ρi(Pi)ui(Pi, Si)

Darcy’s law

ui(Pi, Si) = −Kkri(Si)

µi

(∇Pi − ρi(Pi)g∇z

)

1 2

3 4

kmin

:0.024 Darcy, kmax

:11.312 Darcy

log 10

(K)

(D

arcy

)

−1.5

−1

−0.5

0

0.5

1

A general formulation of thetwo-phase flow problem

d

dtg(x(t)) = f(x(t), u(t))

6 / 23

Optimal Control Problem

Continuous form

Consider the continuous-time constrained optimal control problem in theBolza form

minx(t),u(t)

J = Φ(x(tb)) +

∫ tb

ta

Φ(x(t), u(t))dt (1a)

subject to

x(ta) = x0 (1b)

d

dtg(x(t)

)= f(x(t), u(t)), t ∈ [ta, tb], (1c)

u(t) ∈ U(t) (1d)

x(t) ∈ Rnx is the state vector and u(t) ∈ Rnu is the control vector. Thetime interval I = [ta, tb] as well as the initial state, x0, are assumed to befixed.

7 / 23

Optimal Control Problem

Path constraints

Path constraintsη(x(t), u(t)) ≥ 0 (2)

are included as soft constraints using the following smooth approximation

χi(x(t), u(t)) =1

2

(√ηi(x(t), u(t))2 + βi

2 − ηi(x(t), u(t)

)(3)

to the exact penalty function max(0,−ηi(x(t))) for i ∈ {1, . . . , nη}.Withthis approximation of the path constraints, the resulting stage cost,Φ(x(t), u(t)), used in (11) consist of the inherent stage cost,Φ(x(t), u(t)), and terms penalizing violation of the path constraints (2)

Φ(x, u) = Φ(x, u) + ‖χ(x, u)‖1,Q1 +1

2‖χ(x, u)‖22,Q2

(4)

8 / 23

Optimal Control Problem

Single Shooting Discretization

We introduce the function

ψ({uk}N−1k=0 , x0) =

{J =

∫ tb

ta

Φ(x(t), u(t))dt+ Φ(x(tb)) : x(t0) = x0,

d

dtg(x(t)) = f(x(t), u(t)), ta ≤ t ≤ tb,

u(t) = uk, tk ≤ t < tk+1, k ∈ N = 0, .., N − 1

}(5)

such that (1) can be approximated with the finite dimensional constrainedoptimization problem

miny:={uk}N−1

k=0

ψ = ψ(y, x0) (6a)

s.t. umin ≤ uk ≤ umax k ∈ N (6b)

∆umin ≤ ∆uk ≤ ∆umax k ∈ N (6c)

ck(uk) ≥ 0 k ∈ N (6d)

with N = {0, 1, . . . , N − 1}.9 / 23

Optimal Control Problem

Sequential Quadratic Programming

We solve the NLP (6) iteratively improving a given estimate yi of thesolution by

yi+1 = yi + αipi (7)

where αi (0 < α ≤ 1) is determined by a linesearch (LS) strategy based onPowell’s exact l1-merit function. The search direction pi is given by solvingthe KKT solution (pi, λi, µi) of a quadratic approximation to (6)

minp

1

2p′H ip′ +∇ψ(yi)′p

s.t ∇h(yi)′p = −h(yi)

∇c(yi) ≥ −c(yi)

(8)

where H i ∈ Rn×n is an approximation for the Hessian ∇2yL of the

lagrangian function L(y, λ, µ) = ψ(y)− λh(y)− µc(y) which starting froman initial estimate H0, is updated after every step using BFGS.

10 / 23

ESDIRK integration methods

Runge-Kutta ESDIRK Methods

We use an embeddedESDIRK method

0 0c2 a21 γc3 a31 a32 γ...

.... . .

1 b1 b2 b3 · · · γ

xn+1 b1 b2 b3 · · · γ

xn+1 b1 b2 b3 · · · bs

1 Solve implicit system

Ti = tn + hnci, i ∈ 2, . . . , s

g(Xi) = g(xn) + hn

s∑j=1

aijf(Tj , Xj , u)

2 Compute xn+1 = Xs

3 Compute the error/tolerance ratio

en+1 = g(xn+1)− g(xn+1)

= hn

s∑j=1

(bj − bj)f(Tj , Xj , u)

rn+1 =1√nx

∥∥∥∥ en+1

atol + |g(xn+1)|rtol

∥∥∥∥2

11 / 23

ESDIRK integration methods

Temporal step size controller performance

(after Volcker 2010)

12 / 23

Continuous Adjoint Method

Proposition (Gradients based on Continuous Adjoints)

Consider the function ψ = ψ({uk}N−1k=0 ;x0) defined by (5).The gradients, ∂ψ/∂uk, may be computed as

∂ψ

∂uk=

∫ tk+1

tk

(∂Φ

∂u− λT ∂f

∂u

)dt k = 0, 1, . . . , N − 1 (9)

in which x(t) is computed by solution of (1b)-(1c) and λ(t) is computedby solution of the adjoint equations

dλT

dt

∂g

∂x+ λT

∂f

∂x− ∂Φ

∂x= 0 (10a)

∂Φ

∂x(x(tb)) + λT (tb)

∂g

∂x(x(tb)) = 0 (10b)

Remember that the dynamic model is given as

d

dtg(x(t)) = f(x(t), u(t))

13 / 23

Production Optimization for a Conventional Oil Field

Test case for waterflooding optimization

squared reservoir of size 450m × 450m × 10muniform cartesian grid of 25x25x1 grid blocksno flow boundaries, 4 injectors and 1 producer (rate controlled)We maximize an economic value for different discount factorsb ∈ 0, 0.06, 0.12

minx(t),u(t)

J(tb) = −NPV(tb) =

∫ tb

ta

Φ(x(t), u(t))dt

Φ = − 1

(1 + b)t/365

∑j∈P

(ro(1− fw,j)− fw,jrw) qj(t)(11)

where fw = λw/(λw + λo), λi = ρikkri/µi, i ∈ {w, o}

1 2

3 4

kmin

:0.024 Darcy, kmax

:11.312 Darcy

log 10

(K)

(D

arcy

)

−1.5

−1

−0.5

0

0.5

1

14 / 23

Production Optimization for a Conventional Oil Field

Constraints

The manipulated variable at time period k ∈ N is

uk = {{qw,i,k}i∈I , {qi,k}i∈P} (12)

with I being the set of injectors and P being the set of producers.

qw,i,k injection rate (m3/day) of water at injector i ∈ Iqi,k total flow rate (m3/day) at producer i ∈ P

Bound constraints

0 ≤ qw,i,k ≤ qmax i ∈ I, k ∈ N (13a)

0 ≤ qi,k ≤ qmax i ∈ P, k ∈ N (13b)

Rate constraints

|qi,k − qi,k−1| ≤ 5 i ∈ I ∪ P, k ∈ N (14a)

|qw,i,k − qw,i,k−1| ≤ 5 i ∈ I, k ∈ N (14b)

15 / 23

Production Optimization for a Conventional Oil Field

Constraints (2)

voidage replacement constraint∑i∈I

qi,k =∑i∈I

qw,i,k =∑i∈P

qi,k k ∈ N (15)

total injection constraint∑i∈I

qw,i,k = qmax k ∈ N (16)

We set qmax = 100 m3/day, tb = 4270 days, Ts = 35 days henceN = 122 periods.

Injection of 1.05 pore volume during operation of the reservoir

We consider as a reference case a fixed water injection of 100/4 = 25m3/day from each injector.

The prediction horizon tb is optimal in the reference case16 / 23

Production Optimization for a Conventional Oil Field

Optimal solution

TIME: 1050 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

TIME: 2135 (Day)

xy

200 400

100

200

300

400

0.2

0.4

0.6

0.8

TIME: 3220 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

TIME: 4270 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

(a) Optimal solution (b = 0).

TIME: 1050 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

TIME: 2135 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

TIME: 3220 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

TIME: 4270 (Day)

x

y

200 400

100

200

300

400

0.2

0.4

0.6

0.8

(b) Reference solution.

Oil saturations at different times for the optimal solution and the referencesolution.

17 / 23

Production Optimization for a Conventional Oil Field

Cumulative oil and water production for different discountfactors

0 500 1000 1500 2000 2500 3000 3500 40000

0.5

1

1.5

2

2.5

3x 10

5

TIME (DAY)

CU

MU

LAT

IVE

PR

OD

UC

TIO

N (

m3 )

opt oilref oilopt waterref water

(a) Discount factor b = 0.

0 500 1000 1500 2000 2500 3000 3500 40000

0.5

1

1.5

2

2.5

3x 10

5

TIME (DAY)

CU

MU

LAT

IVE

PR

OD

UC

TIO

N (

m3 )

opt oilref oilopt waterref water

(b) Discount factor b =0.06.

0 500 1000 1500 2000 2500 3000 3500 40000

0.5

1

1.5

2

2.5

3x 10

5

TIME (DAY)

CU

MU

LAT

IVE

PR

OD

UC

TIO

N (

m3 )

opt oilref oilopt waterref water

(c) Discount factor b =0.12.

Cumulative oil and water productions for different discount factors, b.

18 / 23

Production Optimization for a Conventional Oil Field

NPV, Water cut, Water fraction

0 500 1000 1500 2000 2500 3000 3500 40000

5

10

15

20

25

30

days

Mill

ion

dolla

rs

opt. b=0ref. b=0opt. b=0.06ref. b=0.06opt. b=0.12ref. b=0.12

(a) NPV.

0 500 1000 1500 2000 2500 3000 3500 40000

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

days

opt. b=0opt. b=0.06opt. b=0.12reference

(b) Water cut.

0 500 1000 1500 2000 2500 3000 3500 40000

0.2

0.4

0.6

0.8

1

days

opt. b=0opt. b=0.06opt. b=0.12reference

(c) Water fraction (kg wa-ter/kg fluid).

The net present value (NPV), water cut (accumulated water production perproduced fluid), and the water fraction as function of time for the scenariosconsidered.

19 / 23

Production Optimization for a Conventional Oil Field

Optimal input trajectories

0 1000 2000 3000 40000

50

100

inje

ctor

1 (

m3 /d

ay)

time t (Days)0 1000 2000 3000 4000

0

50

100

inje

ctor

2 (

m3 /d

ay)

time t (Days)

0 1000 2000 3000 40000

50

100in

ject

or 3

(m

3 /day

)

time t (Days)

0 1000 2000 3000 40000

50

100

inje

ctor

4 (

m3 /d

ay)

time t (Days)

b=0b=0.06b=0.12reference

Optimal water injection rates for different discount factors, b.

20 / 23

Production Optimization for a Conventional Oil Field

Improvement table

Table: Key indicators for the optimized cases. Improvements are compared to thebase case.

b NPV ∆NPV Cum. Oil ∆Oil Cum. water ∆Water106 USD % 105 m3 % 105 m3 %

0 28.0 +8.7 3.05 +6.5 0.122 −13.20.06 22.1 +5.6 3.01 +5.2 0.126 −10.50.12 18.3 +4.8 2.98 +4.1 0.129 −8.2

b Oil Rec. factor ∆Oil Rec. factor% %-point

0 83.7 +5.20.06 82.6 +4.10.12 81.7 +3.2

21 / 23

Conclusions

Conclusions

A novel algorithm for large scale optimal control based on

a novel formulation of the differential equations

an ESDIRK method for integration of differential equations

the continuous adjoint method for gradient computation

the SQP method for optimization

the single shooting principle

This algorithm is applied for production optimization of oil reservoirs. Forthis field, optimal control improves the NPV by 8.7%.

Optimal control and nonlinear model predictive control can potentiallyhave a very big impact in oil reservoir management.

22 / 23

Conclusions

Acknowledgement

The Center for Energy Resources Engineering Consortiumwww.cere.dtu.dk

The Danish Research Council for Technology and Production Sciences, FTP Grant no 274-06-0284

23 / 23