A physical information neural network method for groundwater movement simulation based on logarithmic annealing
By optimizing the weights of the multi-objective loss function of the physical information neural network through logarithmic annealing, the problems of high mathematical ability requirements and unbalanced training rate in traditional groundwater movement calculation methods are solved, and a more efficient and accurate groundwater movement simulation is achieved.
Patent Information
- Application Number
- CN202411870606.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-12-18
AI Technical Summary
Traditional groundwater movement calculation methods require high mathematical skills from users and have a significant impact on the choice of discretization method. Physical information neural networks have an unbalanced training rate in multi-objective optimization problems and are affected by the randomness of initial weight distribution, resulting in low prediction accuracy and efficiency.
A physical information neural network method based on logarithmic annealing is adopted. The weights of the multi-objective loss function are optimized through the simulated annealing algorithm. The annealing temperature change is adjusted in logarithmic form. Combined with the error in the high-order differentiation process, the weight configuration of the neural network is optimized to achieve accurate simulation of groundwater movement.
It improves the prediction accuracy and speed of groundwater movement simulation, reduces the interference of randomness on the model, enhances the robustness and generalization ability of the model, and solves the problems of slow simulation speed in complex boundary areas, great impact of data quality, and possible violation of physical laws in traditional methods.
Smart Images

Figure CN119808631B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water environment simulation, and in particular to a physical information neural network groundwater movement simulation method based on logarithmic annealing. Background Art
[0002] Groundwater is one of Earth's most important freshwater resources, crucial for maintaining ecosystem balance, agricultural irrigation, industrial water use, and daily human life. It not only supports the majority of Earth's liquid freshwater reserves but is also often the sole source of freshwater in arid and semi-arid regions. With global population growth and accelerating industrialization, the rational development and protection of groundwater resources have become increasingly important. Groundwater not only affects the sustainable use of water resources but also directly impacts water quality and environmental health. Therefore, accurately monitoring and simulating groundwater movement and trends, as well as monitoring groundwater reserves, are crucial for water resource management and environmental stewardship.
[0003] Traditional groundwater movement calculation methods primarily address Darcy's law and the continuity equation in the saturated zone, and Richards' equation in the vadose zone. Finite element, finite difference, or finite volume methods are used to discretize the mesh within the region. For example, the finite element method constructs a weak form of the partial differential equation at each mesh vertex and assembles these to form a linear system of equations. This system then solves the approximate hydraulic head at each mesh, thereby obtaining the pressure head distribution field over the entire domain. These discretization methods require high mathematical skills, and the choice of discretization method significantly impacts the solution, making them challenging. Physical Information Neural Networks (PINNs) forgo the discrete mesh approach and instead leverage the ability of neural networks to theoretically simulate the properties of any nonlinear function. Physical laws are embedded in the neural network training process, enabling the network to learn solutions consistent with physical laws. Using PINNs to predict contaminant migration in groundwater can significantly improve the accuracy and efficiency of early warning systems.
[0004] When using PINN to solve partial differential equations, the complex form of the equations and the need to consider initial and boundary conditions result in a large number of loss function terms. Simply adding all loss terms together can lead to an imbalance in the training rates of different tasks, causing the neural network training to tend towards a large gradient descent. Currently, the main methods for multi-objective optimization problems include gradient normalization (GradNorm) and the principled loss function. These methods primarily optimize the weights during neural network training to achieve optimal results by customizing the initial weight distribution. However, they are affected by the randomness of the initial weight distribution.
[0005] The simulated annealing algorithm can find global maxima within the range of independent variables, effectively avoid local maxima, and is not easily disturbed by the randomness of the initial independent variable settings, and can converge well to the desired independent variable values. Therefore, a physical information neural network groundwater movement simulation method based on logarithmic annealing is needed to improve the network's prediction accuracy and obtain accurate groundwater head distribution and flow field maps. Summary of the Invention
[0006] The purpose of the present invention is to provide a physical information neural network groundwater movement simulation method based on logarithmic annealing. For the multi-objective optimization problem caused by the physical information neural network calculating partial differential equations, a simulated annealing scheme is used to obtain the optimal weight configuration, the annealing temperature change form is adjusted in logarithmic form, and the error in the high-order differentiation process is considered in the loss function. The optimized neural network shows good properties in solving the groundwater migration equation, which is helpful to analyze the direction of groundwater movement and evaluate the groundwater movement process.
[0007] To achieve the above object, the present invention provides a method for simulating groundwater movement using a physical information neural network based on logarithmic annealing, the steps comprising:
[0008] The first step is to solve the partial differential equation of groundwater movement based on the physical information neural network and establish a pre-training model and an actual training model;
[0009] In the second step, a multi-objective loss function for groundwater movement is established. The pre-trained model optimizes the weights of the multi-objective loss function based on the simulated annealing algorithm, approximating the minimum value of the multi-objective loss function to obtain the optimal distribution weights.
[0010] In the third step, the optimal values of the multi-objective loss function weights are generated based on the obtained optimal allocation weights, the actual model is trained according to the optimal values, and the groundwater head and flow direction distribution in the area are calculated.
[0011] Preferably, the first step specifically includes:
[0012] S1. Establish a conceptual model of groundwater movement area, set groundwater physical parameters, initial conditions, boundary conditions and source and sink conditions;
[0013] S2. Select a sampling method based on the regional conceptual model, perform random sampling on the spatiotemporal boundary and the interior of the region, use the physical prior information of the groundwater flow equation to generate the initial boundary conditions and the loss function term of the physical formula of the interior of the region, and impose physical constraints on the physical information neural network;
[0014] S3. Build a physical information neural network framework and generate pre-training models and actual training models.
[0015] Preferably, the loss function term of generating the initial boundary conditions and the regional internal physical formula by using the physical prior information of the groundwater flow equation includes:
[0016] S21. Using the groundwater flow equation including the saturated zone groundwater movement equation and the vadose zone groundwater movement equation as physical prior information;
[0017] The groundwater movement equation in the saturated zone is expressed as:
[0018]
[0019] The groundwater movement equation in the vadose zone is expressed as:
[0020]
[0021] in, is the Nabla operator, which means and Find the divergence, h is the pressure head, m; K is the permeability coefficient in each direction, m / d; S is the source and sink term, d -1 ;μ s is the water storage rate, m -1 ; t is time, d; K(θ) is the unsaturated hydraulic conductivity of the soil in the vadose zone, m / d; z represents the thickness of the vadose zone soil in the positive direction of the z axis, m;
[0022] S22. Construct boundary condition constraints for the groundwater flow equations of the saturated zone groundwater movement equation and the vadose zone groundwater movement equation. The boundary condition constraints include:
[0023] Dirichlet boundary conditions, the water head value on the boundary is a constant value, the expression is:
[0024] h(x,y,z,t)=G(x,y,z,t),(x,y,z)∈Γ1,t≥0;
[0025] Where Γ1 is the first-class boundary, G(x, y, z, t) is the known head distribution on the boundary;
[0026] Neumann boundary condition, the water flux perpendicular to the boundary is a constant value, the expression is:
[0027]
[0028] Where Γ2 is the second-type boundary, M(x, y, z, t) is the known flow distribution on the boundary, and n is the unit normal vector outside the surface on the second-type boundary;
[0029] Cauchy boundary condition: The hydraulic head and flow distribution combination in the groundwater is known on the boundary and is expressed as follows:
[0030]
[0031] Where Γ3 is the first type of boundary, h is the groundwater head, H s is the pressure head of the surface water body, K is the permeability coefficient of the weak permeable layer, and M is the thickness of the weak permeable layer.
[0032] When there is a weak permeable medium between groundwater and surface water, the two are hydraulically connected;
[0033] The initial conditions of the groundwater flow equation are:
[0034] If the distribution of the head value in the flow field at the beginning is known, the mathematical expression of the initial condition is:
[0035] h(x,y,z,t=0)=H(x,y,z),(x,y,z)∈Ω,t=0;
[0036] Where H(x,y,z) is the known head distribution at the initial moment;
[0037] S23. According to the groundwater flow equation and boundary conditions, partial derivatives that violate physical laws are added to the loss function to generate loss function terms of the initial boundary conditions and the physical formulas within the region.
[0038] Preferably, the loss function term includes:
[0039] MSE=MSE BC +MSE IC +MSE f +MSE u ;
[0040]
[0041] Where MSE represents the total mean square error, represents the function obtained by the neural network, N represents the number of time and space points used by each loss function, u represents the boundary condition or initial condition, L represents the residual of the physical equation under the output of the neural network, MSE BC Represents the boundary loss term, which represents the mean square error between the neural network fitting value and the actual boundary condition value under different boundary conditions. For a point on the boundary, MSE BC The closer it is to 0, the more it meets the boundary condition settings; MSE IC Represents the initial condition loss term, which represents the mean square error between the neural network fitting value and the actual initial condition value under the initial condition. For a point in the study area Ω at t = 0, MSE IC The closer it is to 0, the more it meets the initial condition settings; MSEf Represents the physical information loss term, which represents the mean square error between the neural network simulation results and the actual physical equation constraints. If the random points inside the region can well reflect the physical formula constraints, the corresponding MSE f The closer it is to 0; MSE u Represents the training data loss term, which represents the difference between the fitted value of the neural network with training data and the true value u i For any set of independent variables in the training data, the goal of neural network fitting is to convert the MSE u Approaching 0.
[0042] Preferably, the second step specifically includes:
[0043] S4. For the pre-trained model, a multi-objective loss function is constructed based on the loss function term, and a loss weight term is added to adjust the direction of the gradient descent of the physical information neural network model;
[0044] S5. Use the simulated annealing algorithm to train the pre-trained model, taking the weight of the loss function term as the independent variable and the total loss of the multi-objective loss function as the dependent variable. Apply annealing within the specified weight range to find the loss weight value that minimizes the total loss function at all sampling points.
[0045] Preferably, the multi-objective loss function is expressed as:
[0046]
[0047] Where N is the number of loss function terms, MSE i is the loss term, λ i is the weight of the corresponding loss term, For each penalty item, It is a penalty term in the loss function, which is used to prevent the error accumulation caused by high-order derivatives in partial differential equations when performing automatic differentiation calculations in deep learning frameworks.
[0048] Preferably, the one-time annealing process of the pre-trained model in step S5 includes:
[0049] S51, defining the function form and independent variables to be approximated to the minimum value, setting the initial annealing temperature, annealing cooling temperature, cooling rate and the number of adjustments N for each cooling, selecting the initial independent variable value, and setting the independent variable range;
[0050] S52. If the current temperature is higher than the annealing cooling temperature, perform annealing iterations to adjust the value of the independent variable. The adjustment amplitude is positively correlated with the current temperature. The adjustment is performed N times in total, and the value is adjusted in a logarithmic form.
[0051] S53, calculating the adjusted function value and comparing it with the original value. If it meets the approximation direction, the adjustment is accepted. Otherwise, based on the Metropolis criterion, the acceptance probability p is used to determine whether to accept the new value.
[0052] S54, after N times of adjustment, the current temperature is lowered;
[0053] S55, continuing the annealing iteration until the current temperature is lower than the annealing cooling temperature, and the minimum value of the approximation function within the independent variable range is approached;
[0054] S56. Obtain the loss function values and corresponding weight values continuously recorded during the annealing process, and select a set of weights with the smallest loss function value as the optimal weight value.
[0055] Preferably, the logarithmic adjustment method in step S52 is:
[0056]
[0057] Where λ new represents the independent variable adjusted according to the current temperature, λ represents the independent variable at the current temperature, random1 and random2 represent the random probabilities generated by any [0,1] random number generator, and T represents the current temperature.
[0058] Preferably, the third step specifically includes:
[0059] S6. Based on the optimal weight value obtained after each physical information neural network training, the mean of each weight is calculated to obtain the optimal value of the multi-objective loss function weight under random sampling;
[0060] S7. Based on the obtained optimal weight values, multi-objective optimization training is performed on the actual training model, and the groundwater head and flow direction distribution in the area are calculated.
[0061] Therefore, the present invention adopts the above-mentioned physical information neural network groundwater movement simulation method based on logarithmic annealing, which has the following beneficial effects:
[0062] (1) Physical information is incorporated into the loss of the neural network, and physical constraints are imposed on the neural network model. Compared with the traditional numerical calculation method of groundwater, the discrete grid system is abandoned, and it can cope with areas with complex boundaries and has a higher simulation speed. The shortcomings of data-driven deep learning methods in simulation prediction, such as low accuracy, great influence of data quality, possible violation of physical laws in prediction results, poor generalization ability, and poor model interpretability, are optimized.
[0063] (2) The simulated annealing algorithm is used to optimize the multi-objective loss function of the neural network. During the pre-training model training process, a set of samples are taken for each training and the loss item weights are annealed to obtain the optimal weight value. The influence of randomness on the weight parameters is taken into account, the interference of randomness on the model is reduced, and the prediction robustness of the model is improved.
[0064] (3) Based on the optimal weight values obtained from the pre-training model, the actual training model is subjected to multi-objective optimization training to promote the generalization ability and improve the generalization ability of the model.
[0065] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0067] Figure 2 This is a technical principle diagram of the core method of an embodiment of the present invention;
[0068] Figure 3 This is a diagram showing an annealing implementation path according to an embodiment of the present invention;
[0069] Figure 4 This is a diagram showing the results of a simulated annealing algorithm according to an embodiment of the present invention;
[0070] Figure 5 This is a graph showing the output result of the optimized neural network according to an embodiment of the present invention;
[0071] Figure 6 This is a diagram showing the simulation results of the Hydrus verification model according to an embodiment of the present invention;
[0072] Figure 7 This is a diagram showing the simulation results of the Hydrus verification model according to an embodiment of the present invention;
[0073] Figure 8 This is a flow diagram output by the model of the embodiment of the present invention. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0075] Example
[0076] The present invention provides a method for simulating groundwater movement using a physical information neural network based on logarithmic annealing. Figure 1-2 As shown, the steps include:
[0077] The first step is to solve the partial differential equation of groundwater movement based on the physical information neural network and establish a pre-training model and an actual training model. The specific steps include:
[0078] S1. Establish a conceptual model of the groundwater movement region and set groundwater physical parameters, initial conditions, boundary conditions and source and sink conditions.
[0079] S2. Select the sampling method based on the regional conceptual model, perform random sampling on the spatiotemporal boundaries and the interior of the region, use the physical prior information of the groundwater flow equation to generate the initial boundary conditions and the loss function terms of the physical formula inside the region, and impose physical constraints on the physical information neural network.
[0080] Using the physical prior information of the groundwater flow equation, the loss function terms for generating the initial boundary conditions and the physical formulas within the region include:
[0081] S21. Using the groundwater flow equation including the saturated zone groundwater movement equation and the vadose zone groundwater movement equation as physical prior information;
[0082] The groundwater movement equation in the saturated zone is expressed as:
[0083]
[0084] The groundwater movement equation in the vadose zone is expressed as:
[0085]
[0086] in, is the Nabla operator, which means and Find the divergence, h is the pressure head, m; K is the permeability coefficient in each direction, m / d; S is the source and sink term, d -1 ;μ s is the water storage rate, m -1 ; t is time, d; K(θ) is the unsaturated hydraulic conductivity of the soil in the vadose zone, m / d; z represents the thickness of the vadose zone soil in the positive direction of the z axis, m;
[0087] S22. Construct boundary condition constraints for the groundwater flow equations of the saturated zone groundwater movement equation and the vadose zone groundwater movement equation. The boundary condition constraints include:
[0088] Dirichlet boundary conditions, the water head value on the boundary is a constant value, the expression is:
[0089] h(x,y,z,t)=G(x,y,z,t),(x,y,z)∈Γ1,t≥0;
[0090] Where Γ1 is the first-class boundary, G(x, y, z, t) is the known head distribution on the boundary;
[0091] Neumann boundary condition, the water flux perpendicular to the boundary is a constant value, the expression is:
[0092]
[0093] Where Γ2 is the second-type boundary, M(x, y, z, t) is the known flow distribution on the boundary, and n is the unit normal vector outside the surface on the second-type boundary;
[0094] Cauchy boundary condition: The hydraulic head and flow distribution combination in the groundwater is known on the boundary and is expressed as follows:
[0095]
[0096] Where Γ3 is the first type of boundary, h is the groundwater head, H s is the pressure head of the surface water body, K is the permeability coefficient of the weak permeable layer, and M is the thickness of the weak permeable layer.
[0097] When there is a weak permeable medium between groundwater and surface water, the two are hydraulically connected;
[0098] The initial conditions of the groundwater flow equation are:
[0099] If the distribution of the head value in the flow field at the beginning is known, the mathematical expression of the initial condition is:
[0100] h(x,y,z,t=0)=H(x,y,z),(x,y,z)∈Ω,t=0;
[0101] Where H(x,y,z) is the known head distribution at the initial moment;
[0102] S23. Based on the groundwater flow equation and boundary conditions, add partial derivatives that violate physical laws to the loss function to generate loss function terms for the initial boundary conditions and the physical formula within the region. The loss function terms include:
[0103] MSE=MSE BC +MSE IC +MSE f +MSE u ;
[0104]
[0105] Where MSE represents the total mean square error, represents the function obtained by the neural network, N represents the number of time and space points used by each loss function, u represents the boundary condition or initial condition, L represents the residual of the physical equation under the output of the neural network, MSE BC Represents the boundary loss term, which represents the mean square error between the neural network fitting value and the actual boundary condition value under different boundary conditions. For a point on the boundary, MSE BC The closer it is to 0, the more it meets the boundary condition settings; MSE IC Represents the initial condition loss term, which represents the mean square error between the neural network fitting value and the actual initial condition value under the initial condition. For a point in the study area Ω at t = 0, MSE IC The closer it is to 0, the more it meets the initial condition settings; MSE f Represents the physical information loss term, which represents the mean square error between the neural network simulation results and the actual physical equation constraints. If the random points inside the region can well reflect the physical formula constraints, the corresponding MSE f The closer it is to 0; MSE u Represents the training data loss term, which represents the difference between the fitted value of the neural network with training data and the true value u i For any set of independent variables in the training data, the goal of neural network fitting is to convert the MSE u Approaching 0.
[0106] S3. Build a physical information neural network framework and generate pre-training models and actual training models.
[0107] The second step is to establish a multi-objective loss function for groundwater movement. The pre-trained model optimizes the weights of the multi-objective loss function based on the simulated annealing algorithm, approximating the minimum value of the multi-objective loss function to obtain the optimal distribution weights. The specific steps include:
[0108] S4. For the pre-trained model, a multi-objective loss function is constructed based on the loss function terms, and loss weight terms are added to adjust the direction of the gradient descent of the physical information neural network model. When the loss function has a multi-sum form, simply adding all loss terms will lead to an imbalance in the training rates of different tasks, causing the neural network training to proceed in the direction of larger gradient descent, resulting in unstable training. Therefore, a multi-objective optimization method with automatic learning weights is used to automatically update the weights. The multi-objective loss function is expressed as:
[0109]
[0110] Where N is the number of loss function terms, MSE i is the loss term, λ i is the weight of the corresponding loss term, is the penalty term for each item, preventing λ i Continuous learning tends to 0, causing the loss term to be ignored. It is a penalty term in the loss function, which is used to prevent the error accumulation caused by high-order derivatives in partial differential equations when performing automatic differentiation calculations in deep learning frameworks.
[0111] S5. Use the simulated annealing algorithm to train the pre-trained model, using the weights of the loss function terms as independent variables and the total loss of the multi-objective loss function as the dependent variable. Annealing is applied within a specified weight range to find the loss weight value that minimizes the total loss function at all sampling points. For the pre-trained model, simulated annealing is performed on the weights for each training session. Since the initial boundary conditions and internal points within the study area for each training session are obtained by random sampling, randomness is introduced, enhancing the robustness of the optimal weight parameters.
[0112] The annealing process of the pre-trained model is as follows: Figure 3 As shown, the steps include:
[0113] S51, define the function form and independent variables that need to approach the minimum value, set the initial annealing temperature T0, the annealing cooling temperature T f , cooling rate α and the number of adjustments N in each cooling, select the initial independent variable value, and set the independent variable range.
[0114] S52. If the current temperature is higher than the annealing cooling temperature, perform annealing iterations and adjust the value of the independent variable. The adjustment range is positively correlated with the current temperature. Adjust N times in total and use a logarithmic form to adjust the value. The logarithmic form is as follows:
[0115]
[0116] In the formula, random is the random probability generated by any [0,1] random number generator, and the natural logarithm form is used to prevent the temperature from being too high, causing the adjusted parameter value to exceed the value range of λ. new represents the independent variable adjusted according to the current temperature, λ represents the independent variable at the current temperature, random1 and random2 represent the random probabilities generated by any [0,1] random number generator, and T represents the current temperature.
[0117] S53. Calculate the adjusted function value and compare it with the original value. If it meets the approximation direction, accept the adjustment. Otherwise, based on the Metropolis criterion, decide whether to accept the new value according to the acceptance probability p.
[0118] S54: After N times of adjustment, the current temperature is lowered.
[0119] S55. Continue annealing iterations until the current temperature is lower than the annealing cooling temperature, and approach the minimum value of the function within the range of the independent variable.
[0120] S56. Obtain the loss function values and corresponding weight values continuously recorded during the annealing process, and select a set of weights with the smallest loss function value as the optimal weight value.
[0121] The third step is to generate the optimal value of the multi-objective loss function weight based on the obtained optimal allocation weight, train the actual model based on the optimal value, and calculate the groundwater head and flow direction distribution in the area. The specific steps include:
[0122] S6. Based on the optimal weight value obtained after each physical information neural network training, the mean of each weight is calculated to obtain the optimal value of the multi-objective loss function weight under random sampling;
[0123] S7. Based on the obtained optimal weight values, multi-objective optimization training is performed on the actual training model, and the groundwater head and flow direction distribution in the area are calculated.
[0124] In order to verify the effectiveness of the method of the present invention, a physical information neural network groundwater movement simulation method based on logarithmic annealing was used to solve a two-dimensional groundwater infiltration problem in the vadose zone. Python was used as the programming language and Pytorch as the deep learning framework. Figure 4 、 Figure 5 and Figure 6 The specific situation is as follows.
[0125] The background of the two-dimensional infiltration problem in this case is: a very dry vertical rectangular block of soil with dimensions a×L, 0≤x≤a, 0≤z≤L, where a=L=10m.
[0126] S1. The initial conditions of the site are: h(x,z,t=0)=h r ;
[0127] The site boundary conditions are:
[0128] (1) z = L,
[0129] (2) Other boundaries: h = h r ;
[0130] The soil parameters and physical parameters of the study area are as follows: θ s =0.45,θ r =0.15,α=0.164m -1 , K s =0.1m·d -1 , h r = -10m, the research time is 3 days, where θ s is the saturated moisture content, θ r is the residual moisture content, α is the VG model parameter, K s is the saturated hydraulic conductivity value;
[0131] S2. The motion equation of the vadose zone is given by the Richards equation, and the soil moisture characteristic curve and hydraulic conductivity curve are given by the constitutive equation of the Van-Genuchten law.
[0132] Based on the physical information neural network, the network structure is set to a fully connected neural network architecture of [3, 50, 50, 50, 50, 1]. The activation function is tanh. The weights and biases of each layer of the network are initialized using Xavier initialization.
[0133] The sampling method selected is Latin hypercube sampling LHS, which is performed at each boundary condition, initial condition and within the region. The sampling amount is:
[0134] (1) At z = L, 1001 sets of space-time coordinates (x, z, t);
[0135] (2) the remaining boundaries, 101 sets of space-time coordinates (x, z, t);
[0136] (3) Initial condition t = 0, 1001 sets of space-time coordinates (x, z, 0);
[0137] (4) Internal points, 20,000 sets of space-time coordinates (x, z, t);
[0138] According to the calculation formula of the loss function term at each sampling point, the mean square error is used for calculation;
[0139] S3. Based on the fully connected neural network with a neural network structure of [3, 50, 50, 50, 50, 1] and an activation function of tanh, a pre-training model sa_pre_train and an actual training model sa_train are constructed. The Adam optimizer is selected as the optimizer, and the optimization object is all the parameters of the neural network. The optimizer learning rate is set to 10 -4 , the number of pre-training model training times epoch_pre = 10000, the number of actual training model training times epoch_train = 100000;
[0140] S4. Construct a multi-objective loss function for the pre-training model. The loss function calculation formula is: λ is the weight parameter that needs to be annealed and optimized;
[0141] S5. The pre-trained model uses the optimization method based on the simulated annealing algorithm. In the simulated annealing parameter part, the initial temperature of each annealing is set to T=100, and the cooling temperature is T f =0.01, cooling multiple α=0.99, the number of iterations in each annealing iter=10, and the value range of λ is [0,2];
[0142] The calculation formula for adjusting λ in the simulated annealing algorithm is:
[0143]
[0144] The calculation formula for the Metropolis acceptance probability p in the simulated annealing algorithm is:
[0145]
[0146] Where Δf is the difference between the objective function value after adjustment and the objective function value before adjustment, T is the current temperature, and if the random probability is greater than p, the adjusted λ value is accepted, otherwise it is not accepted.
[0147] Implement simulated annealing. If the current temperature is higher than the cooling temperature, perform annealing. Each time the annealing temperature is lowered, record the minimum value f_best of the objective function and the corresponding λ value l_best in this round of annealing and save them in the array history.
[0148] In the 10,000 trainings of the pre-trained model, a simulated annealing optimization is performed for each training to obtain the weight value λ that minimizes the total loss function, where λi ={λ1,λ2,…,λ j ,…,λ n} i , i represents the i-th training of the pre-trained model, n is the number of loss terms, in this example n = 6, j∈{1,2,3,4,5,6}. After pre-training is completed, a total of 2000 sets of weight values λ are obtained. The optimal weight distribution is obtained by using the mean method. The calculation formula for the j-th weight is:
[0149]
[0150] Among them, f i represents the best total loss value obtained by the i-th pre-training annealing, Represents the mean of all total loss values obtained by the pre-training model to obtain a set of optimal weight configurations λ that take into account both accuracy and randomness best .
[0151] Using the optimal weight configuration, the actual training model is trained with multiple objectives for a total of 100,000 times, and the pressure head distribution is predicted for the entire region.
[0152] The Hydrus-2D software was used to construct a case under the same conditions to verify the actual prediction model. The conditions were set as follows:
[0153] a. The simulation time is 3 days, and the initial time step is 1×10 -4 , the minimum time step is 1×10 -5 , the maximum time step is 0.1;
[0154] b. The maximum number of iterations is 10, the water content threshold is 0.001, and the head threshold is 1;
[0155] c. Use the VG model to construct soil moisture characteristic curve and moisture content curve;
[0156] The number of discrete grids in the d, x, and z directions is 10, and a total of 100 grids are generated.
[0157] The simulation results of the Hydrus model verification are shown in Figure 2. Figure 6 and Figure 7 As shown, the output flow diagram is as follows Figure 8 shown.
[0158] Calculate the relative L2 error on the 100 grid points set by the Hydrus-2D software using the following formula:
[0159]
[0160] Where, is the number of grid points for verification, which is 100 here, ψ is the actual value at the verification point, which is the actual value at the verification point calculated by Hydrus-2D software, is the output value of the neural network.
[0161] The calculated relative L2 error is 0.0176, which proves that the algorithm has high accuracy.
[0162] Therefore, the present invention adopts the above-mentioned physical information neural network groundwater movement simulation method based on logarithmic annealing, and uses logarithmic annealing to optimize the multi-objective loss function of the neural network, thereby improving the simulation accuracy.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solutions of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for simulating groundwater movement using a physical information neural network based on logarithmic annealing, characterized in that the steps include: The first step is to solve the partial differential equation of groundwater movement based on the physical information neural network and establish a pre-training model and an actual training model; In the second step, a multi-objective loss function for groundwater movement is established. The pre-trained model optimizes the weights of the multi-objective loss function based on the simulated annealing algorithm, approximating the minimum value of the multi-objective loss function to obtain the optimal distribution weights. The second step specifically includes: S4. For the pre-trained model, a multi-objective loss function is constructed based on the loss function term, and a loss weight term is added to adjust the direction of the gradient descent of the physical information neural network model; S5. Use the simulated annealing algorithm to train the pre-trained model, taking the weight of the loss function term as the independent variable and the total loss of the multi-objective loss function as the dependent variable. Apply annealing within the specified weight range to find the loss weight value that minimizes the total loss function at all sampling points. The annealing process of the pre-trained model includes: S51, defining the function form and independent variables to be approximated to the minimum value, setting the initial annealing temperature, annealing cooling temperature, cooling rate and the number of adjustments N for each cooling, selecting the initial independent variable value, and setting the independent variable range; S52. If the current temperature is higher than the annealing cooling temperature, perform annealing iterations to adjust the value of the independent variable. The adjustment amplitude is positively correlated with the current temperature. The adjustment is performed N times in total, and the value is adjusted in a logarithmic form. S53, calculating the adjusted function value and comparing it with the original value. If it meets the approximation direction, the adjustment is accepted. Otherwise, based on the Metropolis criterion, the acceptance probability p is used to determine whether to accept the new value. S54, after N times of adjustment, the current temperature is lowered; S55, continuing the annealing iteration until the current temperature is lower than the annealing cooling temperature, and the minimum value of the approximation function within the independent variable range is approached; S56, obtaining the loss function values and corresponding weight values continuously recorded during the annealing process, and selecting a set of weights with the smallest loss function value as the optimal weight value; In the third step, the optimal values of the multi-objective loss function weights are generated based on the obtained optimal allocation weights, the actual model is trained according to the optimal values, and the groundwater head and flow direction distribution in the area are calculated.
2. The method for simulating groundwater movement using a physical information neural network based on logarithmic annealing according to claim 1, characterized in that: The first step specifically includes: S1. Establish a conceptual model of groundwater movement area, set groundwater physical parameters, initial conditions, boundary conditions and source and sink conditions; S2. Select a sampling method based on the regional conceptual model, perform random sampling on the spatiotemporal boundary and the interior of the region, use the physical prior information of the groundwater flow equation to generate the initial boundary conditions and the loss function term of the physical formula of the interior of the region, and impose physical constraints on the physical information neural network; S3. Build a physical information neural network framework and generate pre-training models and actual training models.
3. The method for simulating groundwater movement using a physical information neural network based on logarithmic annealing according to claim 2, characterized in that: The loss function term for generating the initial boundary conditions and the physical formula within the region by using the physical prior information of the groundwater flow equation includes: S21. Using the groundwater flow equation including the saturated zone groundwater movement equation and the vadose zone groundwater movement equation as physical prior information; S22. Construct boundary condition constraints for the groundwater flow equations of the saturated zone groundwater movement equation and the vadose zone groundwater movement equation. The boundary condition constraints include hydraulic head value constraints on the boundaries, water flux constraints perpendicular to the boundaries, and mixed constraints on hydraulic head and flux distribution in groundwater on the boundaries. S23. According to the groundwater flow equation and boundary conditions, partial derivatives that violate physical laws are added to the loss function to generate loss function terms of the initial boundary conditions and the physical formulas within the region.
4. The method for simulating groundwater movement using a physical information neural network based on logarithmic annealing according to claim 3 is characterized in that: The loss function term includes: ; ; ; ; ; Where, represents the total mean square error, represents the boundary loss term, represents the initial condition loss term, represents the physical information loss term, represents the training data loss term, represents the number of spatiotemporal points used by each loss function, represents the function obtained by the neural network, represents the boundary conditions or initial conditions, Represents the residual of the physical equation under the output of the neural network.
5. The method for simulating groundwater movement using a physical information neural network based on logarithmic annealing according to claim 4 is characterized in that: The multi-objective loss function is expressed as: ; Where, A is the number of loss function terms, is the loss item, is the weight of the corresponding loss term, For each penalty item, It is a penalty term in the loss function, which is used to prevent the error accumulation caused by high-order derivatives in partial differential equations when performing automatic differentiation calculations in deep learning frameworks.
6. The method for simulating groundwater movement using a physical information neural network based on logarithmic annealing according to claim 5, characterized in that: In step S52, the logarithmic form is used to adjust the value: ; Where, represents the independent variable adjusted according to the current temperature, represents the independent variable at the current temperature, and represents the random probability generated by any [0,1] random number generator, Indicates the current temperature.
7. The method for simulating groundwater movement using a physical information neural network based on logarithmic annealing according to claim 6, characterized in that: The third step specifically includes: S6. Based on the optimal weight value obtained after each physical information neural network training, the mean of each weight is calculated to obtain the optimal value of the multi-objective loss function weight under random sampling; S7. Based on the obtained optimal weight values, multi-objective optimization training is performed on the actual training model, and the groundwater head and flow direction distribution in the area are calculated.
Citation Information
Patent Citations
Underground water monitoring network optimization method based on physical information driven deep learning model
CN116522566A
Fluid mechanics equation solving method based on physical information neural network
CN117786286A