*4.2. Results*

We will present the numerical results of the proposed method in this section. We are going to show the cluster assignment experiment first, followed by two other experiments which demonstrate the error of the method.

#### 4.2.1. Cluster Assignment in a Local Coarse Element

Before diving into the error analysis, we will show some of the cluster results in a local neighborhood. In this neighborhood, we manually created the cases such as: the extraction of a channel (longer), the expansion of a channel(wider), the discontinuity of a channel, the diagonal channels, the intersection of channels, and so on. In Figure 8, the number on top of each image is the cluster assignment ID number.

**Figure 8.** Cluster results of 28 samples, images shown are heterogeneous fields, the number on top of each image is the cluster assignment ID number.

We also demonstrate the clustering result in Figure 9 of another neighborhood which is around (25, 45) in Figure 7. From the results in both Figures 8 and 9, we observe that our proposed clustering algorithm based on deep learning is able create a good clustering of the parameter space. That is, heterogeneous coefficients with similar spatial structures are grouped in the same cluster.

**Figure 9.** Cluster results of 20 samples, images shown are heterogeneous fields, the number on top of each image is the cluster assignment ID number.

#### 4.2.2. Relation of Error and the Number of Clusters

In this section, we will demonstrate the error change when the hyperparamter—the number of clusters—increases. Given a new realization *<sup>κ</sup>*(*<sup>x</sup>*,*s*<sup>ˆ</sup>) where *s*ˆ denotes the parameter and a fixed neighborhood, suppose the neighborhood of this realization will be fitted into cluster *Si* by the model trained. We compute *κ*¯*i* = 1|*Si*| ∑|*Si*<sup>|</sup> *j*=1 *<sup>κ</sup>ij* where |*Si*| is the number of points in this cluster *Si*. The GMsFEM basis of this neighborhood can then be derived using *<sup>κ</sup>*¯*i*. We finally construct the solution using the GMsFEM basis pre-computed in all neighborhoods. We define the *l*2 relative error as :

$$ratio = \frac{\int\_{D} (u - u\_H)^2 dx}{\int\_{D} u^2 dx},\tag{17}$$

where *u* is the exact solution computed by finite element method with fine enough mesh and *uH* is the solution of the proposed method. We test the network on newly generated 300 samples and take the average of the errors.

In this experiment, we calculate the *l*2 relative error with the number of clusters increases. The number of clusters ranges from 5 to 11; and for each case, we will train the model and compute the *l*2 relative error. The result can be seen in Figure 10 and it can be observed from the picture that, the error is decreasing with the number of cluster increases.

**Figure 10.** The *l*2 error when the number of clusters changes, colors represent the number of GMsFEM basis.

#### 4.2.3. Comparison of Cluster-based Method with Tradition Method

In the second experiments, we first compute the *l*2 relative error (defined in Equation (17) with *uH* denoting the GMsFEM solution) of traditional GMsFEM method with given *<sup>κ</sup>*(*<sup>x</sup>*,*s*<sup>ˆ</sup>). This means that the construct multiscale basis functions using the particular realization *<sup>κ</sup>*(*<sup>x</sup>*,*s*<sup>ˆ</sup>). We then compare this error with the cluster method proposed (11 clusters). The comparison can be seen in Figure 11.

**Figure 11.** The *l*2 error cluster solution (11 clusters) vs. solution by real *<sup>κ</sup>*(*<sup>x</sup>*,*s*<sup>ˆ</sup>). Color represents number of basis.

It can be seen that the difference is negligible when the number of clusters reaches 11. We can then benefit from the deep learning; i.e., the fitting of *<sup>κ</sup>*(*<sup>x</sup>*,*s*<sup>ˆ</sup>) into a cluster is fast; and since we will use the pre-computed basis, we also save time on computing the GMsFEM basis.

#### *4.3. Effect of the Adversary Net*

The target of this task is not the learning of multiscale basis; the multiscale basis in this work is just a supervision of learning the cluster. However, to demonstrate the effectiveness of the adversary network, we also test the the effect of the adversary net. There are many hyper-parameters like the number of clusters and coefficients of the loss function which can affect the result; so to reduce the influence from the clustering, we remove the clustering loss from the training, so this is a generative task which will generate the multiscale basis from the output of the first network in Figure 6. The loss function now can be defined as:

$$\min\_{\theta\_G, \theta\_F} \lambda\_1 R + \lambda\_2 A\_\prime \tag{18}$$

where *R* and *A* are defined in Equations (12) and (15), separately; and *λ*1 and *λ*1 are both set to be 1. We compute the relative error with Equation (17) first by using the learned multiscale basis which is trained by Equation (18); and second by using the multiscale basis trained without the adversary loss Equation (15), i.e.,

$$\min\_{\theta\_G, \theta\_F} A. \tag{19}$$

The *l*2 relative error improves from 41.120439 to 36.760918 if we add one middle layer from the adversary net.

We also calculate the MSE difference of two learned basis (by loss Equation (18) and Equation (19), separately) and real multiscale basis, i.e., we calculate *<sup>B</sup>*learned basis − *B*real basis *MSE*, where *B*learned basis refers to two basis trained with Equation (18) and Equation (19), separately and *B*real basis is the real multiscale basis formed using the input heterogeneous field. The MSE amazingly decreases from 0.9073400 to 0.748312 if we use basis trained with the adversary loss Equation (18). This can show the benefit from the adversary net.
