1
!-------------------------------------------------------------------------------
3
! This file is part of the Code_Saturne Kernel, element of the
4
! Code_Saturne CFD tool.
6
! Copyright (C) 1998-2009 EDF S.A., France
8
! contact: saturne-support@edf.fr
10
! The Code_Saturne Kernel is free software; you can redistribute it
11
! and/or modify it under the terms of the GNU General Public License
12
! as published by the Free Software Foundation; either version 2 of
13
! the License, or (at your option) any later version.
15
! The Code_Saturne Kernel is distributed in the hope that it will be
16
! useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17
! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
! GNU General Public License for more details.
20
! You should have received a copy of the GNU General Public License
21
! along with the Code_Saturne Kernel; if not, write to the
22
! Free Software Foundation, Inc.,
23
! 51 Franklin St, Fifth Floor,
24
! Boston, MA 02110-1301 USA
26
!-------------------------------------------------------------------------------
31
( ncelet , ncel , nfac , nfabor , &
32
iconvp , idiffp , ndircp , isym , nfecra , &
35
coefbp , rovsdt , flumas , flumab , viscf , viscb , &
38
!===============================================================================
42
! CONSTRUCTION DE LA MATRICE DE CONVECTION UPWIND/DIFFUSION/TS
44
! IL EST INTERDIT DE MODIFIER ROVSDT ICI
47
!-------------------------------------------------------------------------------
49
!__________________.____._____.________________________________________________.
50
! name !type!mode ! role !
51
!__________________!____!_____!________________________________________________!
52
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
53
! ncel ! i ! <-- ! number of cells !
54
! nfac ! i ! <-- ! number of interior faces !
55
! nfabor ! i ! <-- ! number of boundary faces !
56
! iconvp ! e ! <-- ! indicateur = 1 convection, 0 sinon !
57
! idiffp ! e ! <-- ! indicateur = 1 diffusion , 0 sinon !
58
! ndircp ! e ! <-- ! indicateur = 0 si decalage diagonale !
59
! isym ! e ! <-- ! indicateur = 1 matrice symetrique !
60
! ! ! ! 2 matrice non symetrique !
61
! thetap ! r ! <-- ! coefficient de ponderation pour le !
62
! ! ! ! theta-schema (on ne l'utilise pour le !
63
! ! ! ! moment que pour u,v,w et les scalaire !
64
! ! ! ! - thetap = 0.5 correspond a un schema !
65
! ! ! ! totalement centre en temps (mixage !
66
! ! ! ! entre crank-nicolson et adams- !
68
! ifacel(2,nfac ! te ! <-- ! no des elts voisins d'une face intern !
69
! ifabor(nfabor ! te ! <-- ! no de l'elt voisin d'une face de bord !
70
! coefbp(nfabor ! tr ! <-- ! tab b des cl pour la var consideree !
71
! flumas(nfac) ! tr ! <-- ! flux de masse aux faces internes !
72
! flumab(nfabor ! tr ! <-- ! flux de masse aux faces de bord !
73
! viscf(nfac) ! tr ! <-- ! visc*surface/dist aux faces internes !
74
! viscb(nfabor ! tr ! <-- ! visc*surface/dist aux faces de bord !
75
! da (ncelet ! tr ! --> ! partie diagonale de la matrice !
76
! xa (nfac,*) ! tr ! --> ! extra diagonale de la matrice !
77
!__________________!____!_____!________________________________________________!
79
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
80
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
81
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
82
! --- tableau de travail
83
!===============================================================================
87
!===============================================================================
89
!===============================================================================
93
!===============================================================================
98
integer ncelet , ncel , nfac , nfabor
99
integer iconvp , idiffp , ndircp , isym
101
double precision thetap
103
integer ifacel(2,nfac), ifabor(nfabor)
104
double precision coefbp(nfabor), rovsdt(ncelet)
105
double precision flumas(nfac), flumab(nfabor)
106
double precision viscf(nfac), viscb(nfabor)
107
double precision da(ncelet ),xa(nfac ,isym)
111
integer ifac,ii,jj,iel
112
double precision flui,fluj,epsi
114
!===============================================================================
116
!===============================================================================
118
!===============================================================================
120
if(isym.ne.1.and.isym.ne.2) then
121
write(nfecra,1000) isym
128
da(iel) = rovsdt(iel)
130
if(ncelet.gt.ncel) then
131
do iel = ncel+1, ncelet
147
!===============================================================================
148
! 2. CALCUL DES TERMES EXTRADIAGONAUX
149
!===============================================================================
154
flui = 0.5d0*( flumas(ifac) -abs(flumas(ifac)) )
155
fluj =-0.5d0*( flumas(ifac) +abs(flumas(ifac)) )
156
xa(ifac,1) = thetap*(iconvp*flui -idiffp*viscf(ifac))
157
xa(ifac,2) = thetap*(iconvp*fluj -idiffp*viscf(ifac))
163
flui = 0.5d0*( flumas(ifac) -abs(flumas(ifac)) )
164
xa(ifac,1) = thetap*(iconvp*flui -idiffp*viscf(ifac))
169
!===============================================================================
170
! 3. CONTRIBUTION DES TERMES X-TRADIAGONAUX A LA DIAGONALE
171
!===============================================================================
175
if (ivecti.eq.1) then
181
da(ii) = da(ii) -xa(ifac,2)
182
da(jj) = da(jj) -xa(ifac,1)
187
! VECTORISATION NON FORCEE
191
da(ii) = da(ii) -xa(ifac,2)
192
da(jj) = da(jj) -xa(ifac,1)
199
if (ivecti.eq.1) then
205
da(ii) = da(ii) -xa(ifac,1)
206
da(jj) = da(jj) -xa(ifac,1)
211
! VECTORISATION NON FORCEE
215
da(ii) = da(ii) -xa(ifac,1)
216
da(jj) = da(jj) -xa(ifac,1)
223
!===============================================================================
224
! 4. CONTRIBUTION DES FACETTES DE BORDS A LA DIAGONALE
225
!===============================================================================
227
if (ivectb.eq.1) then
232
flui = 0.5d0*( flumab(ifac) -abs(flumab(ifac)) )
233
fluj =-0.5d0*( flumab(ifac) +abs(flumab(ifac)) )
234
da(ii) = da(ii) + thetap*( &
235
iconvp*(-fluj + flui*coefbp(ifac) ) &
236
+idiffp*viscb(ifac)*(1.d0-coefbp(ifac)) &
242
! VECTORISATION NON FORCEE
245
flui = 0.5d0*( flumab(ifac) -abs(flumab(ifac)) )
246
fluj =-0.5d0*( flumab(ifac) +abs(flumab(ifac)) )
247
da(ii) = da(ii) + thetap*( &
248
iconvp*(-fluj + flui*coefbp(ifac) ) &
249
+idiffp*viscb(ifac)*(1.d0-coefbp(ifac)) &
255
!===============================================================================
256
! 5. NON PRESENCE DE PTS DIRICHLET --> LEGER RENFORCEMENT DE LA
257
! DIAGONALE POUR DECALER LE SPECTRE DES VALEURS PROPRES
258
!===============================================================================
259
! (si IDIRCL=0, on a force NDIRCP a valoir au moins 1 pour ne pas
260
! decaler la diagonale)
262
if ( ndircp.le.0 ) then
264
da(iel) = (1.d0+epsi)*da(iel)
272
#if defined(_CS_LANG_FR)
276
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
278
'@ @@ ATTENTION : ARRET DANS matrix ',/,&
280
'@ APPEL DE matrix AVEC ISYM = ',I10 ,/,&
282
'@ Le calcul ne peut pas etre execute. ',/,&
284
'@ Contacter l''assistance. ',/,&
286
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
293
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
295
'@ @@ WARNING: ABORT IN matrix' ,/,&
297
'@ matrix CALLED WITH ISYM = ',I10 ,/,&
299
'@ The calculation will not be run.' ,/,&
301
'@ Contact support.' ,/,&
303
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&