A finite element simulation method based on multi-layer neural network
By accelerating the solution of nonlinear equations in cloth simulation through multi-layer neural networks, the problem of insufficient real-time performance in high-resolution cloth simulation is solved, and efficient cloth simulation effects are achieved.
Patent Information
- Application Number
- CN202411040295.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-07-31
AI Technical Summary
Existing technologies have difficulty achieving real-time deformable object simulation of high-resolution objects in cloth simulation. The Newton method has high computational cost and traditional methods have limited performance under high resolution and real-time interaction.
A multi-layer neural network is used to construct a hyperelastic model of cloth, and the Newton iteration method and line search method are used to solve the energy expression. Combined with graph convolutional network and multi-layer perceptron, a multi-layer neural network is constructed to accelerate the solution of nonlinear equations.
The simulation speed and real-time performance of high-resolution cloth simulation are improved, and efficient nonlinear equation solving is achieved to meet real-time interaction needs.
Smart Images

Figure CN118965891B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer graphics cloth simulation, and in particular relates to a finite element simulation method based on a multi-layer neural network. Background Art
[0002] Simulation of deformable objects plays a vital role in various graphics applications, enabling the generation of rich and vivid virtual content. Many of these applications, such as gaming, virtual reality, and fashion design, require not only visually pleasing deformation simulation but, more importantly, real-time interactive feedback. In real life, fashion designers often create drafts on sketches, have them manufactured in factories, and then have models wear them to experience how the garments will look on a person. This process is time-consuming and labor-intensive. However, with fabric simulation, we can dress virtual models in a computer, allowing users to experience the effects of the designed garments on a person, thereby improving productivity. Implicit time integration schemes are generally considered the standard approach for achieving stable large time-step simulation of deformable objects under certain iteration frame rate requirements. Newton's method is a classic numerical method for solving implicit integration problems. However, Newton iterations are costly, as they require constructing the system's Hessian matrix, correcting its positive definiteness, and solving the corresponding linear system at each Newton iteration. A clever quasi-Newton descent direction coupled with a line search strategy can help accelerate the Newton method, but it is still insufficient for real-time performance. Consequently, the Newton method can only handle low-resolution objects under real-time conditions.
[0003] For decades, researchers have been developing fast numerical methods that enable us to handle increasingly large interacting meshes. These methods typically depart from Newton methods and employ different strategies: they either approximate Newtonian directions using quasi-Newton methods in the full space, such as projected dynamics and position-based dynamics, or they model only a subset of degrees of freedom in subspaces, which can be created through domain decomposition or skinning. However, the performance of projected dynamics relies on pre-factorization of direct solvers, which is limited by high memory requirements for very high-resolution meshes. Position-based dynamics suffers from unsatisfactory convergence due to its use of Jacobi or Gauss-Seidel iterations, which are not ideal for simulating high-resolution and rigid objects. Subspace methods perform well at high resolutions, but they cannot handle deformations not encoded in their subspaces. Multigrid methods are very attractive for solving large linear systems because they scale well with the size of the system matrix and typically require less memory than the original system matrix. A well-designed multigrid method can simulate high-resolution objects in its full space while making full use of its multiresolution hierarchy.
[0004] Another interpretation of projected dynamics is to view it as a special case of the alternating direction method of multipliers (ADMM), providing a way to support more general materials. The key advantage of projected dynamics and its extensions is the pre-factorization of the system matrix, which makes the linear solution at runtime only require forward / backward substitution. However, such a substitution step is not friendly to parallel computing. In order to maximize the computing power of GPUs, iterative solvers such as Jacobi or Gauss-Seidel methods are more popular approaches. The researchers used the Chebyshev method to accelerate the iterative solver of projected dynamics and improved the parallelism of the Gauss-Seidel iteration through a novel shading technique, making the algorithm more suitable for GPUs. Summary of the Invention
[0005] The purpose of the present invention is to solve the problems existing in the prior art and provide a finite element simulation method based on a multi-layer neural network.
[0006] In order to achieve the above-mentioned object of the invention, the present invention specifically adopts the following technical solutions:
[0007] A finite element simulation method based on a multi-layer neural network comprises the following steps:
[0008] S1. In fabric simulation, the fabric to be predicted is modeled as a fabric hyperelastic body model. The fabric hyperelastic body model is divided into several units using the fabric finite element method. A dynamic energy expression is constructed for each unit. The energy expression consists of three components: kinetic energy, potential energy, and work done by an additional external force.
[0009] S2. Using Newton's iteration method and line search method to solve the energy expression when the energy expression reaches the minimum value, the solution of the energy expression is used as the position of each point in the unit at the next moment and a training data set of a multi-layer neural network is constructed;
[0010] S3. Pre-acquire a fine grid and construct a multi-level coarse-fine grid structure by the farthest point sampling method. The multi-level coarse-fine grid structure consists of the fine grid and multiple layers of coarse grids, and each layer of coarse grid corresponds to a constructed interpolation matrix;
[0011] S4. Training a multi-layer neural network on the training dataset, performing predictions at multiple moments using the trained multi-layer neural network, outputting a fine-grid displacement matrix at each moment until a preset maximum number of inferences is reached, and using the fine-grid displacement matrices output by the multi-layer neural network at all moments as the position prediction results of the fabric to be predicted;
[0012] In the prediction process of the multi-layer neural network at each moment, the displacement matrix of the fine grid at the previous moment is multiplied with the interpolation matrix of each layer obtained by S3 in turn to obtain the displacement matrix of the coarse grid of each layer. The displacement matrix of the fine grid at the previous moment and the displacement matrix of each coarse grid are input into the trained multi-layer neural network. Each displacement matrix of the coarse grid or fine grid is processed by a graph convolutional network to obtain the feature matrix of each layer. The feature matrix of the coarse grid of each layer is multiplied with the corresponding displacement matrix to make the feature matrix of the coarse grid of each layer have the same dimension as the feature matrix of the fine grid, and the new feature matrix of the coarse grid of each layer is obtained. The new feature matrix of the coarse grid of each layer is spliced with the feature matrix of the fine grid to obtain the spliced feature matrix, which is input into the multi-layer perceptron to output the displacement matrix of the fine grid at the next moment.
[0013] Based on the above solution, each step can be implemented in the following preferred specific manner.
[0014] Preferably, in step S1, the energy expression g(x) is in the following form:
[0015]
[0016] E(x)=E gravity (x)+E elastic (x)
[0017] E gravity (x) = mg′h′
[0018] in, represents the kinetic energy term; E(x) represents the potential energy term, including the gravitational potential energy term E gravity (x) and the elastic potential energy term E elastic (x); represents the additional external force work term; x is the displacement vector, h is the time step, and M is the mass matrix; represents the additional external force; T represents the transposition; m represents the mass of each unit; g′ represents the acceleration of gravity; h′ represents the height of each unit; y = x [0] +hv [0] The current speed v [0] and the current displacement x [0] The calculated position at the next moment.
[0019] Preferably, in step S1, the elastic potential energy term adopts the STVK cloth hyperelastic body model energy model, and is calculated as follows:
[0020]
[0021] E=F T FI
[0022]
[0023] Where F represents the deformation gradient; X represents the position of each unit at the initial moment; E represents the Green stretch coefficient; I represents the identity matrix; ψ(E) represents the energy density function; μ and λ represent the two coefficients of Young's modulus respectively; : represents the Frobenius inner product; and tr represents the trace of the matrix.
[0024] Preferably, the specific process of step S3 is: pre-acquire a fine grid and pre-specify the number of layers of the multi-level neural network, construct a first set from all points of the fine grid, select k1 points from the first set by the farthest geodesic distance method to form a second set, and form a coarse grid from all points of the second set. After the second set is generated by the first set, an interpolation matrix from the fine grid to the coarse grid is obtained by the interpolation matrix generation method; when the total number of sets is less than the number of layers of the multi-level neural network, the farthest geodesic distance method is used to continuously select new points from the previous set and form a new set, and a new coarse grid is generated from all points in the new set, and then the interpolation matrix from the fine grid to each layer of coarse grid is obtained by the interpolation matrix generation method, until the total number of sets is equal to the number of layers of the multi-level neural network, and multiple layers of coarse grids and the interpolation matrices corresponding to each layer of coarse grids are obtained.
[0025] Preferably, in step S3, the specific process of selecting points from the first set to form the second set by the farthest geodesic distance method is as follows: first, randomly select a point from the first set as the initial point for distance calculation, and add the initial point for distance calculation to the second set to initialize the second set; continuously iterate and update the second set, and in each iteration, use each remaining point in the first set except all points included in the second set as a reference point, and then use the Dijkstra algorithm to calculate the shortest geodesic distance from each reference point to each point in the second set in turn, and add the reference point with the largest shortest geodesic distance to the second set for updating the second set, and continuously iterate until the number of points included in the second set meets the requirements.
[0026] As an example, in step S3, the specific process of obtaining an interpolation matrix from a fine grid to a coarse grid by the interpolation matrix generation method is as follows: when there are k0 points in the first set and there are k points in the set corresponding to a coarse grid i When there are points, an interpolation matrix with all elements 0 is pre-constructed, and the size of the interpolation matrix is k i *k0; if the distance between the i′th point in the first set and the j′th point in the set corresponding to a coarse grid is the smallest, then the value of the element at the i′th position in the j′th row of the interpolation matrix is set to 1, until all points in the first set are processed, and an interpolation matrix from a fine grid to a coarse grid is obtained.
[0027] Preferably, in step S3, the loss function used in training the multi-layer neural network is mean square error loss.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] This invention discloses a finite element simulation method based on a multi-layer neural network. This method constructs a multi-layer neural network to accelerate the solution of nonlinear equations in fabric simulation. High-frequency and low-frequency information are captured through a multi-layer grid structure, and each layer is processed using a graph convolutional network, accelerating the solution of the energy equation. Compared with the traditional Newton method, this method improves the speed of solving nonlinear equations for specific simulation problems, thereby enabling simulation scenarios to have superior properties such as real-time performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a schematic diagram of the steps of the present invention;
[0031] Figure 2 The figure is a result of applying the method of the present invention to finite element cloth simulation;
[0032] Figure 3 Schematic diagram of constructing a multi-level coarse and fine grid structure for the farthest point sampling method;
[0033] Figure 4 Schematic diagram of a multi-layer neural network of the present invention;
[0034] Figure 5 The figure is a flow chart of the present invention for solving the minimum value of the energy expression using the Newton iteration method and the line search method. DETAILED DESCRIPTION
[0035] In order to make the above-mentioned objects, features and advantages of the present invention more clearly understood, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. The technical features in the various embodiments of the present invention can be combined accordingly without conflicting with each other.
[0036] In the description of the present invention, it should be understood that the terms "first" and "second" are used solely for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly specifying the number of technical features being described. Therefore, features defined as "first" or "second" may explicitly or implicitly include at least one of such features.
[0037] The method of the present invention constructs a dynamic energy expression based on the STVK cloth hyperelastic body model energy model, and uses the classical Newton iteration method with the line search method to accurately solve the nonlinear equations. The solution of the energy expression when the energy expression reaches the minimum value is used as a training data set and recorded locally. Then, a multi-level neural network is constructed with a graph convolutional network as an encoder and a multi-layer perceptron as a decoder. The initial displacement before solving is input into the multi-level neural network, and the solved displacement is output. The difference between the displacement in the training data set and the displacement output by the multi-level neural network is used as a loss function to train the multi-level neural network. After the training is completed, the multi-level neural network can be used to efficiently solve the cloth hyperelastic body model equation.
[0038] like Figure 1 As shown, in a preferred implementation of the present invention, the above-mentioned finite element simulation method based on a multi-layer neural network includes the following steps S1 to S4. The specific implementation process is described in detail below.
[0039] S1. In fabric simulation, the fabric to be predicted is modeled as a fabric hyperelastic body model. The fabric hyperelastic body model is divided into several units using the fabric finite element method. A dynamic energy expression is constructed for each unit. The energy expression includes three parts: kinetic energy term, potential energy term, and additional external force work term.
[0040] It should be noted that, in the present invention, Figure 2 As shown, Figure 2 The application of the present invention in cloth simulation is demonstrated. It can be seen that after the cloth to be predicted is modeled as a cloth hyperelastic body model, it is divided into many tiny units. Figure 2 It is represented as a triangle. Through the expansion and contraction range of each triangle and the angle between adjacent triangles, the force applied to the vertices of the triangle can be calculated by the cloth finite element method, and the overall movement of the cloth can be displayed through the movement of the vertices.
[0041] In the present invention, the potential energy term is divided into the gravitational potential energy term E gravity (x) and the elastic potential energy term E elastic (x), where the elastic potential energy term is calculated using the stvk cloth finite element model. This is a scalar that measures the deformation of an object. For an operation without internal relative motion, such as translation and rotation, its elastic potential energy is 0.
[0042] The energy expression g(x) is in the form of:
[0043]
[0044] E(x)=E gravity (x)+E elastic(x)
[0045] E gravity (x) = mg′h′
[0046] Among them, the first represents the kinetic energy term; the second term E(x) represents the potential energy term, including the gravitational potential energy term E gravity (x) and the elastic potential energy term E elastic (x); Item 3 represents the additional external force work term; x is the displacement vector, h is the time step, and M is the mass matrix; represents an additional external force; T represents transposition; y = x [0] +hv [0] The current speed v [0] and the current displacement x [0] The calculated position at the next moment, which represents the change in displacement in the absence of external forces; m represents the mass of each unit; g′ represents the acceleration due to gravity; and h′ represents the height of each unit.
[0047] In the potential energy term, the gravitational potential energy term E gravity (x) is related to the coordinate representing the direction of displacement height. The elastic potential energy term E elastic (x) uses the STVK cloth hyperelastic body model energy model, and the calculation method is as follows:
[0048]
[0049] E=F T FI
[0050]
[0051] Among them, F represents the deformation gradient, which is used to measure the deformation of a unit compared to its original shape; X represents the position of each unit at the initial moment; E represents the Green Strain coefficient, which eliminates the rotation-related quantities in the deformation gradient; I represents the identity matrix; ψ(E) represents the energy density function, through which the elastic potential energy at the current moment can be quickly calculated; μ and λ represent the two coefficients of Young's modulus respectively; : represents the Frobenius inner product; tr represents the trace of the matrix.
[0052] S2. Use Newton iteration method and line search method to solve the solution of the energy expression when the energy expression g(x) reaches the minimum value, use the solution of the energy expression as the position of each point in the unit at the next moment and construct a training data set of a multi-layer neural network.
[0053] The position of each point in the unit at the next moment is as follows:
[0054] x n+1 =argmin x g(x)
[0055] It should be noted that in the present invention, the solution of the energy expression g(x) can be obtained by minimizing the energy expression. Since g(x) is a nonlinear function, it is almost impossible to obtain an analytical solution. Generally, an iterative method is used to find a numerical solution. In the present invention, the Newton iteration method is used in combination with the line search method to solve the minimum value of the energy expression g(x), as shown in the following example: Figure 5 As shown. Specifically, the nonlinear energy expression is converted into a linear energy expression for processing by the Newton iteration method. Because the Newton iteration method is most efficient when it is very close to the final solution, it is particularly important to select the position of the initial point. In the method of the present invention, when solving the minimum value of the linear energy expression, the position of the point at the previous moment is selected as the initial solution, and the number of iterations is reduced to accelerate convergence. In the case of strong nonlinearity, using the Newton iteration method once may not cause the objective function to decrease, but may increase. Therefore, the present invention uses a line search method to ensure that the result obtained by the Newton iteration method can cause the energy expression g(x) to decrease, especially in the case of strong nonlinearity. Finally, the position (grid position) of each point in each solved unit is made into a data set and saved locally.
[0056] The specific process of solving the minimum value of the energy expression g(x) is as follows: Figure 5 As shown:
[0057] 1) Initialize the position x of the cell midpoint (0) , which can generally be initialized to x [0] or x [0] +hv [0] .
[0058] 2) At the kth iteration, the position of the unit midpoint is used as the independent variable, and the first and second derivatives of the energy expression g(x) are calculated:
[0059]
[0060] in, Indicates the gradient; x (k) Indicates the position of the unit midpoint at the kth iteration; g(x (k) ) indicates that the independent variable is x (k) Energy expression of f(x (k) ) represents the derivative of the potential energy term; Indicates partial derivative; H(x (k) ) indicates that the independent variable is x (k) The Hessian matrix of the potential energy term.
[0061] 3) Solve the linear energy expression:
[0062]
[0063] x (k+1) =x (k) +αΔx
[0064] Where Δx represents the offset of the linear energy expression solution; α represents the parameter of the line search method. The size of α needs to use the reverse line search method to ensure the decrease of the energy expression; x (k+1) The position of the unit midpoint at the k+1th iteration;
[0065] 4) After solving the minimum value of the energy expression g(x), the solution of the energy expression is saved as a training data set for the multi-layer neural network.
[0066] S3. A fine grid is obtained in advance, and a multi-level coarse-fine grid structure is constructed by the farthest point sampling method. The multi-level coarse-fine grid structure consists of the fine grid and multiple layers of coarse grids, and each layer of coarse grid corresponds to a constructed interpolation matrix.
[0067] It should be noted that in the present invention, the farthest point sampling method is used. This method is a special case of the k-means algorithm. It uses an iterative algorithm to construct a mapping relationship from fine grid to coarse grid, which plays an important role in the construction of neural networks. Figure 3 As shown, a fine grid is obtained in advance and the number of layers of the multi-layer neural network is pre-specified. A first set Ω0 is constructed from all points of the fine grid (k0 points). The farthest geodesic distance method is used to select k1 points from the first set Ω0 to form a second set Ω1. The second set Ω1 only contains a portion of the points on the fine grid. A coarse grid is formed from all points of the second set Ω1. After the second set Ω1 is generated from the first set Ω0, an interpolation matrix is generated from the fine grid to the coarse grid. When the total number of sets is less than the number of layers of the multi-layer neural network, the farthest geodesic distance method is used to continuously select new points from the previous set to form a new set. A new coarse grid is generated from all points in the new set. The interpolation matrix generation method is then used to generate interpolation matrices from the fine grid to each layer of coarse grids until the total number of sets equals the number of layers of the multi-layer neural network. In this way, a mapping relationship is established from the fine grid to the next layer of coarse grid, resulting in multiple layers of coarse grids and the interpolation matrices corresponding to each layer of coarse grids.
[0068] In step S3 of this embodiment, the specific process of selecting points from the first set to form the second set using the farthest geodesic distance method is as follows:
[0069] First, a point is randomly selected from the first set Ω0 as the initial point for distance calculation, and the initial point is added to the second set Ω1 to initialize the second set Ω1; the second set is continuously updated iteratively. In each iteration, each remaining point in the first set Ω0 except all points included in the second set Ω1 is used as a reference point. Then, the Dijkstra algorithm is used to calculate the shortest geodesic distance from each reference point to each point in the second set Ω1 in turn. The reference point with the largest shortest geodesic distance is added to the second set Ω1 (then the point with the largest distance is selected from Ω0\Ω1 and added to Ω1) to update the second set. The iteration is repeated until the number of points in the second set meets the requirement.
[0070] In step S3 of this embodiment, the specific process of obtaining an interpolation matrix from a fine grid to a coarse grid by the interpolation matrix generation method is as follows: when there are k0 points in the first set and there are k points in the set corresponding to a coarse grid i When there are points, an interpolation matrix with all elements 0 is pre-constructed, and the size of the interpolation matrix is k i *k0; if the distance between the i′th point in the first set and the j′th point in the set corresponding to a coarse grid is the smallest, then the value of the element at the i′th position in the j′th row of the interpolation matrix is set to 1, until all points in the first set are processed, and an interpolation matrix from a fine grid to a coarse grid is obtained.
[0071] Taking the first set Ω0 and the second set Ω1 as examples, when there are k0 points in the first set Ω0 and k1 points in the second set Ω1, we pre-construct an interpolation matrix whose elements are all zero and whose size is k1*k0. For all points in the first set Ω0, if the i′th point in the first set Ω0 has the smallest distance from the j′th point in the second set Ω1, we set the value of the element at the i′th position in the j′th row of the interpolation matrix to 1. The same process is repeated for the remaining sets corresponding to the coarse grid: the distances between each point and each point in the first set Ω0 are calculated and the calculation is repeated again.
[0072] Furthermore, a simple interpolation matrix Mc is shown below. It represents that the 0th, 1st, and 2nd points in the first set Ω0 are interpolated to the 0th point in the second set Ω1, the 3rd and 4th points in the first set Ω0 are interpolated to the 1st point in the second set Ω1, and the 5th, 6th, and 7th points in the first set Ω0 are interpolated to the 2nd point in the second set Ω1.
[0073]
[0074] S4. A multi-layer neural network is trained on the training data set, and the trained multi-layer neural network performs predictions at multiple moments. The multi-layer neural network outputs a fine-grid displacement matrix at each moment until a preset maximum number of inferences is reached. The fine-grid displacement matrices output by the multi-layer neural network at all moments are used as the position prediction results of the cloth to be predicted.
[0075] In the prediction process of the multi-layer neural network at each moment, the displacement matrix of the fine grid at the previous moment is multiplied with the interpolation matrix of each layer obtained by S3 in turn to obtain the displacement matrix of the coarse grid of each layer. The displacement matrix of the fine grid at the previous moment and the displacement matrix of each coarse grid are input into the trained multi-layer neural network. Each displacement matrix of the coarse grid or fine grid is processed by a graph convolutional network to obtain the feature matrix of each layer. The feature matrix of the coarse grid of each layer is multiplied with the corresponding displacement matrix to make the feature matrix of the coarse grid of each layer have the same dimension as the feature matrix of the fine grid, and the new feature matrix of the coarse grid of each layer is obtained. The new feature matrix of the coarse grid of each layer is spliced with the feature matrix of the fine grid to obtain the spliced feature matrix, which is input into the multi-layer perceptron to output the displacement matrix of the fine grid at the next moment.
[0076] It should be noted that, in the present invention, Figure 4 As shown in the figure, a multi-layer neural network is constructed by combining an encoder and a decoder. In the encoder part, a graph convolutional network is used on the coarse and fine grids to aggregate the edge information of each input point to obtain the feature matrix of each layer. Then, the feature matrix on the coarse grid is mapped to the fine grid through the interpolation matrix, and the feature matrix of each layer of coarse grid is spliced together with the feature matrix of the fine grid. Then, the decoder is used to restore the feature matrix calculated by the encoder and decoder into the solution of the nonlinear equation (that is, the displacement matrix of the fine grid). Specifically, the decoder is used to decode the spliced feature matrix to obtain the displacement matrix of the fine grid at the next moment. In addition, during the prediction process of the first moment, the multi-layer neural network needs to obtain the displacement matrix of a fine grid in advance, and then use it to generate the displacement matrix of the fine grid at the next moment.
[0077] Furthermore, the processing process of the lth layer in the graph convolutional network is:
[0078]
[0079] Among them, X (l+1) and X (l) are the feature matrices of the l+1th layer and the lth layer respectively; σ represents the activation function; is the adjacency matrix of the lth layer; W represents the degree matrix of the adjacency matrix of the lth layer; (l) are the parameters used to train multi-layer neural networks.
[0080] It should be noted that in the present invention, when training a multi-layer neural network, the multi-layer neural network is trained on the aforementioned training data set. In the training data set of the multi-layer neural network, each training sample is a solution of the energy expression, corresponding to the displacement matrix of the fine grid at each moment. p Back propagation is performed to train the parameters of the multi-layer neural network. After the multi-layer neural network is trained, the displacement matrix of the fine grid at one time can be input into the multi-layer neural network, and the displacement matrix of the fine grid at the next time can be output. This cycle can be repeated to achieve real-time simulation.
[0081] In this embodiment, the loss function used in the training of the multi-layer neural network is the mean square error loss, and its function form is specifically:
[0082]
[0083] Where N is the total number of elements in the displacement matrix of the fine grid, and Represents the displacement matrix of the fine grid at time t and time t+1 in the training dataset; Represents the displacement matrix of the fine grid predicted by the multi-level neural network at time t+1; Model represents the multi-level neural network of the present invention.
[0084] In order to better demonstrate the specific implementation and technical effects of the present invention, a finite element simulation method based on a multi-layer neural network shown in steps S1 to S4 in the above preferred implementation is applied to a specific example.
[0085] Example
[0086] The specific implementation process of the finite element simulation method based on a multi-layer neural network used in this embodiment is as described above and will not be repeated here.
[0087] The present invention captures the high-frequency and low-frequency information of the fabric through a multi-layer neural network, processes it, and directly calculates the solution of the nonlinear equation. The method of the present invention improves the simulation efficiency of high-resolution grids. The experimental results are as follows: Figure 2 As shown, the real-time finite element simulation results of cloth are obtained.
[0088] In addition to the above simulation results, the present invention considers that the Newton method plus the multigrid method is a very classic method in traditional simulation. Therefore, in this embodiment, the multigrid method with a V-shaped iteration is used as the comparison method of the present invention. This embodiment calculates the infinite norm of the force ‖F‖ ∞(The infinity norm is the absolute maximum of all values in F) as the error, and record the time required for the two methods and the speed at which the error decreases. Figure 2 The measured data in the illustrated scenario are shown in Table 1.
[0089] Table 1. Statistical results of different methods
[0090] Initial error One iteration error Usage time (ms) Multigrid method 0.8157 0.3092 1.63 The present invention 0.8157 0.2134 0.52
[0091] In summary, under the same scenario, the method of the present invention achieves better speed and effect than the traditional method by training for the specific scenario in advance.
[0092] The embodiment described above is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Persons skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent substitution or equivalent transformation falls within the scope of protection of the present invention.
Claims
1. A finite element simulation method based on a multi-layer neural network, characterized in that: The following steps are involved: S1. In fabric simulation, the fabric to be predicted is modeled as a fabric hyperelastic body model. The fabric hyperelastic body model is divided into several units using the fabric finite element method. A dynamic energy expression is constructed for each unit. The energy expression consists of three components: kinetic energy, potential energy, and work done by an additional external force. S2. Using Newton's iteration method and line search method to solve the energy expression when the energy expression reaches the minimum value, the solution of the energy expression is used as the position of each point in the unit at the next moment and a training data set of a multi-layer neural network is constructed; S3. Pre-acquire a fine grid and construct a multi-level coarse-fine grid structure by the farthest point sampling method. The multi-level coarse-fine grid structure consists of the fine grid and multiple layers of coarse grids, and each layer of coarse grid corresponds to a constructed interpolation matrix; S4. Training a multi-layer neural network on the training dataset, performing predictions at multiple moments using the trained multi-layer neural network, outputting a fine-grid displacement matrix at each moment until a preset maximum number of inferences is reached, and using the fine-grid displacement matrices output by the multi-layer neural network at all moments as the position prediction results of the fabric to be predicted; In the prediction process of the multi-layer neural network at each moment, the displacement matrix of the fine grid at the previous moment is multiplied with the interpolation matrix of each layer obtained by S3 in turn to obtain the displacement matrix of the coarse grid of each layer. The displacement matrix of the fine grid at the previous moment and the displacement matrix of each coarse grid are input into the trained multi-layer neural network. Each displacement matrix of the coarse grid or fine grid is processed by a graph convolutional network to obtain the feature matrix of each layer. The feature matrix of the coarse grid of each layer is multiplied with the corresponding displacement matrix to make the feature matrix of the coarse grid of each layer have the same dimension as the feature matrix of the fine grid, and the new feature matrix of the coarse grid of each layer is obtained. The new feature matrix of the coarse grid of each layer is spliced with the feature matrix of the fine grid to obtain the spliced feature matrix, which is input into the multi-layer perceptron to output the displacement matrix of the fine grid at the next moment.
2. The finite element simulation method based on a multi-layer neural network according to claim 1, characterized in that: In step S1, the energy expression g(x) is in the form of: E(x)=E gravity (x)+E elastic (x) E gravity (x)=mg′h′ in, represents the kinetic energy term; E(x) represents the potential energy term, including the gravitational potential energy term E gravity (x) and the elastic potential energy term E elastic (x); represents the additional external force work term; x is the displacement vector, h is the time step, and M is the mass matrix; represents the additional external force; T represents the transposition; m represents the mass of each unit; g′ represents the acceleration of gravity; h′ represents the height of each unit; y = x [0] +hv [0] The current speed v [0] and the current displacement x [0] The calculated position at the next moment.
3. The finite element simulation method based on a multi-layer neural network according to claim 2, characterized in that: In step S1, the elastic potential energy term adopts the STVK cloth hyperelastic body model energy model and is calculated as follows: E=F T FI Where F represents the deformation gradient; X represents the position of each unit at the initial moment; E represents the Green stretch coefficient; I represents the identity matrix; ψ(E) represents the energy density function; μ and λ represent the two coefficients of Young's modulus respectively; : represents the Frobenius inner product; and tr represents the trace of the matrix.
4. The finite element simulation method based on a multi-layer neural network according to claim 1, characterized in that: The specific process of step S3 is as follows: a fine grid is obtained in advance and the number of layers of the multi-level neural network is pre-specified, a first set is constructed from all points of the fine grid, k1 points are selected from the first set by the farthest geodesic distance method to form a second set, a coarse grid is constructed from all points of the second set, and after the second set is generated by the first set, an interpolation matrix from the fine grid to the coarse grid is obtained by the interpolation matrix generation method; when the total number of sets is less than the number of layers of the multi-level neural network, new points are continuously selected from the previous set by the farthest geodesic distance method to form a new set, and a new coarse grid is generated from all points in the new set, and then an interpolation matrix from the fine grid to each layer of coarse grid is obtained by the interpolation matrix generation method, until the total number of sets is equal to the number of layers of the multi-level neural network, and multi-layer coarse grids and interpolation matrices corresponding to each layer of coarse grids are obtained.
5. The finite element simulation method based on a multi-layer neural network according to claim 4, characterized in that: In step S3, the specific process of selecting points from the first set to form the second set by the farthest geodesic distance method is as follows: first, a point is randomly selected from the first set as the initial point for distance calculation, and the initial point for distance calculation is added to the second set to initialize the second set; the second set is continuously iterated and updated, and in each iteration, each remaining point in the first set except all points included in the second set is used as a reference point, and then the Dijkstra algorithm is used to calculate the shortest geodesic distance from each reference point to each point in the second set in turn, and the reference point with the largest shortest geodesic distance is added to the second set for updating the second set, and the iteration is repeated until the number of points included in the second set meets the requirement.
6. The finite element simulation method based on a multi-layer neural network according to claim 4, characterized in that: In step S3, the specific process of obtaining an interpolation matrix from a fine grid to a coarse grid by the interpolation matrix generation method is as follows: when there are k0 points in the first set and there are k points in the set corresponding to a coarse grid i When there are points, an interpolation matrix with all elements 0 is pre-constructed, and the size of the interpolation matrix is k i *k0; if the distance between the i′th point in the first set and the j′th point in the set corresponding to a coarse grid is the smallest, then the value of the element at the i′th position in the j′th row of the interpolation matrix is set to 1, until all points in the first set are processed, and an interpolation matrix from a fine grid to a coarse grid is obtained.
7. The finite element simulation method based on a multi-layer neural network according to claim 1, characterized in that: In step S3, the loss function used in the training of the multi-layer neural network is the mean square error loss.
Citation Information
Patent Citations
Acceleration method and device for flow field prediction
CN114218875A
Thermal stress prediction method and system based on neural network
CN116451584A