1 Introduction

Optimization of reservoir management or field development under uncertainty is typically expensive. Since the true reservoir properties are unknowable, in most cases one optimizes the expected value of some desirable objective instead of the objective value itself. A straightforward approach to optimizing the expected value is to repeatedly apply the controls to all members in an ensemble of model realizations to determine the controls that are best on average. This approach is costly, however, if the number of model realizations required for the characterization of uncertainty is large. In many petroleum applications, in which the optimization is performed after history matching, the size of the ensemble is determined by the size needed for the data assimilation method. A typical ensemble size is on the order of 100. Because of the high cost of a standard Monte Carlo approach, there is a need for less expensive alternative approaches.

The objective function evaluated at the mean of the permeability field has been used a number of times for optimal reservoir management as a surrogate for the computation of the mean of the objective functions, usually without comment on the validity of the approximation (Brouwer et al. 2004; Nævdal et al. 2006; Chen et al. 2010), although Nævdal et al. (2006) justified its use as an approximation of the true model, while others (Wang et al. 2009; Chen et al. 2010) simply argued that it was impractical to use the whole ensemble of geological models for robust optimization. Alexanderian et al. (2017) provide mathematical motivation for a mean model approach in optimization under uncertainty and derive an approximate quadratic bias correction term for the case where the objective function is of quadratic form. In the special case for which the objective function is a linear function of the uncertain model parameters, the authors note that the mean model provides unbiased estimates of the mean of the objective function. As the net present value is a linear function of oil price, this implies that the mean oil price schedule could be used instead of an ensemble of realizations of oil price schedules, as noted by others (Siraj et al. 2015).

More recently, Wang and Oliver (2021) used the mean model with a type of multiplicative bias correction for the optimization of the drilling schedule of a synthetic but realistic three-dimensional field model. For the field-scale optimization problem, the mean model was computed using the arithmetic mean of porosity, the geometric mean of fault transmissibility, and the geometric mean of permeability. In their investigation using a field-scale example, optimization of the drilling order for the mean model gave identical results to those obtained when bias correction was applied.

Bias correction will typically be required when the optimal solution obtained using the mean model is substantially different from the optimal solution obtained using the full ensemble of model realizations for optimization of the expectation of the objective function. The fact that the mean model is a biased estimator of the objective function evaluated on the ensemble of model realizations is not in itself an argument for the introduction of bias correction. It is only when the bias correction is nonstationary that it will affect the result from minimization.

1.1 How to Optimize Controls on the Mean Model Most Effectively?

It has become common for the uncertainty in reservoir model properties to be represented by an ensemble of samples of the reservoir properties conditioned to observations. This approach has been especially popular since the introduction of ensemble methods of history matching based on the ensemble Kalman filter (Evensen 1994; Oliver and Chen 2011). Optimization of the sample average approximation of the expected value of an objective function is then often performed using a stochastic estimate of the gradient (Chen et al. 2009; Fonseca et al. 2014). This approach can be fairly efficient, although the accuracy of the gradient approximation is sometimes poor and convergence can be slow. If one needed to optimize controls on the mean model, the use of a stochastic gradient estimator would probably not be the most efficient approach. If the adjoint system for the reservoir simulation equations is available, then an accurate gradient can be computed at a cost somewhat less than the cost of a reservoir simulation. This approach was used by Chen et al. (2010) for the computation of the optimal controls of the Brugge benchmark optimization case (Peters et al. 2010).

When an adjoint system for gradient estimation is not available, or when the objective function is noisy, derivative-free optimization (DFO) methods provide useful, and sometimes superior, alternatives (Larson et al. 2019). Note that the term “derivative-free” does not imply that gradients are not approximated from function evaluations. The family of DFO methods includes methods such as ensemble-based optimization (EnOpt) (Chen et al. 2009) and stochastic simplex approximate gradient (StoSAG) optimization (Fonseca et al. 2014).

Moré and Wild tested various DFO algorithms on a set of 53 benchmark optimization problems. The dimension of the optimization space in the test problems was relatively small for most problems (median dimension was 7), although the largest problem had dimension 100. Three problem classes were investigated: smooth, piecewise smooth, and noisy objective functions. Algorithms were evaluated based on the fraction of the optimization problems that could be solved to specified accuracy within a given computational budget. The highest-ranking DFO method was a function-interpolating trust region method developed by Powell (2006), in which a quadratic model of the objective function is fit to \(2n+1\) evaluation points (n is the number of control variables). Note that a full quadratic model requires \((n+1)(n+2)/2\) coefficients. At each successful iteration, a better solution is added to the interpolation set, and the “worst” solution is dropped. One of the primary benefits of the function-interpolating trust region methods is the efficiency gained by the reuse of sample points from previous iterations (Berahas et al. 2022). Finally, function-interpolating trust region methods tend to be more robust in the presence of noise than other techniques for DFO, and much more robust than gradient-based methods (Berahas et al. 2019; Shi et al. 2023). Although the number of function evaluations scales linearly with the size of the optimization problem, the complexity of the quadratic model fitting may be the limiting factor in its application, as the number of operations required for fitting the quadratic model even in an efficient implementation scales as \(\mathcal {O}(n^4)\) (Conn et al. 2009).

