Conditioning surface-based geological models to well data using artificial neural networks

Surface-based modelling provides a computationally efficient approach for generating geometrically realistic representations of heterogeneity in reservoir models. However, conditioning Surface-Based Geological Models (SBGMs) to well data can be challenging because it is an ill-posed inverse problem with spatially distributed parameters. To aid fast and efficient conditioning, we use here SBGMs that model geometries using parametric, grid-free surfaces that require few parameters to represent even realistic geological architectures. A neural network is trained to learn the underlying process of generating SBGMs by learning the relationship between the parametrized SBGM inputs and the resulting facies identified at well locations. To condition the SBGM to these observed data, inverse modelling of the SBGM inputs is achieved by replacing the forward model with the pre-trained neural network and optimizing the network inputs using the back-propagation technique applied in training the neural network. An analysis of the uncertainties associated with the conditioned realisations demonstrates the applicability of the approach for evaluating spatial variations in geological heterogeneity away from control data in reservoir modelling. This approach for generating geologically plausible models that are calibrated with observed well data could also be extended to other geological modelling techniques such as object- and process-based modelling.


Introduction
Generating realistic geological models that match observed well data is important for understanding and predicting subsurface reservoir behaviour. By combining prior geological knowledge of sedimentary and structural processes, stratigraphy, and facies distributions and associations, with data from wells, geoscientists can generate representative subsurface geological models that honour the sparse data available.
Surface-based geological models (SBGMs) generate representative geologic heterogeneities by applying hierarchical or rule-based relationships to control temporal or spatial positioning of surfaces that represent geological features. Structural, stratigraphic and diagenetic heterogeneities are modelled as discrete geological domains bounded by these Zainab Titus z.titus18@imperial.ac.uk 1 Department of Earth Science and Engineering, Imperial College London, London, UK surfaces. Within these domains, petrophysical properties such as porosity and permeability are homogeneous and further property modelling is not required [1]. Previous work has shown that capturing the geometry, spatial distribution and connectivity of these domains is key to capturing subsurface flow [2]. The use of parametrized surfaces allows modelling of heterogeneity free from any underlying grid, providing greater flexibility for the creation and manipulation of complex, realistic geological geometries at low computational cost. For flow simulation, unstructured meshes are used to discretize space, which more accurately preserve the modelled geometries and key flow features [1,3]. However, although there are significant benefits to the use of SBGMs, conditioning these models to observed data at wells remains a challenging ill-posed inverse problem and a barrier to widespread practical application.
Few studies on conditioning SBGMs to well data have been carried-out. In one of the earliest approaches, [4] conditioned 3D alluvial-architecture process-imitating models using Monte-Carlo simulation in a trial-and-error approach. Pyrcz et al. [5] generated SBGMs of deepwater lobe deposits that honour event deposit geometry and well contacts by local adjustments of the lobe bounding surfaces. The study presented an approach in which a stochastic residual accounted for fluctuations in the bounding surfaces and is conditioned to well data. Using detailed interpretations of well logs to identify and order depositional events, [6] conditioned SBGMs generated using geologic process models to well data. Zhang et al. [7] used a dual-spline error surface interpolation and a surface acceptance criteria to constrain SBGMs to data in a large number of wells. The computational expense of generating and conditioning the SBGMs, time requirements for interpreting well correlations and the large number of wells required for efficiently conditioning these models in some cases have limited their application. Using an inverse modelling method of the channel migration (reverse migration), [8] conditioned channelised systems represented with parametric surfaces to observed channel path and belt structures from satellite and seismic data. To extend the method to subsurface reservoirs deposited in fluvial or deepwater environments, the authors suggest conditioning to well data.
Conditioning SBGMs to well data has been explored using optimisation techniques and probabilistic methods. Using inverse modelling in an optimisation framework to sequentially optimize the input parameters controlling global and local spatial variations, Bertoncello et al. [9] conditioned SBGMs to well log and thickness data. The speed of convergence and quality of fit to the data were improved by significantly reducing the dimensionality of the problem (from 103 to 37 parameters to be optimised for the case considered). However, since the method can significantly modify the model geometry, which results in high degrees of uncertainty, its applicability is limited for cases with sparse data. Although the uncertainty on input parameters was quantified and a sensitivity analysis on leading parameter uncertainty was performed, there is a need for uncertainty assessment of the conditioned realisations as suggested by the authors to evaluate the accuracy and applicability of the method. Wang et al. [10] also applied optimization techniques to condition parameterized object-based models. The optimization used an implicit filtering algorithm based on coordinate search and gradient approximation to minimize the cost function that measures the level of conditioning. The difficulty in parametrizing the objects presents a limitation of the method as this could impact the computational expense and time cost of solving the inverse problem, due to the non-uniqueness and high-dimensionality of the problem. To generate multiple lobe models that fit observed data at well locations, [11] applied a variational inference method which used a stochastic gradient optimizer to determine the optimal parameters of a surrogate probability density function (PDF) that approximates the posterior PDF. The method allowed for the rapid generation of multiple conditioned samples when compared to a Markov Chain Monte Carlo (MCMC) method, although the MCMC yielded models that better fit the data.
The use of neural networks has been explored with remarkable success in the forward and inverse modelling of complex systems and physical processes in geoscience. Dramsch [12] gives a review of the historic application of neural networks in geoscience. In subsurface reservoir applications, neural networks have become increasingly popular for representing complex non-linear functions particularly for lithofacies classification [13][14][15], seismic interpretation and inversion [16][17][18], and generating realisations that honour spatial observations in geostatistical models [19][20][21][22]. In geological modelling, neural networks have also been used for predicting stratigraphic units by interpreting borehole data as oriented spatial sequences or series of data that are processed using Recurrent Neural Networks (RNNs) [23]. By providing a parametrization for the direct generation of conditional realisations obtained using generative adversarial networks (GANs), [24] produced plausible realizations of binary channelized images while achieving dimensionality reduction of two orders of magnitude. Jo et al. [25] explored the use of neural networks for conditioning rule-based modelling methods by training a GAN to extract the geological features of the models and applying semantic image inpainting to generate realizations of the rule-based models.
We present here a method based on neural networks to condition SBGMs to well data. The use of parametrized, surface-based models to describe even complex geological features significantly decreases the computational expense of training the network compared to grid-based models as there are fewer parameters to optimize. The use of neural networks for generating conditioned, grid-free, surface-based models could be extended to grid-based, object-and processbased modelling. Compared to existing conventional geostatistical or other rule-based methods, our approach has more flexibility for capturing geological realism without reference to a pre-defined grid. We use parametric nonuniform rational B-splines (NURBS) which enable the generation of models that better capture geological architectures and preserve geological features such as continuity of channelised bodies compared to grid-based approaches. Furthermore, we require few parameters to model geometries and describe heterogeneities as even complex geological features/bodies can be modelled using surfaces that define volumes within which petrophysical properties are homogeneous. Our workflow allows for the conditioning of these models to well data, specifically well log information such as facies type described in this study, whilst ensuring that the underlying process for generating these models such as the stacking patterns is preserved and constraints posed by using gridding or other resolution-dependent approach are avoided. Thus, the proposed method ensures the preservation and representation of complicated subsurface heterogeneity while conditioning to well data for subsurface models. The use of surface-based modelling to describe geometrically realistic geological features compared to grid-based modelling could significantly decrease the computational expense of training the network for more complex geologies or 3D models as there are fewer parameters to optimize. Figure 1 illustrates the framework for our proposed methodology for generating realistic geological realizations that match observed well data. Using this approach, we 1) train a neural network to learn the geological patterns and underlying phenomenon for generating the SBGMs, 2) generate plausible geological models conditioned to data at well locations by using inverse modelling to optimize the inputs to the neural network, and 3) perform an uncertainty analysis of the conditioned realizations.
Our methodology is illustrated on synthetic data as a proof-of-concept. The example case represents a reservoir that was deposited in a shallow marine setting. We use the neural network to generate inputs for surface-based models that fit the well data at multiple well locations. The optimised inputs describe the locations, orientation and distribution of the depositional bodies within the domain. In Fig. 1 The approach for conditioning surface-based geological models applied in this study. The workflow involves training the neural network to represent the forward model, optimizing the network inputs to generate conditioned SBGMs and assessing the uncertainty associated with these realizations the following section, a description of the surface-based model considered is given, along with an illustration of the process for generating SBGMs. Section 3 describes the procedure for training the neural network to represent the SBGM modelling process. Section 4 explains the framework for the optimisation methodology using the pretrained neural network. The results of the neural network prediction are presented in Section 5, along with examples of conditioned realisations using the proposed methodology. An assessment of the uncertainty associated with the results and proposed methodology is also provided in Section 5.3 and the concluding remarks are presented in the final section.

