Fluid mechanics mechanism model solving method based on MAML and PINN

Through the integration of MAML and PINN, the problem of low solution efficiency of the industrial mechanism model under changing working conditions is solved, the rapid adaptation and efficient solution of the Modelica fluid mechanics model is achieved, the calculation workload and learning cost are reduced, and the model's generality is improved. performance and accuracy.

CN118761344APending Publication Date: 2024-10-11TIANJIN UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410737150.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In the process of solving industrial mechanism models, frequent changes in model initialization parameters lead to low solving efficiency of the existing technology. Especially in the Modelica compilation and solving engine, the calculation tasks for large-scale models are heavy, and models based on neural networks need to be retrained. Adapting to new working conditions limits its application scenarios.

Method used

The meta-learning method MAML is used to optimize the Physics-informed Neural Network (PINN), and the hyper-parameters of PINN are trained through a double-layer cycle optimization framework to quickly obtain the initial value of the optimal parameters under a small sample input and improve the model's adaptability to new tasks. The Navier-Stokes equation was introduced into the Modelica fluid mechanics model to construct a loss function and improve the generalization performance of the model.

Benefits of technology

It realizes the rapid adaptation and solution of the Modelica fluid mechanics model under new working conditions, reduces the computational workload of the numerical solution engine, reduces the dependence on the amount of sample data and the number of model training times, and improves the solution accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118761344A_ABST
    Figure CN118761344A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of fluid mechanics mechanism models, and particularly relates to a fluid mechanics mechanism model solving method based on MAML and PINN, and the method comprises the following steps: S1, creating and training a meta-model; and S2, applying the meta-model in a solution engine. By introducing the MAML meta-learning algorithm into the Modelica simulation solution engine, the small sample learning ability of the engine is enhanced, the adaptive capacity of the artificial intelligence engine to a new working condition task can be realized through a small number of samples and a small number of rounds of training, the calculation workload of a numerical engine is reduced, and the solution efficiency is improved. According to the method, the problem that the initialization parameters cannot be quickly adapted when the traditional PINN is used for solving the Modelica fluid model is solved is solved, the physical interpretability of the solving process is enhanced, and meanwhile, the generalization ability of a simulation engine in solving the variable working condition model is also improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of fluid mechanics mechanism models, and specifically relates to a method for solving a fluid mechanics mechanism model based on MAML and PINN. Background Art

[0002] In the process of solving industrial mechanism models, the initialization parameters of the model need to be changed frequently, such as the dimensions of mechanical parts, the initial temperature of the thermal field, the kinematic viscosity of the fluid model, the Reynolds number, and the geometry of the computational domain. Taking the system-level simulation based on the Modelica language as an example, the solution method commonly used in the Modelica compilation and solution engine is to use numerical calculation methods such as CVode, DASSL, and Runge-Kutta to approximate the solution of differential equations. The disadvantage of this method is that the calculation task for large-scale models is heavy and the solution efficiency is low.

[0003] The development of artificial intelligence technology has provided a new approach to solving industrial mechanism models. For example, neural networks embedded with physical information, such as PINN, can be effectively applied to solving structural mechanics, fluid mechanics, electromagnetism, and various multi-physics field coupling problems. However, when the initialization parameters of the mechanism model change, the model solving engine based on neural network technology usually needs to be retrained, otherwise it will not be able to adapt and solve new problems. At the same time, the acquisition of model training samples also needs to rely on the solution results of numerical calculations, and the application scenarios of the model will be greatly limited. Summary of the invention

[0004] The purpose of the present invention is to provide a method for solving a fluid mechanics mechanism model based on MAML and PINN to solve the problems existing in the background technology.

[0005] The present invention aims to achieve rapid adaptability to new Modelica working condition models by integrating meta-learning methods and physics-informed neural networks (PINNs), and to provide a feasible solution for solving fluid mechanics mechanism models based on neural networks. For example, by training PINNs with a small sample learning ability through the MAML algorithm, the generalization performance of the proxy model can be improved, thereby quickly obtaining a proxy model that can be applied to new tasks.