The application of a function-interpolating trust region method to the problem of minimization of the mean model is straightforward. Its application to the optimization of a well placement problem without uncertainty is discussed in depth by Forouzanfar and Reynolds (2013). Freely available software codes exist for solving both the unconstrained optimization problem (Powell 2006; Ragonneau and Zhang 2023) and the bound constraint optimization problem (Powell 2009; Cartis et al. 2019). When bias correction is used with the model, the usefulness of available software for minimization is not as clear. The challenge for optimization with bias correction is that in the function-interpolating trust region method, function evaluations are reused in later iterations, but their values must be changed if the bias correction is updated. Thus, when the bias correction is continuously updated, the modifications to parts of the minimization code can be substantial.

1.2 Organization of Paper

The focus of this paper is on the problem of optimization of controls on expensive models whose properties are uncertain but which are represented by an ensemble of randomly sampled realizations. In Sect. 2.1, we briefly discuss the meaning of the mean model and the implications of the choice of transformation of property values before computation of the mean. Use of the mean model for optimization will generally give incorrect results, so in Sect. 2.2, a methodology for the correction of bias is described. Because the model of bias is somewhat tedious, details for computing bias correction are reserved for Appendix A and Appendix B. In Sect. 2.5, we describe a modified DFO method that allows sequential updating of the bias correction for the objective function computed using the mean model. The modified DFO method with sequential bias correction is applied to a one-dimensional well location problem for porous media flow in Sect. 3.1. The same problem is also used to illustrate the effect of various choices for the mean model on the magnitude of the bias and on the error in the estimation of the optimal location of the well when bias correction is not used. In Sect. 3.2, a second numerical optimization problem is introduced. In this example, the realizations of the uncertain permeability field are discontinuous and the flow is two-dimensional and two-phase. A modified approach to bias correction estimation is introduced in which the bias correction estimation begins only after solving the optimization problem using the mean model, leading to a more efficient solution method.

2 Methodology

2.1 Computation of the Mean Model

One challenge with the application of the mean model approach to optimization under uncertainty is the definition of the mean model. In subsurface models, a property such as permeability appears as a spatially varying coefficient in the partial differential equations describing fluid flow and is required as an input to the numerical reservoir flow stimulator. It might seem sensible to define the mean model as the arithmetic mean of the ensemble of permeability fields. In ensemble-based data assimilation, however, it is common to update the log permeability fields and to use the mean of the logarithm of permeability for the estimation of the gradient. In this case, it would seem that the sensible thing is to use the geometric mean of the ensemble of permeability fields or, equivalently, the arithmetic mean of the log permeability fields. Additionally, we note that the harmonic mean is useful when computing the effective permeability of beds in series. The Box–Cox transformations (Box and Cox 1964) provide a continuum of transformations that can be applied to a property field before computing the mean.