Surface-based geological model description
Surface-based geological models are forward models in the sense that these models predict depositional sequences or generate geological architectures and features given a set of input parameters. SBGMs can be deterministic and/or stochastic, empirical and/or theoretical [4], and provide realistic representations of subsurface structures [26]. We use SBGMs that model geometries with parametric, grid-free surfaces using Non-Uniform Rational B-Splines (NURBS) interpolation [27] based on the work of [28].

NURBS for generating computationally efficient SBGMs
In this approach, geological architectures are described using parameterised inputs that define geological geometries at multiple levels of surface hierarchy. The resulting surfaces represent realistic geometries and determine the distribution of heterogeneity as the surfaces define discrete rock volumes within which petrophysical properties are assumed uniform. If heterogeneity exists within these volumes, they are further subdivided by additional surfaces. In these geologically meaningful domains, no further property modelling is required [1,2]. The application of NURBS provides a computationally efficient representation as few control points are required to represent even complex curves and surfaces. The efficiency of generating and manipulating SBGMs using the NURBS approach allows for the rapid generation of multiple realizations of realistic reservoir models for training the neural network. Jacquemyn et al. [28] gives details of generating SBGMs using the NURBS approach depicted in Fig. 2a and b, where clinoforms and facies boundaries are constructed using the control points (CP) defined. Fig. 2 a) The dipping clinoform template constructed using the height, length and dip angle, and b) facies boundaries inside a clinothem are constructed using variables relative to their bounding clinoforms, both from [28]

Shallow marine example case
We demonstrate our approach here using a 2D model representing a shallow marine sedimentary succession, similar to what would be encountered in many subsurface reservoirs [29,30]. This is simplified to a single 20m thick parasequence containing dipping clinoforms surfaces and horizontal facies boundaries (see Fig. 11 of [28]) with 1000m lateral extent. Three facies are considered: Upper Shoreface (USF; yellow), Lower Shoreface (LSF) and Offshore Mudstone (OM). The inputs to the SBGMs are derived from stochastically sampled variables from uniform distributions that parameterize the shape, orientation and relative location of the surfaces (depositional or erosional), which are sequentially placed to represent clinoform surfaces and facies boundaries. Figure 3a shows the resulting 2D model and Fig. 3b illustrates the corresponding facies type (wells logs) at three well locations in the domain.
The clinoforms surfaces are parametrised using the dip angle of the surfaces and the parasequence thickness. The toe of each clinoform truncates at the parasequence base or underlying clinoform, depending on the dip. The spacing between clinoforms is determined at the top of the parasequence. Within each clinothem volume, two horizontal facies boundaries are placed to differentiate between different facies. The vertical relative position of the lower facies boundary (LSF-OM boundary) is measured from the parasequence base. The relative vertical position of the upper facies boundary (USF-LSF boundary) is measured from the lower facies boundary. In total 60 clinoforms are constructed to fill the parasequence; each clinothem is subdivided by two facies boundaries and a spacing so the model requires 240 input values (i.e. 60x clinoform dip angle, clinoform spacing, lower facies boundary position, upper facies boundary position). The clinoform surfaces are defined by length and dip angle (Fig. 2a) while facies boundaries inside a clinothem are positioned relative to the parasequence boundaries (flooding surfaces) or underlying facies boundary (Fig. 2b). Table 1 gives the range of parameter distributions sampled to generate stochastic SBGMs.

Modelling SBGMs with ANNs
To condition SBGMs to well log data (facies classification), we use neural networks in two ways: 1) to map the SBGM inputs to the facies type at well locations in the forward modelling step and 2) to generate the optimised SBGM inputs using a back-propagation algorithm to update randomly selected SBGM inputs so that the resulting SBGM honours the observed facies type along the well. This conditions the SBGM to the observed data at the well location. A key benefit of our method is the adoption of a grid-free approach in the forward and inverse modelling steps. In contrast to other methods such as the use of convolutional neural networks for image generation, which have been applied in GANs to condition rulebased geological models [25], our method does not impose constraints or impact on the resolution of the models.
The flexibility of the approach we present allows the generation of the SBGM inputs which are consistent with the geological modelling process, where the underlying phenomenon for generating parametric grid-free SBGMs is preserved. With this approach, we are not artificially, or mechanically changing the underlying process for generating the SBGMs but generating the inputs to the models that take into account the geological relations between surfaces. The proposed method ensures that the spatial continuity of the geological model is preserved, the features are well connected and patterns such as the hierarchical arrangement of surfaces in the SBGM generation process remain unchanged. The method described here guides the conditioning of SBGMs generated using a parametric, gridfree approach whilst ensuring that any constraint posed by the model resolution does not impact the conditioning. Using this approach for more complex or realistic 3D models should also deliver these advantages. The forward  Table 1 Range of the clinoforms and facies zones for the parasequences. The parameters all sampled from a uniform distribution

Forward modelling
We use a multi-layer perceptron (MLP) with fullyconnected layers to obtain a parametrization of the surfacebased modelling process in the forward modelling step.
In this approach, we are given a training set comprising examples of the inputs, p, and the outputs y, with which to train the network. By training the neural network to represent the underlying process for generating SBGMs, we aim to find a set of parameters, θ, that allow the mapping of the SBGM inputs to the observations. Thus, the MLP is applied in a supervised learning mode where the goal is to determine θ so that y = S θ (p), where S represents the neural network so that S θ : R n p → R n y and y ∈ R n y is the property of interest or outputs, i.e. the facies type at n y discretized locations along the well. The problem is formulated as a classification problem, where the facies type at locations along the well is predicted. The input is represented as a feature vector p = [p (1) , . . . , p (n p ) ] ∈ R n p , where n p is the number of inputs to the surface-based model. The aim is to find the classification mapping from the input feature vector, p to the output vector y whose values are taken from a discrete set of n distinct classes, C = {c (1) , . . . , c (n) }, for all discretized locations along the well. The input feature vector is continuous and can take on non-discrete values, while the set of classes is discrete and non-continuous. For a given collection of training examples, D, of M input-output pairs: , we seek to find the parameters θ, that map the inputs of the surface-based model to the facies class or type at discretized locations along the well. Therefore, the inputs to the feed-forward network, p, are the 240 variables that define the control points of the SBGM, while the outputs are the facies types, y, at discretized locations along the well. In the following sections, we discuss a data normalisation applied to the data and the training procedure for deriving the parameters of the network.

