Partial differential equation set solving method and system based on coupling matrix and medium
By dividing the Jacobian matrix into blocks and using the coupling matrix to describe the coupling relationship, the problems of poor code scalability and high memory consumption in multiphysics coupling problems in traditional methods are solved. Modular development and efficient memory utilization are achieved, simplifying the development process and improving computational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NUCLEAR POWER INSTITUTE OF CHINA
- Filing Date
- 2026-03-04
- Publication Date
- 2026-05-19
AI Technical Summary
Traditional methods suffer from poor code scalability, high development difficulty, and high memory consumption in multiphysics coupling problems, resulting in long development cycles, low code reusability, and low computational efficiency.
By dividing the global and local Jacobian matrices into multiple sub-matrix blocks and using coupling matrices to describe the coupling relationships between physical fields, the computational program is configured independently for solving the problem. Storage space is allocated only to the sub-matrix blocks with coupling relationships, achieving modular development and efficient memory utilization.
It achieves high cohesion and low coupling in the physics module, simplifies code development and maintenance, reduces memory usage, improves computational efficiency and flexibility, and supports rapid expansion and reuse of different coupling methods.
Smart Images

Figure CN122064904A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of numerical calculation technology for nuclear reactors, specifically to a method, system, and medium for solving partial differential equations based on coupling matrices. Background Technology
[0002] Multiphysics coupling problems are widespread in key engineering and research fields such as energy, aerospace, biomedicine, and materials science. Their mathematical models typically represent a set of interrelated nonlinear partial differential equations. Traditionally, numerical solutions to such problems mainly employ fully coupled or iteratively coupled strategies based on Newton-Raphson iterations. In the fully coupled strategy, the governing equations of multiple physics fields and their coupling relationships need to be discretized and assembled into a unified global nonlinear equation system for solution. One of the core steps is to construct and solve the linear system corresponding to the global Jacobian matrix in each nonlinear iteration.
[0003] However, existing technologies have significant shortcomings in practical applications, mainly in the following three aspects:
[0004] First, at the code development and maintenance level, traditional architectures suffer from poor scalability and low reusability. When a new physics field is added or a new coupling mechanism is introduced, the variables and equations of each physics field are intertwined, requiring developers to deeply modify or even rewrite the assembly logic of the global Jacobian matrix. This not only requires a deep understanding of numerical methods and program structure, but also leads to highly customized and low-modular code. Changes in different combinations of physics fields or coupling forms often mean a large amount of repetitive development and debugging work, causing the development cycle to increase sharply with the complexity of the problem, which seriously hinders rapid prototyping and the exploration of complex coupling models.
[0005] Secondly, the development of a fully coupled solver presents an extremely high barrier to entry in terms of program implementation complexity. Building an efficient fully coupled program requires developers to be proficient in mathematical models from multiple physical domains, discrete methods such as finite element / finite volume methods, nonlinear iterative strategies, and large-scale sparse linear algebra solution techniques. The traditional "monolithic" programming architecture tightly couples the computational logic of different physical fields, resulting in a complex code structure and making debugging difficult.
[0006] Finally, in terms of computational resource utilization efficiency, traditional methods are particularly memory-intensive. While the global Jacobian matrix of multiphysics coupling problems exhibits high sparsity, traditional implementations typically rely on pre-allocating storage space for the complete global matrix (even with a sparse format) or dynamically assembling the complete matrix structure in each iteration. As the number of physics increases, the mesh size expands, and coupling nonlocality strengthens, the matrix dimension and sparsity pattern can change drastically, leading to a rapid increase in memory consumption. This not only reduces computational efficiency but also limits the ability to solve large-scale practical problems in resource-constrained environments (such as ordinary workstations or small to medium-sized clusters).
[0007] Therefore, there is an urgent need in this field for a solution method and software architecture that can achieve high cohesion and low coupling of physics modules, support flexible and pluggable combinations and coupling methods of physics, improve code reusability, shorten development cycle, and effectively utilize the sparse properties of matrices to significantly reduce memory overhead, thereby providing a solution for the research and engineering application of complex multiphysics coupling problems. Summary of the Invention
[0008] To address the problems existing in the prior art, the purpose of this invention is to provide a method, system, and medium for solving partial differential equations based on coupling matrices. This technical objective is achieved through the following technical solutions:
[0009] This solution provides a method for solving partial differential equations based on coupling matrices, including:
[0010] Obtain the physical field variables to be determined for the current grid cell and the number of degrees of freedom for each physical field variable;
[0011] Based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable, the global Jacobian matrix and local Jacobian matrix of the current grid cell are divided into multiple sub-matrix blocks respectively;
[0012] A coupling matrix is constructed based on the coupling relationship between the physical field variables to be determined, and memory is allocated to each sub-matrix block according to the coupling matrix;
[0013] Traverse all grid cells, configure independent computation programs for submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
[0014] A further optimization scheme involves dividing the global and local Jacobian matrices of the current grid cell into multiple sub-matrix blocks based on the physical field variables to be determined and their degrees of freedom; including the following methods:
[0015] Obtain the number n of the physical field variables to be determined in the current grid cell.var and the number of degrees of freedom for each physical field variable to be determined, wherein the number of degrees of freedom for the i-th physical field variable to be determined is ;
[0016] Divide the global Jacobian matrix or the local Jacobian matrix into n var ×n var There are submatrix blocks, where submatrix block J ij This represents the derivative of the residual corresponding to the physical field variable i and the degree of freedom corresponding to the physical field variable j.
[0017] A further optimized solution involves constructing a coupling matrix based on the coupling relationship between the physical field variables to be determined, including the following method:
[0018] Construct a coupling matrix C with the same dimensions as the submatrix block, where the elements of the coupling matrix C are C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11 ij This represents the coupling relationship between the i-th and j-th physical field variables to be determined; if there is a coupling relationship between the i-th and j-th physical field variables to be determined, then element C... ij Assign a value of 1, otherwise, element C ij The value is assigned to 0; if there is no coupling relationship between all the physical field variables to be determined, then the coupling matrix C is the identity matrix.
[0019] A further optimization scheme is that the method for determining the coupling relationship includes: determining the coupling relationship between each physical field variable to be determined according to a preset physical mechanism, or determining it during the process of solving the degree of freedom of the i-th physical field variable to be determined: if the j-th physical field variable to be determined contributes to the corresponding Jacobian and residual, then it is determined that there is a coupling relationship between the i-th physical field variable to be determined and the j-th physical field variable to be determined.
[0020] A further optimization scheme involves allocating memory for each sub-matrix block based on the coupling matrix, including the following method:
[0021] Memory is allocated to each submatrix block according to the following rules:
[0022] For submatrix block J ij If in the coupling matrix C, the corresponding element C ij =1, then it is a submatrix block J ij Allocate storage space if element C ij =0, then it is not a submatrix block J ij Allocate storage space.
[0023] A further optimization scheme involves configuring independent computation programs for the submatrix blocks of the local Jacobian matrix, performing independent solution calculations; including the following methods:
[0024] Configure one or more computation programs for the sub-matrix block based on the physical field variables to be determined, which are used to calculate the derivatives between coupled physical field variables and the derivatives of the physical field variables with respect to their own degrees of freedom.
[0025] A further optimization scheme involves assembling all independently solved calculation results into a global Jacobian matrix, including the following methods:
[0026] Extract the computed element values from the submatrix blocks of the local Jacobian matrix, and based on the pre-established numbering mapping relationship between the local and global Jacobian matrices, accumulate the computed element values to the corresponding positions in the global Jacobian matrix.
[0027] This solution also provides a partial differential equation system based on coupling matrices for implementing the aforementioned method for solving partial differential equation systems based on coupling matrices. The system includes:
[0028] The acquisition module is used to obtain the physical field variables to be determined in the current grid cell and the number of degrees of freedom of each physical field variable to be determined;
[0029] The partitioning module is used to divide the global Jacobian matrix and local Jacobian matrix of the current grid cell into multiple sub-matrix blocks based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable to be determined;
[0030] The allocation module is used to construct a coupling matrix based on the coupling relationship between the physical field variables to be determined, and to allocate memory for each sub-matrix block according to the coupling matrix;
[0031] The calculation module is used to traverse all grid cells, configure independent calculation programs for submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
[0032] The further optimized solution also includes multiple memory interfaces and multiple computing interfaces;
[0033] The number of memory interfaces and computing interfaces is greater than the number of physical field variables to be determined.
[0034] This solution also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, can implement the method for solving partial differential equations based on coupling matrices as described above.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] 1. This invention provides a method, system, and medium for solving partial differential equations based on coupling matrices. By dividing the global and local Jacobian matrices into explicit sub-matrix blocks according to physical field variables and their degrees of freedom, and by explicitly describing the interaction relationships between physical fields using coupling matrices, modular decomposition of computational logic is achieved. The computational program for each sub-matrix block can be independently configured and developed, corresponding to the self-interaction of a specific physical field or its coupling with other fields. When a new physical field is added, the developer only needs to focus on the computational program of the sub-matrix block of that physical field and define its interaction relationship with other fields by updating the coupling matrix to achieve functional expansion, without touching or reconstructing the assembly logic and code of other existing physical fields. This reduces the coupling degree between codes, enabling the computational modules of different physical fields to be combined and reused, shortening the development cycle, and lowering the technical threshold for developing and maintaining a fully coupled solver.
[0037] 2. This invention provides a method, system, and medium for solving partial differential equations based on coupling matrices. The coupling matrix characterizes the actual coupling relationships between physical fields at the element level. For sub-matrix blocks marked as uncoupled in the coupling matrix, no storage space needs to be allocated. This on-demand allocation strategy, compared to the traditional method of pre-allocating or fully allocating memory for the global matrix, can maximize the inherent high sparsity of the multi-physics Jacobian matrix. Especially as the number of coupled physical fields increases, this scheme avoids storing a large number of always-zero block structures, allowing for flexible increases in the number of coupled equations without completely rewriting the code. It avoids the calculation and memory allocation of zero-element sub-matrix blocks, thereby greatly reducing the memory footprint during program execution. This enables the solution of larger-scale, more complex, and more coupled practical problems under the same hardware resources.
[0038] 3. This invention provides a method, system, and medium for solving partial differential equation systems based on coupling matrices. By configuring independent computation programs for sub-matrix blocks of the local Jacobian matrix for independent solution calculations, the assembly process of the entire Jacobian matrix becomes logically clear and structurally well-organized. The computational task is decomposed into multiple well-defined independent units, which not only facilitates the parallel execution of computations of different sub-matrix blocks but also improves code readability and debuggability. During development, experts from different fields can focus on the computation modules of their respective physical fields-related sub-matrix blocks and integrate them through standard interfaces, effectively promoting collaboration and reducing the overall technical risk of the project. At the same time, the independent sub-matrix block computation programs facilitate algorithm optimization for specific physical fields or coupling terms. Furthermore, the independent architecture allows the program to more flexibly adapt to different types of coupling problems, such as strong coupling, weak coupling, and unidirectional coupling. The solution strategy can be changed simply by adjusting the definition of the coupling matrix without rewriting the core assembly loop, enhancing the solver's versatility and adaptability. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be considered as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:
[0040] Figure 1 This is a schematic diagram of the process for solving a system of partial differential equations based on a coupling matrix.
[0041] Figure 2 This is a diagram illustrating the memory allocation process.
[0042] Figure 3 This is a schematic diagram of the system structure for solving a system of partial differential equations based on a coupling matrix. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0044] Traditional partial differential equation solving methods require reconstructing the assembly logic of the entire Jacobian matrix for each new physics field in multi-physics coupled problems. This results in low code reusability and long development cycles. In particular, the development difficulty of traditional programming architectures increases significantly when developing fully coupled programs. Furthermore, in multi-physics coupled scenarios, the global Jacobian matrix is usually highly sparsity, and traditional methods need to allocate memory for the global matrix, leading to excessive program memory consumption.
[0045] Numerical calculations for nuclear reactors involve multiple disciplines, including neutron physics, thermal engineering, fuel science, and structural mechanics. Traditional partial differential equation solvers typically require explicit derivation of analytical expressions for element stiffness matrices or local Jacobian matrices based on the weak or discrete forms of the equations, and then hard-coding these expressions into the program. During global matrix assembly, each element or degree of freedom needs to be traversed to accumulate specified element values. This method is tightly coupled with specific equations, resulting in insufficient flexibility during coding. In multiphysics coupling problems, the assembly logic of the entire Jacobian matrix needs to be reconstructed for each new physics, leading to low code reusability and long development cycles. The development difficulty of traditional programming architectures increases significantly, especially when developing fully coupled programs. Furthermore, in multiphysics coupling scenarios, the global Jacobian matrix often exhibits high sparsity. This sparsity exists not only at the element level but also at the block level. That is, many sub-blocks (e.g., the derivatives of the equations of one physics A with respect to the variables of another physics B) may be entirely zero blocks. Traditional methods, without dividing the matrix into blocks, require allocating memory for the global matrix, resulting in excessive program memory usage.
[0046] In view of this, the present solution provides the following embodiments to solve the above-mentioned technical problems:
[0047] Example 1
[0048] This embodiment provides a method for solving a system of partial differential equations based on a coupling matrix, such as... Figure 1 As shown, the method includes:
[0049] Step 1: Obtain the physical field variables to be determined for the current grid cell and the number of degrees of freedom for each physical field variable;
[0050] Step two: Based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable, divide the global Jacobian matrix and local Jacobian matrix of the current grid cell into multiple sub-matrix blocks; this step specifically includes the following methods:
[0051] S21, Obtain the number n of the physical field variables to be determined in the current mesh element. var and the number of degrees of freedom for each physical field variable to be determined, wherein the number of degrees of freedom for the i-th physical field variable to be determined is ;
[0052] S22, divide the global Jacobian matrix or the local Jacobian matrix into n var ×n var There are submatrix blocks, where submatrix block J ij This represents the derivative of the residual corresponding to the physical field variable i and the degree of freedom corresponding to the physical field variable j.
[0053] Each sub-matrix block corresponds precisely to the residual R of a specific principal physical field variable i.i The degree of freedom u of the other physical field variable j to be determined j The derivative contribution, i.e. Here, the physical field variable j to be solved can be the principal physical field variable i itself or other physical field variables coupled with the principal physical field variable i. The principal physical field variable here refers to the variable corresponding to the equation being solved.
[0054] Step 3: Construct a coupling matrix based on the coupling relationship between the physical field variables to be determined, and allocate memory for each sub-matrix block according to the coupling matrix;
[0055] In step three, the construction of the coupling matrix based on the coupling relationship between the physical field variables to be determined includes the following methods:
[0056] Construct a coupling matrix C with the same dimensions as the submatrix block, where the elements of the coupling matrix C are C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11 ij This represents the coupling relationship between the i-th and j-th physical field variables to be determined; if there is a coupling relationship between the i-th and j-th physical field variables to be determined, then element C... ij Assign a value of 1, otherwise, element C ij The value is assigned to 0; if there is no coupling relationship between all the physical field variables to be determined, then the coupling matrix C is the identity matrix.
[0057] Specifically, if the number of physical field variables to be solved is 3, namely u1, u2, and u3; and it is assumed that during the solution process, physical field variables u1 and u2 are coupled, physical field variables u2 are coupled with physical field variables u1 and u3, and physical field variables u3 are coupled with physical field variables u2, then the constructed coupling matrix C is:
[0058] .
[0059] The method for determining the coupling relationship includes: determining the coupling relationship between each physical field variable to be determined according to a preset physical mechanism, or determining it during the process of solving the degree of freedom of the i-th physical field variable to be determined: if the j-th physical field variable to be determined contributes to the corresponding Jacobian and residual, then it is determined that there is a coupling relationship between the i-th physical field variable to be determined and the j-th physical field variable to be determined. Figure 2 It provides information on how the coupling matrix controls the memory allocation and computation of the Jacobian matrix.
[0060] In step three, memory is allocated to each sub-matrix block according to the coupling matrix, including the following method:
[0061] Memory is allocated to each submatrix block according to the following rules:
[0062] For submatrix block J ij If in the coupling matrix C, the corresponding element C ij =1, then it is a submatrix block J ij Allocate storage space if element C ij =0, then it is not a submatrix block J ij Allocate storage space.
[0063] Considering the block-level sparsity of the global Jacobian matrix in multiphysics coupling problems, for physically uncoupled variable pairs in the problem, if the element corresponding to the sub-matrix block is determined to be zero based on the coupling matrix, then there is no need to allocate memory for the sub-matrix block; by storing only the actual non-zero sub-matrix blocks, memory consumption can be significantly reduced.
[0064] For the local Jacobian matrix corresponding to the current mesh cell, it is divided into Submatrix blocks, where submatrix blocks The dimension is If the coupling matrix is related to the submatrix block Corresponding elements Then it is a submatrix block. Pre-allocate storage space; if the coupling matrix is related to the submatrix block Corresponding elements If the value is zero, it indicates that there is no coupling relationship between the i-th physical field variable and the j-th physical field variable. The corresponding sub-matrix block does not need to be calculated (all values are 0), nor does it need to be pre-allocated storage space.
[0065] The memory allocation interface based on coupling is responsible for allocating the corresponding memory for the Jacobian matrix to be calculated, including allocating the corresponding memory for the global Jacobian matrix sub-blocks and each local Jacobian matrix sub-block. The memory allocation of the sub-blocks of the global Jacobian matrix is similar to that of the sub-blocks of the local Jacobian matrix, except that its dimension is related to the degrees of freedom of each physical field variable to be calculated.
[0066] Step 4: Traverse all grid cells, configure independent calculation programs for the submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
[0067] In step four, configuring independent computation programs for the submatrix blocks of the local Jacobian matrix for independent solution calculation includes the following methods:
[0068] Configure one or more computation programs for the sub-matrix block based on the physical field variables to be determined, which are used to calculate the derivatives between coupled physical field variables and the derivatives of the physical field variables with respect to their own degrees of freedom.
[0069] In step four, the method of assembling all independent solution calculation results into the global Jacobian matrix includes:
[0070] Extract the calculated element values in the sub-matrix block of the local Jacobian matrix, and accumulate the calculated element values to the corresponding positions in the global Jacobian matrix according to the pre-established numbering mapping relationship between the local Jacobian matrix and the global Jacobian matrix.
[0071] According to the variable coupling relationship described by the coupling matrix, traverse all grid cells in the solution domain, calculate the corresponding local Jacobian matrix and assemble it into the global Jacobian matrix.
[0072] This solution predefines independent program calculation interfaces (usually implemented in the form of rewritable virtual functions) for each possible sub-block of the local Jacobian matrix; developers only need to focus on implementing the specific calculation logic in these interfaces, that is, for the specific variable pairs involved in the physical module they are responsible for, write the core calculation code for calculating all matrix element values within this sub-block. This is the key to the modular development of multi-physics coupling in this solution: developers of each physical field module (such as neutron physics, thermal engineering, structural mechanics, etc.) only need to be responsible for implementing the main variable residuals corresponding to their own equations and the calculation of the Jacobian matrix of the variables involved, without having to concern about the calculations related to variables not involved. After the developer writes the corresponding calculation code for the Jacobian matrix sub-block, the program calculates each Jacobian matrix block according to the variable coupling relationship described by the coupling matrix during the calculation. During the calculation, only when the element C ij = 1 of the coupling matrix, that is, there is a coupling relationship between two variables, the corresponding Jacobian matrix block J ij needs to be calculated.
[0073] Through the variable coupling relationship defined by the coupling matrix and the architecture design of the block Jacobian matrix, this solution can arbitrarily combine or add physical field modules (that is, increase the number of new coupling equations) without having to completely rewrite the underlying Jacobian matrix assembly logic. Each new module only needs to declare its coupling dependency relationship (by setting the coupling matrix) and implement the corresponding calculation code for the Jacobian matrix sub-block. The underlying layer of this solution is responsible for extracting the element values in each independently calculated local Jacobian matrix sub-block and accurately accumulating (assembling) them to the corresponding positions in the global Jacobian matrix according to the pre-established global degree of freedom numbering mapping relationship, without the need for additional implementation by the user. The corresponding pseudo-code example is as follows:
[0074] for (auto& cell: mesh){ / / Traverse all cells within the solution domain mesh
[0075] for (int i=0; i<nvar; ++i){ / / Traverse the main variables [[ID=...]]
[0076] for (int j = 0; j < nvar; ++j) { / / Traverse coupled variables
[0077] if (coupling_matrix[i][j] != 0) { / / Skip zero blocks according to the coupling matrix
[0078] physics_modules[i]->compute_local_jacobian_block(i, j, cell_jac); / / Function to calculate the local Jacobian matrix block (to be implemented by the user developer)
[0079] assemble_global_jacobian_block(i, j, cell_jac); / / Assemble the local Jacobian matrix into the global Jacobian matrix (implemented by the underlying layer of this solution, no additional implementation required by the user)
[0080] }
[0081] }
[0082] }
[0083] }。
[0084] Based on the physical variables to be solved and the coupling matrix, this embodiment divides the global Jacobian matrix and the local Jacobian matrix into multiple sub - matrix blocks, and provides independent memory allocation and program calculation interfaces for each sub - matrix block. The developer only needs to implement the local residual and the calculation of the local Jacobian matrix of the equations they are responsible for, and the assembly of the local residual and Jacobian matrix into the global residual and Jacobian matrix is automatically implemented by the underlying layer of this solution. Among them, the local Jacobian matrix refers to the local Jacobian matrix on a certain unit in numerical calculation, and the global Jacobian matrix refers to the overall global Jacobian matrix formed by the full - coupling and simultaneous solution of each equation.
[0085] In this way, the user does not need to pay attention to the structure of the global equations, and only needs to consider the local physical quantities they are concerned about and the variables directly dependent on them, thus simplifying the addition, removal, or replacement of each professional physical module.
[0086] Embodiment 2
[0087] This embodiment provides a system for solving partial differential equations based on a coupling matrix, as Figure 3 shown, for implementing the method for solving partial differential equations based on a coupling matrix described in Embodiment 1. The system includes:
[0088] An acquisition module, used to obtain the physical field variables to be solved in the current grid cell and the number of degrees of freedom of each physical field variable to be solved;
[0089] The partitioning module is used to divide the global Jacobian matrix and local Jacobian matrix of the current grid cell into multiple sub-matrix blocks based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable to be determined;
[0090] The allocation module is used to construct a coupling matrix based on the coupling relationship between the physical field variables to be determined, and to allocate memory for each sub-matrix block according to the coupling matrix;
[0091] The calculation module is used to traverse all grid cells, configure independent calculation programs for submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
[0092] The system also includes multiple memory interfaces and multiple computing interfaces;
[0093] The number of memory interfaces and computing interfaces is greater than the number of physical field variables to be determined.
[0094] Example 3
[0095] This embodiment provides a computer-readable medium storing a computer program, which, when executed by a processor, can implement the method for solving partial differential equations based on coupling matrices as described in Embodiment 1; specifically, the following steps are performed:
[0096] Step 1: Obtain the physical field variables to be determined for the current grid cell and the number of degrees of freedom for each physical field variable;
[0097] Step 2: Based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable to be determined, divide the global Jacobian matrix and local Jacobian matrix of the current grid cell into multiple sub-matrix blocks respectively;
[0098] Step 3: Construct a coupling matrix based on the coupling relationship between the physical field variables to be determined, and allocate memory for each sub-matrix block according to the coupling matrix;
[0099] Step 4: Traverse all grid cells, configure independent calculation programs for the submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
[0100] Example 4
[0101] This embodiment takes the nuclear-thermal-mechanical multi-field coupling problem as an example for development and expansion.
[0102] Consider a typical multiphysics coupling problem in nuclear reactor engineering: a system involving the interaction of neutron physics (neutron flux field v), thermal hydraulics (temperature field T), and solid mechanics (displacement field u). This problem can be decomposed into three independent physical field modules for development.
[0103] Neutron Physics Module: Responsible for solving the neutron transport equations, with the main physical field variable to be solved being the neutron flux v;
[0104] Thermal Engineering Module: Responsible for thermal calculations, with temperature T as the main physical field variable to be determined;
[0105] Solid Mechanics module: responsible for calculating structural deformation equations, with displacement u as the main physical field variable to be determined.
[0106] The specific development process is as follows:
[0107] For problem T1, the number of variables to be solved is 3. The Jacobian matrix can be divided into 3×3 sub-matrix blocks, as follows:
[0108] ;
[0109] T2, based on the physical mechanism, declares the coupling relationship between variables, and constructs the coupling matrix as follows: That is, v is coupled with v, T, and u; T is coupled with v and T; u is coupled with T and u; that is, the neutron flux v is coupled with temperature T and displacement u, temperature T depends on neutron flux v, and displacement u depends on temperature T.
[0110] T3 dynamically allocates memory for Jacobian matrix sub-blocks based on the non-zero elements of the coupling matrix:
[0111] For J vv J vT J vu (Neutron Physics Module) Allocate memory;
[0112] For J Tv J TT (Thermal module) Allocate memory;
[0113] For J uT J uu Allocate memory for (Solid Mechanics module);
[0114] Skip J Tu and J uv Storage allocation (marked as 0 in the coupling matrix).
[0115] T4, Jacobian Matrix Sub-block Interface Implementation: Each module developer independently implements the sub-block calculation interface they are responsible for.
[0116] Neutron physics module developer implementation:
[0117] Calculate (∂Rv / ∂v1): the derivative of the neutron flux residual Rv with respect to its own degree of freedom v1.
[0118] Calculate (∂Rv / ∂T): the derivative of the neutron flux residual Rv with respect to temperature T.
[0119] Calculate (∂Rv / ∂u): the derivative of the neutron flux residual Rv with respect to the displacement u.
[0120] Thermal module developer implementation:
[0121] Calculate (∂RT / ∂T1): the derivative of the temperature residual RT with respect to its own degree of freedom T1.
[0122] Calculate (∂RT / ∂v): the derivative of the temperature residual RT with respect to the neutron flux v.
[0123] Solid mechanics developers implemented:
[0124] Calculate (∂Ru / ∂T): the derivative of the displacement residual Ru with respect to temperature T.
[0125] Calculate (∂Ru / ∂u1): the derivative of the displacement residual Ru with respect to its own degree of freedom u1.
[0126] T5, Solution: During the solution process, all mesh elements are traversed. For each mesh element, based on the non-zero terms in the coupling matrix, the corresponding Jacobian matrix sub-block calculation interface is called. Then, the calculation results of each sub-block are automatically extracted and assembled into the corresponding positions of the global Jacobian matrix according to the global degree of freedom number mapping. Finally, based on the assembled global Jacobian matrix and residual vector, the equation is solved.
[0127] T6, flexible expansion of the presentation
[0128] Further expansion of requirements necessitates the addition of the electrostatic field Φ and its coupling with the temperature field. In this case, the number of physical field variables to be determined becomes 4, and the Jacobian matrix will transform into a 4×4 submatrix block.
[0129] ;
[0130] Considering the coupling between the electrostatic field and the temperature field, the coupling matrix is updated as follows:
[0131] ;
[0132] The updated coupling matrix contains the new physical field variables to be determined and their coupling relationships.
[0133] At this point, an electromagnetic field module needs to be added to achieve...
[0134] Calculate (∂RΦ / ∂Φ1), the derivative of the electrostatic residual RΦ with respect to its own degree of freedom Φ1.
[0135] Calculate (∂RΦ / ∂T), the derivative of the electrostatic residual RΦ with respect to temperature T.
[0136] And add to the original heat transfer module
[0137] Calculate (∂RT / ∂Φ), the derivative of the temperature residual RT with respect to the electrostatic field Φ.
[0138] As can be seen, after adding the coupled physical field, the code and sub-block implementation logic of the original neutron physics, thermal engineering, and solid mechanics modules have not been significantly modified; only the relevant code of the new module needs to be implemented.
[0139] 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 solving a system of partial differential equations based on a coupling matrix, characterized in that, The methods include: Obtain the physical field variables to be determined for the current grid cell and the number of degrees of freedom for each physical field variable; Based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable, the global Jacobian matrix and local Jacobian matrix of the current grid cell are divided into multiple sub-matrix blocks respectively; A coupling matrix is constructed based on the coupling relationship between the physical field variables to be determined, and memory is allocated to each sub-matrix block according to the coupling matrix; Traverse all grid cells, configure independent computation programs for submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
2. The method for solving partial differential equations based on coupling matrices according to claim 1, characterized in that, Based on the physical field variables to be determined and the degrees of freedom of each physical field variable, the global Jacobian matrix and local Jacobian matrix of the current grid cell are divided into multiple sub-matrix blocks; including method: Obtain the number n of the physical field variables to be determined in the current grid cell. var and the number of degrees of freedom for each physical field variable to be determined, wherein the number of degrees of freedom for the i-th physical field variable to be determined is ; Divide the global Jacobian matrix or the local Jacobian matrix into n var ×n var There are submatrix blocks, where submatrix block J ij This represents the derivative of the residual corresponding to the physical field variable i to be determined with respect to the degree of freedom corresponding to the physical field variable j to be determined.
3. The method for solving partial differential equations based on coupling matrices according to claim 2, characterized in that, The method for constructing the coupling matrix based on the coupling relationship between the physical field variables to be determined includes: Construct a coupling matrix C with the same dimensions as the submatrix block, where the elements of the coupling matrix C are C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11 ij This represents the coupling relationship between the i-th and j-th physical field variables to be determined; if there is a coupling relationship between the i-th and j-th physical field variables to be determined, then element C... ij Assign a value of 1, otherwise, element C ij The value is assigned to 0; if there is no coupling relationship between all the physical field variables to be determined, then the coupling matrix C is the identity matrix.
4. The method for solving partial differential equations based on coupling matrices according to claim 3, characterized in that, The method for determining the coupling relationship includes: determining the coupling relationship between each physical field variable to be determined according to a preset physical mechanism, or determining it during the process of solving the degree of freedom of the i-th physical field variable to be determined: if the j-th physical field variable to be determined contributes to the corresponding Jacobian and residual, then it is determined that there is a coupling relationship between the i-th physical field variable to be determined and the j-th physical field variable to be determined.
5. The method for solving partial differential equations based on coupling matrices according to claim 3, characterized in that, Allocating memory for each sub-matrix block based on the coupling matrix includes the following methods: Memory is allocated to each submatrix block according to the following rules: For submatrix block J ij If in the coupling matrix C, the corresponding element C ij =1, then it is a submatrix block J ij Allocate storage space if element C ij =0, then it is not a submatrix block J ij Allocate storage space.
6. The method for solving partial differential equations based on coupling matrices according to claim 3, characterized in that, The submatrix blocks of the local Jacobian matrix are configured with independent calculation programs for independent solution calculation; Including methods: Configure one or more computation programs for the sub-matrix block based on the physical field variables to be determined, which are used to calculate the derivatives between coupled physical field variables and the derivatives of the physical field variables with respect to their own degrees of freedom.
7. The method for solving partial differential equations based on coupling matrices according to claim 1, characterized in that, The method for assembling all independently solved results into a global Jacobian matrix includes: Extract the computed element values from the submatrix blocks of the local Jacobian matrix, and based on the pre-established numbering mapping relationship between the local and global Jacobian matrices, accumulate the computed element values to the corresponding positions in the global Jacobian matrix.
8. A system for solving partial differential equations based on a coupling matrix, characterized in that, The system is used to implement the method for solving partial differential equations based on coupling matrices as described in any one of claims 1-7, the system comprising: The acquisition module is used to obtain the physical field variables to be determined in the current grid cell and the number of degrees of freedom of each physical field variable to be determined; The partitioning module is used to divide the global Jacobian matrix and local Jacobian matrix of the current grid cell into multiple sub-matrix blocks based on the physical field variables to be determined and the number of degrees of freedom of each physical field variable to be determined; The allocation module is used to construct a coupling matrix based on the coupling relationship between the physical field variables to be determined, and to allocate memory for each sub-matrix block according to the coupling matrix; The calculation module is used to traverse all grid cells, configure independent calculation programs for submatrix blocks of the local Jacobian matrix to perform independent calculations, and assemble all independent calculation results into the global Jacobian matrix.
9. The partial differential equation solving system based on coupling matrix according to claim 8, characterized in that, It also includes multiple memory interfaces and multiple computing interfaces; The number of memory interfaces and computing interfaces is greater than the number of physical field variables to be determined.
10. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, can implement the method for solving partial differential equations based on coupling matrices as described in any one of claims 1-7.