Singular partial differential equation solving method based on hard coding physical information neural network

Through the solution method of singular partial differential equations of hard-coded physical information neural networks, the problem of poor universality of existing hard constraint methods is solved. The boundary mask and optimization algorithm are used to ensure strict satisfaction of boundary conditions, and the different partial differential equations and boundaries are realized. Flexible processing of conditions improves the physical accuracy and accuracy of understanding.

CN119066307APending Publication Date: 2024-12-03ANHUI UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411122659.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing hard constraint methods have poor generality when dealing with partial differential equations, making it difficult to flexibly deal with different types of partial differential equations or boundary conditions, which reduces the scope of application of the method.

Method used

Through the singular partial differential equation solution method based on hard-coded physical information neural network, the calculation domain and boundary conditions of the equation are determined, the sampling point is selected as the input of the neural network, the multi-layer perceptron structure is designed, the boundary mask is set for hard constraints, and the The optimization algorithm adjusts network weights and bias parameters to ensure strict satisfaction of boundary conditions.

Benefits of technology

Improve the universality of hard constraint methods. No matter what physical problems faced, as long as the equations and boundary conditions are properly encoded, the solution that satisfies all physical constraints can be found by minimizing the loss function, and the physical correctness of the understanding can be improved. Accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066307A_ABST
    Figure CN119066307A_ABST
Patent Text Reader

Abstract

The invention discloses a singular partial differential equation solving method based on a hard coding physical information neural network, relates to the technical field of partial differential equation solving, and solves the technical problem that an existing physical information neural network is low in boundary layer problem solving precision. The method comprises the steps of determining a computational domain and boundary conditions of an equation based on partial differential equation information; sampling points are selected in a computational domain to serve as input of a neural network; designing and establishing a neural network based on the structure of the multi-layer perceptron; setting a boundary mask based on the boundary condition of the equation, and performing hard constraint on the boundary condition through the boundary mask; designing equation loss to obtain a loss function; adjusting the weight and bias parameters of the physical information neural network by using an optimization algorithm to obtain a target physical information neural network; and solving the partial differential equation based on the target physical information neural network. The technical problem is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of partial differential equation solution, and relates to hard-coded physical information neural network technology, and specifically to a method for solving singular partial differential equations based on hard-coded physical information neural network. Background Art

[0002] Partial differential equations (PDEs) are a class of equations involving multiple independent variables and their partial derivatives. They are an important tool for describing continuous phenomena in mathematics and physics. In recent years, more and more people have turned their attention to machine learning (ML) solvers. Compared with traditional numerical methods (such as finite difference method, finite element method and finite volume method), ML solvers can avoid complex mesh design and complex numerical techniques, and show superior computational efficiency and generalization ability. Currently, the most widely used and studied ML solver is the physical information neural network (PINN).

[0003] Physically-informed neural networks (PINNs) obtain approximate solutions to partial differential equations and systems by minimizing an objective function, introducing prior knowledge constraints into machine learning methods to significantly improve prediction, robustness, and generalization capabilities. The structure of PINNs is generally designed based on multilayer perceptrons (MLPs), which are a type of feedforward artificial neural network that contains at least three layers of nodes: an input layer, one or more hidden layers, and an output layer. According to the global approximation theorem, MLPs can learn nonlinear relationships and patterns in data. PINNs use this ability of MLPs and use physical constraints as part of the loss function to ensure that the model's predictions not only depend on the data but also follow the laws of physics, thereby performing well in solving complex physical problems and partial differential equations. However, PINNs often perform poorly in dealing with partial differential equations with boundary layers. Boundary layer problems are a special phenomenon in partial differential equations, which often occur in fields such as fluid mechanics, heat conduction, and electromagnetism. Boundary layers refer to thin regions near the boundaries of physical systems where physical quantities (such as velocity, temperature, or electric field intensity) change dramatically. This drastic change causes the partial differential equations to become particularly complex and difficult to solve in the boundary layer region.

