Prediction of Discretization of GMsFEM using Deep Learning

In this paper, we propose a deep-learning-based approach to a class of multiscale problems. THe Generalized Multiscale Finite Element Method (GMsFEM) has been proven successful as a model reduction technique of flow problems in heterogeneous and high-contrast porous media. The key ingredients of GMsFEM include mutlsicale basis functions and coarse-scale parameters, which are obtained from solving local problems in each coarse neighborhood. Given a fixed medium, these quantities are precomputed by solving local problems in an offline stage, and result in a reduced-order model. However, these quantities have to be re-computed in case of varying media. The objective of our work is to make use of deep learning techniques to mimic the nonlinear relation between the permeability field and the GMsFEM discretizations, and use neural networks to perform fast computation of GMsFEM ingredients repeatedly for a class of media. We provide numerical experiments to investigate the predictive power of neural networks and the usefulness of the resultant multiscale model in solving channelized porous media flow problems.


Introduction
Multiscale features widely exist in many engineering problems.For instance, in porous media flow, the media properties typically vary over many scales and contain high contrast.Multiscale Finite Element Methods (MsFEM) [14,21,22] and Generalized Multiscale Finite Element Methods (GMsFEM) [12,8] are designed for solving multiscale problems using local model reduction techniques.In these methods, the computational domain is partitioned into a coarse grid T H , which does not necessarily resolve all multiscale features.We further perform a refinement of T H to obtain a fine grid T h , which essentially resolves all multiscale features.The idea of local model reduction in these methods is based on idenfications of local multiscale basis functions supported in coarse regions on the fine grid, and replacement of the macroscopic equations by a coarse-scale system using a limited number of local multiscale basis functions.As in many model reduction techniques, the computations of multiscale basis functions, which constitute a small dimensional subspace, can be performed in an offline stage.For a fixed medium, these multiscale basis functions are reusable for any force terms and boundary conditions.Therefore, these methods provide a substantial computational savings in the online stage, in which a coarse-scale system is constructed and solved on the reduced-order space.
However, difficulties arise in situations with uncertainties in the media properties in some local regions, which are common for oil reservoirs or aquifers.One straightforward approach for quantifying the uncertainties is to sample realizations of media properties.In such cases, it is challenging to find an offline principal component subspace which is able to universally solve the multiscale problems with different media properties.The computation of multiscale basis functions has to be performed in an online procedure for each medium.Even though the multiscale basis functions are reusable for different force terms and boundary conditions, the computational effort can grow very huge for a large number of realizations of media properties.To this end, building a functional relationship between the media properties and the multiscale model in an offline stage can avoid repeating expensive computations and thus vastly reduce the computational complexity.Due to the diversity of complexity of the media properties, the functional relationship is highly nonlinear.Modelling such a nonlinear functional relationship typically involves high-order approximations.Therefore, it is natural to use machine learning techniques to devise such complex models.In [15,3], the authors make use of a Bayesian approach for learning multiscale models and incorporating essential observation data in the presence of uncertainties.
Deep neural networks is one class of machine learning algorithm that is based on an artificial neural network, which is composed of a relatively large number of layers of nonlinear processing units, called neurons, for feature extraction.The neurons are connected to other neurons in the successive layers.The information propagates from the input, through the intermediate hidden layers, and to the output layer.In the propagation process, the output in each layer is used as input in the consecutive layer.Each layer transforms its input data into a little more abstract feature representation.In between layers, a nonlinear activation function is used as the nonlinear transformation on the input, which increases the expressive power of neural networks.Recently, deep neural network (DNN) has been successfully used to interpret complicated data sets and applied to tasks with pattern recognition, such as image recognition, speech recognition and natural language processing [25,19,18].Extensive researches have also been conducted on investigating the expression power of deep neural networks [11,20,10,28,27,17]. Results show that neural networks can represent and approximate a large class of functions.Recently, deep learning has been applied to model reductions and partial differential equations.In [31], the authors studied deep convolution networks for surrogate model construction.on dynamic flow problems in heterogeneous media.In [26], the authors studied the relationship between residual networks (ResNet) and characteristic equations of linear transport, and proposed an interpretation of deep neural networks by continuous flow models.In [30], the authors combined the idea of the Ritz method and deep learning techniques to solve elliptic problems and eigenvalue problems.In [23], a neural network has been designed to learn the physical quantities of interest as a function of random input coefficients.The concept of using deep learning to generate a reduced-order model for a dynamic flow has been applied to proper orthogonal decomposition (POD) global model reduction [2] and nonlocal multi-continuum upscaling (NLMC) [29].
In this work, we propose a deep-learning-based method for fast computation of the GMsFEM discretization.Our approach makes use of deep neural networks as a fast proxy to compute GMsFEM discretizations for flow problems in channelized porous media with uncertainties.More specifically, neural networks are used to express the functional relationship between the media properties and the multiscale model.Such networks are built up in an offline stage.Sufficient sample pairs are required to ensure the expressive power of the networks.With different realizations of media properties, one can use the built network and avoid computations of local problems and spectral problems.
The paper is organized as follows.We start with the underlying partial differential equation that describes the flow within a heterogeneous media and the main ingredients of GMsFEM in Section 2. Next, in Section 3, we present the idea of using deep learning as a proxy for prediction of GMsFEM discretizations.The networks will be precisely defined and the sampling will be explained in detail.In Section 4, we present numerical experiments to show the effectiveness of our presented networks on several examples with different configurations.Finally, a conclusive discussion is provided in Section 5.