$$\begin{aligned} m_\lambda = {\left\{ \begin{array}{ll} (x^\lambda -1)/\lambda &{} \hbox { if}\ \lambda \ne 0 \\ \log x &{} \hbox { if}\ \lambda = 0. \end{array}\right. } \end{aligned}$$
(1)

The arithmetic mean of the property field corresponds to the use of \(\lambda = 1\), the geometric mean corresponds to the use of \(\lambda = 0\) (also referred to as the mean of the log property field), and the harmonic mean corresponds to the use of \(\lambda = -1\). The consequences of applying various transformations before computing the mean model on the magnitude of the bias in a simple porous media flow problem are illustrated in Sect. 3.1. Note that while there may be a so-called optimal definition of the mean model for most problems, the use of the optimally selected mean model is not necessary for the success of the minimization if bias correction is used. A good choice of mean model (or transformation) can, however, make the bias correction easier to estimate with a small number of function evaluations.

2.2 Estimation of Bias in Predictions from the Mean Model

The expected value of the objective function f when control u is applied and the properties of the model m are uncertain can be written as

$$\begin{aligned} E[f(u,m)] \approx {\bar{f}}(u) = \frac{1}{N_e} \sum ^{N_e}_{j=1}f(u, m_j), \end{aligned}$$
(2)

where \(m \in \mathcal {R}^m\) is an m-dimensional vector of uncertain model parameters, j is the index of individual model realizations, and \(N_e\) indicates the number of reservoir models. Note that we will assume that the sample average approximation (SAA) of the expectation is the true objective function, although if \(N_e\) is small, it is likely that the optimal controls for one SAA might be considerably different from the optimal controls on another.

For objective functions that are linear in the uncertain parameters \(m_j\),

$$\begin{aligned} {\bar{f}}(u) = f \left( u, \frac{1}{N_e} \sum ^{N_e}_{j=1} m_j \right) = f \left( u, {\bar{m}} \right) , \end{aligned}$$

in which case the use of the mean model for optimization without bias correction is justified. For most reservoir management optimization problems of practical interest, however, the relationships will not be linear. In those cases, we define an additive bias correction \(\alpha \) to correct for the use of the mean model instead of the mean of the objectives. (Note that Wang and Oliver (2021) used a multiplicative correction. The additive bias correction avoids the potential problem in which the objective function takes the value 0.) The bias correction will generally be a function of the value of the control variable u at which it is evaluated.

The bias correction at u is defined as the difference between the objective function obtained from evaluation on the mean model and the SAA of the objective function obtained from evaluation on an ensemble of model realizations

$$\begin{aligned} \begin{aligned} \alpha (u)&= {\bar{f}}(u) - f(u,\bar{m}) \\&= \frac{1}{N_e} \sum _{j=1}^{N_e} \left[ f(u,m^j) - f(u,\bar{m}) \right] \\&= \sum _{j=1}^{N_e} \frac{1}{N_e} \textbf{b}_{j}(u), \end{aligned} \end{aligned}$$
(3)

and we refer to the difference between the value of the objective function when applied to a single model realization and to the mean model, \(\textbf{b}_{j}(u) = f(u,m^j) - f(u,\bar{m}) \), as the partial additive bias correction at u for model realization j.

For simplicity of exposition, we consider the case for which the control variable u can only assume a finite number of values \(u \in (u_1, \ldots u_{N_u})\). Examples with a finite number of control variable settings include the problem of determining the optimal grid cell location of a well and the optimal drilling order. When the number of possible values for the control variable is not finite, or when it is very large, then we simply include the values at which the objective function has been evaluated. We then define the vector of all partial correction factors \(\textbf{b}_j\) for model realization \(m_j\) and the vector of bias correction factors \(\alpha _i\) for each possible control variable value \(u_i\)

$$\begin{aligned} \textbf{b}_j = \begin{bmatrix} \beta _{1j} \\ \beta _{2j} \\ \vdots \\ \beta _{N_u j} \end{bmatrix}, \quad \varvec{\alpha } = \begin{bmatrix} \alpha _{1} \\ \alpha _{2} \\ \vdots \\ \alpha _{N_u} \end{bmatrix}, \end{aligned}$$
(4)

and similarly define the array of all partial bias correction factors \(\textbf{b}\)

$$\begin{aligned} \textbf{b} = \begin{bmatrix} \textbf{b}_1&\textbf{b}_2&\ldots&\textbf{b}_{N_e} \end{bmatrix} = \begin{bmatrix} \beta _{11} &{} \beta _{12} &{} \ldots &{} \beta _{1N_e} \\ \beta _{21} &{} \beta _{22} &{} \ldots &{} \beta _{2N_e} \\ \vdots &{} \vdots &{} &{} \vdots \\ \beta _{N_u 1} &{} \beta _{N_u 2} &{} \ldots &{} \beta _{N_u N_e} \end{bmatrix}. \end{aligned}$$
(5)

The bias correction function (needed for optimization using the mean model) is the average of all partial bias correction functions, thus rewriting (3) in vector notation

$$\begin{aligned} \varvec{\alpha } = \frac{1}{N_e} \textbf{b} \textbf{1}_m, \end{aligned}$$
(6)

where \(\textbf{1}_m\) is a column vector of length \(N_e\), all of whose elements are equal to 1.

To estimate the bias correction, one first needs to “observe” a number of values of the partial bias correction. These are simply the differences between the values of the objective function obtained using model realizations and the values of the objective function obtained using the mean model. The relationship between the estimate of the bias correction factor and the function evaluations of the objective function applied to model realizations is detailed in Appendix A. The bias correction estimation process can be summarized as a sequence of relatively simple steps:

  1. 1.

    Estimate the hyperparameters of the hierarchical distribution for the bias correction as described in Appendix B.

  2. 2.

    Estimate the mean bias \({\bar{\alpha }}\) from the observations of partial corrections using (A14).

  3. 3.

    Estimate the mean of the partial corrections for each of the model realizations, \({\bar{b}}_j\), using (A13).

  4. 4.

    Estimate the partial corrections \(\textbf{b}_j\) for each of the model realizations \(m_j\) using (A7).

  5. 5.

    Finally, estimate the additive bias correction \(\alpha (u)\)

    $$\begin{aligned} \alpha (u) = \frac{1}{N_e} \sum _{j=1}^{N_e} \textbf{b}_j(u). \end{aligned}$$
    (7)

2.3 Error in Bias Correction Estimate

When a trust region method is used for minimization, it is necessary to compute comparisons of the current value of the objective function with the trial value of the objective function,

$$\begin{aligned} f(u_i) - f(u_i + s), \end{aligned}$$
(8)

where s is the trial step. For a bias correction method, both quantities are estimated from the evaluation of the objective function at the mean model and the evaluation of the bias correction. Unless the bias correction term is computed at the trial location using the entire ensemble, it will have a Monte Carlo error due to partial sampling. For efficiency, it is desirable to use as few function evaluations as possible. Therefore, in order to know whether the comparison in (8) can be trusted, an estimate of the variance in the error in \(f(u) - f(u + s)\) is useful.

The quantity that we want to estimate is the uncertainty in the additive bias correction at u and \(u+s\). Since our problem is linear, we need only compute the covariance of \(\varvec{\alpha }\).

$$\begin{aligned} {\text {cov}}\varvec{\alpha } = {\text {cov}}\left( \frac{1}{N_e} \sum _{j=1}^{N_e} \textbf{b}_j \right) . \end{aligned}$$

Neglecting terms in the covariance that involve \(\bar{\varvec{\alpha }}\) or \(\bar{\textbf{b}}\) (as only the difference in values of \(\varvec{\alpha }\) for two distinct control points is of interest),

$$\begin{aligned} \begin{aligned} {\text {cov}}\varvec{\alpha }&\approx \frac{1}{N_e} \sum _{j=1}^{N_e} \left( C_\beta ^{-1} + G_j^{\text {T}} C_D^{-1} G_j \right) ^{-1} \\ {}&= \frac{1}{N_e} \sum _{j=1}^{N_e} \left( C_\beta - C_\beta G^{\text {T}} _j (C_D + G_j C_\beta G_j^{\text {T}} )^{-1} G_j C_\beta \right) \\&= C_\beta - \frac{1}{N_e} \sum _{j=1}^{N_e} \left( C_\beta G^{\text {T}} _j (C_D + C_\beta ^{jj})^{-1} G_j C_\beta \right) , \end{aligned} \end{aligned}$$
(9)

where (A11) has been used to obtain the final result. It is not necessary to compute the entire covariance matrix for \(\varvec{\alpha }\), as only the parts corresponding to locations u and \(u+s\) are required.

2.4 Trial Step Acceptance Test for the Trust Region Method

Note that the variance of the difference between two random variables \(z = x - y\) is

$$\begin{aligned} {\text {var}}(z,z) = {\text {var}}(x-y,x-y) = {\text {var}}(x) + {\text {var}}(y) - 2 {\text {cov}}(x,y). \end{aligned}$$
(10)

In the literature for trust region approaches to optimization of noisy objective functions, it is common to assume that the errors in the estimates of f at two control variables are independent (Chen et al. 2018; Sun and Nocedal 2023). If that is the case, then the variance of the difference is the sum of the variances of the two variables. On the other hand, if the two variables are perfectly correlated, the variance of the difference will be zero. For the problem with mean model minimization with bias correction, the covariance might be expected to be quite small when the controls are similar.

For the optimization problem with bias correction, we require the variance of the difference in \(\alpha \) evaluated at the current best estimate u and the trial estimate \(u+s\)

$$\begin{aligned} {\text {var}}(\alpha (u+s) - \alpha (u) ) = {\text {var}}\alpha (u+s) + {\text {var}}\alpha (u) - {\text {cov}}(\alpha (u+s), \alpha (u) ). \end{aligned}$$
(11)

Let

$$\begin{aligned} H_{u,s} = \begin{bmatrix} 0 &{} 0 &{} \cdots &{} 1 &{} \cdots &{} 0 &{} \cdots &{} 0 \\ 0 &{} 0 &{} \cdots &{} 0 &{} \cdots &{} 1 &{} \cdots &{} 0 \end{bmatrix}, \end{aligned}$$

where all entries are 0 except at the location of the u and \(u+s\) controls. The products

$$\begin{aligned} H_{u,s} C_\beta = \begin{bmatrix} C_\beta ^{u,1} &{} C_\beta ^{u,2} &{} \cdots &{} C_\beta ^{u,N_u} \\ C_\beta ^{u+s,1} &{} C_\beta ^{u+s,2} &{} \cdots &{} C_\beta ^{u+s,N_u} \end{bmatrix}, \end{aligned}$$
(12)

and

$$\begin{aligned} H_{u,s} C_\beta H_{u,s}^{\text {T}} = \begin{bmatrix} C_\beta ^{u,u} &{} C_\beta ^{u,u+s} \\ C_\beta ^{u+s,u} &{} C_\beta ^{u+s,u+s} \end{bmatrix}, \end{aligned}$$
(13)

which can be easily computed from (9), without forming the entire matrix.

Using the method of Sun and Nocedal (2023) to ensure convergence to a minimum for a noisy objective function, we add a relaxation term to the numerator and to the denominator to account for the noise. Note, however, that Sun and Nocedal (2023) assumed that the noise at \(\alpha (u+s)\) is independent of the noise at \(\alpha (u)\), so that the variance in the difference in objective function values is the sum of the two variances. In our application, we have assumed that \(\alpha \) is smoothly varying, so that the values at u and \(u+s\) are generally correlated. Consequently, Sun and Nocedal (2023) assume that the magnitude of the noise in the objective function is bounded by \(\epsilon _f\) and the error at \(\alpha (u+s)\) is independent of the error at \(\alpha (u)\) to obtain a modified trust region method with a relaxation term proportional to the magnitude of the error in the objective function, that is,

$$\begin{aligned} \rho _k = \frac{\tilde{f}(u_k) - \tilde{f}(u_k + s_k) + r \epsilon _f}{m_k(0) - m_k(s_k) + r \epsilon _f}, \end{aligned}$$

where \(\tilde{f}\) denotes the bias-corrected approximation of \({\bar{f}}\). For convergence, Sun and Nocedal (2023) requires that \(r \epsilon _f\) be greater than the maximum error in the difference. They assume that the magnitude of the error in the estimate of f is bounded by \(\epsilon _f\) and the errors are independent at different control locations so that the \(r>2\) is appropriate.

We must account for the correlation in the errors when we compute the error in the difference. Also, we use a Gaussian model for noise, so if we assume that the noise in the difference is bounded by \(\epsilon _{df} = 3 \sqrt{{\text {var}}(\alpha (u+s) - \alpha (u) )}\), then the appropriate choice for us is

$$\begin{aligned} \rho _k = \frac{\tilde{f}(u_k) - \tilde{f}(u_k + s_k) + r \epsilon _{df}}{m_k(0) - m_k(s_k) + r \epsilon _{df}}, \end{aligned}$$

where \(r>1\) for convergence.

2.5 Derivative-Free Optimization With Bias Correction of Mean Model

A much simplified version of a function-interpolating trust region DFO algorithm with bias correction is summarized in Algorithm 1. It differs from the standard function-interpolating trust region DFO algorithm (e.g., Powell (2006) Fig. 1) in the additional function evaluations in steps 3 and 9 and in the repeated updating of previously estimated function evaluations. In Algorithm 1, all function evaluations \(f(u,m_j)\), even those for which the trial step is rejected, are used for bias correction, although the number of function evaluations used for quadratic model interpolation is fixed. The total number of function evaluations is determined primarily by \(p_m^k\), the number of function evaluations using model realizations used for estimation of the bias correction at the kth iteration. A reasonable modification of Algorithm 1 would be to reduce \(p_m\) when the estimate of the error in \(\rho _k\) is small.

Algorithm 1
figure a

Derivative-free optimization with bias correction of the mean model

3 Numerical Examples

Two applications of the mean model with bias correction are used to illustrate the benefits and limitations of the use of the mean model. In both cases, DFO methods are used to compute the minimizer of the SAA of the expectation of the objective function. The first example is simple enough that it is straightforward to also address issues with the definition of the mean model. The second example illustrates a somewhat more realistic reservoir management problem for which the mean model has much different characteristics than the individual realizations.

3.1 One-Dimensional Single-Phase Porous Flow

In this example, the problem is to optimize the location of a producing well in a one-dimensional reservoir such that the magnitudes of the expected flow from each direction are equal (Fig. 1). This objective is equivalent to minimizing the total flow into the producing well. A constant pressure boundary condition is applied at \(x=0\) and at \(x=150\), and the pressure at the producer is fixed. The single-phase flow is governed by Darcy’s law. Fluid viscosity and reservoir cross-sectional area are uniform and assumed to be known.

Fig. 1
figure 1

Optimizing the location of the producing well such that the expected production rate is minimized. Permeabilities in grid cells are uncertain

The permeabilities in this toy problem are uncertain, with a prior distribution for permeability that is log-normal with an exponential covariance, a practical range of 40, and a standard deviation of 2. The log permeability is observed at four locations (Fig. 2a), and the posterior uncertainty, conditioned on the observations, is characterized by an ensemble of draws from the posterior distribution (Fig. 2b). The mean log permeability on the left side of the domain is larger than the mean log permeability on the right side because of the conditioning to observations.

Fig. 2
figure 2

Characterization of the uncertainty in permeability for the one-dimensional well location optimization problem with observations (obs) of log permeability at four locations

A typical method for optimizing the expected value of the objective function in subsurface optimization problems is to compute an approximation of the gradient of the SAA of the objective using a stochastic approximation approach (Chen et al. 2009; Fonseca et al. 2017). Because the mean model approach does not directly attempt minimization of the expectation of the objective function, it is reasonable to instead apply DFO methods that are highly efficient for minimization of deterministic objective functions (Moré and Wild 2009). Figure 3 illustrates the application of a model-based trust region approach to the problem of minimizing the SAA of the expectation of the objective function for the one-dimensional optimal well location problem. The objective function is evaluated at an initial guess for optimal well location \(u_0^0\) and two additional initial well locations, \(u_0^1\) and \(u_0^2\), distributed around the initial guess. Based on a quadratic interpolation of the initial values, a trial location is identified (\(u^s\)), and the objective function is evaluated at that location (Fig. 3b). If the improvement is sufficient, the trial point is admitted to the set of interpolation points, the worst point is dropped, and the process is repeated. For a deterministic objective function, the approach can be very efficient, requiring a single function evaluation at each iteration after the initialization step. Naïve application to the robust optimization problem would, however, require \(N_e\) flow simulations per iteration.

Fig. 3
figure 3

Model-based DFO for minimization of deterministic objective. a The initial best-guess \(f_k^0\) and two additional evaluation points are used to create a quadratic model, Q(u), of the objective. b The minimizer of the quadratic \(f_k^{s}\) becomes a trial solution

A much less expensive alternative is to minimize the objective function evaluated on the mean model instead of evaluating the mean of the objective functions evaluated at realizations of the model. In general, the transformation chosen for the computation of the mean model will not be optimal, and bias correction will be required for an accurate approximation of the expectation of the robust objective function (Eq. 2). Here, we follow the approach described in Algorithm 1: At every evaluation location, we run the flow simulator on the mean model and on \(p_m\) randomly chosen realizations of the permeability field. The bias correction is updated after evaluations of the objective function on the model realizations and the mean model. The bias correction is updated not only at the current location but at all previously evaluated locations as well.

In any practical case, it will be necessary to determine how many times the flow simulation must be run on realizations of the permeability field to estimate the bias correction. For the one-dimensional well location problem, Fig. 4 shows the effect of the number of simulations run at each evaluation point when the number is maintained constant throughout the minimization. The total number of model realizations used to define the SAA and the mean model in this example is 400. The mean model in this example is the geometric mean of permeability. Each panel in Fig. 4 compares the estimated bias correction objective function (bias-corrected mean model) with the true objective function evaluated by running 400 simulations of flow for each potential well location. The best results are obtained when the objective function is evaluated on 200 model realizations plus the mean model at each location (Fig. 4a). For that amount of sampling, the bias-corrected mean model gives essentially identical results as the true objective. In contrast, when only four simulations of model realizations are performed (Fig. 4d), the offset in the two functions is quite large and the minimizer is somewhat mislocated.

Fig. 4
figure 4

Effect of the amount of sampling of model realizations for bias correction on the minimization

The efficiency of the bias correction method for various choices of sample rate is summarized in Table 1. The true robust well location is at \(u=85\). The correct solution is identified when 200 realizations are sampled at each control variable location evaluated in the minimization, but an almost equivalent solution is obtained by sampling only 40 realizations at each iteration. In general, the approximation of the objective function is better with more sampling for estimation of the bias correction, but all solutions are in the neighborhood of the “true” solution. Note that the mean model without bias correction also obtains a fairly accurate solution in this example.

Table 1 Effect of the number of simulations on the accuracy of optimal well location estimation for the mean model with bias correction

The objective function for the one-dimensional well location problem is inexpensive enough that it can be used to investigate the effect of the choice of property transformation on the magnitude of the bias in the use of the mean model for optimization. As discussed in Sect. 2.1, both permeability and log permeability seem to be reasonable choices for the computation of a mean model for the optimization of well location. Figure 5a compares the objective function for the arithmetic mean of permeability (blue) to the SAA of the expectation of the objective function (black). Two aspects of the comparison are particularly important. The first is that the magnitude of the difference in the two curves is quite large—the SAA of the expectation is of the order of 2 for most of the reasonable range of well locations. At the same time, the objective function for the arithmetic mean of permeability is of the order of 15 to 18 for the same range. More importantly, the optimum well location computed using the arithmetic mean of permeability as the mean model is close to \(u=38\) (blue dashed line), while the correct optimum location is close to \(u=85\) (black dashed line).

The curves in Fig. 5b show the values of the objective as a function of well location for a variety of mean models. The dashed vertical lines show locations of the minimizer for each of the corresponding objective functions of the same color. Each mean model is computed using a different Box–Cox transformation of the permeability fields (Eq. 1). Using a mean model with exponent \(\lambda = -0.5\) (orange curve in Fig. 5b) results in an objective function that is very similar to the SAA of the expectation of the objective function over a moderately large range of well locations. Hence, for \(\lambda = -0.5\), the magnitude of the bias correction would generally be small. On the other hand, using the mean of log permeability (\(\lambda = 0.0\)) for the mean model results in a larger magnitude of the bias correction than obtained with \(\lambda = -0.5\), but a better approximation of the shape of the objective function and a better estimate of the minimizer if bias correction is not used. Note that the purple vertical dashed line for \(\lambda = 0.2\) is very close to the black vertical dashed line denoting the minimizer of the expectation of the objective under uncertainty. Thus, optimization using the mean model defined using the Box–Cox transformation with \(\lambda = 0.2\) provides a very good approximation of the “true” optimizer for the robust problem, even without bias correction.

Fig. 5
figure 5

The effect of the Box–Cox exponent \(\lambda \) used in averaging on the objective function for the mean model

Before leaving the one-dimensional well location optimization problem, it is valuable to briefly evaluate the appropriateness of the hierarchical model for bias correction. Figure 6 shows the bias correction function \(\alpha (x^i)\) and 40 realizations of the \(\textbf{b}_j\) evaluated at all x. Note that the bias correction \(\alpha \) (black dots) is smoother than most realizations of the partial bias correction, so it is potentially easier to estimate. We also note that the mean partial correction (for fixed model \(m_j\)) could perhaps be modeled as Gaussian as in (A1)—that is, each of the curves in Fig. 6 appears to have a characteristic “level” and fluctuations about that level. This at least appears to be true in the region of plausible solutions.

Fig. 6
figure 6

The partial additive bias corrections, \(\beta (u)\), computed for 40 realizations of the model

3.2 Two-Dimensional, Two-Phase Porous Flow with Facies Model

The second numerical example is also a problem of optimal well location, although in this case the domain is two-dimensional, the flow is two-phase, and the uncertain permeability field is piecewise constant—a simplified model of geological facies. Three producers are located near the southwest, northwest, and northeast corners (Fig. 7). The problem is to find the optimal location of an injector such that the expected net present value (NPV) of the reservoir is maximized. The expected value is approximated by the sample average of 100 objective functions evaluated on realizations of the permeability field. Figure 8a shows 12 of the 100 permeability realizations, while Fig. 8b shows the mean of the realizations of the log permeability field.

Fig. 7
figure 7

Reference permeability model for the two-dimensional well location optimization problem

The mean model in this example is not perfectly uniform (Fig. 8), because the mean is approximated from a finite sample (100 realizations) of the log permeability field. Despite the small variability, the mean model is much more uniform than any of the realizations, making it easier to optimize the well location in the mean model than in the realizations. Unlike the one-dimensional well location problem, the optimal well location in the two-dimensional problem is sometimes located on the boundary of the feasible domain; hence a bound optimization version of the minimization algorithm in the previous section was used (Powell 2009).

Fig. 8
figure 8

Uncertainty is characterized by 100 realizations of permeability with facies. The color scale for (a) is the same as in Fig. 7

Similar to the DFO approach described in Algorithm 1, the minimization algorithm applied to the mean model without bias correction is initialized with the injector location at (1.25, 0.5) (Fig. 9). Because the number of control variables is 2 for the two-dimensional well location problem, four additional locations spaced around the initial guess are included in the initial evaluation set (Fig. 9). Minimization of the interpolated quadratic model results in a trial location closer to the lower boundary. A total of nine function evaluations were required for convergence to the optimizer based on the mean model using the BOBYQA (Bound Optimization BY Quadratic Approximation) algorithm (Powell 2009).

Fig. 9
figure 9

Using the derivative-free optimization method BOBYQA to optimize injector location for the objective function using the mean model without bias correction. Contours show the objective function for the mean log permeability model. Blue dots show all function evaluation locations. The large circle identifies the initial evaluation set; the small circle identifies the final solution

The optimal injection well location is strongly dependent on the permeability field in this problem. Figure 10 shows the optimal well locations for each of the permeability realizations individually (blue dots) and the location that optimizes the expected value of the objective function (orange cross). The variability in the location of nominal optimizers is large, but the optimizer of the mean log permeability model (orange square) is relatively close to the robust optimizer. More importantly, the value of the expected objective function evaluated at the main model (\(\sim 78.7\)) is relatively close to the value obtained by robust optimization (\(\sim 79.1\)).

Fig. 10
figure 10

Optimal well locations for nominal optimization, mean model optimization, and optimization of the sample average of the objective functions for all realizations

As the estimate of the optimal location from the mean model is not identical to the true robust optimal location, bias correction might be appropriate for this problem. Bias correction can, however, be expensive depending on how it is done. In the one-dimensional numerical flow example, a bias correction approach was used in which the bias correction was improved at each iteration and each evaluation location. The benefit of the bias correction updates at later iterations was small in that approach because the magnitude of the bias correction was already well estimated in the neighborhood of the optimizer. Here we take an alternative approach, in which the optimizer of the mean model is first estimated without bias correction. Minimization without bias correction is generally an inexpensive operation, and for this problem it requires only nine function evaluations. The minimization is then reinitialized with the evaluation of \(p_m\) model realizations at each mean model evaluation location. To accurately estimate the hyperparameters of the hierarchical model for bias correction, we use the same model realizations at each evaluation location. After the initial estimation of bias correction, no further sampling is performed.

Figure 11 shows the estimates of the bias correction for the situation where the only evaluations of the objective function for model realizations are performed at the initial set of evaluation locations (blue dots). In Figs. 11a–c), the number of function evaluations at each mean model evaluation location is varied. In Fig. 11a, the same 10 model realizations are simulated at each blue dot location, at Fig. 11b the same 40 model realizations are simulated, and at Fig. 11c the same 100 model realizations are simulated at each location. The shapes of the three bias correction surfaces are generally similar, although the magnitude of the estimated correction is significantly smaller for \(p_m=10\) (Fig. 11a) than for either \(p_m=40\) (Fig. 11b) or \(p_m=100\) (Fig. 11c). The true bias correction surface, shown in Fig. 11d, was computed at a cost of 40,400 flow simulations.