[0004] In physical information neural network (PINN), constraints are added to the loss function as penalty terms, and these constraints are called "soft constraints". Soft constraints include conservation laws of partial differential equations, initial conditions, and boundary conditions. By adding these physical constraints to the loss function, PINN enables the neural network to approximate and satisfy the physical constraints by minimizing the loss function during training; among them, the satisfaction of boundary conditions and initial conditions will greatly affect the prediction accuracy of PINN for the equation. When the physical quantities at the boundary of the equation change dramatically, that is, when there is a boundary layer, it will become very difficult to satisfy the boundary conditions, thereby reducing the prediction accuracy of PINN in the entire spatiotemporal domain. In contrast, PINN can also adopt another method called "hard constraints", which directly restricts the output of the network in the network structure so that it always strictly satisfies the physical constraints. Soft constraints are relatively simple to implement and can handle complex constraints and boundary conditions of arbitrary shapes, but they cannot fully satisfy physical constraints. Hard constraints can ensure the strict satisfaction of physical constraints and the physical correctness of the solution, which improves the accuracy of PINN's prediction results for physical equations by an order of magnitude. However, current hard constraint methods generally face the technical problem of poor versatility during implementation.

[0005] Therefore, the present invention proposes a method for solving singular partial differential equations based on a hard-coded physical information neural network to solve the above problems. Summary of the invention

[0006] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a method for solving singular partial differential equations based on a hard-coded physical information neural network, which is relatively simple to implement and can handle complex constraints and boundary conditions of arbitrary shapes, but cannot fully satisfy physical constraints; while hard constraints can ensure the strict satisfaction of physical constraints and ensure the physical correctness of the solution; however, existing hard constraint methods generally face the technical problem of poor versatility during implementation.

[0007] To achieve the above object, a first aspect of the present invention provides a method for solving singular partial differential equations based on a hard-coded physical information neural network, comprising:

[0008] Step 1: Determine the computational domain and boundary conditions of the equation based on the partial differential equation information;

[0009] Step 2: Select sampling points in the computational domain as the input of the neural network;

[0010] Step 3: Design and establish a neural network based on the structure of a multi-layer perceptron to obtain a physical information neural network;

[0011] Step 4: Set a boundary mask based on the boundary conditions of the equation, and use the boundary mask to hard constrain the boundary conditions;

[0012] Step 5: Get the loss function by designing the equation loss;

[0013] Step 6: The weights and bias parameters of the physical information neural network are adjusted by using an optimization algorithm to obtain a target physical information neural network; the partial differential equation is solved based on the target physical information neural network.

[0014] Preferably, the determining the computational domain and boundary conditions of the equation based on the partial differential equation information includes:

[0015] The general form of a partial differential equation is:

[0016]

[0017] Among them, u(t,x) represents the solution of the equation, is a nonlinear operator parameterized by , Ω represents the spatial domain of the equation;

[0018] A typical form of boundary conditions is:

[0019]

[0020] Among them, u(x, t) represents the value of the partial differential equation at the boundary of the computational domain, and g(x, t) is a known function or value.

[0021] It should be noted that the computational domain refers to the spatial domain Ω and time domain [0, T] defined by the partial differential equation; the boundary conditions are additional constraints given on the edge of the computational domain to limit or specify the behavior of the solution.

[0022] Preferably, the selecting of sampling points in the computational domain as inputs of the neural network comprises:

[0023] Based on the sampling method, sampling points are selected in the computational domain as the input of the neural network; wherein the sampling method is specifically random sampling.

[0024] It should be noted that the input of the neural network is spatial coordinates and time, etc.

[0025] Preferably, the multi-layer perceptron-based structure design and establishment of a neural network includes:

[0026] S1: Construct a neural network based on a multi-layer perceptron; the neural network is a fully connected network;

[0027] S2: Train the neural network based on the sampling points and the solutions of the corresponding equations to obtain a physical information neural network.