Data normalisation
Since the input feature vectors span varying orders of magnitude, we perform a normalisation of the data set. This is necessary to remove any bias to feature vectors with large magnitudes. We standardise the input data to a normal distribution by scaling the input feature vector tõ p ∼ N (0, 1), by computing where μ = [μ 1 , ..., μ n p ] T such that, where p m j represents the j th SBGM input parameter in the mth example and σ = [σ 1 , ..., σ n p ] T such that

One-hot encoding
A commonly applied approach for representing non-ordinal or categorical data for classification problems is one-hot encoding. Since a natural ordered relationship among facies types only exists within clinothems (volumes between two clinoforms), and not necessarily between neighbouring clinothems, one-hot encoding is required to represent the output data rather than label encoding where integer labels are used to encode variables, as this may result in poor performance or unrealistic results. In one-hot encoding, binary variables are used to represent the facies types such that the output data at each discretized location, i, is given as a vector, z i of equal length to the number of classes, n and whose entries are zero except where the class type corresponds to the facies type at that location: where c (l) corresponds to the facies type or class at the discretized location. Figure 4 illustrates the well representation and one-hot encoding of the facies type, which can be interpreted as the the probability of each facies type at the discretized locations. The facies type at the centre of each discretized location was selected to represent the facies type of the discretized location.

Training
For the multi-class classification problem, the network is trained to predict the probability of each facies type at a discrete location,ẑ i using the softmax operator. The final output of the network is the vector of facies type with the highest predicted probability at all discretized locations along the well,ŷ. To learn the parameters of the network, θ , we minimize the objective function, J t which defines the mismatch, L between the one-hot encoded vector of facies type z i and the predicted probabilities by the networkẑ i at each discretized location along the well, given as: where θ represents the trainable parameters of the network, i.e the weights and biases, andẑ i depends on θ and the loss function, L is the multi-class cross-entropy loss function [31] defined as: where l is such that z l i,m = 0. The trainable parameters are iteratively updated using the Adam optimizer [32] and the final output of the model,ŷ consists of the facies with the highest predicted probability at each discretized location, where each entry inŷ is Figure 5 illustrates the model training procedure and shows the architecture of the multi-layer perceptron having 3 hidden layers.

Inverse modelling
An efficient and robust approach to condition SBGMs is the use of an iterative method in an optimization framework with neural networks where the network prediction,ỹ is compared with the observed data, y obs and the inputs, p are updated at each iteration in accordance with the data mismatch. This is achieved using a back-propagation algorithm [33] based on gradient-descent schemes similar to those used in the training process, with the network trainable Fig. 5 The neural network maps a vector representation of the 240 variables onto a discrete vector with n y by n entries. The softmax function gives the probabilities of the facies type at each discretized location. To calculate the parameters of the network, a back-propagation of the mismatch between the predicted probabilitiesẑ i and the one-hot targets, z i at each location is performed to update θ . The loss function is the cross-entropy loss used for multi-class classification given in Eq. 6. The vector of facies type with the maximum probability at all discretized location,ŷ is returned as the output of the network parameters now set to the inputs. Using this approach, we can learn the inputs to the neural network, p, which based on the given parameters of the neural network, θ will give the forward model having observations y obs at the well location. The method is described in more details in Section 4.2.

Optimization methodology
Given the pre-trained network S, we aim to find the set of input feature vectors p * whose outputs from the network, y, match a reference data set or observations, y obs . In other words, to condition the SBGM model to observations, we are to find the SBGM inputs whose predictions from the neural network, match the observed well data, i.e find p, such that S(p) = y obs . We formulate the problem as finding a p * that minimizes the mismatch, L, between the network prediction and the given observations, where J c is the objective function to be minimized defined as: where z i,obs is the one-hot encoding of the observed facies type at each discretized location, l is such that z l i,obs = 0, the mismatch or loss L remains the multi-class crossentropy used in training the model andz i is the predicted facies type by the pre-trained network at that location. The vector of facies with the highest predicted probability at all discretized location,ỹ is given as the network output, where each entry inỹ is To generate realizations conditioned to the observations, we solve Eq. 7 repeatedly starting with different random initial guesses. The mismatch of the facies type predicted at the well locations is compared with the reference well data and a back-propagation algorithm is applied to minimize the objective function, J (p) and update the input parameters, p based on the mismatch. A further evaluation of the generated SBGMs with the optimised inputs is performed by calculating a well correlation, Corr well between the observations at the well, y obs and facies type of the SBGMs from the optimised inputs y * , defined as where n * y is the number of discretized locations where the facies type at the well locations of the SBGM generated with the optimised outputs matches the observed data at the well. The correlations associated with each well are then averaged to obtain the mean well correlation for the model, Corr well given as Corr well,w , where n w is the number of wells in the model. The well correlation provides the proportion of facies type predicted by the conditioned realisations that exactly match the observed data, which can be interpreted as an accuracy metric. Thus, the network accuracy from the training process is used as a cut-off for determining conditioned realisations. The approach presented here (see Fig. 6) provides a robust methodology for identifying the set of input parameters that generate the forward model, i.e. plausible SBGMs which honour the well data, or models that are conditioned to observations. Since the process of generating the SBGMs is not modified to match the observed data at the wells, the geological consistency of the model is preserved. In other words, the model only takes a stochastic set of SBGM inputs which produce a realistic geological model and modifies them to produce SBGMs that match the observed facies type along the well. The workflow is integrated within the neural network framework (see Fig. 6) and the algorithm for the methodology is presented in Algorithm 1.