Fig. 11
figure 11

Estimates of the bias correction obtained from multiple function evaluations at re-initialization locations. The same model realizations are used at each evaluation point

In general terms, we identify three approaches to minimizing the expectation of the objective function (Eq. 2): one can seek to minimize the expectation directly, one can obtain an approximate solution using only the mean model in the optimization, or one can use the mean model with bias correction. When the objective function is nearly linear in the model parameters, the optimization of the objective applied to the mean model should provide a good solution. The dependence of the objective function (NPV) on the permeability field is, however, highly nonlinear in this flow example, as evidenced by the large variability in the optimal location of injectors for individual realizations of the permeability field (Fig. 10). Somewhat surprisingly perhaps, the estimations of optimal well location for the expected value of the objective function using three different approaches give remarkably similar results, even when the type of averaging used for computing the mean model is not optimized (Fig. 12). Figure 12 shows the contours of the expectation of the objective function (unlike Fig. 10, which showed contours of the objective function evaluated on the mean model). Global optimization of Eq. 2 using an exhaustive search required 40,000 function evaluations, obtaining the location indicated by the blue cross in Fig. 12. Using a mean model computed using the ensemble of the log permeability fields and the BOBYQA algorithm gives a solution (orange square) with an objective that is quite close to the global optimum, but at a cost of only 10 function evaluations. Finally, restarting the minimization algorithm at the solution obtained using the mean model but adding bias correction (Fig. 11b) results in a solution that is almost identical to the true solution. The cost of the bias correction approach is 10 function evaluations for the mean model minimization without bias correction plus 200 function evaluations to compute the bias correction surface, plus six final function evaluations in the minimization of the bias-corrected mean model objective function.