[0028] It should be noted that the construction of a neural network based on a multi-layer perceptron includes defining an input layer, one or more hidden layers and an output layer, each hidden layer contains a certain number of neurons, and an appropriate activation function is selected to ensure that the network can capture and learn nonlinear relationships in the data;

[0029] The fully connected network, that is, each node is interconnected with all other nodes; the fully connected network can flexibly process inputs of different dimensions and types, adapt to the complex needs of various physical problems, approach real physical solutions, and at the same time simplify the dependence on the grid, improve the generalization ability of the model and the ability to handle a wider range of spatial domains and boundary conditions.

[0030] Preferably, the boundary mask is set based on the boundary condition of the equation, and the boundary mask is specifically:

[0031]

[0032] Where x is the position in the time and space domain determined by the boundary conditions, input is the input of the neural network, tol is the tolerance value, and boundary mask is a boundary mask used to determine whether the input of the physical information neural network is near the boundary condition.

[0033] Preferably, the step of hard constraining the boundary conditions by using a boundary mask comprises:

[0034] The specific methods of hard constraints are:

[0035]

[0036] in, It refers to the coordinate point when going to the physical information neural network input, is the fitted value output by the physical information neural network.

[0037] It should be noted that if the current point Located on the border, that is, boundary mask When true, the output is adjusted to u i , to ensure that the boundary conditions are met. If the current point is not on the boundary, the output is the calculated value of the physical information neural network

[0038] The purpose of hard constraints is to ensure that the predicted solution of the physical information neural network strictly satisfies the boundary conditions at the boundary points, rather than just trying to minimize the loss of the boundary conditions. Hard constraints are stricter than soft constraints. They directly modify the output of the network to ensure that the boundary conditions are met, rather than just indirectly approximating the boundary conditions through the optimization process.

[0039] Preferably, the loss function is obtained by designing the loss equation, including:

[0040] The equation loss is designed through the physical equation residual, and the boundary condition loss is determined by calculating the difference between the boundary point and the boundary condition, as follows:

[0041] MSE = MSE f +MSE u ;

[0042]

[0043]

[0044] Among them, MSE is the loss function used as a training reference in the physical information neural network; MSE f It is the mean square error between the physical information neural network and the real physical law, indicating the equation loss, MSE u is the fitted value of the physical information neural network at the initial and boundary conditions The mean square error with the true value, indicating the boundary condition loss.

[0045] It should be noted that the loss function is a function used to measure the difference between the predicted value of the physical information neural network and the actual target value. The output of this function is a non-negative real number. The lower the value, the closer the model's prediction is to the actual value.

[0046] The equation loss measures the size of the residual after the output solution of the physical information neural network is substituted into the partial differential equation. The smaller the residual, the closer the solution output by the physical information neural network is to satisfying the partial differential equation.

[0047] The boundary condition loss measures the difference between the predicted solution of the physical information neural network at the boundary point and the given boundary condition. The boundary condition loss ensures that the solution output by the physical information neural network strictly satisfies the preset boundary conditions on the boundary.

[0048] Preferably, the adjusting the weight and bias parameters of the physical information neural network by using an optimization algorithm comprises:

[0049] The partial derivatives in the loss function are calculated using the automatic differentiation function provided by PyTorch;

[0050] Based on partial derivatives, the Adam algorithm and L-BFGS algorithm are used to adjust the weights and bias parameters of the physical information neural network by minimizing the loss function.

[0051] It should be noted that the partial derivative gives the rate of change of the loss function in each parameter direction. In the optimization process, we hope to find a direction so that changing the parameters along this direction can reduce the value of the loss function, that is, the opposite direction of the gradient pointed by the partial derivative, the negative gradient direction;

[0052] The optimization algorithms (Adam and L-BFGS) use partial derivatives to update the weights and bias parameters of the physical information neural network. By adjusting the parameters in the opposite direction of the gradient, the value of the loss function can be gradually reduced, thereby improving the prediction ability of the physical information neural network. Each parameter update is a step towards the goal of minimizing the loss function.