[0006] By using the MAML meta-learning method to optimize the network hyperparameters of PINN, the latter can obtain the optimal initial parameter values ​​through a small amount of iterative training with a small number of sample inputs, thereby realizing the neural network's ability to quickly adapt to new tasks after changing the working condition data, and ensuring the solution performance of the model engine.

[0007] When solving the Modelica fluid dynamics model using the fusion method of MAML and PINN, there are two main processes: 1. Creation and training of the metamodel; 2. Application of the metamodel in the solution engine. The former is responsible for parsing the Modelica model and building and training PINN, while the latter is responsible for applying the trained metamodel to small sample learning and solving the Modelica model.

[0008] In the meta-model training phase, the MAML algorithm is mainly used to train and learn the initialization parameters of PINN. The training process adopts a two-layer loop optimization framework in terms of overall structure, in which the outer loop is responsible for learning the hyperparameters of the meta-model, and the inner loop uses the parameters as the initial values ​​of the PINN hyperparameters. The parameters are tuned based on the small sample data calculated by the numerical solver to obtain the optimized initial values ​​of the hyperparameters. The specific process is as follows: Figure 1 shown.

[0009] (1) PINN is constructed and the network hyperparameter θ is randomly initialized. The activation function is the hyperbolic tangent function and the optimizer is the Adam function. In order to solve the fluid model, the Navier-Stokes equation (hereinafter referred to as the "NS equation") is introduced into the loss function of PINN. Taking a two-dimensional incompressible fluid as an example, the equation is:

[0010]

[0011] Where (x, y) is the spatial coordinate of each configuration point in the flow field, t is the time coordinate, u and v are the lateral velocity and longitudinal velocity of the flow field respectively, p is the flow field pressure, and Re is the Reynolds number of the flow field.

[0012] (2) Randomly initialize the PINN loss function parameter λ = {λ i ,λ b ,λ e}:

[0013]

[0014] In formula 2) represents the overall loss function of PINN, represents the initial condition loss term, represents the boundary condition loss term, represents the loss term of the equation, and its definitions are shown in Equation 3), Equation 4) and Equation 5) respectively. and For labeled data, the corresponding loss term is called data loss term, and the corresponding training process is supervised learning; Corresponding to unlabeled data, the corresponding loss term is called physical loss term, and the corresponding training process is unsupervised learning.

[0015]

[0016]

[0017] In formula 3) and formula 4), N i and N b are the number of samples for initial and boundary conditions, x0 and x b is the spatial coordinate of the sample, t is the time coordinate of the sample, and u is the label value corresponding to the sample data. is the predicted solution output by the neural network. In formula 5), ​​e1 represents the loss term of the fluid continuity equation, and e2 and e3 represent the loss terms of the fluid momentum equation, which are defined as shown in formula 6).

[0018]

[0019] (3) Basic model sampling and training. Assuming that the initialization parameters of the Modelica fluid model obey the data distribution with probability p(T), a set of (N) task data T is sampled according to p(T). i ~p(T). Where T i represents the i-th task in the data set, also called the basic model or basic task, and k sample data are sampled for each basic model. These data are used to train PINN to obtain a set of optimized basic model parameters:

[0020]

[0021] where θ′ i Represents basic task T i After optimizing the hyperparameters, Represents basic task T i The loss function is represent The gradient calculation result relative to the parameter θ, f θ,λ PINN represents the network parameters θ and loss parameters λ respectively. α is the inner loop learning rate of meta-learning, i.e. the basic model learning rate, usually α = 0.001.

[0022] (4) Meta-model training and parameter update. The loss functions of all basic models are summed to obtain the meta-model loss function, and the meta-model hyperparameters are updated after calculating the gradient of the meta-model loss function, including the network structure parameters and the loss function parameters. This is also called completing a meta-training or meta-update:

[0023]

[0024] in represent The gradient calculation result relative to the parameter λ, θ meta and λ meta represents the meta-model hyperparameters obtained after updating using the gradient descent method. β is the outer loop learning rate of meta-learning, i.e., the meta-model learning rate, which can usually be taken as β = 0.001.

[0025] (5) Using the hyperparameter θ output from step (4) meta and λ meta Building a metamodel At this point, the metamodel has been constructed and trained and can be used to solve the Modelica model.