Forward modelling: Well log prediction
The results are given here for the forward modelling using the neural networks. The number of examples in the dataset is 10 6 SBGMs each having 240 SBGM input parameters and 60 facies definitions for each well corresponding to 60 locations along each well. The number of discretized Fig. 6 The workflow for conditioning the SBGMs using the pretrained neural network Algorithm 1 Back-propagation algorithm for conditioning SBGMs.
1: initialization: get random input parameters, p 0 ∈ R n p ; set counter, k = 0 2: initialization: define the optimizer; set network trainable parameters to p 0 3: read y obs and encode output data at each discretized location as z obs,i 4: scale p 0 to a normal distribution,p 0 ∼ N (0, 1) 5: while k K do K is the number of iterations 6: calculatez i ∀i ∈ {1, . . . , n p } 7:ỹ = S θ (p k ) ỹ ∈ R n p 8: U is a uniform distribution 12:p * =p 13: k = k + 1 14: end while 15: returnp * locations was selected based on the vertical resolution of gamma well logging tools of 0.3048m ±5% of leading industry wireline service providers [34]. Consideration was also given to the number of clinoforms used in generating the model, as this can be interpreted as the maximum number of geological volumes that intersect the well. A vertical resolution of 0.33m was used to obtain the 60 discretized locations along each well location, corresponding to a grid size of 1 × 0.3m.
Two networks with a similar architecture to Fig. 5 were trained to predict the facies type along the well for SBGMs having two and three wells, hereafter referred to as SurfNet2 and SurfNet3. For SurfNet2, there are 120 outputs (2 wells each having 60 discretized locations); for SurfNet3, there are 180 outputs (3 wells each having 60 discretized locations). The inputs to both networks are the 240 SBGM parameters, and the outputs are the facies types at the discretized locations along each well in the model. The same dataset and hyper-parameters were applied to train both networks. One-third of the dataset was used as the test set, the remaining two-thirds was used for training the network. Figure 7 shows the loss and accuracy learning curves for SurfNet2 for 100 epochs. The loss is the mismatch calculated in Eq. 6 and the accuracy metric gives the average percent of facies types at the well correctly predicted for all examples. The performance on and also to ascertain that the training and test datasets are representative. It can be seen from Fig. 7 that the dataset containing 10 6 examples shows significant improvements in the test accuracy and loss, whilst maintaining a high accuracy for the training set after only 100 epochs. This indicates that the network generalises well and is not underor over-fitting the data. Therefore, a model trained with 10 6 examples is capable of predicting unseen data with high accuracy. Table 2 shows the hyper-parameters and performance metrics of both networks. From Fig. 8, both networks show comparable accuracy. Although SurfNet2 is slightly more accurate, it can be argued that from the loss plots for SurfNet3, the network is capable of further improvements with more epochs.
In SurfNet2, the network is able to predict the facies along the well with ∼ 99% accuracy for samples in the training set and ∼ 98% accuracy for samples in the test set, which are unseen data not used in the training. The trained MLP is able to represent the SBGM forward model as it is capable of emulating the patterns of the model and identifying facies along the well reasonably. The predictions of the facies type at well locations for unseen samples (SBGM examples not included in the training) is shown in Figs. 9 and 10 for SurfNet2 and SurfNet3 respectively. Although the neural network inherently does not make assumptions about the underlying physical phenomena of modelling SBGMs, but rather selects parameters according to the characteristics of the data, it can be seen from the results that the model is able to generalize well as it predicts well logs for unseen data with high accuracy in both networks.
In the case of this 2D model, we have demonstrated that our approach for generating SBGMs using NURBS allowed for the rapid generation of 10 6 examples to train the network to a very high degree of accuracy as each SBGM can be generated in less than 2s, and this can be done in parallel. Although this might not be practical for more complex and realistic models, Fig. 7 illustrates that it could be possible to reduce the number of models by a factor of two at a reduced accuracy of only about 2%. In addition, training which is sufficient for obtaining practicable results in the prediction step. However, to demonstrate and ascertain the validity of the approach for the conditioning step, it was necessary to ensure a high degree of accuracy is obtained in the forward modelling step, justifying the use of 10 6 examples. Nonetheless, it is also possible to explore other network architectures and hyper-parameter combinations for 10 5 training examples, that would not sacrifice the accuracy of the network as this is also required to aid good performance in the conditioning step.