Fig. 12
figure 12

Using DFO to optimize the injector location for the mean model with bias correction based on bias evaluations at five locations. Contours show values of the sample average approximation of the expectation of the objective function

4 Summary

Optimization on the mean reservoir model has sometimes been used as an approximate method for reservoir management optimization under uncertainty because of its relatively low cost in comparison to the optimization of an expected value. The appropriateness of that approximation, however, cannot generally be known without extensive computation. In this paper, we have suggested an additive bias correction method that allows a mean model to be used with confidence for robust optimization. The cost of estimating the bias correction in our examples is considerably less than the cost of a sample average approach to estimating the expectation of the objective function. The efficiency of the approach to bias correction is further enhanced when a DFO method that accounts for the sequential updating of the bias correction estimate is used.

The methodology was demonstrated on two optimal well location problems. The first problem was used to investigate the application of sequential bias correction in a DFO method and examine the appropriateness of a hierarchical model of the bias correction. The effect of the choice of definition of the mean model on the need for bias correction was also investigated in the first test problem. For some choices of the so-called mean, the bias in the estimated optimal control would be very large, and bias correction would be necessary. For other choices, the bias would be so small that the solution obtained using the mean model without bias correction was the same as would be obtained from sample averaging of the expectation of the objective function.

The second numerical example also examined the problem of estimating optimal well location when permeability is uncertain. This example, however, was more complex than the one-dimensional well location problem; the objective function was the expected NPV of the reservoir, the flow was two-phase oil and water, the permeability field was piecewise continuous, and the reservoir was two-dimensional. We first showed that a very efficient optimization method could be implemented in which the mean log permeability model was used without bias correction to obtain an approximation of the expected NPV. That approximate NPV solution was only 0.5% lower than the optimal expected NPV at a cost of only 10 function evaluations. An improved solution was obtained using bias estimation in the neighborhood of the estimated mean model optimizer and a restart of the DFO. Incorporation of the bias correction into the minimization gave a well location solution that was nearly indistinguishable from the true optimal solution, at a cost of 206 additional function evaluations.

Although both numerical examples used in this manuscript addressed the problem of optimizing well location under uncertainty, the use of the mean model approach for optimization is quite general, with applicability to a variety of subsurface optimization problems including reservoir production management, emissions reduction, and CO2 storage optimization. For some types of optimization problems, the greatest challenge may be to develop a bias correction method that accounts correctly for the “distance” between control settings. While this was straightforward for well location optimization, it is not so simple for problems such as drilling order (Wang and Oliver 2021). Finally, if a mean model is chosen poorly, the bias correction will still provide a valid method for robust optimization, but may not be as efficient as shown in this manuscript. The problem of selecting an appropriate mean model in general is a remaining challenge.