Télécharger nlin_cavity.dgibi

Retour à la liste

Numérotation des lignes :

  1. * fichier : nlin_cavity.dgibi
  2. *************************************************************************
  3. *
  4. * NOM : nlin_cavity.dgibi
  5. *
  6. * DESCRIPTION : We compute the flow governed by the incompressible
  7. * Navier-Stokes equations in a lid driven cavity.
  8. *
  9. * LANGAGE : GIBIANE-CAST3M
  10. * AUTEUR : Alberto BECCANTINI (CEA/DEN/DM2S/SFME/LTMF)
  11. * mél : beccantini@cea.fr
  12. *************************************************************************
  13. * Prière de PRENDRE LE TEMPS de compléter les commentaires
  14. * en cas de modification de ce sous-programme afin de faciliter
  15. * la maintenance !
  16. *************************************************************************
  17. *************************************************************************
  18. *************************************************************************
  19. ******* PERSONAL PROCEDURES *********************************************
  20. *************************************************************************
  21. *************************************************************************
  22. *
  23. *BEGINPROCEDUR matmas
  24. *
  25. *************************************************************************
  26. *
  27. * NOM : MATMAS
  28. *
  29. * DESCRIPTION : We compute
  30. *
  31. * (Np , Nd )
  32. *
  33. * LANGAGE : GIBIANE-CAST3M
  34. * AUTEUR : Alberto BECCANTINI (CEA/DEN/DM2S/SFME/LTMF)
  35. * mél : beccantini@cea.fr
  36. *************************************************************************
  37. * Prière de PRENDRE LE TEMPS de compléter les commentaires
  38. * en cas de modification de ce sous-programme afin de faciliter
  39. * la maintenance !
  40. *************************************************************************
  41. *
  42. *
  43. 'DEBPROC' MATMAS ;
  44. *
  45. 'ARGUMENT' _mt*'MAILLAGE' ;
  46. 'ARGUMENT' nomp*'MOT ' ;
  47. 'ARGUMENT' nomd*'MOT ' ;
  48. 'ARGUMENT' discp*'MOT ' ;
  49. 'ARGUMENT' discd*'MOT ' ;
  50. *
  51. * Arguments
  52. * _mt = MAILLAGE, quaf mesh
  53. * nomp = MOT, name of the primal variable
  54. * nomd = MOT, name of the dual variable
  55. * discp = MOT, name of the discretization of the primal variable
  56. * discd = MOT, name of the discretization of the dual variable
  57. *
  58. idim = 'VALEUR' 'DIME' ;
  59. *
  60. * Matrix A for the operator NLIN
  61. *
  62. numop = 1 ;
  63. numder = idim ;
  64. numvar = 1 ;
  65. * The variable involved in A is the primal variable T
  66. numdat = 0 ;
  67. numcof = 0 ;
  68. *
  69. discg = 'LINE' ;
  70. * Geometrical discretisation
  71. methgau = 'GAU7' ;
  72. * Gauss points involved
  73. *
  74. A = ININLIN numop numvar numdat numcof numder ;
  75. A . 'VAR' . 1 . 'NOMDDL' = 'MOTS' nomp ;
  76. A . 'VAR' . 1 . 'DISC' = discp ;
  77. *
  78. * Matrix B for the operator NLIN
  79. *
  80. B = ININLIN numop numvar 0 0 numder ;
  81. * For B the coef no coefficients are involved
  82. * but 1
  83. B . 'VAR' . 1 . 'NOMDDL' = 'MOTS' nomd ;
  84. B . 'VAR' . 1 . 'DISC' = discd ;
  85. *
  86. A . 1 . 1 . 0 = 'LECT' ;
  87. B . 1 . 1 . 0 = 'LECT' ;
  88. *
  89. mat = 'NLIN' discg _mt A B methgau ;
  90. 'RESPRO' mat ;
  91. 'FINPROC' ;
  92. *
  93. *ENDPROCEDUR matmas
  94. *BEGINPROCEDUR matkv
  95. *
  96. *************************************************************************
  97. *
  98. * NOM : MATKV
  99. *
  100. * DESCRIPTION : We compute the matrix
  101. *
  102. * ((cx \dep{u_x}{x} '+' cy \dep{u_x}{y}), Nvx)
  103. * ((cx \dep{u_y}{x} '+' cy \dep{u_y}{y}), Nvy)
  104. *
  105. * where Nv = shape function for (u_x,u_y)^T
  106. *
  107. * Names of primal variables = names of the dual variables
  108. * = 'UX' 'UY'
  109. *
  110. * LANGAGE : GIBIANE-CAST3M
  111. * AUTEUR : Alberto BECCANTINI (CEA/DEN/DM2S/SFME/LTMF)
  112. * mél : beccantini@cea.fr
  113. *************************************************************************
  114. * Prière de PRENDRE LE TEMPS de compléter les commentaires
  115. * en cas de modification de ce sous-programme afin de faciliter
  116. * la maintenance !
  117. *************************************************************************
  118. *
  119. 'DEBPROC' MATKV ;
  120. 'ARGUMENT' _mt*'MAILLAGE' ;
  121. 'ARGUMENT' discv*'MOT ' ;
  122. 'ARGUMENT' discc*'MOT ' ;
  123. 'ARGUMENT' cx*'CHPOINT' ;
  124. 'ARGUMENT' cy*'CHPOINT' ;
  125. *
  126. * _mt = solid quaf mesh
  127. * discv = discretization type ux, uy
  128. * discc = discretization type for cx, cy
  129. * cx = CHPOINT ('SCAL')
  130. * cy = CHPOINT ('SCAL')
  131. *
  132. idim = 'VALEUR' 'DIME' ;
  133. *
  134. numop = 2 ;
  135. numder = idim ;
  136. numvar = 2 ;
  137. * Two variables, ux, uy
  138. numdat = 2 ;
  139. * cx, cy
  140. numcof = 2 ;
  141. * Coef: cx cy (two identity functions)
  142. discg = 'LINE' ;
  143. * Geometrical discretisation
  144. methgau = 'GAU7' ;
  145. * Gauss points involved
  146. *
  147. * Matrix A for the operator NLIN
  148. *
  149. A = ININLIN numop numvar numdat numcof numder ;
  150. A . 'VAR' . 1 . 'NOMDDL' = 'MOTS' 'UX' ;
  151. A . 'VAR' . 1 . 'DISC' = discv ;
  152. A . 'VAR' . 2 . 'NOMDDL' = 'MOTS' 'UY' ;
  153. A . 'VAR' . 2 . 'DISC' = discv ;
  154. * cx
  155. A . 'DAT' . 1 . 'NOMDDL' = 'MOTS' 'SCAL' ;
  156. A . 'DAT' . 1 . 'DISC' = discc ;
  157. A . 'DAT' . 1 . 'VALEUR' = cx ;
  158. A . 'COF' . 1 . 'COMPOR' = 'IDEN' ;
  159. A . 'COF' . 1 . 'LDAT' = 'LECT' 1 ;
  160. * cy
  161. A . 'DAT' . 2 . 'NOMDDL' = 'MOTS' 'SCAL' ;
  162. A . 'DAT' . 2 . 'DISC' = discc ;
  163. A . 'DAT' . 2 . 'VALEUR' = cy ;
  164. A . 'COF' . 2 . 'COMPOR' = 'IDEN' ;
  165. A . 'COF' . 2 . 'LDAT' = 'LECT' 2 ;
  166. *
  167. * Matrix B for the operator NLIN
  168. *
  169. numvar = 2 ;
  170. B = ININLIN numop numvar 0 0 numder ;
  171. *
  172. * For B, no coefficients are involved
  173. * but 1
  174. *
  175. B . 'VAR' . 1 . 'NOMDDL' = 'MOTS' 'UX' ;
  176. B . 'VAR' . 1 . 'DISC' = discv ;
  177. B . 'VAR' . 2 . 'NOMDDL' = 'MOTS' 'UY' ;
  178. B . 'VAR' . 2 . 'DISC' = discv ;
  179. *
  180. * Contribution
  181. *
  182. * cx \dep{ux}{x} Nvx
  183. A . 1 . 1 . 1 = 'LECT' 1 ;
  184. B . 1 . 1 . 0 = 'LECT' ;
  185. * cy \dep{ux}{y} Nvx
  186. A . 1 . 1 . 2 = 'LECT' 2 ;
  187. * cx \dep{uy}{x} Nvy
  188. A . 2 . 2 . 1 = 'LECT' 1 ;
  189. B . 2 . 2 . 0 = 'LECT' ;
  190. * cy \dep{uy}{y} Nd
  191. A . 2 . 2 . 2 = 'LECT' 2 ;
  192. *
  193. mat = 'NLIN' discg _mt A B methgau ;
  194. 'RESPRO' mat ;
  195. 'FINPROC' ;
  196. *
  197. *ENDPROCEDUR matkv
  198. *BEGINPROCEDUR matlap
  199. *
  200. *************************************************************************
  201. *
  202. * NOM : MATLAP
  203. *
  204. * DESCRIPTION : We compute the matrix arising from the computation of
  205. * the scalar product
  206. *
  207. * ( -(coef \div( \alpha \grad T)) , Nd )
  208. *
  209. * where Nd = test function for the dual variable.
  210. *
  211. * -\int_{\Omega} coef \div( \alpha \grad T) Nd dV =
  212. * -\int_{\delta \Omega}
  213. * coef \alpha (\grad T \cdot n) Nd dS '+'
  214. * +\int_{\Omega}
  215. * coef \alpha (\grad T \cdot \grad Nd) dV '+'
  216. * +\int_{\Omega}
  217. * Nd \alpha (\grad T \cdot \grad coef) dV
  218. *
  219. * The matrix is issue from the 2nd and 3rd contribution
  220. * (volume integrals).
  221. *
  222. *
  223. * LANGAGE : GIBIANE-CAST3M
  224. * AUTEUR : Alberto BECCANTINI (CEA/DEN/DM2S/SFME/LTMF)
  225. * mél : beccantini@cea.fr
  226. *************************************************************************
  227. * Prière de PRENDRE LE TEMPS de compléter les commentaires
  228. * en cas de modification de ce sous-programme afin de faciliter
  229. * la maintenance !
  230. *************************************************************************
  231. *
  232. *
  233. 'DEBPROC' MATLAP ;
  234. *
  235. 'ARGUMENT' _mt*'MAILLAGE' ;
  236. 'ARGUMENT' nomt*'MOT ' ;
  237. 'ARGUMENT' disct*'MOT ' ;
  238. 'ARGUMENT' nomd*'MOT ' ;
  239. 'ARGUMENT' discd*'MOT ' ;
  240. 'ARGUMENT' discal*'MOT ' ;
  241. 'ARGUMENT' alpha*'CHPOINT' ;
  242. 'ARGUMENT' discof*'MOT ' ;
  243. 'ARGUMENT' coef*'CHPOINT' ;
  244. *
  245. * Arguments
  246. *
  247. * _mt = surface QUAF mesh
  248. * nomt = name of the primal variable T
  249. * disct = discretization type of T
  250. * nomd = name of the dual variable
  251. * discd = discretization type of the dual variable
  252. * discal = discretization type of alpha
  253. * discof = discretization type of coef
  254. * alpha = CHPOINT ('SCAL')
  255. * coef = CHPOINT ('SCAL')
  256. *
  257. idim = 'VALEUR' 'DIME' ;
  258. *
  259. * Four contributions
  260. *
  261. * (coef alpha \dep{T}{x} \dep{Nd}{x}
  262. * + coef alpha \dep{T}{y} \dep{Nd}{y}
  263. * + Nd alpha \dep{T}{x} \dep{coef}{x}
  264. * + Nd alpha \dep{T}{y} \dep{coef}{y})
  265. *
  266. * Matrix A for the operator NLIN
  267. *
  268. numop = 4 ;
  269. numder = idim ;
  270. numvar = 1 ;
  271. * The variable involved in A is the primal variable T
  272. numdat = 2 ;
  273. * Two data: alpha, coef
  274. numcof = 4 ;
  275. * Four functions: f(alpha) = alpha
  276. * f(coef) = coef
  277. * f(coef) = \dep{coef}{x}
  278. * f(coef) = \dep{coef}{y}
  279. discg = 'LINE' ;
  280. * Geometrical discretisation
  281. methgau = 'GAU7' ;
  282. * Gauss points involved
  283. *
  284. A = ININLIN numop numvar numdat numcof numder ;
  285. A . 'VAR' . 1 . 'NOMDDL' = 'MOTS' nomt ;
  286. A . 'VAR' . 1 . 'DISC' = disct ;
  287. * alpha
  288. A . 'DAT' . 1 . 'NOMDDL' = 'MOTS' 'SCAL' ;
  289. A . 'DAT' . 1 . 'DISC' = discal ;
  290. A . 'DAT' . 1 . 'VALEUR' = alpha ;
  291. * coef
  292. A . 'DAT' . 2 . 'NOMDDL' = 'MOTS' 'SCAL' ;
  293. A . 'DAT' . 2 . 'DISC' = discof ;
  294. A . 'DAT' . 2 . 'VALEUR' = coef ;
  295. * Function alpha
  296. A . 'COF' . 1 . 'COMPOR' = 'IDEN' ;
  297. A . 'COF' . 1 . 'LDAT' = 'LECT' 1 ;
  298. * Function coef
  299. A . 'COF' . 2 . 'COMPOR' = 'IDEN' ;
  300. A . 'COF' . 2 . 'LDAT' = 'LECT' 2 ;
  301. * Function \dep{coef}{x}
  302. A . 'COF' . 3 . 'COMPOR' = 'D/DX1' ;
  303. A . 'COF' . 3 . 'LDAT' = 'LECT' 2 ;
  304. * Function \dep{coef}{y}
  305. A . 'COF' . 4 . 'COMPOR' = 'D/DX2' ;
  306. A . 'COF' . 4 . 'LDAT' = 'LECT' 2 ;
  307. *
  308. * Matrix B for the operator NLIN
  309. *
  310. B = ININLIN numop numvar 0 0 numder ;
  311. * For B the coef no coefficients are involved
  312. * but 1
  313. B . 'VAR' . 1 . 'NOMDDL' = 'MOTS' nomd ;
  314. B . 'VAR' . 1 . 'DISC' = discd ;
  315. *
  316. * Contribution
  317. *
  318. * coef alpha \dep{T}{x} \dep{Nd}{x}
  319. A . 1 . 1 . 1 = 'LECT' 1 2 ;
  320. B . 1 . 1 . 1 = 'LECT' ;
  321. * coef alpha \dep{T}{y} \dep{Nd}{y}
  322. A . 2 . 1 . 2 = 'LECT' 1 2 ;
  323. B . 2 . 1 . 2 = 'LECT' ;
  324. * Nd alpha \dep{T}{x} \dep{coef}{x}
  325. A . 3 . 1 . 1 = 'LECT' 1 3 ;
  326. B . 3 . 1 . 0 = 'LECT' ;
  327. * Nd alpha \dep{T}{y} \dep{coef}{y}
  328. A . 4 . 1 . 2 = 'LECT' 1 4 ;
  329. B . 4 . 1 . 0 = 'LECT' ;
  330. mlapn = 'NLIN' discg _mt A B methgau ;
  331. 'RESPRO' mlapn ;
  332. 'FINPROC' ;
  333. *ENDPROCEDUR matlap
  334. *BEGINPROCEDUR matdiv
  335. *
  336. *************************************************************************
  337. *
  338. * NOM : MATDIV
  339. *
  340. * DESCRIPTION : We compute the matrix arising from the computation of
  341. * the scalar product
  342. *
  343. * (div(u),Np)
  344. *
  345. * where Np = shape function for pressure
  346. *
  347. *
  348. * LANGAGE : GIBIANE-CAST3M
  349. * AUTEUR : Alberto BECCANTINI (CEA/DEN/DM2S/SFME/LTMF)
  350. * mél : beccantini@cea.fr
  351. *************************************************************************
  352. * Prière de PRENDRE LE TEMPS de compléter les commentaires
  353. * en cas de modification de ce sous-programme afin de faciliter
  354. * la maintenance !
  355. *************************************************************************
  356. *
  357. *
  358. 'DEBPROC' MATDIV ;
  359. *
  360. 'ARGUMENT' _mt*'MAILLAGE' ;
  361. 'ARGUMENT' nompre*'MOT ' ;
  362. 'ARGUMENT' discp*'MOT ' ;
  363. 'ARGUMENT' discv*'MOT ' ;
  364. *
  365. * _mt = solid QUAF mesh
  366. * nompre = name of the pressure
  367. * discp = discretization type for the pressure
  368. * (for instance 'LINE')
  369. * discv = discretization type for the speed
  370. * (for instance 'QUAF')
  371. *
  372. idim = 'VALEUR' 'DIME' ;
  373. *
  374. * Two contributions
  375. *
  376. * \dep{u_x}{x} Np
  377. * + \dep{u_y}{y} Np
  378. *
  379. * Matrix A for the operator NLIN
  380. *
  381. numop = 1 ;
  382. numder = idim ;
  383. numvar = 2 ;
  384. * The variables involved in A are u_x, u_y
  385. numdat = 0 ;
  386. * Zero data
  387. numcof = 0 ;
  388. * Zero functions (but 1)
  389. discg = 'LINE' ;
  390. * Geometrical discretisation
  391. methgau = 'GAU7' ;
  392. * Gauss points involved
  393. *
  394. A = ININLIN numop numvar numdat numcof numder ;
  395. A . 'VAR' . 1 . 'NOMDDL' = 'MOTS' 'UX' ;
  396. A . 'VAR' . 1 . 'DISC' = discv ;
  397. A . 'VAR' . 2 . 'NOMDDL' = 'MOTS' 'UY' ;
  398. A . 'VAR' . 2 . 'DISC' = discv ;
  399. *
  400. * Matrix B for the operator NLIN
  401. *
  402. numvar = 1 ;
  403. B = ININLIN numop numvar 0 0 numder ;
  404. * For B the coef no coefficients are involved
  405. * but 1
  406. B . 'VAR' . 1 . 'NOMDDL' = 'MOTS' nompre ;
  407. B . 'VAR' . 1 . 'DISC' = discp ;
  408. *
  409. * Contribution
  410. *
  411. * 1 \dep{u_x}{x} Np
  412. A . 1 . 1 . 1 = 'LECT' ;
  413. B . 1 . 1 . 0 = 'LECT' ;
  414. * 1 \dep{u_y}{y} Np
  415. A . 1 . 2 . 2 = 'LECT' ;
  416. *
  417. mdiv = 'NLIN' discg _mt A B methgau ;
  418. 'RESPRO' mdiv ;
  419. 'FINPROC' ;
  420. *
  421. *ENDPROCEDUR matdiv
  422. *BEGINPROCEDUR matpre
  423. *
  424. *************************************************************************
  425. *
  426. * NOM : MATPRE
  427. *
  428. * DESCRIPTION : We compute the integral of volume of
  429. *
  430. * (coef \dep{p}{x} , Nv)
  431. * (coef \dep{p}{y} , Nv)
  432. *
  433. * where Nv = test function for u_x = test function for u_y.
  434. *
  435. * \int_{\Omega} coef \dep{p}{x} Nv dV =
  436. * \int_{\delta \Omega} coef p Nv (i \cdot n) dS '+'
  437. * -\int_{\Omega} coef p \dep{nv}{x} dV '+'
  438. * -\int_{\Omega} Nv p \dep{coef}{x} dV
  439. *
  440. * Here we only compute the 2nd and 3rd contribution (volume
  441. * integrals).
  442. *
  443. * LANGAGE : GIBIANE-CAST3M
  444. * AUTEUR : Alberto BECCANTINI (CEA/DEN/DM2S/SFME/LTMF)
  445. * mél : beccantini@cea.fr
  446. *
  447. *************************************************************************
  448. * Prière de PRENDRE LE TEMPS de compléter les commentaires
  449. * en cas de modification de ce sous-programme afin de faciliter
  450. * la maintenance !
  451. *************************************************************************
  452. *
  453. *
  454. 'DEBPROC' MATPRE ;
  455. *
  456. 'ARGUMENT' _mt*'MAILLAGE' ;
  457. 'ARGUMENT' nompre*'MOT ' ;
  458. 'ARGUMENT' discp*'MOT ' ;
  459. 'ARGUMENT' discv*'MOT ' ;
  460. 'ARGUMENT' discc*'MOT ' ;
  461. 'ARGUMENT' coef*'CHPOINT ' ;
  462. *
  463. * _mt = surface QUAF mesh
  464. * nompre = name of the pressure (usuallt 'LX')
  465. * discp = discretization type of p (usually LINE)
  466. * discv = discretization type of v (usually QUAF)
  467. * discc = discretization type of coef
  468. * coef = CHPOINT ('SCAL')
  469. *
  470. idim = 'VALEUR' 'DIME' ;
  471. *
  472. * Matrix A for the operator NLIN
  473. *
  474. numop = 4 ;
  475. numder = idim ;
  476. numvar = 1 ;
  477. * The variable involved in A is the primal p
  478. numdat = 1 ;
  479. * The data: coef
  480. numcof = 3 ;
  481. * Three functions: f(coef)= coef
  482. * f(coef)=\dep{coef}{x}
  483. * f(coef)=\dep{coef}{y}
  484. *
  485. discg = 'LINE' ;
  486. * Geometrical discretisation
  487. methgau = 'GAU7' ;
  488. * Gauss points involved
  489. *
  490. A = ININLIN numop numvar numdat numcof numder ;
  491. A . 'VAR' . 1 . 'NOMDDL' = 'MOTS' nompre ;
  492. A . 'VAR' . 1 . 'DISC' = discp ;
  493. *
  494. * coef
  495. *
  496. mcoef = 'EXTRAIRE' coef 'COMP' ;
  497. A . 'DAT' . 1 . 'NOMDDL' = mcoef ;
  498. A . 'DAT' . 1 . 'DISC' = discc ;
  499. A . 'DAT' . 1 . 'VALEUR' = coef ;
  500. * coef, \dep{coef}{x}, \dep{coef}{y}
  501. A . 'COF' . 1 . 'COMPOR' = 'IDEN' ;
  502. A . 'COF' . 1 . 'LDAT' = 'LECT' 1 ;
  503. A . 'COF' . 2 . 'COMPOR' = 'D/DX1' ;
  504. A . 'COF' . 2 . 'LDAT' = 'LECT' 1 ;
  505. A . 'COF' . 3 . 'COMPOR' = 'D/DX2' ;
  506. A . 'COF' . 3 . 'LDAT' = 'LECT' 1 ;
  507. *
  508. * Matrix B for the operator NLIN
  509. *
  510. numvar = 2 ;
  511. *
  512. * ux, uy
  513. *
  514. numdat = 1 ;
  515. numcof = 1 ;
  516. B = ININLIN numop numvar numdat numcof numder ;
  517. *
  518. * For B the coef no coefficients are involved
  519. * but -1
  520. *
  521. B . 'VAR' . 1 . 'NOMDDL' = 'MOTS' 'UX' ;
  522. B . 'VAR' . 1 . 'DISC' = discv ;
  523. B . 'VAR' . 2 . 'NOMDDL' = 'MOTS' 'UY' ;
  524. B . 'VAR' . 2 . 'DISC' = discv ;
  525. * -1
  526. B . 'DAT' . 1 . 'NOMDDL' = 'MOTS' 'SCAL' ;
  527. B . 'DAT' . 1 . 'DISC' = 'CSTE' ;
  528. B . 'DAT' . 1 . 'VALEUR' = -1.0 ;
  529. B . 'COF' . 1 . 'COMPOR' = 'IDEN' ;
  530. B . 'COF' . 1 . 'LDAT' = 'LECT' 1 ;
  531. *
  532. * -\int_{\Omega} coef p \dep{Nv}{x} dV
  533. *
  534. A . 1 . 1 . 0 = 'LECT' 1 ;
  535. B . 1 . 1 . 1 = 'LECT' 1 ;
  536. *
  537. * -\int_{\Omega} Nv p \dep{coef}{x} dV
  538. *
  539. A . 2 . 1 . 0 = 'LECT' 2 ;
  540. B . 2 . 1 . 0 = 'LECT' 1 ;
  541. *
  542. * -\int_{\Omega} coef p \dep{Nv}{y} dV (second dual variable)
  543. *
  544. A . 3 . 1 . 0 = 'LECT' 1 ;
  545. B . 3 . 2 . 2 = 'LECT' 1 ;
  546. *
  547. * -\int_{\Omega} Nv p \dep{coef}{y} dV (second dual variable)
  548. *
  549. A . 4 . 1 . 0 = 'LECT' 3 ;
  550. B . 4 . 2 . 0 = 'LECT' 1 ;
  551. *
  552. mat = 'NLIN' discg _mt A B methgau ;
  553. 'RESPRO' mat ;
  554. 'FINPROC' ;
  555. *
  556. *ENDPROCEDUR matpre
  557. *BEGINPROCEDUR resoup
  558. *************************************************************************
  559. **** Resolution of a linear system **************************************
  560. *************************************************************************
  561. *
  562. 'DEBPROC' RESOUP ;
  563. 'ARGUMENT' LOGTPS*'LOGIQUE ' ;
  564. 'ARGUMENT' mat*'MATRIK ' ;
  565. 'ARGUMENT' matpre/'MATRIK ' ;
  566. 'ARGUMENT' smb*'CHPOINT ' ;
  567. 'ARGUMENT' ccl*'CHPOINT ' ;
  568. 'ARGUMENT' res*'FLOTTANT' ;
  569. 'ARGUMENT' nit*'ENTIER' ;
  570. 'ARGUMENT' pre/'ENTIER' ;
  571. 'ARGUMENT' gggtre/'TABLE ' ;
  572. 'ARGUMENT' gggtcv/'LOGIQUE ' ;
  573. 'ARGUMENT' typslv/'MOT ' ;
  574. *
  575. * Det. tt s.t.
  576. *
  577. * mat . tt = smb
  578. * tt(boundary) = ccl
  579. *
  580. *
  581. * mat = matrix to "inverse"
  582. * matpre = matrix for which preconditioner has been computed (optional)
  583. * smb = right hand side
  584. * ccl = imposed boundary conditions
  585. * res = rvk . 'RESID'
  586. * nit = max number of linear iteration (for an iterative solver)
  587. * pre = type of preconditioning matrix (for an iterative solver)
  588. * gggtre = table of resolution to store 'XINIT'
  589. * gggtcv = graphic of the history for the iterative solver
  590. * (optional FAUX)
  591. * typslv = 'DIRECT'/'ITER' (optional, ITER)
  592. *
  593. 'SI' ('NON' ('EXISTE' typslv)) ;
  594. tslv = VRAI ;
  595. 'SINON' ;
  596. 'SI' ('EGA' typslv 'DIRECT') ;
  597. tslv = FAUX ;
  598. 'SINON' ;
  599. 'SI' ('EGA' typslv 'ITER') ;
  600. tslv = VRAI ;
  601. 'SINON' ;
  602. 'ERREUR' 'Solveur DIRECT ou ITERatif ?' ;
  603. 'FINSI' ;
  604. 'FINSI' ;
  605. 'FINSI' ;
  606. gggniv = 1 ;
  607. 'SI' ('NON' ('EXISTE' pre)) ;
  608. pre = 5 ;
  609. 'FINSI' ;
  610. 'SI' ('OU' ('NON' ('EXISTE' gggtcv)) ('NON' tslv)) ;
  611. gggtcv = FAUX ;
  612. 'FINSI' ;
  613. rv = 'EQEX' ;
  614. rvk = rv . 'METHINV' ;
  615. 'SI' ('EXISTE' matpre) ;
  616. rvk . 'MATASS' = matpre ;
  617. rvk . 'MAPREC' = matpre ;
  618. 'SINON' ;
  619. rvk . 'MATASS' = mat ;
  620. rvk . 'MAPREC' = mat ;
  621. 'FINSI' ;
  622. 'SI' tslv ;
  623. rvk . 'TYPINV' = 3 ;
  624. 'SINON' ;
  625. rvk . 'TYPINV' = 1 ;
  626. 'FINSI' ;
  627. rvk . 'SCALING' = 1 ;
  628. * Scaling factor
  629. rvk . 'OUBMAT' = 1 ;
  630. * oubmat = 1 -> We eliminate the elementary matrix
  631. * 'ILUTPPIV' -> 1 We always search for a new pivot
  632. * -> 0 We do not search for a new pivot
  633. rvk . 'ILUTPPIV' = 0.1D0 ;
  634. * rvk . 'ILUTPPIV' = 0.01D0 ;
  635. * rvk . 'ILUTPPIV' = 0.00001D0 ;
  636. * rvk . 'ILUTPPIV' = 0.D0 ;
  637. rvk . 'IMPINV' = gggniv ;
  638. rvk . 'TYRENU' = 'SLOA' ;
  639. rvk . 'PCMLAG' = 'APR2' ;
  640. rvk . 'NITMAX' = nit ;
  641. rvk . 'RESID' = res ;
  642. rvk . 'PRECOND' = pre ;
  643. rvk . 'BCGSBTOL' = 1.D-200 ;
  644. rvk . 'ILUTLFIL' = 1.5 ;
  645. *
  646. 'SI' ('EXISTE' gggtre) ;
  647. 'SI' ('EXISTE' gggtre 'XINIT') ;
  648. rvk . 'XINIT' = gggtre . 'XINIT' ;
  649. 'FINSI' ;
  650. 'FINSI' ;
  651. 'TEMPS' 'ZERO' ;
  652. tt = 'KRES' mat 'TYPI' rvk 'SMBR' smb 'CLIM' ccl ;
  653. TABTPS = TEMP 'NOEC';
  654. tcpu = TABTPS.'TEMPS_CPU'.'INITIAL';
  655. tcpus = '/' ('FLOTTANT' tcpu) 100.D0 ;
  656. 'SI' LOGTPS ;
  657. 'MESSAGE' ('CHAINE' 'tcpu (s) = ' tcpus) ;
  658. 'FINSI' ;
  659. 'SI' ('ET' gggtcv ('EXISTE' rvk 'CONVINV')) ;
  660. lcvg = rvk . 'CONVINV' ;
  661. nit = 'DIME' lcvg ;
  662. 'SI' ('>' nit 1) ;
  663. lit = 'PROG' 1.D0 PAS 1.D0 NPAS ('-' nit 1) ;
  664. evit = 'EVOL' 'MANU' 'iter' lit 'log residu'
  665. ('/' ('LOG' lcvg) ('LOG' 10.D0)) ;
  666. 'DESSIN' evit 'TITR' titglob ;
  667. 'FINSI' ;
  668. 'FINSI' ;
  669. 'SI' ('EXISTE' gggtre) ;
  670. gggtre . 'XINIT' = tt ;
  671. 'FINSI' ;
  672. 'RESPRO' tt ;
  673. *
  674. * End of procedure file RESOU
  675. *
  676. 'FINPROC' ;
  677. *
  678. *************************************************************************
  679. **** End of the Resolution of a linear system ***************************
  680. *************************************************************************
  681. *ENDPROCEDUR resoup
  682. *************************************************************************
  683. *************************************************************************
  684. ******* END OF PERSONAL PROCEDURES **************************************
  685. *************************************************************************
  686. *************************************************************************
  687. *
  688. 'OPTION' 'DIME' 2 'ELEM' 'QUA4' 'TRAC' 'X' ;
  689. GRAPH = FAUX ;
  690. *
  691. * Linear/bilinear continuus pressure
  692. * QUAFdratic speed
  693. *
  694. **** Mesh
  695. *
  696. *
  697. * A4 A3
  698. *
  699. *
  700. *
  701. *
  702. * A1 A2
  703. *
  704. L = 1.0 ;
  705. A1 = 0.0 0.0 ;
  706. A2 = L 0.0 ;
  707. A3 = L L ;
  708. A4 = 0.0 L ;
  709. *
  710. DX = L '/' (2 '*' 10) ;
  711. DY = DX ;
  712. *
  713. A1A2 = A1 'DROIT' A2 'DINI' DX 'DFIN' DX ;
  714. A2A3 = A2 'DROIT' A3 'DINI' DY 'DFIN' DY ;
  715. A3A4 = A3 'DROIT' A4 'DINI' DX 'DFIN' DX ;
  716. A4A1 = A4 'DROIT' A1 'DINI' DY 'DFIN' DY ;
  717. *
  718. DOM1 = 'SURFACE' (A1A2 'ET' A2A3 'ET' A3A4 'ET' A4A1) 'PLAN' ;
  719. *DOM1 = 'CHANGER' DOM1 'QUAF' ;
  720. 'SI' GRAPH ;
  721. 'TRACER' DOM1 'TITRE' 'Mesh' ;
  722. 'FINSI' ;
  723. QDOM1 = 'CHANGER' DOM1 'QUAF' ;
  724. QA4A1 = 'CHANGER' A4A1 'QUAF' ;
  725. QA1A2 = 'CHANGER' A1A2 'QUAF' ;
  726. QA2A3 = 'CHANGER' A2A3 'QUAF' ;
  727. QA3A4 = 'CHANGER' A3A4 'QUAF' ;
  728. 'ELIMINATION' (QA4A1 'ET' QDOM1) 1.0D-4 ;
  729. 'ELIMINATION' (QA1A2 'ET' QDOM1) 1.0D-4 ;
  730. 'ELIMINATION' (QA2A3 'ET' QDOM1) 1.0D-4 ;
  731. 'ELIMINATION' (QA3A4 'ET' QDOM1) 1.0D-4 ;
  732. *
  733. * Boundary conditions
  734. *
  735. LIMDIR = 'CHANGER' ('CONTOUR' QDOM1) 'POI1' ;
  736. LIMDIR1 = 'DIFF' ('CHANGER' 'POI1' QA3A4) ('MANUEL' 'POI1' A3) ;
  737. LIMDIR1 = 'DIFF' LIMDIR1 ('MANUEL' 'POI1' A4) ;
  738. LIMDIR2 = 'DIFF' LIMDIR LIMDIR1 ;
  739. UN1 = 'MANUEL' 'CHPO' LIMDIR1 2 'UX' 1.0 'UY' 0.0 ;
  740. UN2 = 'MANUEL' 'CHPO' LIMDIR2 2 'UX' 0.0 'UY' 0.0 ;
  741. UNLIM = UN1 '+' UN2 ;
  742. Re = 1000. ;
  743. PNLIM = 'MANUEL' 'CHPO' ('MANUEL' 'POI1' A4) 1 'LX' 0.0 ;
  744. UNPLIM = UNLIM '+' PNLIM ;
  745. *
  746. * IC
  747. *
  748. UN = ('MANUEL' 'CHPO' QDOM1 2 'UX' 0.0 'UY' 0.0) '+' (UN1 '+' UN2) ;
  749. *
  750. VECN = 'VECTEUR' 0.1 UN ;
  751. 'SI' GRAPH ;
  752. 'TRACER' DOM1 VECN ;
  753. 'FINSI' ;
  754. *
  755. * Time step
  756. *
  757. DT = 1.0D2 '*' DX '/' 1.0 ;
  758. *
  759. NU = 'MANUEL' 'CHPO' DOM1 1 'SCAL' (1.0 '/' Re) ;
  760. *
  761. * Matrices
  762. *
  763. MMAS1 = MATMAS QDOM1 'UX' 'UX' 'QUAF' 'QUAF' ;
  764. MMAS2 = MATMAS QDOM1 'UY' 'UY' 'QUAF' 'QUAF' ;
  765. * MMASP = (MATMAS QDOM1 'LX' 'LX' 'LINE' 'LINE') '*' 0.0 ;
  766. * Mass matrix for the pressure to help the linear solver to converge.
  767. * From "Gounand's RECIPIES"
  768. * MMAS = MMAS1 'ET' MMAS2 'ET' MMASP;
  769. MMAS = MMAS1 'ET' MMAS2 ;
  770. MKON = MATKV QDOM1 'QUAF' 'QUAF' ('EXCO' 'UX' UN) ('EXCO' 'UY' UN) ;
  771. CHONE = 'MANUEL' 'CHPO' DOM1 1 'SCAL' 1.0 ;
  772. MLAP1 = MATLAP QDOM1 'UX' 'QUAF' 'UX' 'QUAF' 'LINE' NU 'LINE' CHONE ;
  773. MLAP2 = MATLAP QDOM1 'UY' 'QUAF' 'UY' 'QUAF' 'LINE' NU 'LINE' CHONE ;
  774. MLAP = MLAP1 'ET' MLAP2 ;
  775. MDIV = MATDIV QDOM1 'LX' 'LINE' 'QUAF' ;
  776. MPRE = MATPRE QDOM1 'LX' 'LINE' 'QUAF' 'LINE' CHONE ;
  777. *
  778. * Total matrix
  779. *
  780. MMASSDT = MMAS '/' DT ;
  781. mconst = MMASSDT 'ET' MLAP ;
  782. mconst = mconst 'ET' MPRE ;
  783. mconst = mconst 'ET' MDIV ;
  784. mtot = mconst 'ET' MKON ;
  785. *
  786. * Resolution
  787. *
  788. TPS = 0.0 ;
  789. UN = 'COPIER' UN ;
  790. UNM = 'COPIER' UN ;
  791. LIT = 'PROG' ;
  792. LER = 'PROG' ;
  793. ERRO = 1.0D10 ;
  794. *
  795. TABRESUN = 'TABLE' ;
  796. UNP = UN '+' ('MANUEL' 'CHPO' DOM1 1 'LX' 0.0) ;
  797. NITERU = 100 ;
  798. PREC = 3 ;
  799. METINV = MOT 'DIRECT' ;
  800. *
  801. 'REPETER' BL1 200 ;
  802. TPS = TPS '+' DT ;
  803. qv = MMASSDT '*' UN ;
  804. mtotik = 'KOPS' 'RIMA' mtot ;
  805. TABRESUN . 'XINIT' = UNP ;
  806. UNP = RESOUP FAUX mtotik mtotik qv UNPLIM 1.0D-12 NITERU
  807. PREC TABRESUN METINV ;
  808. UN = 'EXCO' ('MOTS' 'UX' 'UY') UNP ('MOTS' 'UX' 'UY') ;
  809. 'SI' (ERRO < 1.0D-5) ;
  810. 'QUITTER' BL1 ;
  811. 'FINSI' ;
  812. 'SI' (((&BL1 '/' 5) '*' 5) 'EGA' &BL1) ;
  813. ERRO = 'MAXIMUM' (UN '-' UNM) 'ABS' ;
  814. 'MESSAGE' ('CHAINE' 'ITER = ' &BL1 ', TPS = ' TPS ', ERRO = '
  815. ERRO) ;
  816. UNM = 'COPIER' UN ;
  817. LIT = LIT 'ET' ('PROG' &BL1) ;
  818. L10 = 'LOG' 10. ;
  819. LER = LER 'ET' ('PROG' (('LOG' (ERRO '+' 1.0D-20)) '/' L10)) ;
  820. EVER = 'EVOL' 'MANU' 'it' LIT 'Log(Err)' LER ;
  821. 'SI' GRAPH ;
  822. 'DESSIN' EVER 'TITR' 'Convergence history' 'NCLK' ;
  823. 'FINSI' ;
  824. 'FINSI' ;
  825. *
  826. ****** We update the convective matrix
  827. *
  828. MKON = MATKV QDOM1 'QUAF' 'QUAF' ('EXCO' 'UX' UN) ('EXCO' 'UY' UN) ;
  829. MTOT = MCONST 'ET' MKON ;
  830. 'FIN' BL1 ;
  831. *
  832. UX = 'EXCO' UN 'UX' ;
  833. UY = 'EXCO' UN 'UY' ;
  834. *
  835. ***** Post treatment
  836. *
  837. VECN = 'VECTEUR' UN ;
  838. 'SI' GRAPH ;
  839. 'TRACER' UX DOM1 VECN 'TITR' 'ux' ;
  840. 'TRACER' UY DOM1 VECN 'TITR' 'uy' ;
  841. 'FINSI' ;
  842. *
  843. QXMED = QA4A1 'PLUS' ((L '/' 2.) 0.0) ;
  844. QYMED = QA1A2 'PLUS' (0.0 (L '/' 2.)) ;
  845. 'ELIMINATION' QDOM1 (DX '/' 100.) QXMED ;
  846. 'ELIMINATION' QDOM1 (DX '/' 100.) QYMED ;
  847. *
  848. **** Evolution objects
  849. *
  850. LUX = 'EXTRAIRE' ('EVOL' 'CHPO' ('EXCO' 'UX' UN) QXMED) 'ORDO' ;
  851. LY = 'EXTRAIRE' ('EVOL' 'CHPO' ('COORDONNEE' 2 QXMED) QXMED) 'ORDO' ;
  852. UX_Y = 'EVOL' 'MANU' 'ux' LUX 'y' LY ;
  853. *
  854. *
  855. LUY = 'EXTRAIRE' ('EVOL' 'CHPO' ('EXCO' 'UY' UN) QYMED) 'ORDO' ;
  856. LX = 'EXTRAIRE' ('EVOL' 'CHPO' ('COORDONNEE' 1 QYMED) QYMED) 'ORDO' ;
  857. UY_X = 'EVOL' 'MANU' 'x' LX 'uy' LUY ;
  858. *
  859. *
  860. *
  861. TAB1 = 'TABLE' ;
  862. TAB1 . 'TITRE'= 'TABLE' ;
  863. TAB1 . 2 = 'MARQ CROI NOLI';
  864. TAB1 . 'TITRE' . 2 = 'Reference (Su)' ;
  865. TAB1 . 1 = 'REGU' ;
  866. TAB1 . 'TITRE' . 1 = 'Numerical res.' ;
  867. *
  868. * Solution of Su
  869. *
  870. LXSU = 'PROG' 0 0.0625 0.0703 0.0781 0.0938 0.1563 0.2266
  871. 0.2344 0.5 0.8047 0.8594 0.9063 0.9453 0.9531 0.9609
  872. 0.9688 1 ;
  873. LUY_X_SU = 'PROG' 0 0.2763 0.2918 0.3053 0.3282 0.3711 0.3279
  874. 0.3193 0.0243 -0.317 -0.4245 -0.5182 -0.3972 -0.3421 -0.2816
  875. -0.2175 0 ;
  876. EVUYX = 'EVOL' 'MANU' 'x' LXSU 'uy' LUY_X_SU ;
  877. *
  878. LYSU = 'PROG' 0. 0.0547 0.0625 0.0703 0.1016 0.1719 0.2812 0.4531
  879. 0.5 0.6172 0.7344 0.8516 0.9531 0.9609 0.9688 0.9766 1 ;
  880. LUX_Y_SU = 'PROG' 0 -0.1788 -0.1999 -0.2204 -0.2972 -0.3834 -0.2759
  881. -0.1058 -0.0605 0.0564 0.1857 0.3316 0.466 0.5109 0.5743 0.6582 1 ;
  882. EVUXY = 'EVOL' 'MANU' 'ux' LUX_Y_SU 'y' LYSU ;
  883. *
  884. 'SI' GRAPH ;
  885. 'DESSIN' (UX_Y 'ET' EVUXY) 'TITRE'
  886. ('CHAINE' 'ux at y = ' (L '/' 2.)) 'LEGE'
  887. TAB1 ;
  888. 'DESSIN' (UY_X 'ET' EVUYX) 'TITRE'
  889. ('CHAINE' 'uy at x = ' (L '/' 2.)) 'LEGE'
  890. TAB1 ;
  891. 'FINSI' ;
  892. *
  893. * We check whether the convergence is reached
  894. *
  895. NITER = &BL1 ;
  896. *
  897. 'SI' (NITER > 100) ;
  898. 'MESSAGE' 'Convergence not reached' ;
  899. 'ERREUR' 5 ;
  900. 'FINSI' ;
  901. *
  902. * Difference between the solution of Su and the one here obtained
  903. *
  904. LUX_Y_HE = 'IPOL' LYSU LY LUX ;
  905. ERRO = (LUX_Y_HE '-' LUX_Y_SU) 'ABS' ;
  906. EVERX = 'EVOL' 'MANU' 'y' lysu 'UX' ERRO ;
  907. LUY_X_HE = 'IPOL' LXSU LX LUY ;
  908. ERRO = (LUY_X_HE '-' LUY_X_SU) 'ABS' ;
  909. EVERY = 'EVOL' 'MANU' 'x' lysu 'UY' ERRO ;
  910. 'SI' GRAPH ;
  911. 'DESSIN' EVERX 'TITRE' 'Error on ux' ;
  912. 'DESSIN' EVERY 'TITRE' 'Error on uy' ;
  913. 'FINSI' ;
  914. aax = 'MAXIMUM' ('EXTRAIRE' ('PRIM' EVERX) 'ORDO') ;
  915. aay = 'MAXIMUM' ('EXTRAIRE' ('PRIM' EVERY) 'ORDO') ;
  916. *
  917. 'SI' (aax > 1.0D-2) ;
  918. 'ERREUR' 5 ;
  919. 'FINSI' ;
  920. 'SI' (aay > 1.0D-2) ;
  921. 'ERREUR' 5 ;
  922. 'FINSI' ;
  923. *
  924. 'FIN' ;
  925. *
  926.  
  927.  
  928.  
  929.  
  930.  

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