Method for applying Dirichlet boundary condition in finite element analysis and related product
By setting a unified interface for calculating discrete operator terms and using the 0-to-1 method for Dirichlet boundary conditions in finite element analysis, the problems of code complexity and calculation accuracy are solved, and the precise application of Dirichlet boundary conditions and the improvement of calculation efficiency are achieved.
Patent Information
- Application Number
- CN202511224586.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-11-28
AI Technical Summary
Existing techniques for applying Dirichlet boundary conditions in finite element analysis suffer from problems such as high code complexity, poor scalability, and indirect application methods affecting the accuracy of calculation results.
By setting a unified operator discrete term calculation interface for Dirichlet and non-Dirichlet boundaries, the calculation unit is identified and the degree of freedom number is stored. The contribution of the boundary term is calculated, and the boundary term is assembled into the global matrix using the 0-set-1 method, so as to achieve precise application of boundary conditions.
It simplifies program development, improves code scalability and computational accuracy, and enhances the efficiency of nonlinear and linear solution calculations.
Smart Images

Figure CN121031207A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of finite element analysis, and in particular to a method for applying Dirichlet boundary conditions in finite element analysis and related products. BACKGROUND
[0002] In finite element analysis, the correct application of boundary conditions is a key step to ensure the accuracy of the calculation results. Dirichlet boundary conditions directly specify the solution of the variable to be solved on the boundary, and there are different ways to handle them. The commonly used penalty function method and other indirect application methods introduce certain numerical errors, affecting the accuracy of the calculation results; while other direct application methods may increase the complexity of the code and increase the cost of maintenance.
[0003] Therefore, a general and efficient method is needed to apply Dirichlet boundary conditions, which optimizes the program logic and improves the scalability of the code based on the accurate application of boundary conditions. SUMMARY
[0004] The present application provides a method for applying Dirichlet boundary conditions in finite element analysis and related products to solve the problems of code complexity, poor scalability and indirect application affecting the accuracy of the calculation results in existing direct application methods.
[0005] The present application is implemented by the following technical solutions: In a first aspect of the present application, a method for applying Dirichlet boundary conditions in finite element analysis is provided, comprising: Setting a uniform operator discrete term calculation interface for equation terms of Dirichlet boundaries and non-Dirichlet boundaries; the operator discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface and a stiffness matrix calculation interface; Iterating through all calculation units, identifying a first calculation unit of non-Dirichlet boundary conditions and a second calculation unit requiring Dirichlet boundary conditions, and storing the degree of freedom numbers of the first calculation unit and the second calculation unit; Calculating the contribution of the operator discrete terms of Dirichlet boundary terms and non-Dirichlet boundary terms through the operator discrete term calculation interface; the contribution of the operator discrete terms includes the combination of residuals and Jacobian matrices, or the combination of right-hand side terms and stiffness matrices; According to the index position of the degree of freedom number of the first calculation unit, the contribution of the operator discrete terms of the non-Dirichlet boundary terms is assembled into the corresponding position in the corresponding global vector and global matrix; According to an index position of a degree of freedom number of the second calculation unit, a residual or a right end term of the Dirichlet boundary term is assigned to a corresponding position in a corresponding global vector, and a Jacobian matrix or a stiffness matrix of the Dirichlet boundary term is filled into a corresponding position in a corresponding global matrix based on a 0-1 method.
[0006] In the above method of the present application, by setting a unified calculation interface for calculating residuals, right end terms, Jacobian matrices and stiffness matrices of Dirichlet boundary and other types of equation terms, the program development can be simplified and the code scalability can be improved; after calculating the residuals / right end terms, Jacobian matrices / stiffness matrices of all non-Dirichlet boundary terms and Dirichlet boundary terms in the equation during equation discretization and assembly, by identifying and recording the degree of freedom number of the variable on the node to which the Dirichlet boundary condition needs to be applied, the residuals / right end terms of the Dirichlet boundary term are assembled into the corresponding position in the global residual vector / global right end term using the 0-1 method, and the Jacobian matrix / stiffness matrix of the Dirichlet boundary term is assembled into the corresponding position in the global Jacobian matrix / global stiffness matrix, thereby realizing accurate application of the Dirichlet boundary in finite element analysis, and uniformly processing Dirichlet boundary conditions and other types (non-Dirichlet boundary conditions) of equation terms, simplifying the application of Dirichlet boundary conditions, and improving the accuracy of nonlinear and linear solution calculations.
[0007] In some embodiments, the method further comprises: directly setting the iteration initial value of the degree of freedom of the second calculation unit as the Dirichlet boundary value.
[0008] In some embodiments, the filling of the Jacobian matrix or the stiffness matrix of the Dirichlet boundary term into the corresponding position in the corresponding global matrix based on the 0-1 method comprises: zeroing all elements in a row and a column of an index position of the degree of freedom number of the second calculation unit in the global Jacobian matrix or the global stiffness matrix; assigning elements of the Jacobian matrix of the Dirichlet boundary term to a corresponding diagonal position in the global Jacobian matrix; or assigning elements of the stiffness matrix of the Dirichlet boundary term to a corresponding diagonal position in the global stiffness matrix.
[0009] In some embodiments, according to an index position of a degree of freedom number of the first calculation unit, the contribution of the operator discrete term of the non-Dirichlet boundary term is assembled into a corresponding position in a corresponding global vector and a global matrix, comprising: assembling the residual of the non-Dirichlet boundary term to a corresponding position in a global residual vector, assembling the Jacobian matrix of the non-Dirichlet boundary term to a corresponding position in a global Jacobian matrix; or, assembling the right-hand side term of the non-Dirichlet boundary term to a corresponding position in a global right-hand side term, assembling the stiffness matrix of the non-Dirichlet boundary term to a corresponding position in a global stiffness matrix.
[0010] In some embodiments, the computing unit includes grid elements and computing nodes, the first computing unit is a grid element and / or a computing node without Dirichlet boundary condition, and the second computing unit is a computing node with Dirichlet boundary condition.
[0011] In some embodiments, the contribution of the Dirichlet boundary term and the non-Dirichlet boundary term to the operator-discrete term is calculated based on a weak form of the equation through the operator-discrete term calculation interface.
[0012] In some embodiments, the contribution of the Dirichlet boundary term and the non-Dirichlet boundary term to the operator-discrete term is calculated based on a weak form of the equation through the operator-discrete term calculation interface.
[0013] In some embodiments, the initial value of the degree of freedom of the node with Dirichlet boundary condition is set as the Dirichlet boundary value when performing nonlinear iterative solution.
[0014] In some embodiments, the initial value of the degree of freedom of the node with Dirichlet boundary condition is set as the Dirichlet boundary value when performing nonlinear iterative solution. In some embodiments, the initial value of the degree of freedom of the node with Dirichlet boundary condition is set as the Dirichlet boundary value when performing nonlinear iterative solution. The computing interface module is configured to set a uniform operator-discrete term calculation interface for equation terms of Dirichlet boundary and non-Dirichlet boundary; the operator-discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface, and a stiffness matrix calculation interface. The computing interface module is configured to set a uniform operator-discrete term calculation interface for equation terms of Dirichlet boundary and non-Dirichlet boundary; the operator-discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface, and a stiffness matrix calculation interface. a non-Dirichlet boundary condition term calculation module, configured to assemble, according to the first position index set, contributions of operator discrete terms of the non-Dirichlet boundary term to corresponding positions in a corresponding global vector and a corresponding global matrix; a Dirichlet boundary condition application module, configured to assign, according to an index position of the degree of freedom number of the second calculation unit, a residual or a right end term of the Dirichlet boundary term to a corresponding position in a corresponding global vector, and fill a Jacobian matrix or a stiffness matrix of the Dirichlet boundary term into a corresponding position in a corresponding global matrix based on a 0-1 method.
[0015] In a fourth aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for applying Dirichlet boundary conditions in finite element analysis according to any one of the first aspect of the present application or the finite element analysis method according to any one of the second aspect of the present application when executing the computer program.
[0016] In a fifth aspect, the present application provides a computer readable storage medium, having a computer program stored thereon, wherein the computer program is executable on a processor to implement the method for applying Dirichlet boundary conditions in finite element analysis according to any one of the first aspect of the present application or the finite element analysis method according to any one of the second aspect of the present application.
[0017] In a sixth aspect, the present application provides a computer program product, comprising computer programs / instructions executable on a processor to implement the method for applying Dirichlet boundary conditions in finite element analysis according to any one of the first aspect of the present application or the finite element analysis method according to any one of the second aspect of the present application.
[0018] Compared with the prior art, the present application has the following advantages and beneficial effects: By setting a unified calculation interface for calculating residuals, right end terms, Jacobian matrices and stiffness matrices of Dirichlet boundaries and other types of equation terms, the program development is simplified, and the reusability and scalability of the code are improved; In the equation discretization and assembly, the 0-1 method is used to assemble the residuals and Jacobian matrices of the Dirichlet boundary into the global residual vector and the global Jacobian matrix (or the 0-1 method is used to assemble the right end terms and stiffness matrices of the Dirichlet boundary into the global right end term and the global stiffness matrix), thereby realizing accurate application of the Dirichlet boundary in the finite element analysis. The Dirichlet boundary condition is uniformly processed with other types of equation terms, the application of the Dirichlet boundary condition is simplified, and the scalability of the code is improved; The free degree of the node corresponding to the Dirichlet boundary is directly set as the boundary value, and the convergence speed of the nonlinear iteration calculation is accelerated. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced as follows. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be considered as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor. In the drawings: Figure 1 is a flow chart of a method for applying Dirichlet boundary conditions in finite element analysis according to an embodiment of the present application; Figure 2 is a schematic diagram of a method for applying Dirichlet boundary conditions in finite element analysis according to an embodiment of the present application; Figure 3 is a block diagram of an apparatus for applying Dirichlet boundary conditions in finite element analysis according to an embodiment of the present application; Figure 4 is a block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the embodiments and drawings. The exemplary embodiments of the present application and their descriptions are only used to explain the present application, and are not intended to limit the present application.
[0021] It should be noted that the terms "include" and "have" and any variations thereof in the specification and claims of the present application and the above drawings are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to or inherent to other steps or units.
[0022] The terminology used in the various embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to limit the various embodiments of the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. The terms (such as those defined in commonly used dictionaries) are to be interpreted as having the same meaning as in the context of the relevant technical field and are not to be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.
[0023] The embodiments of the present invention provide a method and related products for applying Dirichlet boundary conditions in finite element analysis. It is applicable to finite element analysis scenarios that require the application of Dirichlet boundary conditions, can uniformly handle Dirichlet boundary conditions and other types of equation terms, simplify the application of Dirichlet boundary conditions, and improve the accuracy and convergence speed of nonlinear and linear iterative calculations.
[0024] Please see Figure 1 , Figure 1 The diagram shows a flowchart of a method for applying Dirichlet boundary conditions in finite element analysis proposed in this invention. The method includes the following steps, which have no specific order and some can be executed in parallel.
[0025] S1 sets up a unified interface for calculating discrete operator terms for equations with and without Dirichlet boundaries.
[0026] The operator discrete term calculation interface allows users to set the contribution of each equation term to the discrete term. In finite element analysis, the specific combination of equations depends on the problem type (linear / nonlinear), boundary condition type, and the choice of numerical method. Common combinations include residual terms + Jacobian matrix and right-hand side terms + stiffness matrix. Therefore, in this implementation, the equation discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface, and a stiffness matrix calculation interface. A unified calculation interface is used when calculating the contribution of each operator discrete term under different boundary conditions.
[0027] S2, traverse all computational units, identify the first computational unit without Dirichlet boundary conditions and the second computational unit that needs to be subject to Dirichlet boundary conditions, and store the degree of freedom numbers of the first and second computational units.
[0028] The first computational unit is the one that does not require Dirichlet boundary conditions, while the second computational unit is the one that requires Dirichlet boundary conditions. Dirichlet boundary conditions directly specify the solution to the variable to be solved on the boundary; non-Dirichlet boundary condition terms refer to all other terms in the equations besides the Dirichlet boundary condition terms.
[0029] The identification of the first and second computational units can be performed automatically or manually. Automatic identification can be based on geometric features, physical labels, or user-defined rules. Taking geometric identification as an example, the boundary is identified by the position (coordinate range) of the geometric entity and marked as a Dirichlet boundary element. The remaining unmarked elements are used as the first computational unit for non-Dirichlet boundary conditions. Taking physical label identification as another example, physical groups are predefined in the mesh file, directly associated with boundary condition types, and the boundary type is distinguished based on the material properties of the marked elements in the physical group or user-defined fields.
[0030] Furthermore, the computational unit includes mesh elements and computational nodes. The first computational unit refers to a mesh element, or a computational node, or a mesh element and a computational node that do not require the application of Dirichlet boundary conditions. The second computational unit is a computational node that requires the application of Dirichlet boundary conditions.
[0031] S3 calculates the contributions of the operator discrete terms for both Dirichlet boundary terms and non-Dirichlet boundary terms through the operator discrete term calculation interface.
[0032] The contribution of the discrete term of the operator includes the combination of the residual and the Jacobian matrix, or the combination of the right-hand side term and the stiffness matrix.
[0033] Furthermore, in this implementation, the contribution of each operator's discrete term is calculated based on the weak form of the equation.
[0034] Taking the Poisson equation as an example, its strong form is: Its weak form can be written as: .
[0035] In the formula, u For the variable to be determined, f For load function, For the calculation area, For the regional boundary, a For Dirichlet boundary values, v This is a test function.
[0036] The contributions of each term in the equation excluding Dirichlet boundary terms to the residuals and Jacobian matrix are calculated based on the above formula, and the corresponding calculation interfaces in step S1 are set. After the settings are completed, the program assembles these contributions into the global residual vector (or global right-hand side terms) and the global Jacobian matrix (or global stiffness matrix).
[0037] The following is an example of an interface for calculating the contribution of the diffusion term in the Poisson equation to the residuals: double FEMDiffusion::computeResidualOnQp() { return _u[_qp] *_test_diff [_qp]; } The following is an example of an interface for calculating the contribution of the diffusion term of the Poisson equation to the Jacobian matrix: double FEMDiffusion::computeJacobianOnQp() { return _phi_diff[_qp]*_test_diff [_qp]; } The following is an example of an interface for calculating the contribution of Dirichlet boundary conditions to the residuals: double FEMDirichletBC::computeResidualOnQp() { return _u[_qp] -computeValueOnQp(); } An example of the interface for calculating the contribution of Dirichlet boundary conditions to the Jacobian matrix is as follows: double FEMDirichletBC::computeJacobianOnQp() { return 1; } This interface allows developers to set the contribution of each equation term to the residual and Jacobian matrix.
[0038] Specifically, for each node that requires the application of Dirichlet boundary conditions, its contribution to the residuals (or right-hand side terms) and the Jacobian matrix (or stiffness matrix) is calculated.
[0039] (1) The residual value is ,in Here, represents the degrees of freedom of the variables at the node, and 'value' represents the boundary condition value. (2) The corresponding element in the Jacobian matrix has a value of 1; (3) If it is necessary to calculate the right-hand term, the corresponding value of the right-hand term is the boundary condition value.
[0040] S4. Based on the index position of the degree of freedom number of the first calculation unit, assemble the residuals (or right-hand terms) of the non-Dirichlet boundary terms into the corresponding positions in the global residual vector (or global right-hand terms), and assemble the Jacobian matrix (or stiffness matrix) of the non-Dirichlet boundary terms into the corresponding positions in the global Jacobian matrix (or global stiffness matrix).
[0041] This step applies non-Dirichlet boundary conditions using the finite element method. It involves storing the global degree-of-freedom (DOF) numbers in an array and assembling the global discrete terms based on the global position index of the DDF numbers corresponding to the elements in the stored non-Dirichlet boundary condition terms. This includes assembling the global residual vector based on the residuals of the non-Dirichlet boundary terms, assembling the global Jacobian matrix based on the Jacobian matrix of the non-Dirichlet boundary terms, and in some cases, assembling the global right-hand side terms based on the right-hand side terms of the non-Dirichlet boundary conditions, and finally assembling the global stiffness matrix based on the stiffness matrix of the non-Dirichlet boundary conditions.
[0042] S5. Based on the index position of the degree of freedom number of the second calculation unit, assign the residual (or right-hand term) of the Dirichlet boundary term to the corresponding position in the global residual vector (or global right-hand term), and fill the Jacobian matrix (or stiffness matrix) of the Dirichlet boundary term into the corresponding position in the global Jacobian matrix (or global stiffness matrix) based on the 0-to-1 method.
[0043] This step applies Dirichlet boundary conditions to the finite element method and updates the global residual vector (or global right-hand side term) and global Jacobian matrix (or stiffness matrix) based on the global position index of the element corresponding to the stored Dirichlet boundary terms.
[0044] The method of filling the Jacobian matrix elements of the Dirichlet boundary condition terms into the corresponding positions in the global matrix based on the zero-to-one method includes: setting all elements in the row and column where the index position of the degree of freedom number of the second computational unit in the global Jacobian matrix is located to zero; and assigning the elements of the Jacobian matrix of the Dirichlet boundary terms to the corresponding diagonal positions in the global Jacobian matrix. The stiffness matrix of the Dirichlet boundary term is filled into the corresponding position in the global matrix based on the zero-to-one method, including: setting all elements in the row and column where the index position of the degree of freedom number of the second calculation unit in the global stiffness matrix is located to zero; and assigning the elements of the stiffness matrix of the Dirichlet boundary term to the corresponding diagonal position in the global stiffness matrix.
[0045] Specifically, the method for assembling the contributions of the Dirichlet boundary to the residuals and Jacobian matrix into the global residual vector and the global Jacobian matrix is explained below.
[0046] (1) Processing of residual terms: Based on the stored global degree of freedom index, the calculated residual of the Dirichlet boundary is directly overwritten with the original residual value at that position.
[0047] (2) Processing of the Jacobian matrix: Based on the stored global degree of freedom index, first set all the elements of the row and column corresponding to the index in the original Jacobian matrix to zero, and then assign the calculated Jacobian element value (value 1) of the Dirichlet boundary to the diagonal position of the row in the matrix, thus realizing the conversion from 0 to 1.
[0048] The same applies to the right-hand side terms and the stiffness matrix.
[0049] Specifically, suppose the global Jacobian matrix and right-hand side terms assembled from the terms of an equation without Dirichlet boundary conditions are as follows: That is, In the formula a and b All values are known. x The value of the degrees of freedom (unknown quantity) to be determined.
[0050] Now apply the Dirichlet boundary conditions: Assume and The degrees of freedom are the degrees of freedom corresponding to the Dirichlet boundary conditions, and the value is 3 (3 is an arbitrarily set boundary value). After applying the Dirichlet boundary conditions, setting the rows and columns corresponding to the degrees of freedom of the Dirichlet boundary conditions to 0, setting the diagonal elements to 1, and setting the right-hand side to the Dirichlet boundary values, will result in the Jacobian matrix and the right-hand side becoming... This completes the application of the Dirichlet boundary.
[0051] In some implementations, the method further includes setting the initial values of the degrees of freedom iteration of the second computational unit directly as Dirichlet boundary values. To enable faster convergence of the nonlinear iterative calculation, the initial values of the degrees of freedom iteration of the nodes corresponding to the Dirichlet boundary are set as boundary values during the nonlinear solution iterative calculation.
[0052] Embodiments of the present invention also provide a finite element analysis method, wherein when performing finite element analysis, the method for applying Dirichlet boundary conditions in finite element analysis as described in any of the preceding claims of the present invention is used to apply Dirichlet boundary conditions.
[0053] In some implementations, during nonlinear iterative solutions, the initial values of the degrees of freedom of nodes with applied Dirichlet boundary conditions are set to Dirichlet boundary values. This improves the convergence speed of nonlinear iterative calculations.
[0054] See Figure 2 As shown, applying Dirichlet boundary conditions during finite element analysis includes the following steps.
[0055] (1) Set up a unified interface for calculating residuals (or right-hand side terms) and Jacobian matrix (or stiffness matrix) for Dirichlet boundary and other types of equation terms; (2) Calculate the residuals (or right-hand side terms) and Jacobian matrix (or stiffness matrix) of all non-Dirichlet boundary terms in the weak form of the equation. (3) Identify and store the degree of freedom numbers of the node variables that require Dirichlet boundary conditions; (4) Calculate the contribution of Dirichlet boundary conditions to the residuals (or right-hand side terms) and Jacobian matrix (or stiffness matrix); (5) Based on the method of setting 0 to 1, the contributions of the Dirichlet boundary to the residual (or right-hand term) and Jacobian matrix (or stiffness matrix) are assembled into the global residual vector (or global right-hand term) and global Jacobian matrix (or global stiffness matrix); (6) Set the initial value of the degree of freedom of the node corresponding to the Dirichlet boundary directly as the boundary value to accelerate the convergence speed of the nonlinear iterative calculation.
[0056] In step (3) above, during the traversal of elements and nodes, the degree of freedom numbers of the variables on the nodes where the Dirichlet boundary conditions are located are recorded and stored.
[0057] In step (5) above, when the global Jacobian matrix is set to zero and then to 1, according to the global degree of freedom index of the variable on the node where the Dirichlet boundary condition is located, the elements of the row and column corresponding to the index in the original Jacobian matrix are first set to zero, and then the calculated Jacobian element value of the Dirichlet boundary (value is 1) is assigned to the diagonal position of the row in the matrix.
[0058] Through the above steps, the residual vector and Jacobian matrix are processed into a special form, such that the degree of freedom values of the variables at the boundary condition nodes are directly equal to the specified boundary condition values, thereby ensuring the precise application of the boundary conditions.
[0059] Embodiments of the present invention also provide an apparatus for applying Dirichlet boundary conditions in finite element analysis, for performing the method for applying Dirichlet boundary conditions in finite element analysis as described in any of the preceding claims of the present invention, such as... Figure 3 As shown, it includes: The calculation interface module is used to set a unified operator discrete term calculation interface for equations with Dirichlet boundaries and non-Dirichlet boundaries; the operator discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface, and a stiffness matrix calculation interface. The unit identification module is used to traverse all computational units, identify the first computational unit without Dirichlet boundary conditions and the second computational unit that needs to be subject to Dirichlet boundary conditions, and store the degree of freedom numbers of the first and second computational units. The calculation interface module is also used to calculate the contributions of the operator discrete terms of Dirichlet boundary terms and non-Dirichlet boundary terms respectively through the operator discrete term calculation interface; the contribution of the operator discrete term includes the combination of residual and Jacobian matrix, or the combination of right-hand side term and stiffness matrix. The non-Dirichlet boundary condition term calculation module is used to assemble the contributions of the operator discrete terms of the non-Dirichlet boundary terms into the corresponding positions in the corresponding global vector and global matrix according to the first position index set. The Dirichlet boundary condition application module is used to assign the residual or right-hand side term of the Dirichlet boundary term to the corresponding position in the corresponding global vector according to the index position of the degree of freedom number of the second calculation unit, and fill the Jacobian matrix or stiffness matrix of the Dirichlet boundary term into the corresponding position in the corresponding global matrix based on the method of setting 0 to 1.
[0060] Furthermore, in the Dirichlet boundary application module, the Jacobian matrix of the Dirichlet boundary term is filled into the corresponding position of the corresponding global matrix based on the zero-to-one method, including: Set all elements in the row and column containing the index of the degree of freedom number of the second computational unit in the global Jacobian matrix to zero; assign the elements of the Jacobian matrix of the Dirichlet boundary term to the corresponding diagonal positions in the global Jacobian matrix; The stiffness matrix of the Dirichlet boundary term is filled into the corresponding position of the corresponding global matrix based on the zero-to-one method, including: setting all elements in the row and column where the index position of the degree of freedom number of the second calculation unit in the global stiffness matrix is located to zero; and assigning the elements of the stiffness matrix of the Dirichlet boundary term to the corresponding diagonal position in the global stiffness matrix.
[0061] Furthermore, the computation interface module calculates the contributions of the operator discrete terms for Dirichlet boundary terms and non-Dirichlet boundary terms based on the weak form of the equation.
[0062] Embodiments of the present invention also provide an electronic device, such as... Figure 4 As shown, the electronic device includes a processor 40 and a memory 41, and the number of processors 40 can be one or more. The memory 41, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules. The processor executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory, thereby implementing the method of applying Dirichlet boundary conditions in finite element analysis, or the finite element analysis method, as described in any of the above embodiments of the present invention.
[0063] The memory 41 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 41 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or other non-volatile solid-state storage device. In some instances, the memory 41 may further include memory remotely located relative to the processor, which can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0064] The electronic device also includes an input device 42 and an output device 43 for receiving and outputting data, enabling data interaction with other devices.
[0065] Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for applying Dirichlet boundary conditions in finite element analysis, or a finite element analysis method, according to any embodiment of the present invention.
[0066] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0067] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0068] Embodiments of the present invention also provide a computer program product that, when run on a computer, causes the computer to execute the method of applying Dirichlet boundary conditions in finite element analysis, or the finite element analysis method, as described in any of the above embodiments of the present invention.
[0069] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for applying Dirichlet boundary conditions in finite element analysis, characterized in that, include: A unified operator discrete term calculation interface is set up for equations with Dirichlet boundaries and non-Dirichlet boundaries; the operator discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface, and a stiffness matrix calculation interface; Traverse all computational units, identify the first computational unit without Dirichlet boundary conditions and the second computational unit that needs to be subject to Dirichlet boundary conditions, and store the degree of freedom numbers of the first and second computational units. The contribution of the operator discrete terms to the Dirichlet boundary terms and the non-Dirichlet boundary terms is calculated through the operator discrete term calculation interface; the contribution of the operator discrete terms includes the combination of the residual and the Jacobian matrix, or the combination of the right-hand side term and the stiffness matrix. Based on the index position of the degree of freedom number of the first computing unit, the contributions of the operator discrete terms of the non-Dirichlet boundary terms are assembled into the corresponding positions in the corresponding global vector and global matrix. Based on the index position of the degree of freedom number of the second calculation unit, the residual or right-hand term of the Dirichlet boundary term is assigned to the corresponding position in the corresponding global vector, and the Jacobian matrix or stiffness matrix of the Dirichlet boundary term is filled into the corresponding position in the corresponding global matrix based on the method of setting 0 to 1.
2. The method for applying Dirichlet boundary conditions in finite element analysis according to claim 1, characterized in that, The method further includes: directly setting the initial value of the degree of freedom iteration of the second computing unit as the Dirichlet boundary value.
3. The method for applying Dirichlet boundary conditions in finite element analysis according to claim 1, characterized in that, The Jacobian matrix or stiffness matrix of the Dirichlet boundary terms is filled into the corresponding positions in the corresponding global matrix based on the zero-to-one method, including: Set all elements in the row and column containing the index of the degree of freedom number of the second computational unit in the global Jacobian matrix or global stiffness matrix to zero; Assign the elements of the Jacobian matrix of the Dirichlet boundary terms to the corresponding diagonal positions in the global Jacobian matrix; or, The elements of the stiffness matrix of the Dirichlet boundary terms are assigned to the corresponding diagonal positions in the global stiffness matrix.
4. The method for applying Dirichlet boundary conditions in finite element analysis according to claim 1, characterized in that, Based on the index position of the degree of freedom number of the first computing unit, the contributions of the operator discrete terms of the non-Dirichlet boundary terms are assembled into the corresponding positions in the corresponding global vector and global matrix, including: Assemble the residuals of the non-Dirichlet boundary terms into the corresponding positions in the global residual vector, and assemble the Jacobian matrix of the non-Dirichlet boundary terms into the corresponding positions in the global Jacobian matrix; or... Assemble the right-hand side of the non-Dirichlet boundary term into the corresponding position in the global right-hand side term, and assemble the stiffness matrix of the non-Dirichlet boundary term into the corresponding position in the global stiffness matrix.
5. The method for applying Dirichlet boundary conditions in finite element analysis according to any one of claims 1-4, characterized in that, The computing unit includes a grid cell and a computing node. The first computing unit is a grid cell and / or computing node that does not require the application of Dirichlet boundary conditions, and the second computing unit is a computing node that requires the application of Dirichlet boundary conditions.
6. The method for applying Dirichlet boundary conditions in finite element analysis according to claim 1, characterized in that, The contributions of the operator discrete terms for both Dirichlet and non-Dirichlet boundary terms, calculated through the operator discrete term calculation interface, are based on the weak form of the equation.
7. A finite element analysis method, characterized in that, The finite element analysis method employs the method described in any one of claims 1-6 for applying Dirichlet boundary conditions in finite element analysis.
8. The finite element analysis method according to claim 7, characterized in that, When performing nonlinear iterative solutions, the initial values of the degrees of freedom of nodes with applied Dirichlet boundary conditions are set as Dirichlet boundary values.
9. A device for applying Dirichlet boundary conditions in finite element analysis, characterized in that, include: The calculation interface module is used to set a unified operator discrete term calculation interface for equations with Dirichlet boundaries and non-Dirichlet boundaries; the operator discrete term calculation interface includes a residual calculation interface, a right-hand side term calculation interface, a Jacobian matrix calculation interface, and a stiffness matrix calculation interface. The unit identification module is used to traverse all computational units, identify the first computational unit without Dirichlet boundary conditions and the second computational unit that needs to be subject to Dirichlet boundary conditions, and store the degree of freedom numbers of the first and second computational units. The calculation interface module is also used to calculate the contributions of the operator discrete terms of Dirichlet boundary terms and non-Dirichlet boundary terms respectively through the operator discrete term calculation interface; the contribution of the operator discrete term includes the combination of residual and Jacobian matrix, or the combination of right-hand side term and stiffness matrix. The non-Dirichlet boundary condition term calculation module is used to assemble the contributions of the operator discrete terms of the non-Dirichlet boundary terms into the corresponding positions in the corresponding global vector and global matrix according to the first position index set. The Dirichlet boundary condition application module is used to assign the residual or right-hand side term of the Dirichlet boundary term to the corresponding position in the corresponding global vector according to the index position of the degree of freedom number of the second calculation unit, and fill the Jacobian matrix or stiffness matrix of the Dirichlet boundary term into the corresponding position in the corresponding global matrix based on the method of setting 0 to 1.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for applying Dirichlet boundary conditions in finite element analysis as described in any one of claims 1-6, or the finite element analysis method as described in any one of claims 7-8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method for applying Dirichlet boundary conditions in finite element analysis as described in any one of claims 1-6, or the finite element analysis method as described in any one of claims 7-8.
12. A computer program product comprising a computer program / instructions, characterized in that, When executed by a processor, the computer program / instruction implements the method for applying Dirichlet boundary conditions in finite element analysis as described in any one of claims 1-6, or the finite element analysis method as described in any one of claims 7-8.