Inverse modelling: Generating the SBGM inputs
Using the pre-trained networks, SurfNet2 and SurfNet3, we performed the inverse modelling. A stochastically determined set of SBGM inputs was generated to produce observed data at the wells, which we refer to as the reference. The set of SBGM inputs that generated the reference and the reference data were not used in training or testing the network. The workflow presented in Section 4.2 was used to generate the optimised SBGMs. We use a maximum of 10 4 iterations for the optimisation or a tolerance of 10 −4 , which is over 2 orders of magnitude lower than the neural network training loss. Table 3 gives a summary of the hyper-parameters used for optimising the SBGM inputs using the pre-trained networks. Figures 11a to 14b compare the SBGM from the initialised, reference and optimised neural network inputs from the inversion using SurfNet2 and SurfNet3 for two examples. It can be observed that the conditioned neural network geological models do not match the reference SBGM at all locations. However, a high correlation between the facies type from the SBGM derived from the neural network and that from the reference model is observed as the inputs generated by the neural networks produce SBGMs that are conditioned to the data at the well locations (see Figs. 11b, 12b, 13b and 14b). In Examples 1 and 2, the value of Corr well is 98.3% for SurfNet2 and 97.8% with SurfNet3. Figures 16a to 17b compare the well data of the SBGMs at different stages of the optimisation (0, 100, 500, 2000 and 10000 iterations) with the reference (observed) data. It can be seen that the initial guess presents a poor match with the reference data. The quality of the match improves as the number of iterations increases. At only 2000 iterations, there is a reasonable match with the reference data. Figure 15a and b show the loss plots for the two examples using SurfNet2 and SurfNet3. The decrease in the mismatch as shown in the loss plots does not significantly increase between 2000 iterations (obtained after 3mins) and 10000 iterations (obtained after 11mins), as observed in Figs. 16a to 17b. The learning rate is annealed by 0.5 after every 2000 iterations. Thus, it can be suggested that the fit of the model Fig. 11 The initialised, optimised and reference SBGMs results for an example using SurfNet2 (Top). The inputs to the initialised model are optimised in the back-propagation algorithm to produce the inputs that generate the neural network SBGM shown which are to match reference SBGM at the well location in the conditioning step. The facies types at the well for models with the initialised SBGM inputs, the optimised SBGM inputs from SurfNet2 and the reference SBGM are shown in the bottom. The optimised inputs from the neural network yield a reasonable match of the facies type at the well with the reference model (observed data) with the reference data even at 2000 iterations provides a sufficient match with the observed data. The results show that the fit with the reference data is especially good at the upper and lower sections of the model and at boundaries where the thickness of the layers are significant. However, the model does not produce an exact match at well locations where the thickness of the layer is less than the resolution of the encoding of the output data presented in Section 3.1.2 as the facies type of is given as the value at the centre of the discretized location.
It is useful to point that both SBGM and ANN can be used in the conditioning step. For current 2D models the speed difference is minimal, but looking forward to more general and 3D cases this will become more significant, and ANN will likely be faster. For the 2D models presented in this research, the wall time for running 10000 iterations for conditioning the model is approximately 7 to 11mins. In some cases, this time can be reduced by 1/5th since after 2000 iterations, as shown in Figs. 16a to 17b, the neural network optimised inputs attain a reasonable match with Fig. 12 The initialised, optimised and reference SBGMs results for an example using SurfNet2 (Top). The inputs to the initialised model are optimised in the back-propagation algorithm to produce the inputs that generate the neural network SBGM shown which are to match reference SBGM at the well location in the conditioning step. The facies types at the well for models with the initialised SBGM inputs, the optimised SBGM inputs from SurfNet2 and the reference SBGM are shown in the bottom. The optimised inputs from the neural network yield a reasonable match of the facies type at the well with the reference model (observed data) the observed (reference) model at the well location. An assessment of the uncertainties is presented in the following section to validate the applicability of the method for evaluating spatial variations.