[0053] The present invention enables the physical information neural network to learn a solution that approximately satisfies the original equation by minimizing the equation loss, that is, minimizing the residual after the physical information neural network predicted solution is substituted into the partial differential equation.

[0054] Compared with the prior art, the present invention has the following beneficial effects:

[0055] 1. The present invention determines the computational domain and boundary conditions of the equation based on partial differential equation information; selects sampling points in the computational domain as the input of the neural network; designs and establishes a neural network based on the structure of a multi-layer perceptron; sets a boundary mask based on the boundary conditions of the equation, and hard constrains the boundary conditions through the boundary mask; obtains a loss function by designing the equation loss; adjusts the weights and bias parameters of the physical information neural network by using an optimization algorithm to obtain a target physical information neural network; solves the partial differential equation based on the target physical information neural network, thereby solving the technical problem of poor versatility commonly faced by existing hard constraint methods during implementation.

[0056] 2. Existing hard constraint methods are often designed for specific types of problems or boundary conditions, which limits their scope of application and makes it difficult to flexibly respond to different types of partial differential equations or boundary conditions, reducing the versatility of the methods. The present invention sets a boundary mask based on the boundary conditions of the equation, and hard constrains the boundary conditions through the boundary mask. The use of the boundary mask ensures that no matter what type of boundary conditions are, they can be processed uniformly without modifying the network structure or training process. The loss function is obtained by designing the equation loss. The weights and bias parameters of the physical information neural network are adjusted by using an optimization algorithm to minimize the loss function, ensuring that no matter what physical problem is faced, as long as the equations and boundary conditions are properly encoded, the solution that satisfies all physical constraints can be found by minimizing the loss function, solving the problem of poor transparency of existing hard constraint methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0058] Figure 1 A schematic diagram of the method steps of an embodiment of the present invention;

[0059] Figure 2 A comparison diagram of the predicted solution and the actual solution of the one-dimensional advection-diffusion-reaction equation by the physical information neural network trained by the embodiment of the present invention;

[0060] Figure 3 A comparison diagram of the predicted solution and the actual solution of the one-dimensional advection-diffusion-reaction equation by the physical information neural network trained by soft constraints in an embodiment of the present invention;

[0061] Figure 4 A comparison diagram of the predicted solution and the actual solution of the one-dimensional advection-diffusion-reaction equation by the physical information neural network that implements hard constraint training by function method in an embodiment of the present invention;

[0062] Figure 5 An image of a true solution to a two-dimensional singular perturbation problem with a boundary layer according to an embodiment of the present invention;

[0063] Figure 6 An image of a predicted solution of a physical information neural network trained by an embodiment of the present invention to a two-dimensional singular perturbation problem with a boundary layer;

[0064] Figure 7 This is an image of the predicted solution of a two-dimensional singular perturbation problem with a boundary layer by a physical information neural network trained by soft constraints in an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0066] See also Figure 1 The first aspect of the present invention provides a method for solving singular partial differential equations based on a hard-coded physical information neural network, comprising:

[0067] Step 1: Determine the computational domain and boundary conditions of the equation based on the partial differential equation information;

[0068] Step 2: Select sampling points in the computational domain as the input of the neural network;

[0069] Step 3: Design and establish a neural network based on the structure of a multi-layer perceptron to obtain a physical information neural network;

[0070] Step 4: Set a boundary mask based on the boundary conditions of the equation, and use the boundary mask to hard constrain the boundary conditions;

[0071] Step 5: Get the loss function by designing the equation loss;

[0072] Step 6: The weights and bias parameters of the physical information neural network are adjusted by using an optimization algorithm to obtain a target physical information neural network; the partial differential equation is solved based on the target physical information neural network.

[0073] Determine the computational domain and boundary conditions of the equation based on the partial differential equation information, including:

[0074] The general form of a partial differential equation is:

[0075]