[0026] After training, the meta-model will have the most optimized initial values ​​of network hyperparameters and will be able to learn with small samples for new target models. By introducing this meta-model into the Modelica engine, it is possible to quickly solve and predict new models. The specific process is as follows: Figure 2 As shown (where Figure 1 correspond Figure 2 Creating and training a meta-learning model in .

[0027] (1) Load the Modelica target model and extract its initialization parameters.

[0028] (2) If the current model is solved for the first time or the model initialization parameters have changed compared to the last solution, the modification history of the model parameters is recorded and the probability distribution p(T) of the parameter value range is updated to provide sample data for subsequent meta-model training.

[0029] (3) Use a numerical solver to solve the Modelica model. Here, only a small number of time steps need to be solved, for example, only 10% of the solution tasks of the simulation setting need to be completed.

[0030] (4) Create and train a meta-model based on the initialization parameters of the target model and its probability distribution p(T) to obtain the PINN after meta-learning training. This step can be performed simultaneously with the numerical solution of step (3).

[0031] (5) The numerical solution output from step (3) is used as the input data of the meta-model for small sample training to obtain a PINN with optimal initialization parameters for the target model.

[0032] (6) Using the PINN output from step (5), the target model is solved according to the simulation settings, and the prediction results are output. The model solution is completed.

[0033] Since small sample learning reduces the data volume requirement, the present invention can save a lot of numerical calculation workload for the solution link of the Modelica simulation engine. On the other hand, by introducing prior physical knowledge in different fields into the loss function of PINN, it can be applied to the solution of different types of mechanism models, so the present invention also has a certain reference role in solving problems in other fields.

[0034] The above is only an introduction to the preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several modifications and substitutions can be made without departing from the principle of the present invention, and these modifications and substitutions should also be regarded as the protection scope of the present invention.

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

[0036] 1. The present invention can realize the rapid adaptation and solution of the fluid mechanics model under variable working conditions by the Modelica compilation solution engine through the fusion of MAML and PINN, which can effectively reduce the computational workload of the numerical solution engine.

[0037] 2. The present invention can reduce the Modelica compilation and solution engine's dependence on the amount of sample data and the number of model training times by introducing a meta-learning algorithm, and can achieve the same solution accuracy as the original neural network model at a lower learning cost.

[0038] 3. The present invention optimizes the initialization parameters through the MAML model, which can achieve the adaptability and generalization performance of the PINN loss function, and can quickly obtain a proxy model that adapts to new working condition data. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 Shown is a flow chart of the construction and training method of the meta-model;

[0040] Figure 2 Shown is a flow chart of the Modelica fluid model prediction method;

[0041] Figure 3a Shown is a comparison of the solution performance for the lateral velocity u of the Kovasznay fluid;

[0042] Figure 3b Shown is a comparison of the performance of solving the longitudinal velocity v of the Kovasznay fluid;

[0043] Figure 3c Shown is a comparison of the performance of solving the pressure p for Kovasznay fluid. DETAILED DESCRIPTION

[0044] The specific implementation of the present invention is described in detail below with reference to the accompanying drawings and preferred embodiments.

[0045] 1) This example solves the problem of two-dimensional Kovasznay flow. Equation 10) is the analytical solution of Kovasznay flow, where ξ is a constant whose definition is shown in Equation 11). Assume that the operating parameter that needs to be frequently changed during the construction of the Modelica mechanism model of Kvarznay fluid is the Reynolds number Re of the fluid. When the value of Re changes, the model can be regarded as a new solution task. Assume that the value range of the operating parameter is Re∈[1, 1000], and the parameter obeys a uniform probability distribution. According to steps (1) and (2) in process 1, construct PINN and its loss function, and randomly initialize the hyperparameters of the neural network.

[0046]

[0047] 2) According to step (3) in process 1, N = 5 groups of working condition data (basic tasks) are sampled according to the above probability distribution, as shown in Table 1. Each group of working condition data is solved by a numerical calculation solver and k = 100 groups of sample data are sampled to update the hyperparameters of the basic model.

[0048] Table 1 Modelica model initialization parameters

[0049]

[0050]

[0051] 3) According to steps (4) and (5) in process 1, update the initialization parameters of the meta-model (i.e. complete a meta-training) and complete the construction of the meta-model. In order to verify the improvement of the model solving performance of the present invention, the pre-trained PINN is used as the benchmark model. The meta-training and pre-training use the same method to sample the training data set and the test data set, and the number of training times is 7×10 4 Second-rate.

[0052] 4) According to step (1) in process 2, load the Modelica model of Kvarzner fluid for parsing and compilation, and extract the value of its initialization parameter Re. According to the parameter value, update the probability distribution of the initialization parameter according to step (2) in process 2.

[0053] 5) According to step (3) in process 2, the Modelica model is solved by a numerical solver, and the solution result is used as sample data. According to step (5) in process 2, the meta-model output in process 1 is trained to obtain the optimized PINN. Without loss of generality, assuming that the parameter Re of the new operating condition model is 40 (or other values), the new operating condition model is solved according to step (6) in process 2, and its solution result is compared with the pre-trained PINN. The results are shown in Figure 3a-3c As shown in the figure, the PINN obtained after MAML meta-training is better than the pre-trained PINN in solving new tasks. The error convergence speed during the model training process is faster, which realizes the rapid adaptability of the proxy model to new tasks.

[0054] It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A method for solving the fluid mechanics mechanism model based on MAML and PINN, Features : Includes the following steps: S1: Creation and training of meta-model; S2: Application of metamodel in solution engine.

2. The method for solving the fluid mechanics mechanism model based on MAML and PINN according to claim 1, Features: In S1, the creation and training of the metamodel mainly includes the following steps: (1) PINN is constructed and the network hyperparameter θ is randomly initialized. The activation function is the hyperbolic tangent function and the optimizer is the Adam function. In order to solve the fluid model, the Navier-Stokes equation is introduced into the loss function of PINN, hereinafter referred to as the "NS equation"; (2) Construct the loss function of PINN and randomly initialize the parameters of each loss term, including data loss term and physical loss term; (3) Basic model sampling and training. Assuming that the initialization parameters of the Modelica fluid model obey the data distribution with probability p(T), a set of (N) task data T is sampled according to p(T). i ~p(T). Where T i Represents the i-th task in the data set, also called the basic model or basic task. K unlabeled sample data are sampled for each basic model. These data are used to train PINN to obtain a set of optimized basic model parameters θ i ′; (4) Meta-model training and parameter update: summing up the loss functions of all basic models to obtain the meta-model loss function, and calculating the gradient of the meta-model loss function to update the meta-model hyperparameters, including network structure parameters and loss function parameters. This is also called completing a meta-training or meta-update. (5) Using the hyperparameter θ output from step (4) meta and λ meta Building a metamodel At this point, the metamodel has been constructed and trained and can be used to solve the Modelica model.

3. The method for solving the fluid mechanics mechanism model based on MAML and PINN according to claim 2, Features: In S2, by introducing the meta-model into the Modelica engine, the new model can be quickly solved and predicted, which mainly includes the following steps: (1) Load the Modelica target model and extract its initialization parameters; (2) If the current model is solved for the first time or the model initialization parameters have changed compared to the last solution, the modification history of the model parameters is recorded and the probability distribution p(T) of the parameter value range is updated to provide sample data for subsequent meta-model training; (3) Use a numerical solver to solve the Modelica model, where only a small number of time steps are required; (4) Create and train a meta-model based on the initialization parameters of the target model and its probability distribution p(T) to obtain the PINN after meta-learning training; this step can be performed simultaneously with the numerical solution of step (3); (5) The numerical solution outputted from step (3) is used as the input data of the meta-model outputted from step (4) for small sample training to obtain a PINN with optimal initialization parameters for the target model; (6) Using the PINN output from step (5), the target model is solved according to the simulation settings, and the prediction results are output. The model solution is completed.

Citation Information

Cited By

  • Modelica proxy model generation method, device and medium

    CN119808611A

  • Deep learning modeling and analysis method for hydropower station equipment operation trend early warning

    CN121168248A

  • Deep learning modeling and analysis method for early warning of hydropower station equipment operation trends

    CN121168248B