pyesmda

class pyesmda.ESMDA(obs: array, m_init: array, stdev_d: array, stdev_m: array, forward_model: Callable, forward_model_args: tuple = (), forward_model_kwargs: dict = {}, n_assimilation: int = 4, alpha: Optional[List[int]] = None, m_bounds: Optional[array] = None)[source]

Ensemble Smoother with Multiple Data Assimilations.

Implement the ES-MDA as proposed by Emerick, A. A. and A. C. Reynolds 1, 2.

Parameters
  • dobs (np.array) – Obsevrations vector.

  • m_init (np.array) – Initial ensemble of N_{e} parameters vector.

  • stdev_d (np.array) – Standard deviation of the observations.

  • stdev_m (np.array) – Standard deviation of the parameters.

  • forward_model (callable) – Function calling the non-linear observation model (forward model) for all ensemble members and returning the predicted data for each ensemble member.

  • forward_model_args (tuple) – Additional args for the callable forward_model.

  • forward_model_kwargs (dict) – Additional kwargs for the callable forward_model.

  • n_assimilation (int, optional) – Number of data assimilations. The default is 4.

  • alpha (Union[List[int], None], optional) – Multiplication factor used to inflate the covariance matrix of the measurement errors. The default is None.

  • m_bounds (Union[List[int], None], optional) – Top and bottom bounds on the initial ensemble of N_{e} parameters vector. The default is None.

References

1(1,2)

Emerick, A. A. and A. C. Reynolds, Ensemble smoother with multiple data assimilation, Computers & Geosciences, 2012.

2

Emerick, A. A. and A. C. Reynolds. (2013). History-Matching Production and Seismic Data in a Real Field Case Using the Ensemble Smoother With Multiple Data Assimilation. Society of Petroleum Engineers - SPE Reservoir Simulation Symposium 2013. 2. 10.2118/163675-MS.

property alpha

Get the alpha coefficients used by ES-MDA.

Single and multiple data assimilation are equivalent for the linear-Gaussian case as long as the factor \(\alpha_{l}\) used to inflate the covariance matrix of the measurement errors satisfy the following condition:

\[\sum_{l=1}^{N_{a}} \frac{1}{\alpha_{l}} = 1\]

In practise, \(\alpha_{l} = N_{a}\) is a good choice 1.

analyse(assimilation_iteration)[source]

Analysis step of the ES-MDA.

Update the vector of model parameters using

\[m^{l+1}_{j} = m^{l}_{j} + C^{l}_{MD}\left(C^{l}_{DD}+\alpha_{l+1} C_{D}\right)^{-1} \left(d^{l}_{uc,j} - d^{l}_{j} \right), \textrm{for } j=1,2,...,N_{e}.\]
Return type

None.

approximate_covariance_matrices()[source]

Calculate Average and Covariance MD and Covariance DD.

The covariance matrices \(C^{l}_{MD}\) and \(C^{l}_{DD}\) are approximated from the ensemble in the standard way of EnKF 3, 4.

References

3

Evensen, G., Data Assimilation: The Ensemble Kalman Filter, Springer, Berlin, 2007

4

Aanonsen, S. I., G. Nævdal, D. S. Oliver, A. C. Reynolds, and B. Valles, Review of ensemble Kalman filter in petroleum engineering, SPE Journal, 14(3), 393–412, 2009.

property d_dim

Return the number of forecast data.

forecast()[source]

Forecast step of ES-MDA.

Run the forward model from time zero until the end of the historical period from time zero until the end of the historical period to compute the vector of predicted data

\[d^{l}_{j}=g\left(m^{l}_{j}\right),\textrm{for }j=1,2,...,N_{e},\]

where \(g(·)\) denotes the nonlinear observation model, i.e., \(d^{l}_{j}\) is the \(N_{d}\)-dimensional vector of predicted data obtained by running the forward model reservoir simulation with the model parameters given by the vector \(m^{l}_{j}\) from time zero. Note that we use \(N_{d}\) to denote the total number of measurements in the entire history.

Return type

None.

property m_bounds

Get the parameter errors covariance matrix.

property m_dim

Return the length of the parameters vector.

property n_assimilation

Return the number of assimilation to perfom.

property n_ensemble

Return the number of ensemble members.

pertrub(assimilation_iteration)[source]

Perturbation of the observation vector step of ES-MDA.

Perturb the vector of observations

\[d^{l}_{uc,j} = d_{obs} + \sqrt{\alpha_{l+1}}C_{D}^{1/2}Z_{d}, \textrm{for } j=1,2,...,N_{e},\]

where \(Z_{d} \sim \mathcal{N}(O, I_{N_{d}})\).

Return type

None.

solve()[source]

Solve the optimization problem with ES-MDA algorithm.

property stdev_d

Get the observation errors covariance matrix.

property stdev_m

Get the parameter errors covariance matrix.