[0076] Among them, u(t,x) represents the solution of the equation, is a nonlinear operator parameterized by , Ω represents the spatial domain of the equation;

[0077] A typical form of boundary conditions is:

[0078]

[0079] Among them, u(x, t) represents the value of the partial differential equation at the boundary of the computational domain, and g(x, t) is a known function or value.

[0080] By selecting sampling points in the computational domain as the input of the neural network, including:

[0081] Based on the sampling method, sampling points are selected in the computational domain as the input of the neural network; wherein the sampling method is specifically random sampling.

[0082] Design and build a neural network based on the structure of a multi-layer perceptron, including:

[0083] S1: Construct a neural network based on a multi-layer perceptron; the neural network is a fully connected network;

[0084] S2: Train the neural network based on the sampling points and the solutions of the corresponding equations to obtain a physical information neural network.

[0085] The boundary mask is set based on the boundary conditions of the equation. The boundary mask is specifically:

[0086]

[0087] Where x is the position in the time and space domain determined by the boundary conditions, input is the input of the neural network, tol is the tolerance value, and boundary mask is a boundary mask used to determine whether the input of the physical information neural network is near the boundary condition.

[0088] Boundary conditions are hard constrained through boundary masks, including:

[0089] The specific methods of hard constraints are:

[0090]

[0091] in, It refers to the coordinate point when going to the physical information neural network input, is the fitted value output by the physical information neural network.

[0092] By designing the equation loss, we get the loss function, including:

[0093] The equation loss is designed through the physical equation residual, and the boundary condition loss is determined by calculating the difference between the boundary point and the boundary condition, as follows:

[0094] MSE = MSE f +MSE u ;

[0095]

[0096]

[0097] Among them, MSE is the loss function used as a training reference in the physical information neural network; MSE f It is the mean square error between the physical information neural network and the real physical law, indicating the equation loss, MSE u is the fitted value of the physical information neural network at the initial and boundary conditions The mean square error with the true value, indicating the boundary condition loss.

[0098] The weights and bias parameters of the physical information neural network are adjusted by using optimization algorithms, including:

[0099] The partial derivatives in the loss function are calculated using the automatic differentiation function provided by PyTorch;

[0100] Based on partial derivatives, the Adam algorithm and L-BFGS algorithm are used to adjust the weights and bias parameters of the physical information neural network by minimizing the loss function.

[0101] Embodiment 1:

[0102] Step 1: Determine the computational domain and boundary conditions of the equation based on the partial differential equation information;

[0103] This embodiment is a one-dimensional advection-diffusion-reaction equation, the spatial domain is [0,1], and the equation and its boundary conditions are:

[0104]

[0105] u(0)=0,u(1)=1;

[0106] This equation is used to describe the process of material propagation through diffusion and advection in one-dimensional space; where u represents a physical quantity in the advection-diffusion-reaction system, is the advection term, describing the advection process, is the diffusion term, describing the diffusion process, ∈ is a small positive parameter, representing the diffusion coefficient, set to 5×10 -4 .

[0107] The above equation can be solved analytically and used to evaluate the accuracy of the physical information neural network (PINN) solution:

[0108]

[0109] Step 2: Select sampling points in the computational domain as the input of the neural network;

[0110] Based on random sampling, sampling points for training are selected in the computational domain to provide comprehensive and diverse data input for neural network training, thereby improving the generalization ability and prediction accuracy of the model.

[0111] Step 3: Design and establish a neural network based on the structure of a multi-layer perceptron;

[0112] Construct a neural network based on a multi-layer perceptron (MLP): Based on the PyTorch deep learning framework, a physical information neural network is constructed on the pycharm platform using the Python programming language. The network neurons are connected in a fully connected manner, and the weights W and bias b are initialized; the weights W and bias b are the parameters of the neural network layer, which will be adjusted through the back propagation algorithm during the training process to minimize the loss function. The activation function uses the hyperbolic tangent activation function tanh.