Uncertainty assessment: Evaluating spatial variations
Due to the sparsity of the data and non-uniqueness of the solution, numerous plausible realisations of the SBGM exist. Although conditioning SBGMs to well data using local optimisation methods such as applied in this study is complicated by the stochastic nature of generating SBGMs [35], this allows the generation of multiple realisations for the assessment of uncertainty. Using our optimization methodology presented in Fig. 6, we run the backpropagation algorithm multiple times with different initialised SBGM inputs to rapidly obtain an ensemble of conditioned realisations and perform an analysis of the uncertainties associated with the conditioned models. Fig. 13 The initialised, optimised and reference SBGMs results for an example using SurfNet3 are shown in the top. The inputs to the initialised model are optimised in the back-propagation algorithm to produce the inputs that generate the neural network SBGM shown which are to match reference SBGM at the well location in the conditioning step. The facies types at the well for models with the initialised SBGM inputs, the optimised SBGM inputs from SurfNet3 and the reference SBGM are shown in the bottom. The optimised inputs from the neural network yield a reasonable match of the facies type at the well with the reference model (observed data) Many models which fit the observed well data were obtained by continuously sampling and optimizing SBGM inputs Eq. 9 with different initial guesses for the inputs. Using our approach, fast generation of plausible geological models that honour observed data at the wells was achieved and the uncertainties associated with these models was evaluated. We optimised the inputs to 1000 SBGMs and obtained the models (here referred to as the conditioned realisations) with high well correlation using Eq. 12. The well-correlation cut-offs used are 98.0% and 97.5% for models generated using SurfNet2 and SurfNet3. The values of the well correlation used correspond to the test accuracy of the models (within a range of +0.5%). The method lends itself to parallelism and this massively improves the speed of computation and the performance as realisations can be conditioned independently. For SurfNet2, 36.4% of the optimised SBGM inputs showed high correlation with the observed well data, while 38.8% of the optimised inputs with SurfNet3 showed high correlation with the well data using the well-correlation cut-offs. Fig. 14 The initialised, optimised and reference SBGMs results for an example using SurfNet3 are shown in (a). The inputs to the initialised model are optimised in the back-propagation algorithm to produce the inputs that generate the neural network SBGM shown which are to match reference SBGM at the well location in the conditioning step. The facies types at the well for models with the initialised SBGM inputs, the optimised SBGM inputs from SurfNet3 and the reference SBGM are shown in the bottom. The optimised inputs from the neural network yield a reasonable match of the facies type at the well with the reference model (observed data) Fig. 15 The loss plot for the inverse modelling for (a) Example 1, and (b) Example 2 using SurfNet2 and SurfNet3 Fig. 16 The well data at different optimisation steps from the initial guess to the final model obtained after 10000 iterations for SurfNet2. The results are shown above for the initial guess, and after 100, 500, 2000 and 1000 iterations given as 1,2,3 and 4 respectively. The observed data is also indicated as the reference. The optimised inputs from the neural network yield a reasonable match of the facies type at the well with the reference model (observed data) except at locations where the resolution of the grid does not allow for the representation of the data at that point To assess the uncertainties associated with the conditioned realisations, we use a frequency of predictions. The frequency of predictions provides a measure of the agreement among the conditioned realizations and the reference data. This is useful for understanding the spatial variations and uncertainties in the conditioning methodology. The frequency of prediction, Fig. 17 The well data at different optimisation steps from the initial guess to the final model obtained after 10000 iterations for SurfNet3. The results are shown above for the initial guess, and after 100, 500, 2000 and 1000 iterations given as 1,2,3 and 4 respectively. The observed data is also indicated as the reference. The optimised inputs from the neural network yield a reasonable match of the facies type at the well with the reference model (observed data) except at locations where the resolution of the grid does not allow for the representation of the data at that point f pred is given as the difference between the maximum frequency and the minimum frequency defined as where f max i,j is the frequency of the facies with the highest occurrence (also described as the occurrences of the facies type with the most predictions), and f min i,j is the frequency of the facies with the least occurrence at each discretized location within the domain. For example, if the facies type at a particular discretized location is predicted to be USF 80 times, LSF  = 75. Figure 18 shows the frequency of predictions for the initial guess of the SBGMs. It can be observed that there is high uncertainty in the model as the uncertainty varies in equal proportions laterally in the model including at the well locations. Figure 19a and b depict the frequency of predictions and the variations among 100 conditioned realizations for models conditioned using SurfNet2 and SurfNet3 respectively. The 100 realisations used have the same initial guess for the optimisation in both networks, and are above the cut-offs used for both networks. In both figures, spatial variations and uncertainties among the conditioned realizations are considerably lower at locations close to the wells compared to locations away from the control data, where we observe a smaller number of the conditioned realisations predicting the same facies types. In Fig. 19b, the addition of the well at x=500m constrains the model at that location and its surrounding, resulting in a more global reduction in the uncertainties. Figure 20a and b show the facies with the highest predictions at discretized grids over the entire domain of the SBGM for 100 conditioned realizations. Qualitatively, it can be observed that salient features are captured and patterns in the reference wells are preserved as the facies predicted in most of the models from the neural network follow similar trends with the reference model. In contrast, Fig. 21 which shows the maximum predicted facies for the initialised SBGM models does not depict the significant variations at well location that correspond to the observed data. An assessment of Fig. 20a and b show similar patterns at x=100m and x=900m, while at x=500m, variations between the two maximum predictions are observed. By constraining the model with more information at x=500m, there is a better agreement with the reference model.
We found good results using the approach proposed here for conditioning surface-based models, particularly for initialised input values that largely agree with the reference data, where the conditioning is very effective and the method produces plausible realizations. However, if initialised model inputs significantly disagree with the spatial statistics of the reference dataset, conditioning may be more challenging. Since geological and petrophysical properties are often spatially correlated, exploring the spatial variations among variables through the use of Convolutional Neural Networks (CNNs) [36], which are capable of learning representative features of spatially correlated data should be very interesting. Furthermore, the hierarchical arrangement of surfaces and stacking patterns of SBGMs present opportunities for conditioning individual surfaces using Recurrent Neural Networks (RNNs) to model temporal sequences [37][38][39]. Because perturbing previous events of the forward model changes subsequent events, data conditioning on an eventby-event basis may significantly improve the results as variations among the conditioned realizations along the well locations can still be observed at points that correspond to the boundaries of facies associations in the reference data. The addition of information regarding variations in Fig. 18 The frequency of predictions plot for the initialised SBGMs.The uncertainty varies in equal proportions laterally in the model including at the well locations Fig. 19 The frequency of predictions plot for SurfNet2 and SurfNet3 depicting the difference between the maximum frequency (number of facies with the highest occurrence), and the minimum frequency (number of facies with the least occurrence) at each discretized location in the domain. At regions close to the control data (wells at x=100m, x=500m and x=900m), there is a higher number of predictions of the same facies type among the 100 conditioned realizations, compared to regions away from the control data sequence numbers and thickness of layers using RNNs may significantly improve the results. This will allow for the extension of the method to conditioning SBGMs to stratigraphic surfaces in addition to the facies type investigated in this research. The proposed methodology may also be reapplied to object-based models where parameterized objects are used to describe complex reservoir geometry. Future work will have far-reaching practical application for more accurately describing the spatial distribution of geological features in 3D reservoir modelling and characterisation.
Although the application of the method is presented on a 2D synthetic example, the method described in this work Fig. 20 The facies type with the maximum frequency or number of occurrences is shown for 100 plausible realisations that have been conditioned to the well data using (a) SurfNet2 and (b) SurfNet3. Patterns associated with the reference well are preserved as the facies predicted in most of the models from the neural network follow similar trends with the reference model can also be applied to real cases, where SBGMs can be generated using the method presented in [28]. For field applications, the approach outlined in Fig. 6 can be utilised for conditioning geological models to well data although more attention will be focused on generating SBGMs that are 3D and comprise a broader range of geometries that are representative of subsurface geology. Furthermore dealing with more than three facies codes and higher number of wells are steps to take for a more general application. We also note that in contrast to the example demonstrated here, the following challenges will apply to real cases: 1. Longer time requirements for generating the SBGMs to be used as training examples for the neural network.

