Uncertainty quantification in inverse problems with multiscale models. Applications to porous media Yalchin Efendiev Department of Mathematics & ISC Texas A&M University Collaborators: A. Datta-Gupta (TAMU), P. Dostert (Arizona), T. Hou (Caltech), B. Mallick (TAMU), A. Mondal (TAMU) Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.1/27 Introduction • We consider a problem of characterizing subsurface properties given “coarse-scale” measurements. • Subsurface properties are highly heterogeneous with uncertainties at “small” scales that can affect the measurement results. 9 3 8 2 7 6 1 5 0 4 3 −1 2 −2 1 0 −3 −1 • The relation between the input (subsurface properties in this talk) and the output (e.g., oil production rate) is highly nonlinear. • Inverse problem in a Bayesian framework (uncertainty quantification in inverse problems, ...): P (k|D) ∝ P (D|k)P (k), where k(x) represents the subsurface property (permeability, e.g.). Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.2/27 Illustration Fractional Flows 1 Exact Sampled 0.8 F 0.6 0.4 0.2 0 0 0.5 1 PVI 1.5 2 Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.3/27 Prototypical model We consider two-phase flow in a heterogeneous porous formation under the assumption that the displacement is dominated by viscous effects. ∇ · (λ(S)k∇p) = h, ∂S + v · ∇f (S) = 0, v = −λ(S)k∇p. ∂t Measured data: F (t) = R out R vf (S)dl out vdl F(t) Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.4/27 Problem setting • Given the fractional flow information (integrated response) F (t) and some precision, we would like to sample k from P (k|F ). • From Bayes theorem P (k|F ) ∝ P (F |k)P (k). • Here P (k) is the prior information, P (F |k) is the likelihood and assumed given by P (F |k) = exp(− kFk (t)−F obs (t)k2 ). 2 σf 2 obs )k • Priors can be (1) P (k) = exp(− k log(k)−log(k ) (2) covariance matrix is given σ2 k (3) with unknown parameters in the covariance matrix (4) ... Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.5/27 Difficulties • • π(k) = P (k|F ) can be multi-modal and high dimensional. π(k) = P (k|F ) is not given analytically and involves the solution of nonlinear pde system. P k Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.6/27 Sampling Algorithm (Metropolis-Hastings MCMC) • Step 1. At kn generate k from q(k|kn ). • Step 2. Accept k as a sample with probability „ q(kn |k)π(k) p(kn , k) = min 1, q(k|kn )π(kn ) « , i.e. kn+1 = k with probability p(kn , k), and kn+1 = kn with probability 1 − p(kn , k). Here π(k) is the distribution we would like to sample. • Direct (full) MCMC simulations are usually prohibitively expensive, because each proposal requires a fine-scale computation. • We use algorithms where the proposal distribution is modified using coarse-scale spatial models. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.7/27 Priors 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 00000000000000000000000000000000000000000000000 11111111111111111111111111111111111111111111111 0000 1111 0000 1111 0000 1111 Facies 2 0000 Facies 1 1111 0000 1111 0000 1111 • Interface modeling with level sets (τ = const) ∂τ + w · ∇τ = 0, ∂s where w is a random vector field. In simulations, we assume that the direction of the velocity field is fixed. • Within each region, two-point correlation based log-permeability fields are used, i.e., R(x, y) = E(Y (x, ω)Y (y, ω)) is given, where Y (x, ω) = log(k(x, ω)). Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.8/27 Priors removed interface segments existing points existing interface added interface segments updated interface new point updated points • Discretization of the interface is done with variable number of points that have unknown locations. • Discretization of permeability field in each region is done with Karhunen-Loéve √ expansion, Y (x, ω) = P θi (ω) λi φi (x). • Permeability is conditioned at some locations (well locations). 0.35 2 0.8 normal exponential 1.5 10 0.3 1.5 0.6 1 20 1 eigenvalue 0.25 0.4 0.5 30 0.2 0.5 0.2 40 0 0 0 0.15 50 0.1 −0.5 −0.5 −0.2 60 −1 −1 0.05 −0.4 70 −1.5 −1.5 0 −0.6 80 0 10 20 30 40 50 5 10 15 20 25 −2 numeration Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.9/27 Proposal distributions removed interface segments existing points existing interface added interface segments updated interface new point updated points An illustration of the Birth, Death and Jump process in Reversible Jump MCMC for an interface. • Permeability within a region (k(x) → Y (x) = log(k(x)) → θi (ω)) is proposed either using random walk sampler or Langevin. • Forward models based on pde’s allow computing the gradients of the posterior. • Langevin proposals are derived from the solution of dk(τ ) = 1 ∇ log π(k(τ ))dτ 2 + dWτ . It is given by √ ∆τ Y = kn + ∇ log π(kn ) + ∆τ ǫn . 2 Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.10/27 Langevin Algorithms The transition distribution of the proposal is q(Y |kn ) ∝ exp q(kn |Y ) ∝ exp − kY − kn − − kkn − Y − ∆τ 2 ∇ log π(kn )k2 ! , )k2 ! . 2∆τ ∆τ 2 ∇ log π(Y 2∆τ Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.11/27 Multiscale spatio-temporal models • In multiscale simulations, we attempt to represent the solution on a coarse grid. • Multiscale basis functions (or similarly upscaled quantities) are pre-computed on a coarse grid. The objective is to solve the problems on a coarse grid. • Example: the solution p(x) defined on 100 × 100 fine grid is written as P50 Multiscale basis functions are computed such that it captures the local variations of the solution. • Ensemble level multiscale methods: p(x, ω) ≈ P50 i=1 ci φi (x, ω). p(x) ≈ i=1 ci φi (x). • Some details can be found, e.g., Efendiev and Hou, Multiscale finite element methods. Theory and Applications. Springer, 2009 Coarse−grid Fine−grid Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.12/27 A simple example Exact solution Basis 0.3 1.2 1 0.2 0.8 0.15 0.6 0.1 0.4 3 2 1 uε 0.25 φ φ φ −(aε(x) u’ε)’=1 0.05 0.2 0 0 −0.05 0 0.2 0.4 0.6 x 0.8 1 −0.2 0 0.2 0.4 0.6 0.8 1 x (aǫ (x)u′ )′ = −1, u(0) = u(1) = 0, aǫ (x) = 1/(2 + 1.99 cos(x/ǫ)), ǫ = 0.01. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.13/27 Gridding Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.14/27 The use of multiscale models • π(k) = P (k|F ) ∝ P (F |k)P (k), where P (F |k) = exp(− kFk (t)−F obs (t)k2 ). 2 σf • Based on off-line computations (fine vs. coarse), one can determine a statistical relation kFk (t) − Fobs (t)k ≈ G(kFk∗ (t) − F obs (t)k) + N oise. (error modeling, e.g., J. Glimm, M. Christie, ...) • A simplest relation is a linear relation G(x) = ax. ∗ • Introduce π∗ (k) ∝ exp(− G(kFk (t)−F σ2 obs (t)k)2 )P (k). f 5 3 3 2.5 Fine error (rescaled) 2.5 E* k 2 1.5 1 0.5 0 x 10 mean+std mean−std mean data 2 1.5 1 0.5 0 0 0.5 1 1.5 2 Ek 2.5 3 3.5 −0.5 0 2 4 6 Coarse error (rescaled) 8 10 4 x 10 Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.15/27 Preconditioned coarse-gradient Langevin algorithm (1) Make a proposal (birth/death for an interface point; move the interface; populate spatial features based on “coarse gradients”); (2) run the coarse-scale simulation code and check the “appropriateness” of the sample; (3) run the “fine-scale” simulation. • Step 1. At kn , generate a trial proposal Y from the coarse Langevin distribution q ∗ (Y |kn ). • Step 2. Take the proposal k as k= ( k̃ kn with probability αp (kn , k̃), with probability 1 − αp (kn , k̃), where αp (kn , k̃) = min 1, q(kn |k̃)π ∗ (k̃) q(k̃|kn )π ∗ (kn ) ! . Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.16/27 Preconditioned coarse-gradient Langevin algorithm • If we are at Birth Step n P ∗ (F |k̃) P (τ )P (θ)P (xloc |mn + 1)P (mn + 1) obs αp (kn , k̃) = min 1, ∗ × P (Fobs |kn ) P (τn )P (θn )P (xloc n |mn )P (mn ) | {z } | {z } likelihood ratio prior ratio qθ (θn |θ)pdel mn +1 ˛ ∂g ˛o loc ˛ mn m (xn , u) ˛ × ×˛ ˛ . add loc loc qθ (θ|θn )pmn qmn mn +1 (u|xn ) ∂xn ∂u {z } {z } | | Jacobian proposal ratio ........ • Step 3. Accept k as a sample with probability „ Q(kn |k)π(k) ρ(kn , k) = min 1, Q(k|kn )π(kn ) « , where Q is the effective proposal distribution. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.17/27 Convergence of modified Markov Chain Denote ˘ ¯ E = k; π(k) > [0] , ˘ ¯ E ∗ = k; π ∗ (k) > [0] , ˘ ¯ D = k; q(k|kn ) > [0] for some kn ∈ E , To sample from π(k) correctly, it is necessary that E ⊆ E ∗ . Otherwise, there will exist a subset A ⊂ (E \ E ∗ ) such that π(A) = Z A π(x)dx > 0 and π ∗ (A) = Z π ∗ (x)dx = 0. A As a result, the chain {kn } will never visit (sample from) A since the element of A will never be accepted for fine-scale run in Step 2. For the same reason, we should require that E ⊆ Ω. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.18/27 A remark • If π∗ (k) is a smooth surface, then instead of using π∗ (k), it can be interpolated employing sparse collocation techniques ∗ π̃ = X π ∗ (ki )Li (k), i where ki are sparse collocation points and Li (k) are polynomials (P. Dostert et al., 2007). • Some analysis of MH in the homogenization setting can be carried out. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.19/27 Numerical Results −3 −3 2 −2 −1 π* 0 2 1.5 θ θ 2 −1 2 −2 1.5 π 0 1 1 1 0.5 2 3 −3 1 −2 −1 0 θ1 1 2 3 0.5 2 3 −3 −2 −1 0 θ1 1 2 3 Left: Coarse-scale response surface π ∗ restricted to a 2-D hyperplane. Right: Fine-scale response surface π restricted to the same 2-D hyperplane. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.20/27 Numerical Results 0.75 12 precond coarse Langevin 11x11 interp precond coarse Langevin 11x11 11.5 CPU Time (log scale) Acceptance Percentage 0.7 0.65 0.6 0.55 0.5 11 10.5 10 9.5 0.45 9 0.4 8.5 0.001 0.003 σ2 c 0.006 precond coarse Langevin 11x11 interp precond coarse Langevin 11x11 0.001 0.003 σ2 c 0.006 Left: Acceptance rate comparison. Right: Natural log of CPU time (seconds) comparison. In each plot we use δ = 0.05 and σf2 = 0.001. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.21/27 Numerical Results 0.1 Fractional Flows Interpolated Langevin coarse scale Langevin 1 0.8 0.06 0.6 F Avg FF error 0.08 Exact Sampled 0.04 0.4 0.02 0.2 0 0 20 40 60 Accepted Trials 80 100 0 0 0.5 1 PVI 1.5 2 Left: The fractional flow errors for coarse Langevin compared with interpolated Langevin. Right: The fractional flows of sampled realizations and the reference fractional flow. In these numerical tests, δ = 0.05, σf2 = 0.001. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.22/27 Numerical results Upper left plot is the reference conductivity. The other three plots are examples of accepted conductivity realizations. Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.23/27 Numerical results reference initial 4 3 2 1 0 −1 realization 2 0 realization 3 2 1 0 −1 3 2 1 0 −1 realization realization 3 2 1 0 −1 3 2 1 0 −1 median mean 2 0 −2 2 0 −2 Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.24/27 2 3 1.8 2.5 1.6 1.4 2 k E* E* k 1.2 1 1.5 0.8 1 0.6 0.4 0.5 0.2 0 0 0.5 1 1.5 Ek 2 2.5 0 3 0 0.5 1 1.5 2 Ek 24-1 2.5 3 3.5 Numerical results Fractional flow error vs iterations 0.8 full RCMCMC two−stage RJMCMC with three blocks in coarse scale two−stage RJMCMC with nine blocks in coarse scale 0.7 fractional flow error 0.6 0.5 0.4 0.3 0.2 0.1 0 0 20 40 60 80 accepted iterations 100 120 Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.25/27 Numerical results reference initial 3 2 1 0 realization 3 2 1 0 realization 3 2 1 0 realization 3 2 1 0 realization 3 2 1 0 3 2 1 0 median mean 3 2 1 0 3 2 1 0 Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.26/27 Conclusions • Direct sampling using MH MCMC approaches is expensive • Coarse gradient information and inexpensive coarse-scale models can be used to speed-up the simulations • Numerical results demonstrate CPU time can be reduced by two orders of magnitude. • Models at different scales with weights can be also used. • Other representations for modeling interfaces • ... Uncertainty quantification in inverse problems with multiscale models. Applications to porous media – p.27/27