CN111008497B - Method for generating finite element total stiffness matrix and terminal - Google Patents

Method for generating finite element total stiffness matrix and terminal Download PDF

Info

Publication number
CN111008497B
CN111008497B CN201911238615.7A CN201911238615A CN111008497B CN 111008497 B CN111008497 B CN 111008497B CN 201911238615 A CN201911238615 A CN 201911238615A CN 111008497 B CN111008497 B CN 111008497B
Authority
CN
China
Prior art keywords
array
finite element
stiffness matrix
total stiffness
elements
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911238615.7A
Other languages
Chinese (zh)
Other versions
CN111008497A (en
Inventor
扈喆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jimei University
Original Assignee
Jimei University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jimei University filed Critical Jimei University
Priority to CN201911238615.7A priority Critical patent/CN111008497B/en
Publication of CN111008497A publication Critical patent/CN111008497A/en
Application granted granted Critical
Publication of CN111008497B publication Critical patent/CN111008497B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method and a terminal for generating a finite element total stiffness matrix, which are characterized in that four storage spaces are opened up, four arrays are used for storing non-zero elements of the finite element total stiffness matrix respectively, the non-zero elements are stored to a first array in any sequence, a second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, a third array stores the position of the non-zero element in each row of the initial finite element total stiffness matrix, a fourth array correspondingly stores the position of the next non-zero element in the first array in the same row as each element in the first array, and the searching is performed in rows, so that the searching operand is greatly reduced, the random storage is performed, when the elements are added or deleted in the finite element total stiffness matrix, the adjustment or the movement of other elements is not needed, the operand is greatly reduced, and the operation complexity is qualitatively changed compared with a coordinate method and a triple method.

Description

Method for generating finite element total stiffness matrix and terminal
Technical Field
The invention relates to the field of data processing, in particular to a method and a terminal for generating a finite element total stiffness matrix.
Background
The finite element method is the most widely applied engineering numerical analysis method at present, and engineering calculation software based on the finite element method, such as ANSYS, ABAQUS and the like, is widely applied. The finite element method splits a continuous structure into a set of discrete polygons (cells), and the physical quantities inside the polygons can be represented by the physical quantities at the corners (nodes) of the polygons. Fig. 1 shows an example of cell division and node numbering for a rectangular plate.
For any unit, the node displacement and the node load have a certain relationship, and taking the unit No. 3 in fig. 1 as an example, the above relationship can be written as formula (1):
Figure BDA0002305555370000011
wherein x is 3 、x 14 K at the left end of the equation, which is the node displacement of the unit component node i,j The coefficient matrix is called a unit stiffness matrix of the No. 3 unit, and the right end of the equation is node load.
After the unit stiffness matrixes of all the units are obtained, the unit stiffness matrixes of all the units are assembled into a total stiffness matrix according to the node number positions, and finally, a total stiffness matrix equation is solved to complete calculation. Equation (2) gives the overall stiffness matrix equation of the example of fig. 1.
Figure BDA0002305555370000012
Wherein x is 1 ~x 23 Node displacement for all nodes, f 1 ~f 23 Node load for all nodes. K at the left end of the equation i,j The coefficient matrix is referred to as the total stiffness matrix.
In the finite element method, the unit stiffness matrix is obtained by a numerical integration method in the unit, and the generation of the total stiffness matrix is obtained by splicing and combining the unit stiffness matrices. For a certain unit, the splicing method of the unit rigidity matrix comprises the following steps: coefficient k of unit stiffness matrix i,j To the corresponding position of the overall stiffness matrix.
Still taking the unit No. 3 in fig. 1 as an example, the splicing method of the unit stiffness matrix is as follows: (1) Coefficient k of matrix of unit stiffness 3,3 Superimposing the position of the 3 rd row and the 3 rd column of the total rigidity matrix; (2) Coefficient k of unit stiffness matrix 3,14 Superimposed on the 3 rd row and 14 th column positions of the total stiffness matrix; (3) And repeating the process until all the 23 coefficients in the unit stiffness matrix are completely superposed, wherein the superposition means that the value of the corresponding coefficient of the total stiffness matrix after splicing = the value before splicing + the coefficient value of the spliced unit stiffness matrix.
The dimension of the total stiffness matrix is large, the memory space required for storing all elements is large, so that a common computer cannot bear the total stiffness matrix, and many elements in the total stiffness matrix are 0, so that the total stiffness matrix in all current engineering software is stored in a sparse matrix form, namely only non-0 elements in the sparse matrix are stored.
And the adoption of a sparse matrix storage method brings certain trouble to matrix splicing. There are 2 common sparse matrix storage methods: coordinate method, ternary method. The coordinate method adopts 3 arrays of storage sparse matrixes, and respectively stores the row number, the column number and the element value of non-zero elements in the sparse matrixes; the triple method is divided into row-by-row retrieval and column-by-column retrieval, taking the row-by-row retrieval triple method as an example, 3 arrays are adopted to store the row number, the column number and the element value of the non-zero elements in the sparse matrix, the array 1 sequentially stores all the non-zero elements of the sparse matrix according to rows, the array 2 stores the column number of the corresponding element, and the array 3 stores the position of the first non-zero element of each row in the sparse matrix in the array 1.
The addition of new non-0 elements by adopting a coordinate method is very convenient, only one element is added at the tail end of each of 3 groups, and the consumed time of program operation can be almost ignored. However, it is troublesome to modify the matrix elements by using a coordinate method, which requires searching the whole array to determine the positions of the elements to be modified. In the process of assembling the unit stiffness matrix, sometimes, non-0 elements in the sparse matrix need to be added, and sometimes, a value needs to be superimposed on one element in the sparse matrix. Therefore, when any element of the unit stiffness matrix is assembled, it is necessary to judge whether to add a non-0 element or to superimpose the element on the existing element, and the judging process requires to search through the whole array. Therefore, if the sparse matrix has n non-0 elements, about n operations are required to assemble one element disadvantageously. If the total node number is N, the operation required for assembling the whole rigidity matrix can reach (N + 1) × N/2 times of operation, and the operation amount is large.
The matrix search is much less computationally intensive when triplets are used, since the search is more straightforward to narrow using array 3. Generally, the number of non-0 elements in a certain row/column of the total stiffness matrix is within 100, so that the number of operations required by retrieval is also within 100, and the method is greatly reduced compared with a coordinate method. The triple method has the disadvantage that the addition of the non-0 element requires a large amount of operation. Firstly, the position where the newly added element should be placed needs to be searched, and the calculation amount of the step is small; however, before adding an element, all elements behind this position need to be moved backward by one position. Therefore, if the sparse matrix has n existing non-0 elements, the calculation amount required for adding one new element is n in consideration of the worst case. By the calculation, the calculation amount of the rigidity matrix assembled by adopting the triad method is equivalent to that of a coordinate method. Another disadvantage of the triplet method is that the local elements must be reassembled to generate the global stiffness matrix when they are adjusted. For example, after a node is deleted, the corresponding data of all nodes behind the node needs to be moved forward, which brings extra computation. In the actual engineering structure design process, the optimization grids and nodes are frequently required to be adjusted, so that the calculation amount is greatly increased.
Therefore, the problem that the computation amount is large when the total stiffness matrix is generated in the existing finite element method, the solving efficiency of the finite element method is influenced, and further the engineering structure analysis efficiency is influenced exists.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method and the terminal for generating the finite element total stiffness matrix can reduce the operation amount during the generation of the finite element total stiffness matrix and improve the generation efficiency of the finite element total stiffness matrix.
In order to solve the technical problem, the invention adopts a technical scheme that:
a method for generating a finite element total stiffness matrix, comprising the steps of:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
s2, opening up four storage spaces which are respectively used for storing a first array, a second array, a third array and a fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row where the element is located, the value of the element corresponding to the fourth array is 0;
and S4, receiving adjustment of the finite element mesh model, updating the initial finite element total rigidity matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total rigidity matrix.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a terminal for generating a finite element total stiffness matrix, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
s2, opening up four storage spaces which are respectively used for storing the first array, the second array, the third array and the fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row where the element is located, the value of the element corresponding to the fourth array is 0;
and S4, receiving adjustment of the finite element mesh model, updating the initial finite element total rigidity matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total rigidity matrix.
The invention has the beneficial effects that: the method comprises the steps of establishing four storage spaces, storing non-zero elements of a finite element total stiffness matrix by using four arrays respectively, storing the non-zero elements to a first array in any sequence, storing the column numbers of each element in the first array in the initial finite element total stiffness matrix correspondingly by the second array, storing the position of the non-zero element appearing in the first array first in each row of the initial finite element total stiffness matrix correspondingly by the third array, and storing the position of the next non-zero element in the first array in the same row as each element in the first array correspondingly by the fourth array.
Drawings
FIG. 1 is a schematic diagram of a finite element method based unit and node partitioning for a rectangular plate;
FIG. 2 is a flowchart illustrating steps of a method for generating a total stiffness matrix of finite elements according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a terminal for generating a finite element total stiffness matrix according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of finite element mesh modeling of a main hull of a catamaran in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of a finite element mesh modeling of a bolted connection according to an embodiment of the invention;
FIG. 6 is a schematic diagram of finite element mesh modeling of a PVC pipe bundle structure according to an embodiment of the present invention;
description of reference numerals:
1. a terminal for generating a finite element total stiffness matrix; 2. a memory; 3. a processor.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 2, a method for generating a finite element total stiffness matrix includes the steps of:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
s2, opening up four storage spaces which are respectively used for storing a first array, a second array, a third array and a fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column numbers of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in the first array in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row, the value of the element corresponding to the fourth array is 0;
and S4, receiving adjustment of the finite element mesh model, updating the initial finite element total rigidity matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total rigidity matrix.
As can be seen from the above description, the beneficial effects of the present invention are: the method comprises the steps of establishing four storage spaces, storing non-zero elements of a finite element total stiffness matrix by using four arrays respectively, storing the non-zero elements to a first array in any sequence, correspondingly storing the column numbers of each element in the first array in the initial finite element total stiffness matrix by using a second array, storing the position of the non-zero element appearing in the first array in each row of the initial finite element total stiffness matrix by using a third array, and correspondingly storing the position of the next non-zero element in the first array in the same row as each element in the first array by using a fourth array.
Further, the adjusting of the finite element mesh model in step S4 includes adding nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the line index of the coefficient, jumping to the first array and the fourth array for searching, and determining whether elements in the same line and column with the coefficient exist or not by combining the second array;
and S43, if so, directly superposing the coefficients on the elements in the same row and column with the coefficients in the first array to generate an updated finite element total stiffness matrix.
From the above description, when the nodes in the finite element mesh model are to be added, if the coefficients corresponding to the added nodes are the non-zero elements existing in the initial finite element total stiffness matrix, the elements to be superimposed can be quickly retrieved only by locating the rows where the elements to be superimposed are located and then performing the retrieval, and the method has the advantages of small traffic, accuracy and high efficiency.
Further, the S43 further includes:
if not, the new increment at the end of the first array is the element of the coefficient, the new increment at the end of the second array is the element of the column index of the coefficient, the new increment at the end of the fourth array is the element of 0, and the value of the element corresponding to the element in the fourth array is updated to the length of the fourth array according to the last non-zero element which is determined in the step S42 and is in the same row with the coefficient so as to generate an updated finite element total stiffness matrix.
It can be known from the above description that, when nodes in the finite element mesh model are to be added, if the coefficients corresponding to the added nodes are non-zero elements that do not exist in the initial finite element total stiffness matrix, the added nodes are only directly added without adjusting the added nodes and the existing non-zero elements, so that the computation amount is reduced, and the generation efficiency of the finite element total stiffness matrix is further improved.
Further, the adjusting of the finite element mesh model comprises deleting nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the row index of the coefficient, jumping to the first array and the fourth array for searching, and combining the second array to position the element to be deleted;
s43, deleting the positioned elements, and updating the values of the elements corresponding to the upstream elements in the fourth array corresponding to the deleted elements into the values of the elements corresponding to the deleted elements in the fourth array to generate an updated finite element total stiffness matrix.
It can be known from the above description that when a node in the finite element mesh model needs to be deleted, only the coefficient corresponding to the node in the initial finite element total stiffness matrix needs to be directly deleted and the element related to the node in the fourth array needs to be adjusted, and the non-zero element does not need to be adjusted in a large range, so that the computation amount is greatly reduced.
Further, the method also comprises the following steps:
s5, reducing the updated finite element total stiffness matrix, and solving a total stiffness matrix equation according to the reduced finite element total stiffness matrix to realize the solution of the engineering structure;
the restoring the updated finite element total stiffness matrix comprises:
sequentially retrieving each element of the third array;
for each element, respectively performing:
s51, jumping to the first array, and determining non-zero elements in rows corresponding to the elements in the finite element total stiffness matrix and row numbers and column numbers thereof by combining the second array;
s52, jumping to the fourth array, determining another non-zero element in the same row with the newly determined non-zero element by combining the second array, and the row number and the column number of the non-zero element, and returning to the step S52 until the non-zero elements in the row corresponding to the element are all positioned;
and restoring the updated finite element total stiffness matrix according to all the determined non-zero elements and the corresponding row numbers and column numbers thereof.
According to the description, the non-zero elements in each row and the positions of the non-zero elements can be quickly obtained through line-by-line retrieval, so that the updated finite element total stiffness matrix can be quickly restored.
Referring to fig. 3, a terminal for generating a finite element total stiffness matrix includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the following steps:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
s2, opening up four storage spaces which are respectively used for storing a first array, a second array, a third array and a fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column numbers of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in the first array in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row, the value of the element corresponding to the fourth array is 0;
and S4, receiving adjustment of the finite element mesh model, updating the initial finite element total rigidity matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total rigidity matrix.
From the above description, the beneficial effects of the present invention are: the method comprises the steps of establishing four storage spaces, storing non-zero elements of a finite element total stiffness matrix by using four arrays respectively, storing the non-zero elements to a first array in any sequence, correspondingly storing the column numbers of each element in the first array in the initial finite element total stiffness matrix by using a second array, storing the position of the non-zero element appearing in the first array in each row of the initial finite element total stiffness matrix by using a third array, and correspondingly storing the position of the next non-zero element in the first array in the same row as each element in the first array by using a fourth array.
Further, the adjusting of the finite element mesh model in step S4 includes adding nodes in the finite element mesh model;
the updating the initial finite element total stiffness matrix according to the adjusting and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the row index of the coefficient, jumping to the first array and the fourth array for searching, and determining whether elements in the same row and the same column with the coefficient exist by combining the second array;
and S43, if so, directly superposing the coefficients on the elements in the same row and column with the coefficients in the first array to generate an updated finite element total stiffness matrix.
From the above description, when the nodes in the finite element mesh model are to be added, if the coefficients corresponding to the added nodes are the non-zero elements existing in the initial finite element total stiffness matrix, the elements to be superimposed can be quickly retrieved only by locating the rows where the elements to be superimposed are located and then performing the retrieval, and the method has the advantages of small traffic, accuracy and high efficiency.
Further, the S43 further includes:
if not, the new increment at the end of the first array is the element of the coefficient, the new increment at the end of the second array is the element of the column index of the coefficient, the new increment at the end of the fourth array is the element of 0, and the value of the element corresponding to the element in the fourth array is updated to the length of the fourth array according to the last non-zero element which is determined in the step S42 and is in the same row with the coefficient so as to generate an updated finite element total stiffness matrix.
It can be known from the above description that, when nodes in the finite element mesh model are to be added, if the coefficients corresponding to the added nodes are non-zero elements that do not exist in the initial finite element total stiffness matrix, the added nodes are only directly added without adjusting the added nodes and the existing non-zero elements, so that the computation amount is reduced, and the generation efficiency of the finite element total stiffness matrix is further improved.
Further, the adjusting of the finite element mesh model comprises deleting nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the line index of the coefficient, skipping to the first array and the fourth array for searching, and combining the second array to position the element to be deleted;
s43, deleting the positioned elements, and updating the values of the elements corresponding to the upstream elements in the fourth array corresponding to the deleted elements into the values of the elements corresponding to the deleted elements in the fourth array to generate an updated finite element total stiffness matrix.
It can be known from the above description that when a node in the finite element mesh model needs to be deleted, only the coefficient corresponding to the node in the initial finite element total stiffness matrix needs to be directly deleted and the element related to the node in the fourth array needs to be adjusted, and the non-zero element does not need to be adjusted in a large range, so that the computation amount is greatly reduced.
Further, the method also comprises the following steps:
s5, reducing the updated finite element total stiffness matrix, and solving a total stiffness matrix equation according to the reduced finite element total stiffness matrix to realize the solution of the engineering structure;
the restoring the updated finite element total stiffness matrix comprises:
sequentially retrieving each element of the third array;
for each element, respectively performing:
s51, jumping to the first array, and determining non-zero elements in rows corresponding to the elements in the finite element total stiffness matrix and row numbers and column numbers thereof by combining the second array;
s52, jumping to the fourth array, determining another non-zero element in the same row with the newly determined non-zero element by combining the second array, and the row number and the column number of the non-zero element, and returning to the step S52 until the non-zero elements in the row corresponding to the element are all positioned;
and restoring the updated finite element total stiffness matrix according to all the determined non-zero elements and the corresponding row numbers and column numbers thereof.
According to the description, the non-zero elements in each row and the positions of the non-zero elements can be quickly obtained through line-by-line retrieval, so that the updated finite element total stiffness matrix can be quickly restored.
Example one
Referring to fig. 2, a method for generating a finite element total stiffness matrix includes the steps of:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
the engineering structure to be solved can be a double-hull ship main hull structure, a bolt connection structure or a PVC pipe row structure, and the stress of the double-hull ship main hull structure and the bolt connection structure is analyzed by establishing a finite element grid model for the structure and carrying out finite element method solution;
s2, opening up four storage spaces which are respectively used for storing a first array, a second array, a third array and a fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row where the element is located, the value of the element corresponding to the fourth array is 0;
specifically, assume an initial finite element total stiffness matrix of
Figure BDA0002305555370000121
The array storage results are as follows:
array 1:
Figure BDA0002305555370000122
array 2:
Figure BDA0002305555370000123
array 3:
Figure BDA0002305555370000124
array 4:
Figure BDA0002305555370000125
s4, receiving adjustment of the finite element mesh model, updating the initial finite element total stiffness matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total stiffness matrix;
wherein the adjusting of the finite element mesh model in step S4 includes adding nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the row index of the coefficient, jumping to the first array and the fourth array for searching, and determining whether elements in the same row and the same column with the coefficient exist by combining the second array;
s43, if yes, directly superposing the coefficients on elements in the first array, which are in the same row and column with the coefficients, so as to generate an updated finite element total stiffness matrix;
if not, the new increment at the end of the first array is the element of the coefficient, the new increment at the end of the second array is the element of the column index of the coefficient, the new increment at the end of the fourth array is the element of 0, and the value of the element corresponding to the element in the fourth array is updated to the length of the fourth array according to the last non-zero element which is determined in the step S42 and is in the same row with the coefficient so as to generate an updated finite element total stiffness matrix;
specifically, any non-zero element k is added to the initial finite element total stiffness matrix i,j Firstly, searching the data of the ith row, namely, searching from the ith element of the array 3, determining the position of the ith element in the first array, and skipping to the array 4 for searching after the search of the ith element is finished; in the process of determining the elements, the column number of the retrieved element is determined through the second array, and is compared with j, if the element k already exists i,j If so, directly performing superposition operation on the corresponding element values in the first array;
if element k is not present i,j Then, the following steps are adopted to newly add elements: adding new element k at the end of the first array i,j (ii) a Adding an element j at the end of the second array; adding an element at the end of the fourth array, and assigning a value of 0; changing the value of the position of the last non-0 element of the i row in the fourth array from 0 to the length of the fourth array;
for example, with the above matrix K and structureTaking the corresponding array 1 to array 4 as an example, the element k to be assembled 3,2 =9, the following steps are required:
search line 3, array 3 with element 3 being 2 and array 2 with element 2 being 3, indicating that the element is k 3,3
Further retrieve the 2 nd element of array 4, with a value of 7, retrieve the 7 th element of array 2, with a value of 2, indicating that the element is exactly k 3,2 Already exists, at this time, only the 7 th element of the array 1 is added with 9, that is, the array 1 becomes
Figure BDA0002305555370000131
As another example, to assemble element k 1,4 =9, the following steps are required:
search line 1, array 3 with element 1 and array 2 with element 1, indicating that this element is k 1,1
Continuing to search array 4 for the 1 st element, the value is 4, array 2 has the 4 th element of 3, indicating that the element is k 1,3 And continuously searching the 4 th element of the array 4, wherein the value is 0, which indicates that no element exists in the row, and the element needs to be added:
adding an element 9 at the tail end of the array 1; adding an element 4 at the tail end of the array 2; the array 3 is unchanged; and adding 0 to the tail end of the array 4, namely the 8 th element is 0, and changing the value of the element to be 0 to be 8 when the last element searched by the array 4 is the 4 th element, wherein the changed array is as follows:
array 1:
Figure BDA0002305555370000141
array 2:
Figure BDA0002305555370000142
array 3:
Figure BDA0002305555370000143
array 4:
Figure BDA0002305555370000144
s5, reducing the updated finite element total stiffness matrix, and solving a total stiffness matrix equation according to the reduced finite element total stiffness matrix to realize the solution of the engineering structure;
the restoring the updated finite element total stiffness matrix comprises:
sequentially retrieving each element of the third array;
for each element, respectively performing:
s51, jumping to the first array, and determining non-zero elements in rows corresponding to the elements in the finite element total stiffness matrix and row numbers and column numbers thereof by combining the second array;
s52, jumping to the fourth array, determining another nonzero element in the same row with the latest determined nonzero element and the row number and column number of the nonzero element by combining the second array, and returning to the step S52 until all nonzero elements in the row corresponding to the element are positioned;
restoring the updated finite element total stiffness matrix according to all the determined non-zero elements and the corresponding row numbers and column numbers thereof;
for example, take the matrix K and the constructed corresponding array 1 to array 4 as an example:
a. the 1 st element of the array 3 is 1, which indicates that the position of the 1 st element appearing in the 1 st line in the array 1 is 1, the value of the element is 2 as known from the array 1, and the column number of the element is 1 as known from the array 2, namely k 1,1 =2; meanwhile, as can be seen from the array 4, the position of the next non-0 element in the 1 st row in the array 1 is 4;
b. reading the 4 th element of the array 1 to obtain the value =1, reading the 4 th element of the array 2 to obtain the column number of the element as 3, namely k 1,3 =1, read the 4 th element in the array 4, find 0, know that no next non-0 element is in the 1 st row;
c. at this point, line 1 has been converted, and line 2 can be read, reading the 2 nd element of array 3 to 3, indicating thatThe position of the 1 st non-0 element appearing in the 2 nd line in the array 1 is 3; reading the 3 rd element in the array 1 and the array 2, wherein the element value is 3, the element column number is 2, namely k 2,2 =3, element 3 of array 4 is 0, indicating that the row has no more non-0 elements;
d. reading the 3 rd element of array 3 to be 2, reading the 2 nd elements of array 1 and array 2 to obtain k 3,3 =4; reading the 2 nd element of array 4 with a value of 7, indicating that the position of the next non-0 element of row 3 in array 1 is 7, reading the 7 th elements of array 1 and array 2, and obtaining k 3,2 =1; reading the 7 th element of the array 4, wherein the value is 0, and the 3 rd row has no non-0 element;
e. reading the 4 th element of array 3 to be 5, reading the 5 th elements of array 1 and array 2 to obtain k 4,4 =5; reading the 5 th element of array 4 with a value of 6, indicating that the position of the next non-0 element in row 4 in array 1 is 6; read the 6 th elements of array 1 and array 2 to get k 4,1 =8; the 6 th element of array 4 is read and has a value of 0, indicating that there are no other non-0 elements on row 4.
Example two
The present embodiment is different from the first embodiment in that the adjusting of the finite element mesh model in step S4 includes deleting nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of a corresponding unit stiffness matrix according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the line index of the coefficient, skipping to the first array and the fourth array for searching, and combining the second array to position the element to be deleted;
s43, deleting the positioned elements, and updating the values of the elements corresponding to the upstream elements in the fourth array corresponding to the deleted elements into the values of the elements corresponding to the deleted elements in the fourth array to generate an updated finite element total stiffness matrix;
specifically, when a node change requires deletion of a certain matrix element, the following steps are required: searching and positioning the elements to be deleted; updating the value of the corresponding element of the upstream element corresponding to the element to be deleted in the fourth array to the value of the corresponding element of the deleted element in the fourth array; thus, the delete operation is completed, and at this time, although the element to be deleted still remains in the first array, the element cannot be pointed to in the search, and the actual effect is equivalent to that the element is deleted;
if the element to be deleted is exactly the element pointed to in the third array, updating the value of the element corresponding to the element to be deleted in the third array according to the element in the first array after the element is deleted;
for example, take matrix K and the corresponding array 1 to array 4 constructed in embodiment one as an example:
if k needs to be deleted 1,3 Then, first, search the 1 st row of data, array 3 with the 1 st element 1 and array 2 with the 1 st element 1, i.e. k 1,1 Continue to search the 1 st element of array 4, which is 4, the 4 th element of array 2, which is 3, exactly k 1,3 That is, to delete the element, the upstream element of the element needs to be adjusted to point to the downstream element of the element directly, and the element itself is skipped, specifically, the upstream element of the element to be deleted corresponds to the 1 st element of the array 3, and it can be known by searching the array 4 that the downstream element of the element to be deleted corresponds to the 4 th element of the array 4, and the value is 0, at this time, the value of the 1 st element of the array 4 should be changed to the 4 th element of the array 4, that is, 0, and the modified array storage form is as follows:
array 1:
Figure BDA0002305555370000161
array 2:
Figure BDA0002305555370000162
array 3:
Figure BDA0002305555370000163
array 4:
Figure BDA0002305555370000164
if it is k 3,3 Due to k 3,3 The data pointed to by the third element in the array 3, which is the first element appearing in the array 1 in the non-zero data of the third row in the initial finite element total stiffness matrix, is deleted, and in addition to the corresponding adjustment array 4, the value of the third element in the adjustment array 3 is also updated to 7, because k is deleted 3,3 Thereafter, the first of the non-zero data in the third row of the initial finite element Total stiffness matrix appears in array 1 as k 3,2
EXAMPLE III
Referring to fig. 3, a terminal 1 for generating a finite element total stiffness matrix includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, where the processor 3 implements each step in the first or second embodiment when executing the computer program.
Example four
The method for generating the finite element total rigidity matrix greatly reduces the workload in the assembling process of the rigidity matrix. Setting the total node number in the finite element grid model as N and the maximum number of non-0 elements in a single row of the sparse matrix as m, the magnitude of the operation amount of assembling the total stiffness matrix by adopting a coordinate method is N 2 The magnitude of the operation amount by the triple method is also N 2 The magnitude of the operation amount by adopting the method is mxN; for large-scale engineering calculation, N can reach the size of hundreds of millions, and m can not exceed 100 under most conditions, so that the calculated amount of the method is reduced considerably, when 1 non-0 element is deleted or newly added, the calculation amount magnitude of the coordinate method and the triple method is N, the calculation amount magnitude of the method is m, and the calculated amount is reduced remarkably.
Three specific application scenarios are given below to illustrate the improvement of the calculation speed of the method:
as shown in fig. 4, the application scenario is to perform stress analysis on a main hull structure of a twin-hull ship by using a finite element method;
as shown in fig. 5, the application scenario is to perform local stress analysis on the bolt connection structure by using a finite element method;
as shown in fig. 6, the application scenario is to perform application analysis on a PVC pipe bundle structure by using a finite element method;
table 1 shows the comparison of the calculation time of the finite element total stiffness matrix generated in the present invention with the coordinate method and the triple method in the above three application scenarios.
TABLE 1 comparison of calculated time in three application scenarios
Figure BDA0002305555370000171
As can be seen from comparison of the table 1, the method provided by the invention has the advantages that the calculation performance is improved well when the method is applied to various problems, the operation time for generating the finite element total stiffness matrix is effectively shortened, and the application prospect is good.
In summary, according to the method and the terminal for generating the finite element total stiffness matrix provided by the invention, four storage spaces are opened up, four arrays are used for storing non-zero elements of the finite element total stiffness matrix respectively, the non-zero elements are stored in the first array in any order, the second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the first non-zero element in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the first array in the same row as each element in the first array, row-by-row retrieval can be realized through the specific storage mode, so that when the finite element total stiffness matrix is adjusted, the retrieval operation amount can be greatly reduced, the retrieval efficiency is improved, and the first array stores all non-zero elements in a random order, so that if the elements are added or deleted, the retrieval operation amount is not required to be greatly reduced, the finite element total stiffness matrix generation efficiency is greatly improved compared with the finite element total stiffness matrix solving method, the finite element total stiffness analysis efficiency is improved, and the finite element total stiffness analysis efficiency is improved.
The above description is only an embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent modifications made by the present invention and the contents of the accompanying drawings, which are directly or indirectly applied to the related technical fields, are included in the scope of the present invention.

Claims (4)

1. A method for generating a finite element total stiffness matrix, comprising the steps of:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
s2, opening up four storage spaces which are respectively used for storing the first array, the second array, the third array and the fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row where the element is located, the value of the element corresponding to the fourth array is 0;
s4, receiving adjustment of the finite element mesh model, updating the initial finite element total stiffness matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total stiffness matrix;
the step S4 of adjusting the finite element mesh model includes adding nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the line index of the coefficient, jumping to the first array and the fourth array for searching, and determining whether elements in the same line and column with the coefficient exist or not by combining the second array;
s43, if yes, directly superposing the coefficients on elements in the same row and column with the coefficients in the first array to generate an updated finite element total stiffness matrix;
the S43 further includes:
if not, the new increment at the end of the first array is the element of the coefficient, the new increment at the end of the second array is the element of the column index of the coefficient, the new increment at the end of the fourth array is the element of 0, and the value of the element corresponding to the element in the fourth array is updated to the length of the fourth array according to the last non-zero element which is determined to be in the same row as the coefficient in the step S42 so as to generate an updated finite element total stiffness matrix;
the adapting of the finite element mesh model comprises deleting nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of a corresponding unit stiffness matrix according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the row index of the coefficient, jumping to the first array and the fourth array for searching, and combining the second array to position the element to be deleted;
s43, deleting the positioned elements, and updating the values of the elements corresponding to the upstream elements in the fourth array corresponding to the deleted elements into the values of the elements corresponding to the deleted elements in the fourth array to generate an updated finite element total stiffness matrix.
2. A method for generating a finite element total stiffness matrix as claimed in claim 1, further comprising the steps of:
s5, reducing the updated finite element total stiffness matrix, and solving a total stiffness matrix equation according to the reduced finite element total stiffness matrix to realize the solution of the engineering structure;
the restoring the updated finite element total stiffness matrix comprises:
sequentially retrieving each element of the third array;
for each element, respectively performing:
s51, jumping to the first array, and determining non-zero elements in rows corresponding to the elements in the finite element total stiffness matrix and row numbers and column numbers of the non-zero elements in the rows in combination with the second array;
s52, jumping to the fourth array, determining another nonzero element in the same row with the latest determined nonzero element and the row number and column number of the nonzero element by combining the second array, and returning to the step S52 until all nonzero elements in the row corresponding to the element are positioned;
and restoring the updated finite element total stiffness matrix according to all the determined non-zero elements and the corresponding row numbers and column numbers thereof.
3. A terminal for generating a finite element total stiffness matrix, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to perform the steps of:
s1, receiving an initial finite element total stiffness matrix, wherein the initial finite element total stiffness matrix is generated after a finite element grid model is established for an engineering structure to be solved;
s2, opening up four storage spaces which are respectively used for storing a first array, a second array, a third array and a fourth array;
s3, determining non-zero elements in the initial finite element total stiffness matrix, and storing the non-zero elements to the first array in any sequence, wherein the second array correspondingly stores the column number of each element in the first array in the initial finite element total stiffness matrix, the third array stores the position of the non-zero element in each row of the initial finite element total stiffness matrix, the fourth array correspondingly stores the position of the next non-zero element in the same row as each element in the first array, and if the element in the first array is the last non-zero element in the row where the element is located, the value of the element corresponding to the fourth array is 0;
s4, receiving adjustment of the finite element mesh model, updating the initial finite element total rigidity matrix according to the adjustment and the first array, the second array, the third array and the fourth array, and generating an updated finite element total rigidity matrix;
the step S4 of adjusting the finite element mesh model includes adding nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of corresponding unit stiffness matrixes according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the row index of the coefficient, jumping to the first array and the fourth array for searching, and determining whether elements in the same row and the same column with the coefficient exist by combining the second array;
s43, if yes, directly superposing the coefficients on elements in the first array, which are in the same row and column with the coefficients, so as to generate an updated finite element total stiffness matrix;
the S43 further includes:
if not, the new increment at the end of the first array is the element of the coefficient, the new increment at the end of the second array is the element of the column index of the coefficient, the new increment at the end of the fourth array is the element of 0, and the value of the element corresponding to the element in the fourth array is updated to the length of the fourth array according to the last non-zero element which is determined in the step S42 and is in the same row with the coefficient so as to generate an updated finite element total stiffness matrix;
the adapting of the finite element mesh model comprises deleting nodes in the finite element mesh model;
updating the initial finite element total stiffness matrix according to the adjustment and the first, second, third and fourth arrays, and generating an updated finite element total stiffness matrix comprises:
s41, determining coefficients of a corresponding unit stiffness matrix according to the nodes, wherein the coefficients comprise row indexes and column indexes;
s42, searching from the element corresponding to the third array according to the line index of the coefficient, skipping to the first array and the fourth array for searching, and combining the second array to position the element to be deleted;
s43, deleting the positioned elements, and updating the values of the elements corresponding to the upstream elements in the fourth array corresponding to the deleted elements into the values of the elements corresponding to the deleted elements in the fourth array to generate an updated finite element total stiffness matrix.
4. A terminal for generating a finite element total stiffness matrix according to claim 3, further comprising the steps of:
s5, reducing the updated finite element total stiffness matrix, and solving a total stiffness matrix equation according to the reduced finite element total stiffness matrix to realize the solution of the engineering structure;
the restoring the updated finite element total stiffness matrix comprises:
sequentially retrieving each element of the third array;
for each element, respectively performing:
s51, jumping to the first array, and determining non-zero elements in rows corresponding to the elements in the finite element total stiffness matrix and row numbers and column numbers thereof by combining the second array;
s52, jumping to the fourth array, determining another nonzero element in the same row with the latest determined nonzero element and the row number and column number of the nonzero element by combining the second array, and returning to the step S52 until all nonzero elements in the row corresponding to the element are positioned;
and restoring the updated finite element total stiffness matrix according to all the determined non-zero elements and the corresponding row numbers and column numbers thereof.
CN201911238615.7A 2019-12-06 2019-12-06 Method for generating finite element total stiffness matrix and terminal Active CN111008497B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911238615.7A CN111008497B (en) 2019-12-06 2019-12-06 Method for generating finite element total stiffness matrix and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911238615.7A CN111008497B (en) 2019-12-06 2019-12-06 Method for generating finite element total stiffness matrix and terminal

Publications (2)

Publication Number Publication Date
CN111008497A CN111008497A (en) 2020-04-14
CN111008497B true CN111008497B (en) 2022-11-11

Family

ID=70114786

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911238615.7A Active CN111008497B (en) 2019-12-06 2019-12-06 Method for generating finite element total stiffness matrix and terminal

Country Status (1)

Country Link
CN (1) CN111008497B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4787057A (en) * 1986-06-04 1988-11-22 General Electric Company Finite element analysis method using multiprocessor for matrix manipulations with special handling of diagonal elements
CN102184298A (en) * 2011-05-18 2011-09-14 山东大学 Method for storing and generating stiffness matrix for finite-element analysis in metal bulk plastic forming
CN104133959A (en) * 2014-07-28 2014-11-05 东北大学 Bridge finite element model modifying method
CN105677981A (en) * 2016-01-08 2016-06-15 西北工业大学 Multi-displacement-boundary-value constraint working condition handling method for large-scale structure finite element model
CN105701291A (en) * 2016-01-13 2016-06-22 中国航空动力机械研究所 Finite element analysis device, information acquisition method and method for parallel generation of system matrix

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4787057A (en) * 1986-06-04 1988-11-22 General Electric Company Finite element analysis method using multiprocessor for matrix manipulations with special handling of diagonal elements
CN102184298A (en) * 2011-05-18 2011-09-14 山东大学 Method for storing and generating stiffness matrix for finite-element analysis in metal bulk plastic forming
CN104133959A (en) * 2014-07-28 2014-11-05 东北大学 Bridge finite element model modifying method
CN105677981A (en) * 2016-01-08 2016-06-15 西北工业大学 Multi-displacement-boundary-value constraint working condition handling method for large-scale structure finite element model
CN105701291A (en) * 2016-01-13 2016-06-22 中国航空动力机械研究所 Finite element analysis device, information acquisition method and method for parallel generation of system matrix

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
自升式平台桩腿海上对接过程中的碰撞问题;林国珍;《船舶工程》;20180430;第40卷(第4期);70-75 *

Also Published As

Publication number Publication date
CN111008497A (en) 2020-04-14

Similar Documents

Publication Publication Date Title
CN110825375A (en) Quantum program conversion method and device, storage medium and electronic device
CN108897716B (en) Data processing device and method for reducing calculation amount through memory read-write operation
CN110399591B (en) Data processing method and device based on convolutional neural network
US20230049471A1 (en) Method and apparatus for operating image data
CN112149808A (en) Method, system and medium for expanding stand-alone graph neural network training to distributed training
CN114444274B (en) Method, medium and device for reconstructing original structure grid from unstructured grid
CN111008497B (en) Method for generating finite element total stiffness matrix and terminal
KR102306252B1 (en) Apparatus and method for transforming matrix and data processing system
CN112084198A (en) Direct column writing method and device for node admittance matrix in compressed storage form
CN112100877A (en) Structural rigidity efficient topology optimization method and application thereof
CN113536567A (en) Method for multi-target vector fitting
CN110210691B (en) Resource recommendation method, device, storage medium and equipment
CN113609720B (en) Master-slave degree of freedom processing method, device and storage medium for finite element analysis
CN105375468B (en) A kind of method that rectangular co-ordinate Newton-Laphson method trend is quickly asked for based on symmetrical and sparse technology
CN111723246B (en) Data processing method, device and storage medium
CN106980743A (en) A kind of three-dimensional structure static numerical simulation analogy method based on sparse storage form
CN107391666B (en) Method and device for generating composite index key value
CN105677981A (en) Multi-displacement-boundary-value constraint working condition handling method for large-scale structure finite element model
JP2009025962A (en) Simultaneous linear equation solution method and device
CN116501247A (en) Data storage method and data storage system
CN116880979A (en) Task event scheduling method, device, computer equipment and storage medium
KR20240035291A (en) Pagerank computing method and apparatus
JP2016207010A (en) Parallel computing system, calculation method, calculation program, and information processing device
CN117708169A (en) Database query optimization method and device, electronic equipment and storage medium
Fialko et al. A sparse direct multi-frontal solver in SCAD software

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant