Research Article
Efficient Alternative for Construction of the Linear System Stemming from Numerical Solution of Heat Transfer Problems via FEM
Code 2
Gauss-Seidel method used for calculating the global linear system.
| ! GAUSS SEIDEL METHOD | | T = 1.d0; Ti = T; rAux = 0.d0; Emax = 0.0000000001d0 !T: Temperature; Ti: initial shot | | do i = 1, 200000 | | ii = 1; rAuxE = 0.d0 | | do j = 1,nnost | | soma = 0.d0 | | do jj = ii,k | | if(Mirow(jj).eq.j.and.Mjcol(jj).eq.j) then | | rAux = GG(jj) | | end if | | if(Mirow(jj).eq.j) then | | if(Mjcol(jj).eq.j) then | | continue | | else | | soma = soma + GG(jj)T(Mjcol(jj)) | | end if | | else | | ii = jj | | go to (2) | | end if | | end do | | (2) T(j) = (1.d0/rAux)(FG(j) - soma) | | end do | | do j = 1,nnost | | Erro = dabs(Ti(j) - T(j)) | | if(Erro>rAuxE) then | | rAuxE = Erro | | end if | | end do | | if(rAuxE>Emax) then !Emax: stop criterion | | Ti = T | | else | | go to (1) | | end if | | end do | | (1) continue |
|