6
! This file is part of the Code_Saturne Kernel, element of the
7
! Code_Saturne CFD tool.
9
! Copyright (C) 1998-2009 EDF S.A., France
11
! contact: saturne-support@edf.fr
13
! The Code_Saturne Kernel is free software; you can redistribute it
14
! and/or modify it under the terms of the GNU General Public License
15
! as published by the Free Software Foundation; either version 2 of
16
! the License, or (at your option) any later version.
18
! The Code_Saturne Kernel is distributed in the hope that it will be
19
! useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20
! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
! GNU General Public License for more details.
23
! You should have received a copy of the GNU General Public License
24
! along with the Code_Saturne Kernel; if not, write to the
25
! Free Software Foundation, Inc.,
26
! 51 Franklin St, Fifth Floor,
27
! Boston, MA 02110-1301 USA
5
! This file is part of Code_Saturne, a general-purpose CFD tool.
7
! Copyright (C) 1998-2011 EDF S.A.
9
! This program is free software; you can redistribute it and/or modify it under
10
! the terms of the GNU General Public License as published by the Free Software
11
! Foundation; either version 2 of the License, or (at your option) any later
14
! This program is distributed in the hope that it will be useful, but WITHOUT
15
! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19
! You should have received a copy of the GNU General Public License along with
20
! this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
21
! Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
23
!-------------------------------------------------------------------------------
31
25
subroutine uscfth &
35
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
36
nnod , lndfac , lndfbr , ncelbr , &
37
nvar , nscal , nphas , &
38
iccfth , imodif , iphas , &
39
nideve , nrdeve , nituse , nrtuse , &
40
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
41
ipnfac , nodfac , ipnfbr , nodfbr , &
42
idevel , ituser , ia , &
43
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
44
30
dt , rtp , rtpa , propce , propfa , propfb , &
46
sorti1 , sorti2 , gamagr , xmasmr , &
47
rdevel , rtuser , ra )
32
sorti1 , sorti2 , gamagr , xmasmr )
49
34
!===============================================================================
201
186
!__________________.____._____.________________________________________________.
202
187
! nom !type!mode ! role !
203
188
!__________________!____!_____!________________________________________________!
204
! idbia0 ! i ! <-- ! number of first free position in ia !
205
! idbra0 ! i ! <-- ! number of first free position in ra !
206
! ndim ! i ! <-- ! spatial dimension !
207
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
208
! ncel ! i ! <-- ! number of cells !
209
! nfac ! i ! <-- ! number of interior faces !
210
! nfabor ! i ! <-- ! number of boundary faces !
211
! nfml ! i ! <-- ! number of families (group classes) !
212
! nprfml ! i ! <-- ! number of properties per family (group class) !
213
! nnod ! i ! <-- ! number of vertices !
214
! lndfac ! i ! <-- ! size of nodfac indexed array !
215
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
216
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
217
189
! nvar ! i ! <-- ! total number of variables !
218
190
! nscal ! i ! <-- ! total number of scalars !
219
! nphas ! i ! <-- ! number of phases !
220
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
221
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
222
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
223
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
224
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
225
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
226
! iprfml ! ia ! <-- ! property numbers per family !
227
! (nfml, nprfml) ! ! ! !
228
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
229
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
230
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
231
! nodfac(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
232
! idevel(nideve) ! ia ! <-> ! integer work array for temporary developpement !
233
! ituser(nituse ! ia ! <-> ! user-reserved integer work array !
234
! ia(*) ! ia ! --- ! main integer work array !
235
! xyzcen ! ra ! <-- ! cell centers !
236
! (ndim, ncelet) ! ! ! !
237
! surfac ! ra ! <-- ! interior faces surface vectors !
238
! (ndim, nfac) ! ! ! !
239
! surfbo ! ra ! <-- ! boundary faces surface vectors !
240
! (ndim, nfavor) ! ! ! !
241
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
242
! (ndim, nfac) ! ! ! !
243
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
244
! (ndim, nfabor) ! ! ! !
245
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
246
! (ndim, nnod) ! ! ! !
247
! volume(ncelet) ! ra ! <-- ! cell volumes !
248
191
! dt(ncelet) ! ra ! <-- ! time step (per cell) !
249
192
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
250
193
! (ncelet, *) ! ! ! (at current and preceding time steps) !
269
209
! mode: <-- input, --> output, <-> modifies data, --- work array
270
210
!===============================================================================
212
!===============================================================================
214
!===============================================================================
229
!===============================================================================
274
!===============================================================================
276
!===============================================================================
290
!===============================================================================
294
integer idbia0 , idbra0
295
integer ndim , ncelet , ncel , nfac , nfabor
296
integer nfml , nprfml
297
integer nnod , lndfac , lndfbr , ncelbr
298
integer nvar , nscal , nphas
299
integer iccfth , imodif , iphas
300
integer nideve , nrdeve , nituse , nrtuse
302
integer ifacel(2,nfac) , ifabor(nfabor)
303
integer ifmfbr(nfabor) , ifmcel(ncelet)
304
integer iprfml(nfml,nprfml)
305
integer ipnfac(nfac+1), nodfac(lndfac)
306
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
307
integer idevel(nideve), ituser(nituse), ia(*)
309
double precision xyzcen(ndim,ncelet)
310
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
311
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
312
double precision xyznod(ndim,nnod), volume(ncelet)
236
integer iccfth , imodif
313
238
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
314
239
double precision propce(ncelet,*),propfa(nfac,*),propfb(nfabor,*)
315
240
double precision coefa(nfabor,*), coefb(nfabor,*)
317
242
double precision sorti1(*), sorti2(*), gamagr(*), xmasmr(*)
318
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
320
244
! Local variables
322
integer idebia, idebra
325
248
integer iel , ifac , ivar
326
integer ipriph , irhiph , itkiph , ieniph
327
integer iuiph , iviph , iwiph
249
integer irh , itk , ien
328
250
integer iclp , iclr , iclt , icle
329
251
integer iclu , iclv , iclw
357
279
! No user input required.
358
280
!===============================================================================
364
282
! Error indicator (stop if non zero)
367
285
! Rank of the variables in their associated arrays
368
286
if(iccfth.ge.0.or.iccfth.le.-2) then
370
irhiph = isca(irho (iphas))
371
itkiph = isca(itempk(iphas))
372
ieniph = isca(ienerg(iphas))
376
iclp = iclrtp(ipriph,icoef)
377
iclr = iclrtp(irhiph,icoef)
378
iclt = iclrtp(itkiph,icoef)
379
icle = iclrtp(ieniph,icoef)
380
iclu = iclrtp(iuiph,icoef)
381
iclv = iclrtp(iviph,icoef)
382
iclw = iclrtp(iwiph,icoef)
290
iclp = iclrtp(ipr,icoef)
291
iclr = iclrtp(irh,icoef)
292
iclt = iclrtp(itk,icoef)
293
icle = iclrtp(ien,icoef)
294
iclu = iclrtp(iu,icoef)
295
iclv = iclrtp(iv,icoef)
296
iclw = iclrtp(iw,icoef)
385
299
! For calculation of values at the cell centers,
570
sorti1(iel) = xmasml*rtp(iel,ipriph)/(rr*rtp(iel,irhiph))
476
sorti1(iel) = xmasml*rtp(iel,ipr)/(rr*rtp(iel,irh))
572
sorti2(iel) = cv0(iphas)*sorti1(iel) &
573
+ 0.5d0*( rtp(iel,iuiph)**2 + rtp(iel,iviph)**2 &
574
+ rtp(iel,iwiph)**2 )
478
sorti2(iel) = cv0*sorti1(iel) &
479
+ 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 )
577
482
! Transfer to the array rtp
578
483
if(imodif.gt.0) then
580
rtp(iel,itkiph) = sorti1(iel)
581
rtp(iel,ieniph) = sorti2(iel)
485
rtp(iel,itk) = sorti1(iel)
486
rtp(iel,ien) = sorti2(iel)
606
sorti1(iel) = xmasml*rtp(iel,ipriph)/(rr*rtp(iel,itkiph))
511
sorti1(iel) = xmasml*rtp(iel,ipr)/(rr*rtp(iel,itk))
608
sorti2(iel) = cv0(iphas)*rtp(iel,itkiph) &
609
+ 0.5d0*( rtp(iel,iuiph)**2 + rtp(iel,iviph)**2 &
610
+ rtp(iel,iwiph)**2 )
513
sorti2(iel) = cv0*rtp(iel,itk) &
514
+ 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 )
613
517
! Transfer to the array rtp
614
518
if(imodif.gt.0) then
616
rtp(iel,irhiph) = sorti1(iel)
617
rtp(iel,ieniph) = sorti2(iel)
520
rtp(iel,irh) = sorti1(iel)
521
rtp(iel,ien) = sorti2(iel)
654
sorti1(iel) = rtp(iel,irhiph)*rtp(iel,itkiph)*rr/xmasml
558
sorti1(iel) = rtp(iel,irh)*rtp(iel,itk)*rr/xmasml
656
sorti2(iel) = cv0(iphas)*rtp(iel,itkiph) &
657
+ 0.5d0*( rtp(iel,iuiph)**2 + rtp(iel,iviph)**2 &
658
+ rtp(iel,iwiph)**2 )
560
sorti2(iel) = cv0*rtp(iel,itk) &
561
+ 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 )
661
564
! Transfer to the array rtp
662
565
if(imodif.gt.0) then
664
rtp(iel,ipriph) = sorti1(iel)
665
rtp(iel,ieniph) = sorti2(iel)
567
rtp(iel,ipr) = sorti1(iel)
568
rtp(iel,ien) = sorti2(iel)
807
710
! Calculation of the Mach number at the boundary face, using the
808
711
! cell center velocity projected on the vector normal to the boundary
810
( rtp(iel,iuiph)*surfbo(1,ifac) &
811
+ rtp(iel,iviph)*surfbo(2,ifac) &
812
+ rtp(iel,iwiph)*surfbo(3,ifac) ) / ra(isrfbn+ifac-1) &
813
/ sqrt( gamagp * rtp(iel,ipriph) / rtp(iel,irhiph) )
713
( rtp(iel,iu)*surfbo(1,ifac) &
714
+ rtp(iel,iv)*surfbo(2,ifac) &
715
+ rtp(iel,iw)*surfbo(3,ifac) ) / surfbn(ifac) &
716
/ sqrt( gamagp * rtp(iel,ipr) / rtp(iel,irh) )
886
789
! Calculation of the Mach number at the boundary face, using the
887
790
! cell center velocity projected on the vector normal to the boundary
889
( rtp(iel,iuiph)*surfbo(1,ifac) &
890
+ rtp(iel,iviph)*surfbo(2,ifac) &
891
+ rtp(iel,iwiph)*surfbo(3,ifac) ) / ra(isrfbn+ifac-1) &
892
/ sqrt( gamagp * rtp(iel,ipriph) / rtp(iel,irhiph) )
792
( rtp(iel,iu)*surfbo(1,ifac) &
793
+ rtp(iel,iv)*surfbo(2,ifac) &
794
+ rtp(iel,iw)*surfbo(3,ifac) ) / surfbn(ifac) &
795
/ sqrt( gamagp * rtp(iel,ipr) / rtp(iel,irh) )
894
797
( coefa(ifac,iclu)*surfbo(1,ifac) &
895
798
+ coefa(ifac,iclv)*surfbo(2,ifac) &
896
+ coefa(ifac,iclw)*surfbo(3,ifac) ) /ra(isrfbn+ifac-1) &
897
/ sqrt( gamagp * rtp(iel,ipriph) / rtp(iel,irhiph) )
799
+ coefa(ifac,iclw)*surfbo(3,ifac) ) /surfbn(ifac) &
800
/ sqrt( gamagp * rtp(iel,ipr) / rtp(iel,irh) )
898
801
dxmach = xmachi - xmache
900
803
! Pressure: rarefaction wave (Rusanov)
901
804
if(dxmach.le.0.d0) then
903
806
if(dxmach.gt.2.d0/(1.d0-gamagp)) then
904
coefa(ifac,iclp) = rtp(iel,ipriph)* &
807
coefa(ifac,iclp) = rtp(iel,ipr)* &
905
808
( (1.d0 + (gamagp-1.d0)*0.50d0*dxmach) &
906
809
** (2.d0*gamagp/(gamagp-1.d0)) )
907
810
elseif(dxmach.le.2.d0/(1.d0-gamagp) ) then
911
814
! Pressure: shock (Rusanov)
913
coefa(ifac,iclp) = rtp(iel,ipriph)* &
816
coefa(ifac,iclp) = rtp(iel,ipr)* &
914
817
( 1.d0 + gamagp*dxmach &
915
818
*( (gamagp+1.d0)*0.25d0*dxmach &
916
819
+ sqrt(1.d0 + (gamagp+1.d0)**2/16.d0*dxmach**2) ) )
919
822
! This choice overrides the previous Rusanov choice
920
coefa(ifac,iclp) = rtp(iel,ipriph)
823
coefa(ifac,iclp) = rtp(iel,ipr)
923
826
coefa(ifac,icle) = &
960
863
iel = ifabor(ifac)
962
865
! Rarefaction case
963
if(coefa(ifac,iclp).le.rtp(iel,ipriph)) then
866
if(coefa(ifac,iclp).le.rtp(iel,ipr)) then
966
coefa(ifac,iclr) = rtp(iel,irhiph) &
967
* (coefa(ifac,iclp)/rtp(iel,ipriph))**(1.d0/gamagp)
869
coefa(ifac,iclr) = rtp(iel,irh) &
870
* (coefa(ifac,iclp)/rtp(iel,ipr))**(1.d0/gamagp)
970
coefa(ifac,iclu) = rtp(iel,iuiph) &
971
+ 2.d0/(gamagp-1.d0) &
972
* sqrt(gamagp*rtp(iel,ipriph)/rtp(iel,irhiph)) &
973
* (1.d0-(coefa(ifac,iclp)/rtp(iel,ipriph) &
974
)**((gamagp-1.d0)/(2.d0*gamagp))) &
975
* surfbo(1,ifac)/ra(isrfbn+ifac-1)
977
coefa(ifac,iclv) = rtp(iel,iviph) &
978
+ 2.d0/(gamagp-1.d0) &
979
* sqrt( gamagp*rtp(iel,ipriph)/rtp(iel,irhiph)) &
980
* (1.d0-(coefa(ifac,iclp)/rtp(iel,ipriph) &
981
)**((gamagp-1.d0)/(2.d0*gamagp))) &
982
* surfbo(2,ifac)/ra(isrfbn+ifac-1)
984
coefa(ifac,iclw) = rtp(iel,iwiph) &
985
+ 2.d0/(gamagp-1.d0) &
986
* sqrt( gamagp*rtp(iel,ipriph)/rtp(iel,irhiph)) &
987
* (1.d0-(coefa(ifac,iclp)/rtp(iel,ipriph) &
873
coefa(ifac,iclu) = rtp(iel,iu) &
874
+ 2.d0/(gamagp-1.d0) &
875
* sqrt(gamagp*rtp(iel,ipr)/rtp(iel,irh)) &
876
* (1.d0-(coefa(ifac,iclp)/rtp(iel,ipr) &
877
)**((gamagp-1.d0)/(2.d0*gamagp))) &
878
* surfbo(1,ifac)/surfbn(ifac)
880
coefa(ifac,iclv) = rtp(iel,iv) &
881
+ 2.d0/(gamagp-1.d0) &
882
* sqrt( gamagp*rtp(iel,ipr)/rtp(iel,irh)) &
883
* (1.d0-(coefa(ifac,iclp)/rtp(iel,ipr) &
884
)**((gamagp-1.d0)/(2.d0*gamagp))) &
885
* surfbo(2,ifac)/surfbn(ifac)
887
coefa(ifac,iclw) = rtp(iel,iw) &
888
+ 2.d0/(gamagp-1.d0) &
889
* sqrt( gamagp*rtp(iel,ipr)/rtp(iel,irh)) &
890
* (1.d0-(coefa(ifac,iclp)/rtp(iel,ipr) &
988
891
)**((gamagp-1.d0)/(2.d0/gamagp))) &
989
* surfbo(3,ifac)/ra(isrfbn+ifac-1)
892
* surfbo(3,ifac)/surfbn(ifac)
992
895
coefa(ifac,icle) = &
1001
coefa(ifac,iclr) = rtp(iel,irhiph) &
904
coefa(ifac,iclr) = rtp(iel,irh) &
1002
905
* ( (gamagp+1.d0)*coefa(ifac,iclp) &
1003
+ (gamagp-1.d0)*rtp(iel,ipriph) ) &
906
+ (gamagp-1.d0)*rtp(iel,ipr) ) &
1004
907
/ ( (gamagp-1.d0)*coefa(ifac,iclp) &
1005
+ (gamagp+1.d0)*rtp(iel,ipriph) )
908
+ (gamagp+1.d0)*rtp(iel,ipr) )
1008
coefa(ifac,iclu) = rtp(iel,iuiph) &
1009
- (coefa(ifac,iclp)-rtp(iel,ipriph)) &
1012
*((gamagp+1.d0)*coefa(ifac,iclp) &
1013
+(gamagp-1.d0)*rtp(iel,ipriph) ))) &
1014
* surfbo(1,ifac)/ra(isrfbn+ifac-1)
1016
coefa(ifac,iclv) = rtp(iel,iviph) &
1017
- (coefa(ifac,iclp)-rtp(iel,ipriph)) &
1020
*((gamagp+1.d0)*coefa(ifac,iclp) &
1021
+(gamagp-1.d0)*rtp(iel,ipriph) ))) &
1022
* surfbo(2,ifac)/ra(isrfbn+ifac-1)
1024
coefa(ifac,iclw) = rtp(iel,iwiph) &
1025
- (coefa(ifac,iclp)-rtp(iel,ipriph)) &
1028
*((gamagp+1.d0)*coefa(ifac,iclp) &
1029
+(gamagp-1.d0)*rtp(iel,ipriph) ))) &
1030
* surfbo(3,ifac)/ra(isrfbn+ifac-1)
911
coefa(ifac,iclu) = rtp(iel,iu) &
912
- (coefa(ifac,iclp)-rtp(iel,ipr)) &
915
*((gamagp+1.d0)*coefa(ifac,iclp) &
916
+(gamagp-1.d0)*rtp(iel,ipr) ))) &
917
* surfbo(1,ifac)/surfbn(ifac)
919
coefa(ifac,iclv) = rtp(iel,iv) &
920
- (coefa(ifac,iclp)-rtp(iel,ipr)) &
923
*((gamagp+1.d0)*coefa(ifac,iclp) &
924
+(gamagp-1.d0)*rtp(iel,ipr) ))) &
925
* surfbo(2,ifac)/surfbn(ifac)
927
coefa(ifac,iclw) = rtp(iel,iw) &
928
- (coefa(ifac,iclp)-rtp(iel,ipr)) &
931
*((gamagp+1.d0)*coefa(ifac,iclp) &
932
+(gamagp-1.d0)*rtp(iel,ipr) ))) &
933
* surfbo(3,ifac)/surfbn(ifac)
1033
936
coefa(ifac,icle) = &
1230
1128
elseif(iccfth.eq.0) then
1232
1130
do iel = 1, ncel
1233
propce(iel,ipproc(icp(iphas))) = cp0(iphas)
1234
propce(iel,ipproc(icv(iphas))) = &
1235
cp0(iphas) - rr/xmasmr(iel)
1236
rtp(iel,irhiph) = p0(iphas)*xmasmr(iel)/rr/t0(iphas)
1238
propce(iel,ipproc(icv(iphas)))*t0(iphas)
1131
propce(iel,ipproc(icp)) = cp0
1132
propce(iel,ipproc(icv)) = &
1133
cp0 - rr/xmasmr(iel)
1134
rtp(iel,irh) = p0*xmasmr(iel)/rr/t0
1135
rtp(iel,ien) = propce(iel,ipproc(icv))*t0
1249
1146
sorti1(iel) = &
1250
xmasmr(iel)/rr*rtp(iel,ipriph)/rtp(iel,irhiph)
1147
xmasmr(iel)/rr*rtp(iel,ipr)/rtp(iel,irh)
1253
sorti2(iel) = propce(iel,ipproc(icv(iphas)))*sorti1(iel) &
1254
+ 0.5d0*( rtp(iel,iuiph)**2 &
1255
+ rtp(iel,iviph)**2 + rtp(iel,iwiph)**2 )
1150
sorti2(iel) = propce(iel,ipproc(icv))*sorti1(iel) &
1151
+ 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 )
1259
1155
! Transfer to the array rtp
1260
1156
if(imodif.gt.0) then
1261
1157
do iel = 1, ncel
1262
rtp(iel,itkiph) = sorti1(iel)
1263
rtp(iel,ieniph) = sorti2(iel)
1158
rtp(iel,itk) = sorti1(iel)
1159
rtp(iel,ien) = sorti2(iel)
1275
1171
sorti1(iel) = &
1276
xmasmr(iel)/rr*rtp(iel,ipriph)/rtp(iel,itkiph)
1172
xmasmr(iel)/rr*rtp(iel,ipr)/rtp(iel,itk)
1279
1175
sorti2(iel) = &
1280
propce(iel,ipproc(icv(iphas)))*rtp(iel,itkiph) &
1281
+ 0.5d0*( rtp(iel,iuiph)**2 &
1282
+ rtp(iel,iviph)**2 + rtp(iel,iwiph)**2 )
1176
propce(iel,ipproc(icv))*rtp(iel,itk) &
1177
+ 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 )
1286
1181
! Transfer to the array rtp
1287
1182
if(imodif.gt.0) then
1288
1183
do iel = 1, ncel
1289
rtp(iel,irhiph) = sorti1(iel)
1290
rtp(iel,ieniph) = sorti2(iel)
1184
rtp(iel,irh) = sorti1(iel)
1185
rtp(iel,ien) = sorti2(iel)
1302
1197
sorti1(iel) = &
1303
rtp(iel,ipriph)/(gamagr(iel)-1.d0)/( rtp(iel,ieniph) &
1304
- 0.5d0*( rtp(iel,iuiph)**2 &
1305
+ rtp(iel,iviph)**2 + rtp(iel,iwiph)**2 ) )
1198
rtp(iel,ipr)/(gamagr(iel)-1.d0)/( rtp(iel,ien) &
1199
- 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 ) )
1308
sorti2(iel) = xmasmr(iel)/rr*rtp(iel,ipriph)/sorti1(iel)
1202
sorti2(iel) = xmasmr(iel)/rr*rtp(iel,ipr)/sorti1(iel)
1312
1206
! Transfer to the array rtp
1313
1207
if(imodif.gt.0) then
1314
1208
do iel = 1, ncel
1315
rtp(iel,irhiph) = sorti1(iel)
1316
rtp(iel,itkiph) = sorti2(iel)
1209
rtp(iel,irh) = sorti1(iel)
1210
rtp(iel,itk) = sorti2(iel)
1328
1222
sorti1(iel) = &
1329
rtp(iel,irhiph)*rr/xmasmr(iel)*rtp(iel,itkiph)
1223
rtp(iel,irh)*rr/xmasmr(iel)*rtp(iel,itk)
1332
1226
sorti2(iel) = &
1333
propce(iel,ipproc(icv(iphas)))*rtp(iel,itkiph) &
1334
+ 0.5d0*( rtp(iel,iuiph)**2 &
1335
+ rtp(iel,iviph)**2 + rtp(iel,iwiph)**2 )
1227
propce(iel,ipproc(icv))*rtp(iel,itk) &
1228
+ 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 )
1339
1232
! Transfer to the array rtp
1340
1233
if(imodif.gt.0) then
1341
1234
do iel = 1, ncel
1342
rtp(iel,ipriph) = sorti1(iel)
1343
rtp(iel,ieniph) = sorti2(iel)
1235
rtp(iel,ipr) = sorti1(iel)
1236
rtp(iel,ien) = sorti2(iel)
1355
1248
sorti1(iel) = &
1356
(gamagr(iel)-1.d0)*rtp(iel,irhiph)*( rtp(iel,ieniph) &
1357
- 0.5d0*( rtp(iel,iuiph)**2 &
1358
+ rtp(iel,iviph)**2 + rtp(iel,iwiph)**2 ) )
1249
(gamagr(iel)-1.d0)*rtp(iel,irh)*( rtp(iel,ien) &
1250
- 0.5d0*( rtp(iel,iu)**2 + rtp(iel,iv)**2 + rtp(iel,iw)**2 ) )
1361
sorti2(iel) = xmasmr(iel)/rr*sorti1(iel)/rtp(iel,irhiph)
1253
sorti2(iel) = xmasmr(iel)/rr*sorti1(iel)/rtp(iel,irh)
1365
1257
! Transfer to the array rtp
1366
1258
if(imodif.gt.0) then
1367
1259
do iel = 1, ncel
1368
rtp(iel,ipriph) = sorti1(iel)
1369
rtp(iel,itkiph) = sorti2(iel)
1260
rtp(iel,ipr) = sorti1(iel)
1261
rtp(iel,itk) = sorti2(iel)
1379
1271
do iel = 1, ncel
1381
1273
! Verification of the positivity of the pressure
1382
if(rtp(iel,ipriph).lt.0.d0) then
1383
write(nfecra,1110) iel , rtp(iel,ipriph)
1274
if(rtp(iel,ipr).lt.0.d0) then
1275
write(nfecra,1110) iel , rtp(iel,ipr)
1386
1278
! Verification of the positivity of the density
1387
elseif(rtp(iel,irhiph).le.0.d0) then
1388
write(nfecra,1120) iel , rtp(iel,irhiph)
1279
elseif(rtp(iel,irh).le.0.d0) then
1280
write(nfecra,1120) iel , rtp(iel,irh)
1394
1286
sorti1(iel) = &
1395
gamagr(iel) * rtp(iel,ipriph) / rtp(iel,irhiph)
1287
gamagr(iel) * rtp(iel,ipr) / rtp(iel,irh)
1410
1302
do iel = 1, ncel
1412
1304
! Verification of the positivity of the density
1413
if(rtp(iel,irhiph).lt.0.d0) then
1414
write(nfecra,1220) iel , rtp(iel,irhiph)
1305
if(rtp(iel,irh).lt.0.d0) then
1306
write(nfecra,1220) iel , rtp(iel,irh)
1420
sorti1(iel) = rtp(iel,irhiph)**gamagr(iel)
1312
sorti1(iel) = rtp(iel,irh)**gamagr(iel)
1450
1342
do iel = 1, ncel
1452
1344
! Verification of the positivity of the pressure
1453
if(rtp(iel,ipriph).lt.0.d0) then
1454
write(nfecra,1310) iel , rtp(iel,ipriph)
1345
if(rtp(iel,ipr).lt.0.d0) then
1346
write(nfecra,1310) iel , rtp(iel,ipr)
1457
1349
! Verification of the positivity of the density
1458
elseif(rtp(iel,irhiph).le.0.d0) then
1459
write(nfecra,1320) iel , rtp(iel,irhiph)
1350
elseif(rtp(iel,irh).le.0.d0) then
1351
write(nfecra,1320) iel , rtp(iel,irh)
1465
1357
sorti1(iel) = &
1466
rtp(iel,ipriph) / (rtp(iel,irhiph)**gamagr(iel))
1358
rtp(iel,ipr) / (rtp(iel,irh)**gamagr(iel))
1505
1397
! Calculation of the Mach number at the boundary face, using the
1506
1398
! cell center velocity projected on the vector normal to the boundary
1507
xmach = ( rtp(iel,iuiph)*surfbo(1,ifac) &
1508
+ rtp(iel,iviph)*surfbo(2,ifac) &
1509
+ rtp(iel,iwiph)*surfbo(3,ifac) ) / ra(isrfbn+ifac-1) &
1510
/ sqrt( gamagr(iel)*rtp(iel,ipriph)/rtp(iel,irhiph) )
1399
xmach = ( rtp(iel,iu)*surfbo(1,ifac) &
1400
+ rtp(iel,iv)*surfbo(2,ifac) &
1401
+ rtp(iel,iw)*surfbo(3,ifac) ) / surfbn(ifac) &
1402
/ sqrt( gamagr(iel)*rtp(iel,ipr)/rtp(iel,irh) )
1512
1404
coefa(ifac,iclp) = 0.d0
1529
1421
*( (gamagr(iel)+1.d0)/4.d0*xmach &
1530
1422
+ sqrt(1.d0 + (gamagr(iel)+1.d0)**2/16.d0*xmach**2) )
1531
1423
coefb(ifac,iclt) = coefb(ifac,iclp)/(1.d0-coefb(ifac,iclp)) &
1532
/ rtp(iel,ipriph) * ( rtp(iel,irhiph) &
1533
* (rtp(iel,iuiph)**2 &
1534
+rtp(iel,iviph)**2+rtp(iel,iwiph)**2) &
1535
+ rtp(iel,ipriph) *(1.d0-coefb(ifac,iclp)) )
1424
/ rtp(iel,ipr) * ( rtp(iel,irh) &
1425
* (rtp(iel,iu)**2+rtp(iel,iv)**2+rtp(iel,iw)**2) &
1426
+ rtp(iel,ipr) *(1.d0-coefb(ifac,iclp)) )
1538
1429
! Total energy: 'internal energy - Cv T'
1553
1444
! Calculation of the Mach number at the boundary face, using the
1554
1445
! cell center velocity projected on the vector normal to the boundary
1555
xmachi = ( rtp(iel,iuiph)*surfbo(1,ifac) &
1556
+ rtp(iel,iviph)*surfbo(2,ifac) &
1557
+ rtp(iel,iwiph)*surfbo(3,ifac) )/ra(isrfbn+ifac-1) &
1558
/ sqrt(gamagr(iel)*rtp(iel,ipriph)/rtp(iel,irhiph))
1446
xmachi = ( rtp(iel,iu)*surfbo(1,ifac) &
1447
+ rtp(iel,iv)*surfbo(2,ifac) &
1448
+ rtp(iel,iw)*surfbo(3,ifac) )/surfbn(ifac) &
1449
/ sqrt(gamagr(iel)*rtp(iel,ipr)/rtp(iel,irh))
1559
1450
xmache = ( coefa(ifac,iclu)*surfbo(1,ifac) &
1560
1451
+ coefa(ifac,iclv)*surfbo(2,ifac) &
1561
+ coefa(ifac,iclw)*surfbo(3,ifac) )/ra(isrfbn+ifac-1) &
1562
/ sqrt(gamagr(iel)*rtp(iel,ipriph)/rtp(iel,irhiph))
1452
+ coefa(ifac,iclw)*surfbo(3,ifac) )/surfbn(ifac) &
1453
/ sqrt(gamagr(iel)*rtp(iel,ipr)/rtp(iel,irh))
1563
1454
dxmach = xmachi - xmache
1565
1456
! Pressure: rarefaction wave
1566
1457
if(dxmach.le.0.d0) then
1568
1459
if(dxmach.gt.2.d0/(1.d0-gamagr(iel))) then
1569
coefa(ifac,iclp) = rtp(iel,ipriph)* &
1460
coefa(ifac,iclp) = rtp(iel,ipr)* &
1570
1461
( (1.d0 + (gamagr(iel)-1.d0)*0.50d0*dxmach) &
1571
1462
** (2.d0*gamagr(iel)/(gamagr(iel)-1.d0)) )
1572
1463
elseif(dxmach.le.2.d0/(1.d0-gamagr(iel)) ) then
1601
1492
! Calculation of the Mach number at the boundary face, using the
1602
1493
! cell center velocity projected on the vector normal to the boundary
1603
xmach = ( rtp(iel,iuiph)*surfbo(1,ifac) &
1604
+ rtp(iel,iviph)*surfbo(2,ifac) &
1605
+ rtp(iel,iwiph)*surfbo(3,ifac) ) / ra(isrfbn+ifac-1) &
1606
/ sqrt(gamagr(iel)*rtp(iel,ipriph)/rtp(iel,irhiph))
1494
xmach = ( rtp(iel,iu)*surfbo(1,ifac) &
1495
+ rtp(iel,iv)*surfbo(2,ifac) &
1496
+ rtp(iel,iw)*surfbo(3,ifac) ) / surfbn(ifac) &
1497
/ sqrt(gamagr(iel)*rtp(iel,ipr)/rtp(iel,irh))
1608
1499
! Supersonic outlet: Dirichlet for all variables
1609
1500
if(xmach.ge.1.d0) then
1615
1506
coefa(ifac,iclt) = &
1616
rtp(iel,ipriph)/rtp(iel,irhiph)**gamagr(iel)
1507
rtp(iel,ipr)/rtp(iel,irh)**gamagr(iel)
1618
1509
! Subsonic outlet
1619
1510
elseif(xmach.lt.1.d0 .and. xmach.ge.0.d0) then
1622
if(coefa(ifac,iclp).le.rtp(iel,ipriph)) then
1513
if(coefa(ifac,iclp).le.rtp(iel,ipr)) then
1625
coefa(ifac,iclr) = rtp(iel,irhiph) &
1626
* (coefa(ifac,iclp)/rtp(iel,ipriph)) &
1516
coefa(ifac,iclr) = rtp(iel,irh) &
1517
* (coefa(ifac,iclp)/rtp(iel,ipr)) &
1627
1518
**(1.d0/gamagr(iel))
1630
coefa(ifac,iclu) = rtp(iel,iuiph) &
1631
+ 2.d0/(gamagr(iel)-1.d0) &
1632
* sqrt( gamagr(iel) * rtp(iel,ipriph) / rtp(iel,irhiph) ) &
1634
- (coefa(ifac,iclp)/rtp(iel,ipriph)) &
1635
**((gamagr(iel)-1.d0)/2.d0/gamagr(iel)) ) &
1636
* surfbo(1,ifac) / ra(isrfbn+ifac-1)
1638
coefa(ifac,iclv) = rtp(iel,iviph) &
1639
+ 2.d0/(gamagr(iel)-1.d0) &
1640
* sqrt( gamagr(iel) * rtp(iel,ipriph) / rtp(iel,irhiph) ) &
1642
- (coefa(ifac,iclp)/rtp(iel,ipriph)) &
1643
**((gamagr(iel)-1.d0)/2.d0/gamagr(iel)) ) &
1644
* surfbo(2,ifac) / ra(isrfbn+ifac-1)
1646
coefa(ifac,iclw) = rtp(iel,iwiph) &
1647
+ 2.d0/(gamagr(iel)-1.d0) &
1648
* sqrt( gamagr(iel) * rtp(iel,ipriph) / rtp(iel,irhiph) ) &
1650
- (coefa(ifac,iclp)/rtp(iel,ipriph)) &
1651
**((gamagr(iel)-1.d0)/2.d0/gamagr(iel)) ) &
1652
* surfbo(3,ifac) / ra(isrfbn+ifac-1)
1521
coefa(ifac,iclu) = rtp(iel,iu) &
1522
+ 2.d0/(gamagr(iel)-1.d0) &
1523
* sqrt( gamagr(iel) * rtp(iel,ipr) / rtp(iel,irh) ) &
1525
- (coefa(ifac,iclp)/rtp(iel,ipr)) &
1526
**((gamagr(iel)-1.d0)/2.d0/gamagr(iel)) ) &
1527
* surfbo(1,ifac) / surfbn(ifac)
1529
coefa(ifac,iclv) = rtp(iel,iv) &
1530
+ 2.d0/(gamagr(iel)-1.d0) &
1531
* sqrt( gamagr(iel) * rtp(iel,ipr) / rtp(iel,irh) ) &
1533
- (coefa(ifac,iclp)/rtp(iel,ipr)) &
1534
**((gamagr(iel)-1.d0)/2.d0/gamagr(iel)) ) &
1535
* surfbo(2,ifac) / surfbn(ifac)
1537
coefa(ifac,iclw) = rtp(iel,iw) &
1538
+ 2.d0/(gamagr(iel)-1.d0) &
1539
* sqrt( gamagr(iel) * rtp(iel,ipr) / rtp(iel,irh) ) &
1541
- (coefa(ifac,iclp)/rtp(iel,ipr)) &
1542
**((gamagr(iel)-1.d0)/2.d0/gamagr(iel)) ) &
1543
* surfbo(3,ifac) / surfbn(ifac)
1655
1546
coefa(ifac,icle) = coefa(ifac,iclp) &
1669
coefa(ifac,iclr) = rtp(iel,irhiph) &
1560
coefa(ifac,iclr) = rtp(iel,irh) &
1670
1561
* ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1671
+ (gamagr(iel)-1.d0)*rtp(iel,ipriph) ) &
1562
+ (gamagr(iel)-1.d0)*rtp(iel,ipr) ) &
1672
1563
/ ( (gamagr(iel)-1.d0)*coefa(ifac,iclp) &
1673
+ (gamagr(iel)+1.d0)*rtp(iel,ipriph) )
1564
+ (gamagr(iel)+1.d0)*rtp(iel,ipr) )
1676
coefa(ifac,iclu) = rtp(iel,iuiph) &
1677
- (coefa(ifac,iclp)-rtp(iel,ipriph))*sqrt(2.d0/rtp(iel,irhiph) &
1678
/ ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1679
+ (gamagr(iel)-1.d0)*rtp(iel,ipriph) )) &
1680
* surfbo(1,ifac) / ra(isrfbn+ifac-1)
1682
coefa(ifac,iclv) = rtp(iel,iviph) &
1683
- (coefa(ifac,iclp)-rtp(iel,ipriph))*sqrt(2.d0/rtp(iel,irhiph) &
1684
/ ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1685
+ (gamagr(iel)-1.d0)*rtp(iel,ipriph) )) &
1686
* surfbo(2,ifac) / ra(isrfbn+ifac-1)
1688
coefa(ifac,iclw) = rtp(iel,iwiph) &
1689
- (coefa(ifac,iclp)-rtp(iel,ipriph))*sqrt(2.d0/rtp(iel,irhiph) &
1690
/ ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1691
+ (gamagr(iel)-1.d0)*rtp(iel,ipriph) )) &
1692
* surfbo(3,ifac) / ra(isrfbn+ifac-1)
1567
coefa(ifac,iclu) = rtp(iel,iu) &
1568
- (coefa(ifac,iclp)-rtp(iel,ipr))*sqrt(2.d0/rtp(iel,irh) &
1569
/ ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1570
+ (gamagr(iel)-1.d0)*rtp(iel,ipr) )) &
1571
* surfbo(1,ifac) / surfbn(ifac)
1573
coefa(ifac,iclv) = rtp(iel,iv) &
1574
- (coefa(ifac,iclp)-rtp(iel,ipr))*sqrt(2.d0/rtp(iel,irh) &
1575
/ ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1576
+ (gamagr(iel)-1.d0)*rtp(iel,ipr) )) &
1577
* surfbo(2,ifac) / surfbn(ifac)
1579
coefa(ifac,iclw) = rtp(iel,iw) &
1580
- (coefa(ifac,iclp)-rtp(iel,ipr))*sqrt(2.d0/rtp(iel,irh) &
1581
/ ( (gamagr(iel)+1.d0)*coefa(ifac,iclp) &
1582
+ (gamagr(iel)-1.d0)*rtp(iel,ipr) )) &
1583
* surfbo(3,ifac) / surfbn(ifac)
1695
1586
coefa(ifac,icle) = coefa(ifac,iclp) &
1952
1843
'@ by setting a minimum value for the density variable in',/, &
1953
1844
'@ the GUI or in the user subroutine ''usini1'' (set the ',/, &
1954
1845
'@ scamin value associated to the variable ',/, &
1955
'@ isca(irho(iphas)).',/, &
1846
'@ isca(irho).',/, &
1957
1848
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
1961
1852
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&