Fig. 21
The facies type with the maximum frequency or number of occurrences is shown for 100 models used as initial inputs to the inverse modelling. General trends and similarities with the reference data cannot be observed at well locations However, compared to other methods, the use of parametric, grid-free surface-based models for representing geological heterogeneity of interest such as features which influence the flow conditions has many advantages which outweigh any anticipated computational limitations. Furthermore, the number of surfaces required to model realistic reservoirs using surfaces has been shown by [2] to be low to generate representative models. 2. Increased model training time/computational requirements due to the increase in the number of input parameters for the model, which might require more complex network architectures. However, for 3D model equivalents of the 2D example shown, the number of parameters only increase by a factor of two.

Conclusions
We have demonstrated how surface-based geological models (SBGMs) can be conditioned to well data using neural networks. A multi-layer perceptron was trained to learn the features and underlying relationship between the SBGM inputs and facies types along a well. The ease of representing realistic surface-based geological models enabled the rapid generation of 10 6 SBGM samples with which the network could be trained to a high degree of accuracy. Using a back-propagation algorithm, the inputs of the SBGM were generated by optimizing the inputs of the pre-trained neural network based on the forward model. The inverse modelling provided an ensemble of realisations that fit the observed well data; these multiple realisations can be used to understand the impact of uncertainty on predictions of fluid flow and other important reservoir metrics. An assessment of the uncertainties revealed low variations between models close to the control data as expected, and high variations away from control data, further informing the spatial uncertainty of the sequences in the geological model. The use of an additional well constrains the resulting SBGMs further and validates the applicability of the method as a robust framework for conditioning SBGMs to well data. This proof-of-concept work is essential to underpin future research to improve the methodology for application to real cases, particularly 3D reservoir models of more complex heterogeneities and a larger number of wells. The use of CNNs, which apply sparse connections to describe spatial correlations, and RNNs, which allow for variability in building series models, are proposed in future work to improve the methodology presented here. indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons. org/licenses/by/4.0/.