This paper proposes an efficient alternative to construction of the linear system coming from a solution via the Finite Element Method that is able to significantly decrease the time of construction of this system. From the presentation of the methodology used and a numerical application it will be clear that the purpose of this work is to be able to decrease 67 times (on average) the linear system building time.
The several activities related to engineering and research connected with it are not motivated solely and exclusively by human curiosity, but mainly real needs, which often need to be resolved quickly and accurately. The heat transfer study is of great importance in various branches of engineering. The interest to know the heat transfer mechanisms may involve equipment operations, such as in boilers, condensers, and air preheater. In cooling systems and those of air conditioning that involve heat exchangers, the heat transfer study is extremely important for mechanical engineering. In electrical engineering, in turn, there is an interest to know the heat dissipation in chips and semiconductor devices, in chemical engineering the interest is in heat transfer processes in various chemical reactions, and in environmental engineering there is an interest to study the effect of heat in the dispersion of pollutants in the air and the diffusion of pollutants in soils and thermal pollution in lakes and seas and their impact on human life, in addition to many other applications in other branches of engineering.
The majority of physical problems are governed or may be represented by partial differential equations. The 3D convectiondiffusionreaction problems can be represented, in general, using the following partial differential equation [
Some mathematical methods are able to supply analytical solutions of physical problems, especially problems from heat transfer, but only of some and very specific problem, due to which it becomes unviable for engineering practice. So numerical methods are essential tools for solving heat transfer problems.
For decades the numerical methods have been used to solve such problems, among which stand out the Finite Difference Method [
One may here mention other variants of the variants of Finite Element Method, but the main focus of this paper is related to a new proposal for constructing a global linear system coming from a formulation made with some of the variants of the Finite Element Method. Here, just for simplicity, Galerkin method will be used for such study.
In the following, a summary of the manner which was performed for the construction of the linear system in [
In the works cited above [
Connectivity matrix for a domain divided into 12 hexahedrons elements with 8 nodes (see Figure
Element  Nodes  

1  2  3  4  5  6  7  8  
1  1  2  5  6  13  14  17  18 
2  2  3  6 

14  15  18  19 
3  3  4 

8  15  16  19  20 
4  5  6  9  10  17  18  21  22 
5  6 

10  11  18  19  22  23 
6 

8  11  12  19  20  23  24 
7  13  14  17  18  25  26  29  30 
8  14  15  18  19  26  27  30  31 
9  15  16  19  20  27  28  31  32 
10  17  18  21  22  29  30  33  34 
11  18  19  22  23  30  31  34  35 
12  19  20  23  24  31  32  35  36 
Therefore, each contribution of an element (matrix element) is inserted in the global linear system that represents the physical characteristics of the problem. However, following this manner and remembering that each line of the global matrix is directly connected to its node, that is, row 1 to node 1, row 2 to node 2, and so on, construction of the mesh occurs in a manner unordered form because the contributions that each line of the global matrix receives do not occur in an orderly manner. See, for example, from Table
See also that the global matrix in position, line 7 column 7, will receive contribution of four cited elements, but at different times of the construction of this system, it would be quiet if the storage of the global matrix is made in a full matrix (
Example of matrix constructed of disorderly manner (above) and orderly one (below).
Disorderly  Row  1  2  1  3  7  2  ⋯ 
Column  1  3  5  1  2  9  ⋯  
Coefficients  0.5  0.2  0.7  0.8  0.9  1.5  ⋯  


Orderly  Row  1  1  2  2  3  7  ⋯ 
Column  1  5  3  9  1  2  ⋯  
Coefficients  0.5  0.7  0.2  1.5  0.8  0.9  ⋯ 
Thus, the purpose of this paper is to build the global linear system in orderly form and faster in order to accelerate the computation process, for it is proposed that instead of building the global linear system in the traditional form, that is, element by element, build it node to node.
For this, it is proposed from connectivity matrix (see again Table
Connectivity matrix constructed to present for each node which elements that are contained.
Nodes  Elements  

1  2  3  4  5  6  7  8  
1  1  0  0  0  0  0  0  0 
2  1  2  0  0  0  0  0  0 
3  2  3  0  0  0  0  0  0 









6  1  2  4  5  0  0  0  0 









18  1  2  4  5  7  8  10  11 









3D domain divided into 12 hexahedrons elements with 8 nodes (each).
With a matrix constructed conforming to the idea presented in Table
Code
ka = 1
do i = 1,NNost
do j = 1,8
if(KNN(i,j).eq.0) then
go to (1)
end if
do jj = 1,NNos
if(KCONEC(KNN(i,j),jj).eq.i) then
iAUX = jj
go to (2)
end if
end do
(2)
do jj = ka,k
if(Mjcol(jj).eq.KCONEC(KNN(i,j),ii).and.Mirow(jj).eq.i) then
GG(jj) = GG(jj) + G(iAUX,ii)
iAUXj = jj + 1
go to (3)
end if
end do
(3)
end do
end do
(1) continue
ka = iAUXj
end do
The piece of Code
Example of construction of the vectors GG, Mirow, and Mjcol.
GG  −0.15  0.04  −0.02  ⋯  1.12  2.00  1.13  ⋯ 


Mirow  1  1  1  ⋯  2  2  2  ⋯ 


Mjcol  1  2  5  ⋯  1  7  2  ⋯ 
Note that, in the example shown in Code
!
T = 1.d0; Ti = T; rAux = 0.d0; Emax = 0.0000000001d0
do i = 1, 200000
ii = 1; rAuxE = 0.d0
(2) T(j) = (1.d0/rAux)
end do
Erro = dabs(Ti(j)  T(j))
if(Erro>rAuxE) then
rAuxE = Erro
end if
end do
if(rAuxE>Emax) then
Ti = T
else
go to (1)
end if
end do
(1) continue
It is noteworthy that if it was also necessary to have the ordinates columns, a simple code would solve this. Furthermore, the choice of the GaussSeidel method is due to its simplicity of implementation; however, this proposal could be adapted to other methods of solving linear systems, as, for example, the method of conjugate gradients when the formulation is done via LSFEM (Least Squares Finite Element Method).
To analyze the efficiency of this proposal, we analyze application 2 of [
The proposal presented in this paper through the previous item will be called CASE 2. However, in this paper, CASE 2 was performed in such a way that the computer’s own code constructs the mesh and its connectivity matrix, and with that, mesh was performed which is constructed building code lines using this knowledge; however, there may be situations that a mesh stemming from an external mesh generator to the FEM code is used and therefore did not have knowledge of how this mesh is constructed, so here it will be called CASE 3, the situation where how the mesh is constructed is not known, so for each node of the mesh, the connectivity matrix (Table
For clarity, in the code of CASE 2, it is known that the mesh is constructed from left to right (in
Mirow = 0; Mjcol = 0; KNN = 0; k = 1; ka = 1
do i = 1,NNost
ki = 1; iel = 1
do j = 1,Nelem
do ii = 1,NNos
if(KCONEC(j,ii).eq.i) then
iAUX = j
KNN(i,ki) = j
ki = ki + 1
iel = iel + 1
go to (1)
end if
if(ii.eq.NNos) then
go to (3)
end if
end do
(1)
if(iel.eq.2) then
do ii = 1,NNos
Mirow(k) = i
Mjcol(k) = KCONEC(iAUX,ii)
k = k + 1
end do
else
do ii = 1,NNos
do kk = ka,k
if(Mirow(kk).eq.i.and.Mjcol(kk).eq.KCONEC(iAUX,ii)) then
go to (2)
end if
end do
Mirow(k) = i
Mjcol(k) = KCONEC(iAUX,ii)
k = k + 1
(2) continue
end do
end if
(3) continue
end do
ka = k  1
end do
k = k  1
continue
The numerical results of this application are shown in Table
Numerical results for the three case studies.
8 nodes per element  In seconds  





CR  CASE 1  CASE 3  % C1C3  CASE 2  % C1C2 
1331  1000  0.100 

—  24.39  1.09  4.47%  1.07  4.39% 
2744  2197  0.077 

1.97  52.45  3.60  6.86%  3.45  6.58% 
4096  3375  0.067 

2.02  94.45  6.54  6.92%  6.51  6.89% 
6859  5832  0.056 

1.98  176.08  15.00  8.52%  15.51  8.81% 
9261  8000  0.050 

2.01  252.98  25.09  9.92%  19.85  7.85% 
13824  12167  0.043 

2.03  218.00  55.88  25.63%  45.92  21.06% 
17576  15625  0.040 

1.93  313.46  83.87  26.76%  65.42  20.87% 
24389  21952  0.036 

2.02  485.78  144.51  29.75%  117.15  24.12% 
29791  27000  0.033 

1.98  664.28  202.25  30.45%  146.48  22.05% 



It is believed that this proposal is very important and it could bring many benefits in the art of programming numerical of heat transfer problems via Finite Element Method. It is clear that, in character of numerical programming, lines of code could be presented maybe a little more technically better, but this is not the main objective of this paper.
The most interesting part of this paper is the results presented in CASE 3, where, without having knowledge of how the mesh is built, we obtained an average of 16.59% of the time spent compared with CASE 1 which is used in a traditional manner, element by element, for construction of the global linear system, that is, a significant improvement in computation time.
The author has not declared any conflict of interests.
The FAPESP (Proc. 2014/066798) supported the present work.