Télécharger kfm12.eso

Retour à la liste

Numérotation des lignes :

kfm12
  1. C KFM12 SOURCE OF166741 24/12/13 21:16:05 12097
  2. SUBROUTINE KFM12(IRES,IRN,IGN,IRETN,IGAMN,IVCO,
  3. & ICHPSU,ICHPDI,ICHPVO,INORM,
  4. & MELEMC,MELEMF,MELEFL,MELTFA,DTPS,DCFL,
  5. & MELLIM,ICHLIM,NJAC,ICOEF,ICOEV,
  6. & IDU,IPROBL)
  7. C************************************************************************
  8. C
  9. C PROJET : CASTEM 2000
  10. C
  11. C NOM : KFM12
  12. C
  13. C DESCRIPTION : Voir aussi KFM1
  14. C
  15. C Cas deux dimensions, gaz "calorically perfect"
  16. C Méthode de relaxation de type SGS
  17. C
  18. C LANGAGE : FORTRAN 77 + ESOPE 2000 (avec estensions CISI)
  19. C
  20. C AUTEUR : T. KLOCZKO DEN/DM2S/SFME/LTMF
  21. C
  22. C************************************************************************
  23. C ENTREES
  24. C
  25. C
  26. C 1) Pointeurs des CHPOINTs
  27. C
  28. C IRES : CHPOINT 'CENTRE' contenant le residu
  29. C
  30. C IRN : CHPOINT 'CENTRE' contenant la masse volumique
  31. C
  32. C IGN : CHPOINT 'CENTRE' contenant la q.d.m.
  33. C
  34. C IRETN : CHPOINT 'CENTRE' contenant l'energie totale
  35. C
  36. C IGAMN : CHPOINT 'CENTRE' contenant le gamma
  37. C
  38. C IVCO : CHPOINT 'CENTRE' contenant le cut-off
  39. C
  40. C ICHLIM : CHPOINT conditions aux bords
  41. C
  42. C ICOEV : CHPOINT 'CENTRE' contenant le (gamma - 1) K / (R \rho)
  43. C coeff pour calculer le ray. spect. de la matrice
  44. C visc.
  45. C
  46. C 3) Pointeurs de CHPOINTs de la table DOMAINE
  47. C
  48. C ICHPSU : CHPOINT "FACE" contenant la surface des faces
  49. C
  50. C ICHPDI : CHPOINT "CENTRE" contenant le diametre minimum
  51. C de chaque element
  52. C
  53. C ICHPVO : CHPOINT "CENTRE" contenant le volume
  54. C de chaque element
  55. C
  56. C INORM : CHPOINT "CENTRE" contenant le normales aux faces
  57. C
  58. C
  59. C 4) Pointeurs de MELEME de la table DOMAINE
  60. C
  61. C MELEMC : MELEME 'CENTRE' du SPG des CENTRES
  62. C
  63. C MELEMF : MELEME 'FACE' du SPG des FACES
  64. C
  65. C MELEFL : MELEME 'FACEL' du connectivité FACES -> ELEM
  66. C
  67. C MELLIM : MELEME SPG conditions aux bords
  68. C
  69. C 5)
  70. C
  71. C DCFL = le double de la CFL
  72. C
  73. C DTPS = pas de temps physique
  74. C
  75. C NJAC = nombre d'iterations dans le jacobien
  76. C
  77. C
  78. C SORTIES
  79. C
  80. C IDU : resultat
  81. C
  82. C IPROBL : si > 0, il y a un probleme
  83. C
  84. C************************************************************************
  85. C
  86. C HISTORIQUE (Anomalies et modifications éventuelles)
  87. C
  88. C HISTORIQUE : 2004 : creation
  89. C
  90. C
  91. C************************************************************************
  92. C
  93. C
  94. C N.B.: On suppose qu'on a déjà controllé RO, P > 0
  95. C GAMMA \in (1,3)
  96. C Y \in (0,1)
  97. C Si non il faut le faire!!!
  98. C
  99. C************************************************************************
  100. C
  101. IMPLICIT INTEGER(I-N)
  102. INTEGER IRN,IGN,IRETN,IGAMN,ICHPSU,ICHPDI,ICHPVO,INORM
  103. & ,MELEMF,IDU,NFAC, NFACE
  104. & ,IGEOMF,IGEOMC, NGCEG, NGCED, NGCF, NLCF, NLCEG, NLCED
  105. & ,ICEN,NCEN,ICHLIM,MELLIM,NLLIM,IRES,NJAC,ICOMP
  106. & ,I1,I2, IBLJAC, IPROBL, IVCO, MELTFA
  107. & ,NSOUPO,IFACT,NELT, ISOUP, IELT, IFAC, IFACG, JG
  108. & ,ISOUP1, ISOUP2, ICOEF,ICOEV
  109. & , ID, IELT1, IELT2, IFAC1, IFAC2
  110. REAL*8 ROG, RUXG, RUYG, UNG, RETG, GAMG, RECG, RECD, PG, VOLG
  111. & , DIAMG, ROD, RUXD, RUYD, UND, RETD, GAMD, PD
  112. & , CNX, CNY, DCFL, DTPS
  113. & , SURF, SIGMAF
  114. & , UNSDT, UNSDTF, UXD, UYD
  115. & , FR, FRUX, FRUY, FRET, COEF
  116. & , CTX, CTY, RHTD, UTD, UTG, UXG, UYG, QG, CG, UCOG
  117. & , ROF, PF, UNF, GAMF, UCOF, CF, PHI2, COEF1
  118. & , QN
  119. C
  120. CHARACTER*8 TYPE
  121. LOGICAL LOGINV, LOGJAC
  122. C
  123. C**** LES INCLUDES
  124. C
  125.  
  126. -INC PPARAM
  127. -INC CCOPTIO
  128. -INC SMCHPOI
  129. POINTEUR MPOVSU.MPOVAL, MPOVDI.MPOVAL
  130. & , MPODU.MPOVAL, MPOVOL.MPOVAL
  131. & , MPRN.MPOVAL, MPGN.MPOVAL, MPRETN.MPOVAL, MPGAMN.MPOVAL
  132. & , MPNORM.MPOVAL, MPLIM.MPOVAL, MPORES.MPOVAL, MPOCO.MPOVAL
  133. & , MPOCO1.MPOVAL, MELEFL.MELEME, MELEMC.MELEME
  134. & , MPCOEV.MPOVAL
  135. -INC SMCOORD
  136. -INC SMELEME
  137. -INC SMLMOTS
  138. -INC SMLENTI
  139. POINTEUR MLELIM.MLENTI, MLESUP.MLENTI
  140. C
  141. C**** POINTEUR vecteurs
  142. C
  143. SEGMENT VEC
  144. REAL*8 VALVEC(I1)
  145. ENDSEGMENT
  146. POINTEUR SIGMA0.VEC, AN0.VEC, DN0.VEC, D1.VEC
  147. & , USDTI.VEC, PHI2V.VEC, SIGMAV.VEC
  148. C
  149. C**** POINTEUR matriciels
  150. C
  151. SEGMENT MAT
  152. REAL*8 VAL(I1,I2)
  153. ENDSEGMENT
  154. POINTEUR CONS0.MAT, CONS1.MAT, BN0.MAT, BN1.MAT
  155. & , CN0.MAT, CN1.MAT, DU.MAT
  156. & , RES.MAT
  157. & , Q1.MAT, Q2.MAT
  158. C
  159. C
  160. C**** IPROBL: si different de 0, un probleme a été detecté
  161. C
  162. IPROBL=0
  163. C
  164. C**** Initialisation des MLENTI des conditions aux limites
  165. C
  166. C
  167. CALL KRIPAD(MELLIM,MLELIM)
  168. C SEGINI MLELIM
  169. C
  170. C**** Initialisation des MELEMEs
  171. C
  172. C 'CENTRE', 'FACEL'
  173. C
  174. SEGACT MELEFL
  175. NFAC = MELEFL.NUM(/2)
  176. C
  177. C**** KRIPAD pour la correspondance global/local de centre
  178. C
  179. CALL KRIPAD(MELEMC,MLENT1)
  180. C
  181. C**** MLENTI1 a MCORD.XCOORD(/1)/(IDIM+1) elements
  182. C
  183. C Si i est le numero global d'un noeud de ICEN,
  184. C MLENT1.LECT(i) contient sa position, i.e.
  185. C
  186. C I = numero global du noeud centre
  187. C MLENT1.LECT(i) = numero local du noeud centre
  188. C
  189. C MLENT1 déjà activé, i.e.
  190. C
  191. C SEGINI MLENT1
  192. C
  193. C
  194. C**** KRIPAD pour la correspondance global/local de 'FACE'
  195. C
  196. CALL KRIPAD(MELEMF,MLENT2)
  197. C SEGINI MLENT2
  198. C
  199. C
  200. C**** CHPOINTs de la table DOMAINE
  201. C
  202. CALL LICHT(ICHPSU,MPOVSU,TYPE,IGEOMF)
  203. CALL LICHT(ICHPDI,MPOVDI,TYPE,IGEOMC)
  204. CALL LICHT(ICHPVO,MPOVOL,TYPE,IGEOMC)
  205. CALL LICHT(INORM,MPNORM,TYPE,IGEOMC)
  206. C
  207. C**** LICHT active les MPOVALs en *MOD
  208. C
  209. C i.e.
  210. C
  211. C SEGACT MPOVSU*MOD
  212. C SEGACT MPOVOL*MOD
  213. C SEGACT MPOVDI*MOD
  214. C SEGACT MPNORM*MOD
  215. C
  216. CALL LICHT(IDU,MPODU,TYPE,IGEOMC)
  217. C SEGACT MPODU*MOD
  218. C
  219. C USDTI initialisé a zero; USDTI = 1 / DT
  220. C
  221. NCEN=MPOVOL.VPOCHA(/1)
  222. I1=NCEN
  223. SEGINI USDTI
  224. C
  225. CALL LICHT(IRES,MPORES,TYPE,IGEOMC)
  226. CALL LICHT(IRN,MPRN,TYPE,IGEOMC)
  227. CALL LICHT(IGN,MPGN,TYPE,IGEOMC)
  228. CALL LICHT(IRETN,MPRETN,TYPE,IGEOMC)
  229. CALL LICHT(IGAMN,MPGAMN,TYPE,IGEOMC)
  230. CALL LICHT(IVCO,MPOCO,TYPE,IGEOMC)
  231. CALL LICHT(ICHLIM,MPLIM,TYPE,MELLIM)
  232. CALL LICHT(ICOEV,MPCOEV,TYPE,IGEOMC)
  233. C
  234. C SEGACT MPORES*MOD
  235. C SEGACT MPRN*MOD
  236. C SEGACT MPGN*MOD
  237. C SEGACT MPRETN*MOD
  238. C SEGACT MPGAMN*MOD
  239. C SEGACT MPOCO
  240. C SEGACT MPLIM*MOD
  241. C SEGACT MPCOEV*MOD
  242. C
  243. SEGINI, MPOCO1=MPOCO
  244. C
  245. C**** MPOCO1 is the "corrected cut-off" speed.
  246. C It is bigger than the given cut-off and the local
  247. C speed.
  248. C
  249. IF(IGEOMF .NE. MELEMF)THEN
  250. WRITE(IOIMP,*) 'Anomalie dedans kfm11.eso'
  251. WRITE(IOIMP,*) 'Probleme de SPG'
  252. C 21 2
  253. C Données incompatibles
  254. CALL ERREUR(21)
  255. GOTO 9999
  256. ENDIF
  257. IF(IGEOMC .NE. MELEMC)THEN
  258. WRITE(IOIMP,*) 'Anomalie dedans kfm11.eso'
  259. WRITE(IOIMP,*) 'Probleme de SPG'
  260. C 21 2
  261. C Données incompatibles
  262. CALL ERREUR(21)
  263. GOTO 9999
  264. ENDIF
  265. C
  266. C**** On initialise GAMMA=I+(1-phi2)/phi2*Q1.(Q2)^t
  267. C
  268. I1=4
  269. I2=NCEN
  270. SEGINI Q1
  271. SEGINI Q2
  272. C
  273. C**** On initialise le segment de travail D1
  274. C
  275. I1=4
  276. SEGINI D1
  277. C
  278. C**** On initialise AN0, DN0, PHI2V
  279. C
  280. I1=NCEN
  281. SEGINI AN0
  282. SEGINI DN0
  283. SEGINI PHI2V
  284. C
  285. C**** On initialise BN0
  286. C
  287. I1=4
  288. I2=NCEN
  289. SEGINI BN0
  290. C
  291. C**** On initialise BN1
  292. C
  293. I1=4
  294. I2=NCEN
  295. SEGINI BN1
  296. C
  297. C**** On initialise CN0
  298. C
  299. I1=4
  300. I2=NCEN
  301. SEGINI CN0
  302. C
  303. C**** On initialise CN1
  304. C
  305. I1=4
  306. I2=NCEN
  307. SEGINI CN1
  308. C
  309. C**** On initialise SIGMA0, SIGMAV
  310. C
  311. I1=NFAC
  312. SEGINI SIGMA0
  313. SEGINI SIGMAV
  314. C
  315. C**** RES
  316. C
  317. I1=4
  318. I2=NCEN
  319. SEGINI RES
  320. DO ICEN=1,NCEN,1
  321. DO ICOMP=1,4,1
  322. RES.VAL(ICOMP,ICEN)=MPORES.VPOCHA(ICEN,ICOMP)
  323. ENDDO
  324. ENDDO
  325. SEGDES MPORES
  326. C
  327. C***** DU (increment des variables conservatives)
  328. C
  329. I1=4
  330. I2=NCEN
  331. SEGINI DU
  332. C
  333. C**** Les variables conservatives
  334. C
  335. C CONS1.VAL contient les variables conservatives + gamma
  336. C i.e. rho(i) = CONS.VAL(1,i)
  337. C rhoux(i) = CONS.VAL(2,i)
  338. C rhouy(i) = CONS.VAL(3,i)
  339. C rhoet(i) = CONS.VAL(4,i)
  340. C gam(i) = CONS.VAL(5,i)
  341. C
  342. I1=5
  343. I2=NCEN
  344. SEGINI CONS0
  345. DO ICEN=1,NCEN,1
  346. CONS0.VAL(1,ICEN)=MPRN.VPOCHA(ICEN,1)
  347. CONS0.VAL(2,ICEN)=MPGN.VPOCHA(ICEN,1)
  348. CONS0.VAL(3,ICEN)=MPGN.VPOCHA(ICEN,2)
  349. CONS0.VAL(4,ICEN)=MPRETN.VPOCHA(ICEN,1)
  350. CONS0.VAL(5,ICEN)=MPGAMN.VPOCHA(ICEN,1)
  351. ENDDO
  352. SEGDES MPRN
  353. SEGDES MPRETN
  354. SEGDES MPGN
  355. SEGDES MPGAMN
  356. C
  357. SEGINI, CONS1=CONS0
  358. C
  359. C**** Storage of l-1 values of F at the l Jacobi iteration
  360. C
  361. IPT1=MELTFA
  362. SEGACT IPT1
  363. NSOUPO= IPT1.LISOUS(/1)
  364. NSOUPO=MAX(NSOUPO,1)
  365. JG=NSOUPO
  366. SEGINI MLESUP
  367. IFACT=0
  368. IF(NSOUPO .EQ. 1)THEN
  369. MLESUP.LECT(1)=IPT1
  370. NFACE=IPT1.NUM(/1)
  371. NELT=IPT1.NUM(/2)
  372. IFACT=IFACT+(NFACE*NELT)
  373. ELSE
  374. DO ISOUP = 1, NSOUPO, 1
  375. IPT2=IPT1.LISOUS(ISOUP)
  376. MLESUP.LECT(ISOUP)=IPT2
  377. SEGACT IPT2
  378. NFACE=IPT2.NUM(/1)
  379. NELT=IPT2.NUM(/2)
  380. IFACT=IFACT+(NFACE*NELT)
  381. ENDDO
  382. ENDIF
  383. C
  384. C***********************************************************************
  385. C**** FIRST JACOBI ITERATION *******************************************
  386. C***********************************************************************
  387. C
  388. C
  389. C**** LOOP on ELTFA to compute:
  390. C
  391. C AN0_i = 1/(2 \Omega_i) \sum_j \sigma_i,j S_j
  392. C SIGMA0_j
  393. C The cut-off in each cell
  394. C The reciprocal of the dual time step USDTI
  395. C
  396. ICEN=0
  397. IFACG=0
  398. DO ISOUP=1,NSOUPO,1
  399. IPT2=MLESUP.LECT(ISOUP)
  400. NFACE=IPT2.NUM(/1)
  401. NELT=IPT2.NUM(/2)
  402. DO IELT=1,NELT,1
  403. ICEN=ICEN+1
  404. DO IFAC=1,NFACE,1
  405. C IFACG increase with IFAC,IELT,ISOUP
  406. IFACG = IFACG+1
  407. NGCF = IPT2.NUM(IFAC,IELT)
  408. NLCF = MLENT2.LECT(NGCF)
  409. C
  410. C************* NLCF = numero local du centre de facel
  411. C NGCF = numero global du centre de facel
  412. C NGCEG = numero global du centre ELT "gauche"
  413. C NLCEG = numero local du centre ELT "gauche"
  414. C NGCED = numero global du centre ELT "droite"
  415. C NLCED = numero local du centre ELT "droite"
  416. C
  417. NGCEG = MELEFL.NUM(1,NLCF)
  418. NGCED = MELEFL.NUM(3,NLCF)
  419. NLCEG = MLENT1.LECT(NGCEG)
  420. NLCED = MLENT1.LECT(NGCED)
  421. C
  422. CNX = MPNORM.VPOCHA(NLCF,1)
  423. CNY = MPNORM.VPOCHA(NLCF,2)
  424. CTX = -1.0D0 * CNY
  425. CTY = CNX
  426. C
  427. C************* Left or right?
  428. C
  429. IF(NLCEG .EQ. ICEN)THEN
  430. LOGINV=.FALSE.
  431. ELSEIF(NLCED .EQ. ICEN)THEN
  432. LOGINV=.TRUE.
  433. ELSE
  434. WRITE(IOIMP,*) 'Anomalie dans kfm13.eso'
  435. WRITE(IOIMP,*) 'Probleme de SPG'
  436. C 21 2
  437. C Données incompatibles
  438. CALL ERREUR(21)
  439. GOTO 9999
  440. ENDIF
  441. C************* If right, inversion
  442. IF(LOGINV) THEN
  443. NLCED=NLCEG
  444. NLCEG=ICEN
  445. CNX = -1.0D0*CNX
  446. CNY = -1.0D0*CNY
  447. CTX = -1.0D0*CTX
  448. CTY = -1.0D0*CTY
  449. ENDIF
  450. C
  451. SURF = MPOVSU.VPOCHA(NLCF,1)
  452. C
  453. C************* Récupération des Etats "gauche" et "droite"
  454. C
  455. C
  456. ROG = CONS0.VAL(1,NLCEG)
  457. RUXG = CONS0.VAL(2,NLCEG)
  458. RUYG = CONS0.VAL(3,NLCEG)
  459. UXG = RUXG / ROG
  460. UYG = RUYG / ROG
  461. UNG = (UXG * CNX) + (UYG * CNY)
  462. UTG = (UXG * CTX) + (UYG * CTY)
  463. RETG = CONS0.VAL(4,NLCEG)
  464. GAMG = CONS0.VAL(5,NLCEG)
  465. RECG = 0.5D0 * ((RUXG * RUXG) + (RUYG*RUYG))
  466. RECG = RECG / ROG
  467. PG = (GAMG - 1.0D0) * (RETG - RECG)
  468. VOLG = MPOVOL.VPOCHA(NLCEG,1)
  469. DIAMG = MPOVDI.VPOCHA(NLCEG,1)
  470. C
  471. ROD = CONS0.VAL(1,NLCED)
  472. RUXD = CONS0.VAL(2,NLCED)
  473. RUYD = CONS0.VAL(3,NLCED)
  474. UXD = RUXD / ROD
  475. UYD = RUYD / ROD
  476. RETD = CONS0.VAL(4,NLCED)
  477. GAMD = CONS0.VAL(5,NLCED)
  478. RECD = 0.5D0 * ((RUXD * RUXD) + (RUYD*RUYD))
  479. RECD = RECD / ROD
  480. PD = (GAMD - 1.0D0) * (RETD - RECD)
  481. UND = (UXD * CNX) + (UYD * CNY)
  482. UTD = (UXD * CTX) + (UYD * CTY)
  483. C
  484. IF(NLCEG .EQ. NLCED)THEN
  485. C Murs ou condition limite
  486. NLLIM=MLELIM.LECT(NGCF)
  487. IF(NLLIM .EQ.0)THEN
  488. C Mur
  489. UND = -1.0D0 * UNG
  490. UTD = UTG
  491. UXD = UND * CNX + UTD * CTX
  492. UYD = UND * CNY + UTD * CTY
  493. RUXD = ROD*UXD
  494. RUYD = ROD*UYD
  495. ELSE
  496. ROD = MPLIM.VPOCHA(NLLIM,1)
  497. UXD = MPLIM.VPOCHA(NLLIM,2)
  498. UYD = MPLIM.VPOCHA(NLLIM,3)
  499. RUXD = ROD*UXD
  500. RUYD = ROD*UYD
  501. PD = MPLIM.VPOCHA(NLLIM,4)
  502. GAMD = GAMG
  503. UND = (UXD * CNX) + (UYD * CNY)
  504. UTD = (UXD * CTX) + (UYD * CTY)
  505. RETD = ((1.0D0/(GAMD - 1.0D0))*PD)
  506. & +(0.5D0*ROD*((UXD*UXD)+(UYD*UYD)))
  507. ENDIF
  508. ENDIF
  509. C
  510. C************* We check that density and pressure are positive
  511. C
  512. IF((ROG .LE. 0.0D0) .OR. (ROD .LE. 0.0D0) .OR.
  513. & (PG .LE. 0.0D0) .OR. (PD .LE. 0.0D0))THEN
  514. WRITE(IOIMP,*) 'FMM'
  515. WRITE(IOIMP,*) 'TEST'
  516. C 22 0
  517. C**************** Opération malvenue. Résultat douteux
  518. C
  519. CALL ERREUR(22)
  520. IPROBL = 1
  521. GOTO 9998
  522. ENDIF
  523. C
  524. C************* We compute the interfacial state
  525. C
  526. ROF = 0.5D0*(ROG+ROD)
  527. PF = 0.5D0*(PG+PD)
  528. UNF = 0.5D0*(UNG+UND)
  529. GAMF = 0.5D0*(GAMG+GAMD)
  530. C
  531. C************* We compute SIGMA and the corrected cut-off speed
  532. C
  533. UCOF=MAX(MPOCO.VPOCHA(NLCEG,1),MPOCO.VPOCHA(NLCED,1))
  534. UCOF=MAX(UCOF,(((UNG*UNG)+(UTG*UTG))**0.5D0))
  535. UCOF=MAX(UCOF,(((UND*UND)+(UTD*UTD))**0.5D0))
  536. IF(UCOF .GT. MPOCO1.VPOCHA(NLCEG,1))
  537. & MPOCO1.VPOCHA(NLCEG,1)= UCOF
  538. C
  539. QN=ABS(UNF)
  540. CF=(GAMF*PF/ROF)**0.5D0
  541. IF(UCOF .GE. CF)THEN
  542. PHI2 = 1.0D0
  543. ELSEIF(QN .GT. CF)THEN
  544. PHI2 = 1.0D0
  545. ELSEIF(QN .LT. UCOF)THEN
  546. PHI2 = UCOF / CF
  547. ELSE
  548. PHI2 = QN / CF
  549. ENDIF
  550. PHI2=PHI2*PHI2
  551. C
  552. SIGMAF=(1.0D0-PHI2)*QN
  553. SIGMAF=SIGMAF*SIGMAF
  554. SIGMAF=SIGMAF+(4.0D0*PHI2*CF*CF)
  555. SIGMAF=SIGMAF**0.5D0
  556. SIGMAF=SIGMAF+((1.0D0+PHI2)*QN)
  557. SIGMAF=0.5D0*SIGMAF
  558. C
  559. SIGMA0.VALVEC(NLCF)=SIGMAF
  560. C
  561. C************* We compute AN0
  562. C
  563. AN0.VALVEC(NLCEG)=AN0.VALVEC(NLCEG)
  564. & +(0.5D0*SIGMAF*SURF/VOLG)
  565. C
  566. C************* We compute the dual time step
  567. C
  568. UNSDT=USDTI.VALVEC(NLCEG)
  569. UNSDTF = SIGMAF / DIAMG
  570. IF(UNSDT .LT. UNSDTF) USDTI.VALVEC(NLCEG)=UNSDTF
  571. C
  572. C************* We compute SIGMAV
  573. C
  574. C COEF=FG
  575. COEF=(MCOORD.XCOOR(((NGCEG-1)*3)+1)-
  576. & MCOORD.XCOOR(((NGCF-1)*3)+1))*CNX
  577. COEF=COEF+
  578. & ((MCOORD.XCOOR(((NGCEG-1)*3)+2)-
  579. & MCOORD.XCOOR(((NGCF-1)*3)+2))*CNY)
  580. C COEF1=FD
  581. COEF1=(MCOORD.XCOOR(((NGCED-1)*3)+1)-
  582. & MCOORD.XCOOR(((NGCF-1)*3)+1))*CNX
  583. COEF1=COEF1+
  584. & ((MCOORD.XCOOR(((NGCED-1)*3)+2)-
  585. & MCOORD.XCOOR(((NGCF-1)*3)+2))*CNY)
  586. C COEF=|FG|+|FD|
  587. COEF=ABS(COEF)+ABS(COEF1)
  588. SIGMAF=0.5D0*(MPCOEV.VPOCHA(NLCEG,1)+
  589. & MPCOEV.VPOCHA(NLCED,1))/COEF
  590. SIGMAV.VALVEC(NLCF)=SIGMAF
  591. C
  592. C************* We compute the contribution of SIGMAV to
  593. C the diagonal part of the matrix to invert
  594. C
  595. C In the given report, DNO is a_i^0, i.e.
  596. C DN0 = AN0 (previously defined) +
  597. C + (\frac{1}{{\Omega_i}}
  598. C \sum_j \sigma_{V,i,j}^{0} S_j)
  599. C + 1 / \Delta t^n
  600. C
  601. COEF=SURF/VOLG
  602. DN0.VALVEC(NLCEG)=DN0.VALVEC(NLCEG)+COEF*SIGMAF
  603. C
  604. C
  605. C************* We compute the flux
  606. C FLU.VALVEC(1:4,IFAC) flux in IFAC face
  607. C 1 -> mass
  608. C 2 -> momentum (x)
  609. C 3 -> momentum (y)
  610. C 4 -> energy
  611. C
  612. RHTD = RETD+PD
  613. FR = (ROD*UND)
  614. FRUX = (ROD*UND*UXD)+(PD*CNX)
  615. FRUY = (ROD*UND*UYD)+(PD*CNY)
  616. FRET = (UND*RHTD)
  617. C
  618. COEF = SURF/(2.0D0*VOLG)
  619. C
  620. BN0.VAL(1,NLCEG) = BN0.VAL(1,NLCEG)
  621. & + FR * COEF
  622. BN0.VAL(2,NLCEG) = BN0.VAL(2,NLCEG)
  623. & + FRUX * COEF
  624. BN0.VAL(3,NLCEG) = BN0.VAL(3,NLCEG)
  625. & + FRUY * COEF
  626. BN0.VAL(4,NLCEG) = BN0.VAL(4,NLCEG)
  627. & + FRET * COEF
  628. C
  629. C************* Viscous contribution
  630. C
  631. COEF=SURF*SIGMAV.VALVEC(NLCF)/VOLG
  632. C
  633. BN0.VAL(1,NLCEG) = BN0.VAL(1,NLCEG)
  634. & - (COEF * ROD)
  635. BN0.VAL(2,NLCEG) = BN0.VAL(2,NLCEG)
  636. & - (COEF * RUXD)
  637. BN0.VAL(3,NLCEG) = BN0.VAL(3,NLCEG)
  638. & - (COEF * RUYD)
  639. BN0.VAL(4,NLCEG) = BN0.VAL(4,NLCEG)
  640. & - (COEF * RETD)
  641. C
  642. C************* On calcule CN0
  643. C
  644. C CN0 in the referred report is given by
  645. C \sum_j
  646. C \left\{
  647. C \frac{S_j}{2 \Omega_i} ~
  648. C \left(
  649. C \sigma_{i,j}^{0}
  650. C \mathbf{U}_{j,R}^{n+1,m}
  651. C \right)
  652. C \right\}
  653. C
  654. C
  655. COEF=SURF*SIGMA0.VALVEC(NLCF)/(2.0D0*VOLG)
  656. C
  657. CN0.VAL(1,NLCEG) = CN0.VAL(1,NLCEG)
  658. & + (COEF * ROD)
  659. CN0.VAL(2,NLCEG) = CN0.VAL(2,NLCEG)
  660. & + (COEF * RUXD)
  661. CN0.VAL(3,NLCEG) = CN0.VAL(3,NLCEG)
  662. & + (COEF * RUYD)
  663. CN0.VAL(4,NLCEG) = CN0.VAL(4,NLCEG)
  664. & + (COEF * RETD)
  665.  
  666. ENDDO
  667. C
  668. C********** End of loop on the faces of the element
  669. C
  670. C N.B.: ICEN = NLCEG
  671. C
  672. C
  673. C Computation of the low-Mach preconditioning Matrix
  674. C
  675. CG=(GAMG*PG/ROG)**0.5D0
  676. UCOG=MPOCO1.VPOCHA(ICEN,1)
  677. QG=2.0D0*RECG/ROG
  678. QG=QG**0.5D0
  679. C
  680. IF(UCOG .GE. CG)THEN
  681. PHI2 = 1.0D0
  682. ELSEIF(QG .GT. CG)THEN
  683. PHI2 = 1.0D0
  684. ELSEIF(QG .LT. UCOG)THEN
  685. PHI2 = UCOG / CG
  686. ELSE
  687. PHI2 = QG / CG
  688. ENDIF
  689. PHI2=PHI2*PHI2
  690. PHI2V.VALVEC(ICEN)=PHI2
  691. C
  692. Q2.VAL(1,ICEN)=(0.5D0*QG*QG)
  693. Q2.VAL(2,ICEN)=-1.0D0*RUXG/ROG
  694. Q2.VAL(3,ICEN)=-1.0D0*RUYG/ROG
  695. Q2.VAL(4,ICEN)=1.0D0
  696. C
  697. COEF1=(GAMG-1.0D0)/(CG*CG)
  698. COEF=(1.0D0/COEF1)+(0.5D0*QG*QG)
  699. C
  700. Q1.VAL(1,ICEN)=COEF1
  701. Q1.VAL(2,ICEN)=COEF1*RUXG/ROG
  702. Q1.VAL(3,ICEN)=COEF1*RUYG/ROG
  703. Q1.VAL(4,ICEN)=COEF1*COEF
  704. C
  705. C
  706. C Computation of the diagonal coefficients
  707. C
  708. AN0.VALVEC(ICEN)=AN0.VALVEC(ICEN)
  709. C & +(USDTI.VALVEC(ICEN)*2.0D0/DCFL)
  710. C
  711. DN0.VALVEC(ICEN)=DN0.VALVEC(ICEN)+(1.0D0/DTPS)
  712. & +(USDTI.VALVEC(ICEN)*2.0D0/DCFL)
  713. C
  714. ENDDO
  715. ENDDO
  716. C
  717. C***********************************************************************
  718. C**** END FIRST JACOBI ITERATION ***************************************
  719. C***********************************************************************
  720. C
  721. C***********************************************************************
  722. C**** JACOBI LOOP ******************************************************
  723. C***********************************************************************
  724. C
  725. C
  726. LOGJAC=.TRUE.
  727. C
  728. DO IBLJAC=1,NJAC,1
  729. C
  730. C
  731. C Si ICOEF=2 (i.e. si on a "LJACOF" (voir kfm1.eso))
  732. C alors relaxation SGS avec uniquement des balayages "forward"
  733. C
  734. C Si ICOEF=3 (i.e. si on a "LJACOB")
  735. C alors relaxation SGS avec uniquement des balayages "backward"
  736. C
  737. C Sinon (i.e. si on a "LJACOFB")
  738. C alors relaxation SGS avec des balayages "forward" et "backward"
  739. C
  740. IF(ICOEF .EQ. 2)THEN
  741. LOGJAC=.TRUE.
  742. ELSEIF(ICOEF .EQ. 3)THEN
  743. LOGJAC=.FALSE.
  744. ELSE
  745. LOGINV=LOGJAC
  746. LOGJAC=(IBLJAC / 2 * 2) .EQ. IBLJAC
  747. IF(LOGJAC)THEN
  748. LOGJAC= .NOT. LOGINV
  749. ELSE
  750. LOGJAC= LOGINV
  751. ENDIF
  752. ENDIF
  753. C
  754. IF(LOGJAC)THEN
  755. ICEN=0
  756. IFACG=0
  757. ID=1
  758. ISOUP1=1
  759. ISOUP2=NSOUPO
  760. ELSE
  761. ICEN=NCEN+1
  762. IFACG=IFACT+1
  763. ID=-1
  764. ISOUP1=NSOUPO
  765. ISOUP2=1
  766. ENDIF
  767. C
  768. DO ISOUP=ISOUP1,ISOUP2,ID
  769. IPT2=MLESUP.LECT(ISOUP)
  770. NFACE=IPT2.NUM(/1)
  771. NELT=IPT2.NUM(/2)
  772. C
  773. IF(LOGJAC)THEN
  774. IELT1=1
  775. IELT2=NELT
  776. IFAC1=1
  777. IFAC2=NFACE
  778. ELSE
  779. IELT2=1
  780. IELT1=NELT
  781. IFAC2=1
  782. IFAC1=NFACE
  783. ENDIF
  784. C
  785. DO IELT=IELT1,IELT2,ID
  786. ICEN=ICEN+ID
  787. DO IFAC=IFAC1,IFAC2,ID
  788. C IFACG increase with IFAC,IELT,ISOUP
  789. IFACG = IFACG+ID
  790. NGCF = IPT2.NUM(IFAC,IELT)
  791. NLCF = MLENT2.LECT(NGCF)
  792. NGCEG = MELEFL.NUM(1,NLCF)
  793. NGCED = MELEFL.NUM(3,NLCF)
  794. NLCEG = MLENT1.LECT(NGCEG)
  795. NLCED = MLENT1.LECT(NGCED)
  796. C
  797. CNX = MPNORM.VPOCHA(NLCF,1)
  798. CNY = MPNORM.VPOCHA(NLCF,2)
  799. CTX = -1.0D0 * CNY
  800. CTY = CNX
  801. C
  802. C**************** Left or right?
  803. C
  804. IF(NLCEG .EQ. ICEN)THEN
  805. LOGINV=.FALSE.
  806. ELSEIF(NLCED .EQ. ICEN)THEN
  807. LOGINV=.TRUE.
  808. ELSE
  809. WRITE(IOIMP,*) 'Anomalie dedans kfm11.eso'
  810. WRITE(IOIMP,*) 'Probleme de SPG'
  811. C 21 2
  812. C Données incompatibles
  813. CALL ERREUR(21)
  814. GOTO 9999
  815. ENDIF
  816. C**************** If right, inversion
  817. IF(LOGINV) THEN
  818. NLCED=NLCEG
  819. NLCEG=ICEN
  820. CNX = -1.0D0*CNX
  821. CNY = -1.0D0*CNY
  822. CTX = -1.0D0*CTX
  823. CTY = -1.0D0*CTY
  824. ENDIF
  825. C
  826. SURF = MPOVSU.VPOCHA(NLCF,1)
  827. SIGMAF = SIGMA0.VALVEC(NLCF)
  828. C
  829. C**************** Recuperation des Etats "gauche" et "droite"
  830. C
  831. ROG = CONS1.VAL(1,NLCEG)
  832. RUXG = CONS1.VAL(2,NLCEG)
  833. RUYG = CONS1.VAL(3,NLCEG)
  834. ROG = CONS1.VAL(1,NLCEG)
  835. RUXG = CONS1.VAL(2,NLCEG)
  836. RUYG = CONS1.VAL(3,NLCEG)
  837. UXG = RUXG / ROG
  838. UYG = RUYG / ROG
  839. UNG = (UXG * CNX) + (UYG * CNY)
  840. UTG = (UXG * CTX) + (UYG * CTY)
  841. RETG = CONS1.VAL(4,NLCEG)
  842. GAMG = CONS1.VAL(5,NLCEG)
  843. RECG = 0.5D0 * ((RUXG * RUXG) + (RUYG*RUYG))
  844. RECG = RECG / ROG
  845. PG = (GAMG - 1.0D0) * (RETG - RECG)
  846. VOLG = MPOVOL.VPOCHA(NLCEG,1)
  847. C
  848. ROD = CONS1.VAL(1,NLCED)
  849. RUXD = CONS1.VAL(2,NLCED)
  850. RUYD = CONS1.VAL(3,NLCED)
  851. UXD = RUXD / ROD
  852. UYD = RUYD / ROD
  853. RETD = CONS1.VAL(4,NLCED)
  854. GAMD = CONS1.VAL(5,NLCED)
  855. RECD = 0.5D0 * ((RUXD * RUXD) + (RUYD*RUYD))
  856. RECD = RECD / ROD
  857. PD = (GAMD - 1.0D0) * (RETD - RECD)
  858. UND = (UXD * CNX) + (UYD * CNY)
  859. UTD = (UXD * CTX) + (UYD * CTY)
  860. C
  861. IF(NLCEG .EQ. NLCED)THEN
  862. C Murs ou condition limite
  863. NLLIM=MLELIM.LECT(NGCF)
  864. IF(NLLIM .EQ.0)THEN
  865. C Mur
  866. UND = -1.0D0 * UNG
  867. UTD = UTG
  868. UXD = UND * CNX + UTD * CTX
  869. UYD = UND * CNY + UTD * CTY
  870. RUXD = ROD*UXD
  871. RUYD = ROD*UYD
  872. ELSE
  873. ROD = MPLIM.VPOCHA(NLLIM,1)
  874. UXD = MPLIM.VPOCHA(NLLIM,2)
  875. UYD = MPLIM.VPOCHA(NLLIM,3)
  876. RUXD = ROD*UXD
  877. RUYD = ROD*UYD
  878. PD = MPLIM.VPOCHA(NLLIM,4)
  879. GAMD = GAMG
  880. UND = (UXD * CNX) + (UYD * CNY)
  881. UTD = (UXD * CTX) + (UYD * CTY)
  882. RETD = ((1.0D0/(GAMD - 1.0D0))*PD)
  883. & +(0.5D0*ROD*((UXD*UXD)+(UYD*UYD)))
  884. ENDIF
  885. ENDIF
  886. C
  887. C**************** We check that density and pressure are positive
  888. C
  889. IF((ROG .LE. 0.0D0) .OR. (ROD .LE. 0.0D0) .OR.
  890. & (PG .LE. 0.0D0) .OR. (PD .LE. 0.0D0))THEN
  891. WRITE(IOIMP,*) 'FMM'
  892. WRITE(IOIMP,*) 'ITERATION JAC',IBLJAC
  893. WRITE(IOIMP,*) 'ITERATION ICEN',ICEN
  894. WRITE(IOIMP,*) ROG,PG
  895. WRITE(IOIMP,*) ROD,PD
  896. C
  897. C 22 0
  898. C******************* Opération malvenue. Résultat douteux
  899. C
  900. CALL ERREUR(22)
  901. IPROBL = 1
  902. GOTO 9998
  903. ENDIF
  904. C
  905. C
  906. C**************** We compute the flux
  907. C FLU.VALVEC(1:4,IFAC) flux in IFAC face
  908. C 1 -> mass
  909. C 2 -> momentum (x)
  910. C 3 -> momentum (y)
  911. C 4 -> energy
  912. C
  913. RHTD = RETD+PD
  914. FR = (ROD*UND)
  915. FRUX = (ROD*UND*UXD)+(PD*CNX)
  916. FRUY = (ROD*UND*UYD)+(PD*CNY)
  917. FRET = (UND*RHTD)
  918. C
  919. COEF = SURF/(2.0D0*VOLG)
  920. C
  921. BN1.VAL(1,NLCEG) = BN1.VAL(1,NLCEG)
  922. & + FR * COEF
  923. BN1.VAL(2,NLCEG) = BN1.VAL(2,NLCEG)
  924. & + FRUX * COEF
  925. BN1.VAL(3,NLCEG) = BN1.VAL(3,NLCEG)
  926. & + FRUY * COEF
  927. BN1.VAL(4,NLCEG) = BN1.VAL(4,NLCEG)
  928. & + FRET * COEF
  929. C
  930. C**************** Viscous contribution
  931. C
  932. COEF=SURF*SIGMAV.VALVEC(NLCF)/VOLG
  933. C
  934. BN1.VAL(1,NLCEG) = BN1.VAL(1,NLCEG)
  935. & - (COEF * ROD)
  936. BN1.VAL(2,NLCEG) = BN1.VAL(2,NLCEG)
  937. & - (COEF * RUXD)
  938. BN1.VAL(3,NLCEG) = BN1.VAL(3,NLCEG)
  939. & - (COEF * RUYD)
  940. BN1.VAL(4,NLCEG) = BN1.VAL(4,NLCEG)
  941. & - (COEF * RETD)
  942. C
  943. C**************** On calcule DIS1
  944. C
  945. C DIS1 in the referred report is given by
  946. C \sum_j
  947. C \left\{
  948. C \frac{S_j}{2 \Omega_i} ~
  949. C \left(
  950. C \sigma_{i,j}^{0}
  951. C \mathbf{U}_{j,R}^{n+1,m,l}
  952. C \right)
  953. C \right\}
  954. C
  955. C
  956. COEF=SURF*SIGMA0.VALVEC(NLCF)/(2.0D0*VOLG)
  957. C
  958. CN1.VAL(1,NLCEG) = CN1.VAL(1,NLCEG)
  959. & + (COEF * ROD)
  960. CN1.VAL(2,NLCEG) = CN1.VAL(2,NLCEG)
  961. & + (COEF * RUXD)
  962. CN1.VAL(3,NLCEG) = CN1.VAL(3,NLCEG)
  963. & + (COEF * RUYD)
  964. CN1.VAL(4,NLCEG) = CN1.VAL(4,NLCEG)
  965. & + (COEF * RETD)
  966.  
  967. ENDDO
  968. C
  969. C************* End of the loop on the faces of the element
  970. C
  971. DO ICOMP=1,4,1
  972. D1.VALVEC(ICOMP) = 0.0D0
  973. ENDDO
  974. C
  975. COEF=0.0D0
  976. DO I1=1,4,1
  977. COEF=COEF+(Q2.VAL(I1,ICEN)
  978. & *(CN1.VAL(I1,ICEN) - CN0.VAL(I1,ICEN)))
  979. ENDDO
  980. COEF=COEF*(1.0D0-PHI2V.VALVEC(ICEN))
  981. & /PHI2V.VALVEC(ICEN)
  982. C
  983. DO I1=1,4,1
  984. D1.VALVEC(I1)=(CN1.VAL(I1,ICEN)
  985. & - CN0.VAL(I1,ICEN))
  986. & +(COEF*Q1.VAL(I1,ICEN))
  987. c write(6,*)D1.VALVEC(I1)
  988. ENDDO
  989. C
  990. C************* At this moment D1 = \Gamma \cdot (\Delta CN1)
  991. C
  992. DO ICOMP=1,4,1
  993. C
  994. C************* First increment
  995. C
  996. D1.VALVEC(ICOMP) = (D1.VALVEC(ICOMP)
  997. & +RES.VAL(ICOMP,ICEN)
  998. & +(BN0.VAL(ICOMP,ICEN)-BN1.VAL(ICOMP,ICEN)))
  999. & /(AN0.VALVEC(ICEN)+DN0.VALVEC(ICEN))
  1000. ENDDO
  1001. C
  1002. C************* At this moment, in the referred report,
  1003. C D1 is (\delta \mathbf{U}')^{l+1}_i in section A3
  1004. C
  1005. C************* Second increment
  1006. C
  1007. COEF=0.0D0
  1008. DO I1=1,4,1
  1009. COEF=COEF+(Q2.VAL(I1,ICEN)*D1.VALVEC(I1))
  1010. ENDDO
  1011. C
  1012. C************* COEF is the scalar product between Q2 and the first
  1013. C increment.
  1014. C Let us multiply it by
  1015. C b_i^0 / (a_i^0 + b_i^0)
  1016. C
  1017. COEF=COEF*AN0.VALVEC(ICEN)
  1018. & *(PHI2V.VALVEC(ICEN)-1.0D0)
  1019. COEF=COEF/(AN0.VALVEC(ICEN)+(DN0.VALVEC(ICEN)
  1020. & *PHI2V.VALVEC(ICEN)))
  1021. C
  1022. DO I1=1,4,1
  1023. D1.VALVEC(I1)=D1.VALVEC(I1)+COEF*Q1.VAL(I1,ICEN)
  1024. ENDDO
  1025. C
  1026. C************* D1 = \delta \mathbf{U}
  1027. C
  1028. DO ICOMP=1,4,1
  1029. DU.VAL(ICOMP,ICEN) = D1.VALVEC(ICOMP)
  1030. C
  1031. CONS1.VAL(ICOMP,ICEN) = CONS0.VAL(ICOMP,ICEN)
  1032. & + D1.VALVEC(ICOMP)
  1033. C
  1034. BN1.VAL(ICOMP,ICEN) = 0.0D0
  1035. CN1.VAL(ICOMP,ICEN) = 0.0D0
  1036. ENDDO
  1037. C
  1038. C********** End of the loop on the elements
  1039. ENDDO
  1040. C
  1041. C******* End of the loop on the Domains
  1042. ENDDO
  1043. C
  1044. C**** End of the Jacobi loop
  1045. ENDDO
  1046. C
  1047. 9998 CONTINUE
  1048. DO ICEN=1,NCEN,1
  1049. DO ICOMP=1,4,1
  1050. MPODU.VPOCHA(ICEN,ICOMP) = DU.VAL(ICOMP,ICEN)
  1051. ENDDO
  1052. ENDDO
  1053. C
  1054. SEGSUP DU
  1055. SEGSUP RES
  1056. SEGSUP CONS0
  1057. SEGSUP CONS1
  1058. SEGSUP Q1
  1059. SEGSUP Q2
  1060. SEGSUP SIGMA0
  1061. SEGSUP AN0
  1062. SEGSUP AN0
  1063. SEGSUP BN0
  1064. SEGSUP BN1
  1065. SEGSUP CN0
  1066. SEGSUP CN1
  1067. SEGSUP DN0
  1068. SEGSUP PHI2V
  1069. SEGSUP USDTI
  1070. C
  1071. SEGDES MPOVSU
  1072. SEGDES MPOVDI
  1073. SEGDES MPOVOL
  1074. SEGDES MPNORM
  1075. SEGDES MPOCO
  1076. SEGDES MPCOEV
  1077. C
  1078. SEGSUP MPOCO1
  1079. C
  1080. SEGDES MPODU
  1081. C
  1082. SEGDES MELEFL
  1083. SEGSUP MLENT1
  1084. SEGSUP MLENT2
  1085. C
  1086. SEGSUP MLELIM
  1087. IF(MPLIM .GT. 0) SEGDES MPLIM
  1088. C
  1089. DO ISOUP=1,NSOUPO,1
  1090. IPT2=MLESUP.LECT(ISOUP)
  1091. SEGDES IPT2
  1092. ENDDO
  1093. IPT2 = MELTFA
  1094. IF(ISOUP .GT. 1) SEGDES IPT2
  1095. SEGSUP MLESUP
  1096. C
  1097. 9999 CONTINUE
  1098. RETURN
  1099. END
  1100. C
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales