GAN inversion method of an initial in situ stress field based on the lateral stress coefficient

The initial in situ stress field influences underground engineering design and construction. Since the limited measured data, it is necessary to obtain an optimized stress field. Although the present stress field can be obtained by valley evolution simulation, the accuracy of the ancient stress field has a remarkable influence. This paper proposed a method using the generative adversarial network (GAN) to obtain optimized lateral stress coefficients of the ancient stress field. A numerical model with flat ancient terrain surfaces is established. Utilizing the nonlinear relationship between measured stress components and present burial depth, lateral stress coefficients of ancient times are estimated to obtain the approximate ancient stress field. Uniform designed numerical tests are carried out to simulate the valley evolution by excavation. Coordinates, present burial depth, present lateral stress coefficients and ancient regression factors of lateral stress coefficients are input to GAN as real samples for training, and optimized ancient regression factors can be predicted. The present stress field is obtained by excavating strata layers. Numerical results show the magnitude and distribution law of the present stress field match well with measured points, thus the proposed method for the stress field inversion is effective.

in situ stress fields, but in deep-buried underground engineering, the relationship between the in situ stress and burial depth is not linear.
(2) The boundary load adjustment method 26,27 repeatedly adjusts the calculated boundary load of the numerical model so that the calculated stress values under certain working conditions are close to the measured values. The initial in situ stress obtained by this method can be highly optimized for a specific space point but can hardly fit all measured points. In addition, there is no unique solution for this method, and the trial solution process has no rules to follow and can be time-consuming. (3) The displacement back analysis method 28 uses the assumed in situ stress field and rock mass mechanical parameters to calculate the displacement of the engineering excavation through numerical simulation. The mechanical parameters of the rock mass are adjusted until the calculated displacement is consistent with the measured displacement. Then, the secondary stress field is obtained 29,30 . However, this method is only applicable to underground engineering during construction and cannot be applied in the engineering design stage 31 . (4) The valley evolution method 32,33 uses layered excavation of ancient strata to simulate the formation process of the present topography and uses the lateral stress coefficient to indicate the variation in the stress field, thus obtaining the present in situ stress field. However, since large underground engineering stresses are affected by tectonic stress, it is difficult to determine the lateral stress coefficient, and because the lateral stress coefficient is not a constant value at various depths, this method can result in a large error in the initial in situ stress field inversion. (5) Artificial intelligence combined with the above methods [34][35][36] can improve the efficiency and accuracy of in situ stress inversion. It can simulate the physiological mechanism of the human brain through a large number of neurons to realize intelligent information processing 37 . Artificial intelligence has remarkable advantages in nonlinear analysis and fuzzy recognition [38][39][40] . Commonly used artificial intelligence methods include neural networks 34 , genetic algorithms 41 , and gray theories 2 . These artificial intelligence methods usually aim at inversion of stress at measured points, not the global stress distribution, which results in good agreement at the measured points but uncertain accuracy elsewhere.
In this paper, a 3D numerical model of the Shuangjiangkou underground hydropower station in ancient times is established, which is used to invert initial in situ stress field. According to measured point data, the lateral stress coefficients of stress components in ancient times are estimated, and multiple combinations of stress components with different lateral stress coefficients are established by a uniform design test. Generative adversarial network (GAN) can automatically establish high-dimensional and global probability distribution of variables by confront training, and can generate new data samples according to the distribution of real data, which can improve the accuracy of rock mechanical parameters and models. Based on the nonlinear analysis of the GAN, two regression factors governing the distribution law of optimized lateral stress coefficients of each stress component in ancient times were determined. After GAN prediction of 12 regression factors for six stress components, optimized lateral stress coefficients are determined. By built model of ancient planation surface with no undulations, the ancient stress field can be reconstructed using the optimized lateral stress coefficients. Then, strata are excavated by layers to simulate valley evolution, and the final stress result represents the present in situ stress field and distribution law. Through comparison and verification with measurement points, this inversion method of initial in situ stress is found to be feasible and suitable for deep buried large underground engineering.

GAN inversion method for initial in situ stress field
The stress field in deep-cut valley area evolves from an ancient regional stress field, accompanied by river valley erosion, surface denudation and other geological effects to shape the valley slope in a long-term unloading process, prompting the rock mass to constantly adjust stress, strain and energy to form a new local stress field 42 . Therefore, top-down excavation of the ancient strata is used to simulate the gradual formation of the river valley geomorphic characteristics and the release of stress in the inversion of the present in situ stress field. The ancient strata denudation process is shown in Fig. 1, and the following assumptions are made about ancient surface and geological formations 43,44 .
(1) The ancient surface is a planation surface with no obvious undulations.
(2) The ancient stress field consists mainly of a self-gravity stress field and a tectonic stress field, and tectonic movement was completed in the ancient period. (3) The present in situ stress field evolved from an ancient stress field and was gradually formed by geological effects such as surface denudation and river erosion.
Inversion of the ancient stress field based on the lateral stress coefficient. In recent years, a method using lateral stress coefficients to inverse in situ stress fields has been proposed and developed 32,33,42 and is expressed as where σ 1 -σ 6 are stress components σ x , σ y , σ z , τ yz , τ zx and τ xy . k i is the lateral stress coefficient for the six stress components. H is burial depth. γ is bulk density. However, the present stress field is affected by topographical fluctuations and rock mass mechanical properties, leading to the in situ stress coefficient varying greatly in different places 31 . In ancient times, the topography www.nature.com/scientificreports/ and geomorphology had small fluctuations, and the geological structure was simple. Therefore, utilizing lateral stress coefficients to invert the ancient stress field is more suitable. Many scholars 25,37 have considered that lateral stress coefficients are a certain value at each place in a rock mass, which means that stress components increase linearly as burial depth increases. However, for deep buried engineering, the lateral stress coefficient is found not to be linear with burial depth 45 . Based on global measured in situ stress data, Brown and Hoek 45 found that the relationship between the lateral stress coefficient and the burial depth is where σ H , σ h and σ v are the maximum principal stress, minimum principal stress on the horizontal plane and vertical stress, respectively.
Based on the statistical analysis of lateral stress coefficients of different rock masses in mainland China, Jing Feng 46 reached conclusions similar to the ones of Eq. (2). Therefore, the relationship between the lateral stress coefficients and burial depth is where a i and b i are regression factors.
Based on Eq. (3) and measured stresses in engineering, approximate lateral stress coefficients k i of different stress components can be obtained. Introducing k i to Eq. (1), an approximate ancient stress field can be obtained.

Inversion of the present in situ stress field based on GAN.
Based on the approximate ancient stress field, numerical simulation can be used to excavate the ancient strata layer by layer to obtain the present stress field. Since the ancient stress field is approximately estimated, there may be a large error in obtaining the present stress field. To solve this problem, this paper introduces the generative adversarial network (GAN) to fine-tune lateral stress coefficients in ancient times to optimize the present in situ stress field to meet the demand of engineering analysis.
GAN is a generative model proposed by Goodfellow et al. 47 , and further developed by Mirza et al. 48 , Odena et al. 49 and Reed et al. 50 . Its basic thought is inspired by a minimax two-player game, and is widely used in artificial intelligence models, which show high learning and association capabilities and distributed processing capabilities to solve nonlinear problems. GAN consists of a generator and a discriminator trained on confrontational learning mechanism, as shown in Fig. 2. The purpose of GAN is to estimate the potential distribution of existing data and generate new data samples from the same distribution by a generator G which transforms the random variables z into the data that can be faked by continuously learning the probability distribution of real data. The discriminator D is a binary classifier that discriminates whether the input data is real or generated data samples. The two networks are enhanced simultaneously by competing with each other during training, so that the two networks constitute a dynamic game process, until Nash equilibrium 51 is achieved. Both the generator and the www.nature.com/scientificreports/ discriminator can be designed in conjunction with the current deep neural networks 52 . The calculated process of GAN can be summarized as a binary minimax game, and the objective function can be defined as: where V(D,G) is the cross-entropy loss of two classifications, P data (x) is the real data distribution, P g (z) is the random variables distribution, G(z) is samples generated by the generator based on the random variables, and E(⋅) means the calculated expected value. The global optimal solution is reached when P data = P g . For GAN, the loss function of generator and discriminator are expressed as log(D(G(z))) and log(D(x)) + log(1 − D(G(z))).
In this paper, deep learning is carried out on the distribution of the lateral stress coefficient based on the superiority of GAN data enhancement. The basic process of using GAN to analyze the lateral stress coefficients is as follows.
(1) From field survey data, the obtained stress values of the measured points are statistically analyzed, and the effective measured points are selected to determine the approximate lateral stress coefficients by Eq. (3) According to multiple ancient stress fields, strata excavation is carried out using FLAC3D to obtain multiple present initial stress fields, from which lateral stress coefficients under the present burial depth are determined. (4) The coordinates of the measurement point, present burial depth, present lateral stress coefficient and regression factors in ancient times are regarded as real data sample. After data normalization, the data sample are input into the GAN for training. (5) After training in GAN, regression factors a i and b i of the optimized ancient lateral stress coefficients can be obtained. Then, the optimized ancient stress field is constructed by Eq. (1). (6) After excavating the optimized ancient stress field, the optimized present initial stress field can be obtained.
For the selection of a i and b i values, many scholars 25,53-56 use orthogonal experiments. There are six pairs of regression factors a i and b i for six stress components. According to the principle of orthogonal experiments, (6 × 2) 2 = 144 combinations need to be designed for numerical calculation, which can lead to an excessive number of orthogonal tests and is rather time-consuming. Therefore, it is more appropriate to use a uniform design test instead of an orthogonal test 22,57 . The advantage of the uniform design can greatly reduce the number of tests and keep training samples uniformly dispersed. In the uniform design test, multiple combinations with different values of a i and b i can be designed. The parameters of the measured points under different combinations of a i and b i are www.nature.com/scientificreports/ where x and y are the coordinate vectors in the horizontal plane of the measured points. n is the number of measured points. H p is the burial depth vector of the measured points at present. k j is the lateral stress coefficient matrix of the measured points at present and j is the number of uniform design tests. a j and b j are regression factors matrices of stress components σ x , σ y , σ z , τ yz , τ zx and τ xy of measured points in ancient times.
After each uniform design test, the training of the GAN can be carried out. The real data sample input to GAN can be expressed as: After training, input the data of measured points to GAN, the optimized a i and b i values can be obtained. The optimized ancient stress field can be calculated by Eq. (3), and the present stress field can then be obtained after a nonlinear elastic-plastic excavation simulation. Equivalent mechanical parameters of faults. The parameters between the fault and the rock mass are quite different. If the influence of the fault is not considered in the inversion of the present stress field, it causes a large error in the result 58 . Therefore, the parameters of faults should be assigned to the corresponding element before simulating the excavation of ancient strata. Faults and underground caverns do not usually intersect in an orthogonal form and are often simplified into thin elements in numerical simulation analysis. This method of treating faults may bring difficulties in the mesh generation of models due to the limited thickness and complicated intersection relationship of faults.
In this paper, the rock mass is divided into hexahedron elements. Due to the existence of faults, some rock mass elements are cut by faults. These elements contain both rock masses and faults, forming composite elements, as shown in Fig. 3a. For one element, only a set of mechanical parameters can be assigned, so the mechanical parameters of composite elements with both rock masses and faults need to be equalized 59 . It is assumed that the composite element is a transversely isotropic material in the local coordinate system (x′y′z′) established on Equation (15) can be written as where E h is the equivalent elastic modulus in the x′ and y′ directions. Based on Eqs. (15) and (16), the equivalent elastic modulus is Combining Eqs. (15) and (17), the equivalent Poisson's ratio µ can be expressed as

Project overview and in situ stress measurement analysis
The Shuangjiangkou hydropower station is located on the Dadu River in western Sichuan Province, China. The diversion and power generation structures of the hydropower station are arranged on the left bank of the mountain. The length of the 3D numerical model is 878.14 m in the X direction and 950 m in the Y direction, as shown in Fig. 4. The X direction is N170° E along the axis of the main powerhouse. The length of the main powerhouse in the underground powerhouse is 217.5 m, the arch span is 28.3 m, the maximum excavation depth is 68.3 m, the horizontal burial depth is 400-640 m, and the vertical burial depth is 320-500 m. Two faults F1 and F2 and a lamprophyre L1 are found in the engineering site, as shown in Fig. 5. The distribution of the ten measured points is shown in Fig. 5, and the measured in situ stress data are shown in Table 1. As the measured in situ stress is obtained in the geodetic coordinate system, it needs to be converted to a model coordinate system, as shown in Table 2. The measured in situ stress in the underground powerhouse has the following distribution characteristics.    www.nature.com/scientificreports/ respectively, which are greater than 1.0. This indicates that the horizontal stress component in the measured stress is larger than the horizontal stress formed by Poisson's ratio effect of the rock mass gravity. Therefore, there is a horizontal tectonic stress field in this area. (4) σ x /σ y is greater than 1.00, indicating that the horizontal tectonic stress in the Y direction is smaller than that in the X direction. (5) σ z /ρgh is the ratio of σ z at a point to the vertical stress formed by gravity of the overlying rock mass. Except for at the measured point 3, σ z /ρgh is 1.08-3.06, and the average value is 1.97. Point 3 and point 5 are relatively near Fault 2 and the lamprophyre, respectively, which may cause undulation of the measured value 10 . Therefore, in the inversion of the initial in situ stress, points 3 and 5 are not used.

Inversion and analysis of stress field
Approximate stress field. By the analysis of the measured in situ stress in "Project overview and in situ stress measurement analysis", except for measured points 3 and 5, other measured in situ stress points are considered to be representative sample points. In Table 3, the actual lateral stress coefficients k i for the six stress components can be calculated. Based on Eq. (3), the relationship between the present burial depth and k i is shown in Fig. 6. The fitted stress function can be imported into FLAC3D to form an approximate ancient stress field. As shown in Fig. 7, the Z direction range of the ancient model is from the bottom elevation of 1970 m to the planation plane. The upper six layers in the model are elements for excavation, which are used to simulate the denudation process of the valley. The parameters input to the ancient model in FLAC3D are listed in Table 4. The coordinates of elements containing both rock masses and faults are exported by the FISH language. Then, the parameters of equivalent elements are calculated based on "Equivalent mechanical parameters of faults" and assigned to the model. The equivalent element is calculated using a transversely isotropic elastic constitutive model.
In FLAC3D, each element zone stores six stress components, and each element grid point stores unbalanced forces. If unbalanced forces in the X, Y, Z directions are not applied to model element grid points, stresses in element zones change, and the calculated results of the model greatly deviate from the real results. To optimize    (3) and (4) several times to make the stress components close enough to the stress components in the ancient model.

Magnitude (MPa) Direction (°) Dip angle (°)
After the above process, the balance calculation of the approximate ancient field is completed. Excavating ancient strata layer by layer can obtain the present in situ stress field. Six stress components and lateral stress coefficients at the measured points can be obtained. However, these lateral stress coefficients are obtained by approximating the ancient stress field, so there may be some unacceptable errors, and further optimized regression factors need to be determined.
Optimized stress field. By using a GAN to inversely optimize the present stress field, it is necessary to construct adequate real samples for training. Since the initial in situ stress inversion of this project is to provide accurate ground stress for the underground cavern excavation, the measured points in and around the underground cavern need to be selected as samples. In addition, boundary effects occur in numerical excavation simulations, so measured points near the boundary of the numerical model need to be selected as samples. Therefore, the measured point in Table 3 can be as samples to GAN training. Based on a large number of trial calculations 25 0.84, 0.92, 1.00, 1.08, 1.16, 1.24, 1.32, 1.40, and 1.48 times, respectively, so the U 13 uniform table is selected 56 , Table 3. Lateral stress coefficient k i for six stress components.  www.nature.com/scientificreports/ as shown in Table 5. Regression factors of each test can be taken into Eqs. (1) and (3) to calculate the stress components of each element, which can be imported into FLAC3D for calculation. In each test, the calculated stress components and lateral stress coefficients of the measured points can be obtained. There are eight effective measured points, so eight training samples can be created in each test, for a total of 13 × 8 = 104 samples. After training with real data samples, input x and y coordinates, present burial depth and lateral stress coefficient of the measured points in the present stress field of measured points, the regression factors of the ancient stress field can be obtained. Then, the optimized ancient stress field can be obtained by Eq. (3). Figure 8 shows the relationship between the loss function of generator and discriminator in GAN and iterations. The generator G and the discriminator network D are continuously confronted, so that the loss function of the two network reduces to a minimum, indicating that the output sample data from generator is stable. After GAN training, the regression factors of the optimized ancient stress field can be predicted, so the optimized ancient stress field can be obtained by Eq. (3). After excavating the optimized ancient stress field, the present stress field can be obtained. The regression factors and calculated stress values of the measured points are listed in Tables 6 and 7. The relative error Δ of the measured points can be calculated: where σ i is the calculated stress component and σ i is the measured stress component. �· · · � 2 is the 2-Norm.   Tables 6 and 7. For these method, the relative errors of σ x , σ y and σ z are less than 15%, which is more optimized than τ yz , τ xz and τ xy . According to statistical data, the error of in situ stress measurement results can reach 25-30% 61 . The maximum relative error of the measured points with GAN is 17.46%, so the distribution law of the in situ stress field is reasonable. For BP method, the maximum relative error for Point 8 reaches 28.4%, so the average relative error of GAN is much smaller than that of BP neural network, especially for the inversion of τ yz , τ xz and τ xy .

Analysis of present in situ stress field based on GAN inversion method.
Based on the calculated present stress field, the contour maps of y′ = 0 in Fig. 3 including some measured points are shown in Fig. 9. The topography has a significant influence on the in situ stress distribution in the engineering area, while the lithology has a small influence on the stress field. From the top to the bottom of the Earth's surface, σ x , σ y and   www.nature.com/scientificreports/ σ z increase with increasing depth. Due to the weak mechanical parameters at faults and lamprophyre, there are stress release effects in these areas. The stress components of the faults and lamprophyre all drop sharply, and the stress components of nearby rock masses also decrease. Figure 10 shows the principal stress contour map of Unit 1 in the main powerhouse, indicating that.
(1) The principal stress changes with the topography, and the surface unloading area has a small deformation modulus due to the relaxation of the rock mass structure, so there is a stress relaxation. (2) When the horizontal and vertical burial depths increase, the values of σ 1 and σ 3 gradually increase, and the contour lines are roughly parallel to the hillside. (3) With the increase in the depth of the caves, the stress value of the cave surrounding rock also increases, and the stress of the tailwater surge chamber is higher than that of the main powerhouse. The excavation and unloading stresses at the lower part of each cave are higher than those at the top arch, indicating that the excavation unloading effect of the lower part of the cave is more pronounced. (4) The stress field presents distribution characteristics of σ x > σ y > σ z , which is advantageous to excavation of the cave sidewalls, but the stability of the end wall is unfavorable.
The lateral stress coefficients k 1 -k 6 along the perpendicular line through Points A, B and C in Fig. 5 of the center of the three caverns are shown in Fig. 11. The calculated values of the lateral stress coefficients are close to the measured points but disperse from the main curve when the location is at the fault or lamprophyre. The lateral stress coefficients decrease with increasing burial depth and gradually tend to a constant value. The fitting curve shows the relationship between burial depth and lateral pressure coefficient Points A, B and C. The relationship is in accordance with Eq. (3), which can be directly imported into the numerical model with a cavern group for excavation simulation. www.nature.com/scientificreports/

Conclusion
The in situ stress field of the Shuangjiangkou Hydropower Station is mainly composed of tectonic stress and gravity stress, and its distribution is affected by the tectonic stress, geological structure and topography. In this paper, the ancient stratum excavation method combined with the lateral stress coefficient and GAN is utilized to invert the in situ stress field. By comparing with measured points, the feasibility of this method to invert the in situ stress field is verified.
(1) The in situ stress value is positively correlated with the burial depth and the lateral stress coefficient. For deep buried engineering, the lateral stress coefficient is inversely proportional to the burial depth and tends to a constant value, rather than following the commonly used linear relationship. (2) Instead of inverting the stress at measured points with the artificial intelligence method, the regression factor of the lateral stress coefficient in ancient times is determined by GAN. Then, the in situ stress field is obtained by strata excavation to simulate the geological effects of surface erosion and weathering to inverse the present in situ stress field. (3) Elements containing both rock masses and faults are regarded as equivalent elements of transverse isotropy, thereby reducing the difficulty of numerical model modeling and calculation time. (4) The inverted in situ stress components are close to the measured values, so the obtained in situ stress field is reasonable; thus, the inverted in situ stress field can reflect the distribution law of the actual in situ stress field and can provide reasonable guidance for the excavation simulation and stability analysis of underground caverns. (5) Based on the in situ stress field obtained by the inversion analysis, the equation of the lateral stress coefficient and the burial depth can be obtained. In subsequent cavern excavation simulations, a refined model with a cavern group can be established, and the reversed geostress equation can be directly imported into the model.
In summary, this paper proposes a new inversion method of the in situ stress field, which can provide a more optimized in situ stress field for deep-buried engineering.