[0113] Step 4: Set a boundary mask based on the boundary conditions of the equation, and use the boundary mask to hard constrain the boundary conditions;

[0114] The boundary mask is set according to the boundary conditions of the equation, which is defined as follows:

[0115] boundary 0_mask =(|input-0|≤tol);

[0116] Apply boundary masks to implement hard constraints on boundary conditions as follows:

[0117]

[0118] Step 5: Get the loss function by designing the equation loss;

[0119] Design equation loss using physical equation residuals;

[0120] Design the loss function for the one-dimensional advection-diffusion-reaction equation, which is defined as follows:

[0121] MSE = MSE f +MSE u ;

[0122] Among them, MSE is the loss function used as a training reference in the physical information neural network; MSE f It is the mean square error between the neural network and the real physical law, indicating the equation loss, MSE u is the fitted value of the neural network at the initial and boundary conditions The mean square error with the true value, indicating the boundary condition loss.

[0123] MSE f and MSE u Satisfy the following formula:

[0124]

[0125]

[0126] Step 6: By using an optimization algorithm to adjust the weights and bias parameters of the physical information neural network to minimize the loss function, the target physical information neural network is obtained; the partial differential equation is solved based on the target physical information neural network.

[0127] Minimizing the loss function ensures that the physical constraints of the equation are accurately reflected when calculating the residual term, thereby optimizing the training process of the neural network and improving the accuracy and consistency of the solution.

[0128] The automatic differentiation function provided by PyTorch is used to calculate the partial derivatives in the loss function.

[0129] Use optimization algorithms to adjust the weights and bias parameters of the physical information neural network by minimizing the loss function;

[0130] Specifically, the Adam algorithm and the L-BFGS optimization algorithm are used. The optimization algorithm will gradually reduce the value of the loss function in step five, and at the same time update the parameters of the physical information neural network constructed in step three to obtain the target physical information neural network.

[0131] When the physical information neural network (PINN) is trained, the solution of the one-dimensional advection-diffusion-reaction equation in the spatial domain can be predicted.

[0132] The accuracy of the method can be evaluated by comparing the prediction results with the analytical solution, such as Figure 2 In order to better illustrate the effect of the proposed method on solving partial differential equations, this embodiment gives the prediction results of the physical information neural network (PINN) trained using the soft constraint method for the solution of the equation and the prediction results of the physical information neural network (PINN) trained using the hard constraint implemented by the function method for the solution of the equation, as shown in FIG. Figure 3 , Figure 4 As shown in the figure, the red dotted line represents the true solution drawn from the analytical solution, and the blue solid line represents the predicted solution drawn from the neural network training results. The degree of agreement between the two lines reflects the accuracy of the neural network's prediction of the solution to the equation.

[0133] The L2 relative errors of the solutions obtained by the neural networks trained using the three methods are 0.66%, 80.88%, and 86.21%, respectively.

[0134] It can be seen that the physical information neural network (PINN) trained by the hard constraint method of the present invention is significantly better in accuracy than the traditional soft constraint method and the hard constraint implemented by using a function.

[0135] Embodiment 2:

[0136] Step 1: Determine the computational domain and boundary conditions of the equation based on the partial differential equation information;

[0137] This example is the Eriksson-Johnson problem, a two-dimensional singular perturbation problem with a boundary layer, and the spatial domain is Ω∈[0,1] 2 , the equation and its boundary conditions are:

[0138]

[0139]

[0140] This equation is used to describe the diffusion process of substances from high concentration areas to low concentration areas, where ε is a small positive parameter representing the diffusion coefficient and is set to 1×10 -3 ; Δ represents the Laplace operator, is the first derivative of u with respect to x, indicating the flow or change along the x direction;

[0141] The above equation can be solved analytically to evaluate the accuracy of the PINN solution:

[0142]

[0143] in, represents the characteristic roots of the solution to the advection-diffusion equation. These roots affect the behavior of the solution, in particular the relative strength of advection and diffusion.