Preliminaries
In this paper, we are considering the flow problem in highly heterogeneous media where Ω is the computational domain, κ is the permeability coefficient in L ∞ (Ω), and f is a source function in L 2 (Ω).We assume the coefficient κ is highly heterogeneous with high contrast.The classical finite element method for solving (1) numerically is given by: find where V h is a standard conforming finite element space over a partition T h of Ω with mesh size h.However, with the highly heterougeneous property of coefficient κ, the mesh size h has to be taken extremely small to capture the underlying fine-scale features of κ.This ends up with a large computational cost.Generalized Multiscale Finite Element Method (GMsFEM) [12,8] serves as a model reduction technique to reduce the number of degree of freedom and attain both efficiency and accuracy to a considerable extent.GMsFEM has been successfully extended to other formulations and applied to other problems.Here we provide a brief introduction of the main ingredients of GMsFEM.For a more detailed discussion of GMsFEM and related concepts, the reader is referred to [6,5,13,1,7].
In GMsFEM, we define a coarse mesh T H over the domain Ω and refine to obtain a fine mesh T h with mesh size h H, which is fine enough to restore the multiscale properties of the problem.Multiscale basis functions are defined on coarse grid blocks using linear combinations of finite element basis functions on T h , and designed to resolve the local multiscale behaviors of the exact solution.The multiscale finite element space V ms , which is a principal component subspace of the conforming finite space V h with dim(V ms ) dim(V h ), is constructed by the linear span of multiscale basis functions.The multiscale solution u ms ∈ V ms is then defined by In this work, we consider the identification of dominant modes for solving (1) by multiscale basis functions, including spectral basis functions and simplified basis functions, in GMsFEM.Here, we present the details of the construction of multiscale basis functions in GMsFEM.Let N x = {x i |1 ≤ i ≤ N v } be the set of nodes of the coarse mesh T H .For each coarse grid node x i ∈ N x , the coarse neighborhood ω i is defined by that is, the union of the coarse elements K j ∈ T H containing the coarse grid node x i .An example of the coarse and fine mesh, coarse blocks and a coarse neighborhood is shown in Figure 1.For each coarse neighbourhood ω i , we construct multiscale basis functions {φ ωi j } Li j=1 supported on ω i .For the construction of spectral basis functions, we first construct a snapshot space V (i) snap spanned by local snapshot basis functions ψ i,k snap for each local coarse neighborhood ω i .The snapshot basis function ψ i,k snap is the solution of a local problem The fine grid functions δ i,k is a function defined for all x s ∈ ∂ω i , where {x s } denote the fine degrees of freedom on the boundary of local coarse region ω i .In specific, The linear span of these harmonic extensions forms the local snapshot space One can also use randomized boundary conditions to reduce the computational cost associated with snapshot calculations [1].Next, a spectral problem is designed based on our analysis and used to reduce the dimension of local multiscale space.More precisely, we seek for eigenvalues λ i m and corresponding eigenfunctions where the bilinear forms in the spectral problem are defined as where κ = j κ|∇χ j | 2 , and χ j denotes the multiscale partition of unity function.We arrange the eigenvalues λ i m of the spectral problem (6) in ascending order, and select the first l i eigenfunctions {φ ωi m } li m=1 corresponding to the small eigenvalues as the multiscale basis functions.
An alternative way to construct the multiscale basis function is using the idea of simplified basis functions.This approach assumes the number of channels and position of the channalized permeability field are known.Therefore we can obtain multiscale basis functions {φ ωi m } li m=1 using these information and without solving the spectral problem [9].
Once the multiscale basis functions are constructed, the span of the multiscale basis functions will form the offline space We will then seek a multlscale solution u ms ∈ V ms satisfying which is a Galerkin projection of the (1) onto V ms , and can be written as a system of linear equations where A c and b c are the coarse-scale stiffness matrix and load vector.If we collect all the multiscale basis functions and arrange the fine-scale coordinate representation in columns, we obtain the downscaling operator R. Then the fine-scale representation of the multiscale solution is given by 3 Deep Learning for GMsFEM In real world applications, there are uncertainties within some local regions of the permeability field κ in the flow problem.Thousands of forward simulations are needed to quantify the uncertainties of the flow solution.
GMsFEM provides us with a fast solver to compute the solutions accurately and efficiently.Considering that there is a large amount of simulation data, we are interested in developing a method utilizing the existing offline data and reducing direct computational effort later.In this work, we aim at using DNN to model the relationship between heterogeneous permeability coefficient κ and the key ingredients of GMsFEM solver, i.e., coarse scale stiffness matrices and multiscale basis functions.When the relation is built up, we can feed the network any realization of the permeability field and obtain the corresponding GMsFEM ingredients, and further restore fine-grid GMsFEM solution of (1).The general idea of utilizing deep learning in the GMsFEM framework is illustrated in Figure 2. Suppose that there are uncertainties for the heterogeneous coefficient in a local coarse block K 0 , which we call the target block, and the permeability outside the target block remains the same.For example, for a channelized permeability field, the position, location and the permeability values of the channels in the target block can vary.The target block K 0 is inside 3 coarse neighborhoods, denoted by ω 1 , ω 2 , ω 3 .The union of the 3 neighborhoods, i.e. ω are constituted of by the target block K 0 and 12 other coarse blocks, denoted by {K l } 12 l=1 A target block and its surrounding neighborhoods are depicted in Figure 3.
For a fixed permeability field κ, one can compute the multiscale basis functions φ ωi m (κ) defined by ( 6), for i = 1, 2, 3, and the local coarse-scale stiffness matrices A K l c (κ), defined by for l = 0, 1, . . ., 12.We are interested in constructing the maps g m,i B and g l M , where B maps the permeability coefficient κ to a local multiscale basis function φ ωi m , where i denotes the index of the coarse block, and m denotes the index of the basis in coarse block ω i g m,i B : κ → φ ωi m (κ), • g l M maps the permeability coefficient κ to the coarse grid parameters In this work, our goal is to make use of deep learning to build fast approximations of these quantities associated with the uncertainties in the permeability field κ, which can provide fast and accurate solutions to the heterogeneous flow problem (1).
In our networks, the permeability field κ is the input, while the multiscale basis functions φ ωi m and the coarsescale matrix A K l c are the outputs.Once the neural networks are built, we can use the networks to compute the multiscale basis functions and coarse-scale parameters in the associated region for any permeability field κ.Using these local information from the neural networks together with the global information which can be pre-computed, we can form the downscale operator R with the multiscale basis functions, form and solve the linear system (10), and obtain the multiscale solution by (11).

Network architecture
In general, a L-layer neural network N can be written in the form are the weight matrices and b's are the bias vectors, σ is the activation function, x is the input.Such a network is used to approximate the output y.Our goal is then to find θ * by solving an optimization problem where L(θ) is called loss function, which measures the mismatch between the image of the input x under the the neural network N (x, y; θ) and the desired output y in a set of training samples (x j , y j ).In this paper, we use the mean-squared error metric to be our loss function where N is the number of the training samples.An illustration of a deep neural network is shown in Figure 4.
Suppose we have a set of different realizations of the permeability {κ 1 , κ 2 , • • • , κ N } in the target block.In our network, the input x j = κ j ∈ R d is a vector containing the permeability image pixels in the target block.The output y j is an entry of the local stiffness matrix A K l c , or the coordinate representation of a multiscale basis function φ ωi m .We will make use of these sample pairs (x j , y j ) to train a deep neural network N m,i B (x; θ * B ) and N l M (x; θ * M ) by minimizing the loss function with respect to the network parameter θ, such that the trained neural networks can approximate the functions g m,i B and g l M , respectively.Once the neural is constructed, for some given new permeability coefficient κ N +1 , we use our trained networks to compute a fast prediction of the outputs, i.e. local multiscale basis functions φ ωi,pred m by and local coarse-scale stiffness matrix A K l ,pred c by

Network-based multiscale solver
Once the neural networks are built, we can assemble the predicted multiscale basis functions to obtain a prediction R pred for the downscaling operator, and assemble the predicted local coarse-scale stiffness matrix A K l ,pred c in the global matrix A pred c .Following (10) and (11), we solve the predicted coarse-scale coefficient vector u pred c from the following linear system and obtain the predicted multiscale solution u pred ms by

Numerical Results
In this section, we present some numerical results for predicting the GMsFEM ingredients and solutions using our proposed method.We consider permeability fields κ with high-contrast channels inside the domain Ω = (0, 1) 2 , which consist of uncertainties in a target cell K 0 .More precisely, we consider a number of random realizations of permeability fields κ 1 , κ 2 , κ 3 , • • • , κ N +M .Each permeability field contains two highconductivity channels, and the fields differ in the target cell K 0 by: • in Experiment 1, the channel configurations are all distinct, and the permeability coefficients inside the channels are fixed in each sample (see Figure 5 for illustrations), and • in Experiment 2, the channel configurations are randomly chosen among 5 configurations, and the permeability coefficients inside the channels follow a random distribution (see Figure 6 for illustrations).
In these numerical experiments, we assume there are uncertainties in only the target block K 0 .The permeability field in Ω \ K 0 is fixed across all the samples.We follow the procedures in Section 3 and to generate sample pairs using GMsFEM.Local spectral problems are solved to obtain the multiscale basis functions φ ωi m .In the neural network, the permeability field x = κ is considered to be the input, while the local multiscale basis functions y = φ ωi m and local coarsescale matrices y = A K l c are regarded as the output.These sample pairs are divided into the training set and the learning set in a random manner.A large number N of realizations, namely κ 1 , κ 2 , . . ., κ N , are used to generate sample pairs in the training set, while the remaining M realizations, namely, κ N +1 , κ N +2 , . . ., κ N +M are used in testing the predictive power of the trained network.We remark that, for each basis function and each local matrix, we solve an optimization problem in minimizing the loss function defined by the sample pairs in the training set, and build a separate deep neural network.We summarize the network architectures for training local coarse scale stiffness matrix and multiscale basis functions as below: • For the multiscale basis function φ ωi m , we build a network N m,i B using -Input: Vectorized permeability pixels values κ, -Output: Coefficient vector of multiscale basis φ ωi m (κ) on coarse neighborhood ω i , -Loss Function: Mean squared error 1 -Activation Function: Leaky ReLu function, -DNN structure: 10-20 hidden layers, each layer have 250-350 neurons, -Training Optimizer: Adamax.
• For the local coarse scale stiffness matrix A K l c , we build a network N l M using -Input: Vectorized permeability pixels values κ, -Output: Vectorized coarse scale stiffness matrix A K l c (κ) on the coarse block K l , -Loss Function: Mean squared error 1 -Activation Function: ReLu function (Rectifier), -DNN structure: 10-16 hidden layers, each layer have 100-500 neurons, -Training Optimizer: Proximal Adagrad.
For simplicity, the activation functions ReLU function [16] and Leaky ReLU function are used as they have the simplest derivatives among all nonlinear functions.The ReLU function is proved to be useful in training deep neural network architectures The Leaky ReLU function can resolve the vanishing gradient problem which can accelerate the training in some occasions.The optimizers Adamax and Proximal Adagrad are stochastic gradient descent (SGD) based methods commonly used in neural network training [24].In both experiments, we trained our network using Python API Tensorflow and Keras [4].Once a neural network is built on training, it can be used to predict the output given a new input.The accuracy of the predictions is essential in making the network useful.In our experiments, we use of M sample pairs, which are not used in training the network, to examine the predictive power of our network.On these sample pairs, referred to as the testing set, we compare the prediction and the exact output and compute the mismatch in some suitable metric.Here, we summarize the metric used in our numerical experiment.For the multiscale basis functions, we compute the relative error in L 2 and H 1 norm, i.e.
For the local stiffness matrices, we compute the relative error in entrywise 2 , entrywise ∞ and Frobenius norm, i.e.
A more important measure of the usefulness of the trained neural network is the predicted multiscale solution u pred ms (κ) given by ( 14)- (15).We compare the predicted solution to u ms defined by ( 10)-( 11), and compute the relative error in L 2 and energy norm, i.e.

Experiment 1
In this experiment, we consider curved channelized permeability fields.Each permeability field contains a straight channel and a curved channel.The straight channel is fixed and the curved channel strikes the boundary of the target cell K 0 at the same points.The curvature of the sine-shaped channel inside K 0 varies among all realizations.We generate 2000 realizations of permeability fields, where the permeability coefficients are fixed.Samples of permeability fields are depicted in Figure 5.Among the 2000 realizations, 1980 sample pairs are randomly chosen and used as training samples, and the remaining 20 sample pairs are used as testing samples.
For each realization, we compute the local multiscale basis functions and local coarse-scale stiffness matrix.In building the local snapshot space, we solve for harmonic extension of all the fine-grid boundary conditions.Local multiscale basis functions are then constructed by solving the spectral problem and multiplied the spectral basis functions with the multiscale partition of unity functions.With the offline space constructed, we compute the coarse-scale stiffness matrix.We use the training samples to build deep neural networks for approximating these GMsFEM quantities, and examine the performance of the approximations on the testing set.
Tables 1-3 record the error of the prediction by the neural networks in each testing sample and the mean error measured in the defined metric.It can be seen that the prediction are of high accuracy.This is vital in ensuring the predicted GMsFEM solver useful.Table 4 records the error of the multiscale solution in each testing sample and the mean error using our proposed method.It can be observed that using the predicted GMsFEM solver, we obtain a good approximation of the multiscale solution compared with the exact GMsFEM solver.

Experiment 2
In this experiment, we consider sine-shaped channelized permeability fields.Each permeability field contains a straight channel and a sine-shaped channel.There are altogether 5 channel configurations, where the straight channel is fixed and the sine-shaped channel strikes the boundary of the target cell K 0 at the same points.The curvature of the sine-shaped channel inside K 0 varies among these configurations.For each channel configuration, we generate 500 realizations of permeability fields, where the permeability coefficients follow random distributions.Samples of permeability fields are depicted in Figure 6.Among the 2500 realizations, 2475 sample pairs are randomly chosen and used as training samples, and the remaining 25 sample pairs are used as testing samples.Next, for each realization, we compute the local multiscale basis functions and local coarse-scale stiffness matrix.In building the local snapshot space, we solve for harmonic extension of randomized fine-grid boundary conditions, so as to reduce the number of local problems to be solved.Local multiscale basis functions are then constructed by solving the spectral problem and multiplied the spectral basis functions with the multiscale partition of unity functions.With the offline space constructed, we compute the coarsescale stiffness matrix.We use the training samples to build deep neural networks for approximating these GMsFEM quantities, and examine the performance of the approximations on the testing set.Figures 7-9 show the comparison of the multiscale basis functions in 2 respective coarse neighborhoods.It can be observed that the predicted multiscale basis functions are in good agreement with the exact ones.In particular, the neural network successfully interprets the high conductivity regions as the support localization feature of the multiscale basis functions.Tables 5-6 record the mean error of the prediction by the neural networks, measured in the defined metric.Again, it can be seen that the prediction are of high accuracy.Table 7 records the mean error between the multiscale solution using the neural-network-based multiscale solver and using exact GMsFEM.we obtain a good approximation of the multiscale solution compared with

Conclusion
In this paper, we develop a method using deep learning techniques for fast computation of GMsFEM discretizations.Given a particular permeability field, the main ingredients of GMsFEM, including the multiscale e L 2 e a Mean 0.03 0.26 basis functions and coarse-scale matrices, are computed in an offline stage by solving local problems.However, when one is interested in calculating GMsFEM discretizations for multiple choices of permeability fields, repeatedly formulating and solving such local problems could become computationally expensive or even infeasible.Multi-layer networks are used to represent the nonlinear mapping from the fine-scale permeability field coefficients to the multiscale basis functions and the coarse-scale parameters.The networks provide a direct fast approximation of the GMsFEM ingredients in a local neigorhood for any online permeability fields, in contrast to repeatedly formulating and solving local problems.Numerical results are presented to show the performance of our proposed method.We see that, given sufficient samples of GMsFEM discretizations for supervised training, deep neural networks are capable of providing reasonably close approximations of the exact GMsFEM discretization.Moreover, the small consistency error provides good approximations of multiscale solutions.

Figure 1 :
Figure 1: An illustration of coarse mesh (left), a coarse neighborhood and coarse blocks (right)

Figure 2 :
Figure 2: A flow chart in illustrating the idea of using deep learning in the GMsFEM framework.

Figure 3 :
Figure 3: An illustration of a target coarse block K 0 and related neighborhoods.

Figure 4 :
Figure 4: An illustration of a deep neural network.

Figure 5 :
Figure 5: Samples of permeability fields in the target block K 0 in Experiment 1.

Figure 6 :
Figure 6: Samples of permeability fields in the target block K 0 in Experiment 2.

Table 6 :
Percentage error of the local stiffness matrix A K0 c in Experiment 2.

Table 3 :
Percentage error of the local stiffness matrix A K0

Table 4 :
Percentage error of multiscale solution u ms in Experiment 1.

Table 5 :
Mean percentage error of multiscale basis functions φ ωi m in Experiment 2.

Table 7 :
Percentage error of multiscale solution u ms in Experiment 2.