[0144] Step 2: Select sampling points in the computational domain as the input of the neural network;

[0145] Based on random sampling, sampling points for training are selected in the computational domain to provide comprehensive and diverse data input for neural network training, thereby improving the generalization ability and prediction accuracy of the model.

[0146] Step 3: Design and establish a neural network based on the structure of a multi-layer perceptron;

[0147] Construct a neural network based on a multi-layer perceptron (MLP): Based on the PyTorch deep learning framework, a physical information neural network is constructed on the pycharm platform using the Python programming language. The network neurons are connected in a fully connected manner, and the weights W and bias b are initialized; the weights W and bias b are the parameters of the neural network layer, which will be adjusted through the back propagation algorithm during the training process to minimize the loss function. The activation function uses the hyperbolic tangent activation function tanh.

[0148] Step 4: Set a boundary mask based on the boundary conditions of the equation, and use the boundary mask to hard constrain the boundary conditions;

[0149] The boundary mask is set according to the boundary conditions of the equation, which is defined as follows:

[0150] boundary x1_mask =(|input_x-1|≤tol);

[0151] boundary y1_mask =(|input_y-1|≤tol);

[0152] Apply boundary masks to implement hard constraints on boundary conditions as follows:

[0153]

[0154]

[0155] Step 5: Get the loss function by designing the equation loss;

[0156] Design equation loss using physical equation residuals;

[0157] Design the loss function for the Eriksson-Johnson problem, defined as follows:

[0158] MSE = MSE f +MSE u ;

[0159] Among them, MSE is the loss function used as a training reference in the physical information neural network; MSE f It is the mean square error between the neural network and the real physical law, indicating the equation loss, MSE u is the fitted value of the neural network at the initial and boundary conditions The mean square error with the true value, indicating the boundary condition loss.

[0160] MSE f and MSE u Satisfy the following formula:

[0161]

[0162]

[0163] Step 6: By using an optimization algorithm to adjust the weights and bias parameters of the physical information neural network to minimize the loss function, the target physical information neural network is obtained; the partial differential equation is solved based on the target physical information neural network.

[0164] Minimizing the loss function ensures that the physical constraints of the equation are accurately reflected when calculating the residual term, thereby optimizing the training process of the neural network and improving the accuracy and consistency of the solution.

[0165] The automatic differentiation function provided by PyTorch is used to calculate the partial derivatives in the loss function.

[0166] Use optimization algorithms to adjust the weights and bias parameters of the physical information neural network by minimizing the loss function;

[0167] Specifically, the Adam algorithm and the L-BFGS optimization algorithm are used. The optimization algorithm will gradually reduce the value of the loss function in step five, and at the same time update the parameters of the physical information neural network constructed in step three to obtain the target physical information neural network.

[0168] After the physical information neural network (PINN) is trained, it can predict the solution of 2D singular perturbation with boundary layers.

[0169] The accuracy of the method is evaluated by comparing the predicted results with the analytical solution. Figure 5 As shown, the prediction solution of this embodiment is as follows Figure 6 In order to better illustrate the effect of the proposed method on solving partial differential equations, the present invention gives the prediction results of the physical information neural network (PINN) trained by soft constraints on the solution of the equation, as shown in Figure 7 As shown in Figure 2, the relative L2 errors of the solutions predicted by the two methods are 0.10% and 79.12% respectively.

[0170] The image shows the change of physical quantity in the spatial domain, where Figure 5 is drawn based on the analytical solution. Figure 6 and Figure 7 It is drawn based on the neural network training results.

[0171] It can be seen that the present invention can be applied not only to one-dimensional problems, but also to two-dimensional partial differential equations.

[0172] Working principle of the present invention:

[0173] The present invention determines the computational domain and boundary conditions of an equation based on partial differential equation information; selects sampling points in the computational domain as inputs of a neural network; designs and establishes a neural network based on the structure of a multi-layer perceptron; sets a boundary mask based on the boundary conditions of the equation, and imposes hard constraints on the boundary conditions through the boundary mask; obtains a loss function by designing equation losses; adjusts weights and bias parameters of a physical information neural network by using an optimization algorithm to obtain a target physical information neural network; solves the partial differential equation based on the target physical information neural network, thereby solving the technical problem of poor versatility commonly faced by existing hard constraint methods during implementation.

[0174] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.

Claims

1. A method for solving singular partial differential equations based on a neural network with hard-coded physical information, characterized in that: include: Step 1: Determine the computational domain and boundary conditions of the equation based on the partial differential equation information; Step 2: Select sampling points in the computational domain as the input of the neural network; Step 3: Design and establish a neural network based on the structure of a multi-layer perceptron to obtain a physical information neural network; Step 4: Set a boundary mask based on the boundary conditions of the equation, and use the boundary mask to hard constrain the boundary conditions; Step 5: Get the loss function by designing the equation loss; Step 6: The weights and bias parameters of the physical information neural network are adjusted by using an optimization algorithm to obtain a target physical information neural network; the partial differential equation is solved based on the target physical information neural network.

2. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The step of determining the computational domain and boundary conditions of the equation based on the partial differential equation information includes: The general form of a partial differential equation is: x∈Ω,t∈[0,T]; Among them, u(t,x) represents the solution of the equation, is a nonlinear operator parameterized by , Ω represents the spatial domain of the equation; A typical form of boundary conditions is: u(x,t)=g(x,t), t∈[0,T]; Among them, u(x,t) represents the value of the partial differential equation at the boundary of the computational domain, and g(x,t) is a known function or value.

3. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The method of selecting sampling points in the computational domain as inputs of the neural network includes: Based on the sampling method, sampling points are selected in the computational domain as the input of the neural network; wherein the sampling method is specifically random sampling.

4. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The structure design based on the multi-layer perceptron and the establishment of a neural network include: S1: Construct a neural network based on a multi-layer perceptron; the neural network is a fully connected network; S2: Train the neural network based on the sampling points and the solutions of the corresponding equations to obtain a physical information neural network.

5. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The boundary mask is set based on the boundary condition of the equation, and the boundary mask is specifically: boundary mask =(|input-x|≤tol), Where x is the position in the time and space domain determined by the boundary conditions, input is the input of the neural network, tol is the tolerance value, and boundary mask is a boundary mask used to determine whether the input of the physical information neural network is near the boundary condition.

6. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The hard constraint on the boundary condition by the boundary mask includes: The specific methods of hard constraints are: in, It refers to the coordinate point when going to the physical information neural network input, is the fitted value output by the physical information neural network.

7. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The loss function is obtained by designing the equation loss, including: The equation loss is designed through the physical equation residual, and the boundary condition loss is determined by calculating the difference between the boundary point and the boundary condition, as follows: MSE=MSE f +MSE u ; Among them, MSE is the loss function used as a training reference in the physical information neural network; MSE f It is the mean square error between the physical information neural network and the real physical law, indicating the equation loss, MSE u is the fitted value of the physical information neural network at the initial and boundary conditions The mean square error with the true value, indicating the boundary condition loss.

8. The method for solving singular partial differential equations based on hard-coded physical information neural network according to claim 1, characterized in that: The method of adjusting the weight and bias parameters of the physical information neural network by using an optimization algorithm includes: The partial derivatives in the loss function are calculated using the automatic differentiation function provided by PyTorch; Based on partial derivatives, the Adam algorithm and L-BFGS algorithm are used to adjust the weights and bias parameters of the physical information neural network by minimizing the loss function.

Citation Information

Cited By

  • Ring fire track passive angle measurement initial orbit determination method for Mars sampling return

    CN119714307A

  • Neutron diffusion simulation method based on improved PINNs

    CN120724827A

  • Dynamic calculation method based on spectral feature coding network

    CN120974954A

  • Power calculation method based on spectral feature coding network

    CN120974954B