1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521
| CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
$ debug
PROGRAM MAIN
C*******************************************************************
C THIS IS A PATANKAR 2-D DIFFERENTIAL EQUATION SOLVER
C ADAPTED TO THE IBM PC SYSTEM USING THE MICROSOFT
C OPTIMIZING FORTRAN COMPILER. IT IS CAPABLE OF SOLVING FLUID
C FLOW PROBLEMS AND INCLUDES A FACILITY FOR HANDLING ADDITIONAL
C INDEPENDENT VARIABLES BESIDES U,V, AND PC. THESE VARIABLES ARE
C STORED IN THE F(I,J,4) THRU F(I,J,LIV) ARRAYS, WHERE LIV IS THE
C TOTAL NUMBER OF INDEPENDENT VARIABLES, INCLUDING U,V AND PC.
C PARAMETER STATEMENTS MAY BE USED TO CHANGE THE I AND J DIMENSIONS.
C*******************************************************************
C VERSION 4.00 JULY 2,1985 COPYRIGHT DMI inc
C*******************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
LOGICAL LSTOP
COMMON/CNTL/LSTOP
open(1,file='fichier',status='unknown')
C********************************************************************
CALL GRID
CALL SETUP1
CALL START
10 CALL DENSE
CALL OUTPUT
CALL BOUND
CALL SETUP2
IF(LSTOP) STOP
GO TO 10
END
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BLOCK DATA INITIAL
C******************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
PARAMETER (ID=400,JD=400,IMX=400)
PARAMETER (LIV=10)
PARAMETER (LV=LIV+3)
PARAMETER (LIV1=LIV+1,LIV2=LIV+2,LIV3=LIV+3)
CHARACTER*40 INPUTF,SAVEF,LISFIL
LOGICAL LSOLVE,LPRINT,LBLK,LSTOP,LINPUT,LSAVE
CHARACTER*10 TITLE
COMMON/FILE/INPUTF,SAVEF,LISFIL,TITLE(LV)
COMMON/INDX/NF,NFMAX,NP,NRHO,NGAM,L1,L2,L3,M1,M2,M3,
1 IST,JST,ITER,LAST,RELAX(LV),TIME,DT,XL,YL,
2 IPREF,JPREF,LSOLVE(LV),LPRINT(LV),LBLK(LV),MODE,NTIMES(LV),
3 RHOCON,LINPUT(LV),LSAVE(LV)
COMMON/CNTL/LSTOP
C******************************************************************
DATA LISFIL,INPUTF,SAVEF/'USER.LIS','USER.DAT','USER.DAT'/
DATA NFMAX,NP,NRHO,NGAM/LIV,LIV1,LIV2,LIV3/
DATA LSTOP,LSOLVE,LPRINT/1*.FALSE.,LV*.FALSE.,LV*.FALSE./
DATA LINPUT,LSAVE/LV*.FALSE.,LV*.FALSE./
DATA LBLK/LV*.TRUE./
DATA MODE,last,TIME,ITER/1,60,0.d0,0/
DATA RELAX,NTIMES/LV*1.D0,LV*1/
DATA DT,IPREF,JPREF,RHOCON/1.D+10,1,1,1.D0/
END
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SUBROUTINE DIFLOW
C********************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
COMMON/COEF/FLOW,DIFF,ACOF
C******************************************************************
ACOF=DIFF
IF(FLOW.EQ.0.D0) RETURN
TEMP=DIFF-ABS(FLOW)*0.1D0
ACOF=0.D0
IF(TEMP.LE.0.D0) RETURN
TEMP=TEMP/DIFF
ACOF=DIFF*TEMP**5
RETURN
END
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SUBROUTINE SOLVE
C******************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C---- ID=I DIMENSION, JD=J DIMENSION, IMX=MAXIMUM OF ID AND JD
PARAMETER (ID=400,JD=400,IMX=400)
C---- LIV=NUMBER OF INDEPENDENT VARIABLES; INCLUDING U,V, AND PC
PARAMETER (LIV=10)
PARAMETER (LV=LIV+3)
! CHARACTER*10 TITLE
! LOGICAL LSOLVE,LPRINT,LBLK,LSTOP,LINPUT,LSAVE
LOGICAL LSOLVE,LPRINT,LBLK,LINPUT,LSAVE
COMMON F(ID,JD,LV),CON(ID,JD),
1 AIP(ID,JD),AIM(ID,JD),AJP(ID,JD),AJM(ID,JD),AP(ID,JD),
2 X(ID),XU(ID),XDIF(ID),XCV(ID),XCVS(ID),
3 Y(JD),YV(JD),YDIF(JD),YCV(JD),YCVS(JD),
4 YCVR(JD),YCVRS(JD),ARX(JD),ARXJ(JD),ARXJP(JD),
5 R(JD),RMN(JD),SX(JD),SXMN(JD),XCVI(ID),XCVIP(ID)
COMMON DU(ID,JD),DV(ID,JD), FV(JD),FVP(JD),
1 FX(ID),FXM(ID),FY(JD),FYM(JD),PT(IMX),QT(IMX)
COMMON/INDX/NF,NFMAX,NP,NRHO,NGAM,L1,L2,L3,M1,M2,M3,
1 IST,JST,ITER,LAST,RELAX(LV),TIME,DT,XL,YL,
2 IPREF,JPREF,LSOLVE(LV),LPRINT(LV),LBLK(LV),MODE,NTIMES(LV),
3 RHOCON,LINPUT(LV),LSAVE(LV),amb1,amb2,amb3,amb4,amb5,amb6
DIMENSION TH(ID),THU(ID),THDIF(ID),THCV(ID),THCVS(ID)
EQUIVALENCE(X,TH),(XU,THU),(XDIF,THDIF),(XCV,THCV)
1,(XCVS,THCVS),(XL,THL)
C******************************************************************
ISTF=IST-1
JSTF=JST-1
IT1=L2+IST
IT2=L3+IST
JT1=M2+JST
JT2=M3+JST
C******************************************************************
DO 999 NT=1,NTIMES(NF)
NFF=NF
DO 999 N=NF,NFF
C-------------------------------------------------------------------
IF(.NOT.LBLK(NF)) GO TO 10
PT(ISTF)=0.D0
QT(ISTF)=0.D0
DO 11 I=IST,L2
BL=0.D0
BLP=0.D0
BLM=0.D0
BLC=0.D0
DO 12 J=JST,M2
BL=BL+AP(I,J)
IF(J.NE.M2) BL=BL-AJP(I,J)
IF(J.NE.JST) BL=BL-AJM(I,J)
BLP=BLP+AIP(I,J)
BLM=BLM+AIM(I,J)
BLC=BLC+CON(I,J)+AIP(I,J)*F(I+1,J,N)+AIM(I,J)*F(I-1,J,N)
1 +AJP(I,J)*F(I,J+1,N)+AJM(I,J)*F(I,J-1,N)-AP(I,J)*F(I,J,N)
12 CONTINUE
DENOM=BL-PT(I-1)*BLM
IF(ABS(DENOM/BL).LT.1.D-10) DENOM=1.D50
PT(I)=BLP/DENOM
QT(I)=(BLC+BLM*QT(I-1))/DENOM
11 CONTINUE
BL=0.D0
DO 13 II=IST,L2
I=IT1-II
BL=BL*PT(I)+QT(I)
DO 13 J=JST,M2
13 F(I,J,N)=F(I,J,N)+BL
C---------------------------------------------------------------------
PT(JSTF)=0.D0
QT(JSTF)=0.D0
DO 21 J=JST,M2
BL=0.D0
BLP=0.D0
BLM=0.D0
BLC=0.D0
DO 22 I=IST,L2
BL=BL+AP(I,J)
IF(I.NE.L2) BL=BL-AIP(I,J)
IF(I.NE.IST) BL=BL-AIM(I,J)
BLP=BLP+AJP(I,J)
BLM=BLM+AJM(I,J)
BLC=BLC+CON(I,J)+AIP(I,J)*F(I+1,J,N)+AIM(I,J)*F(I-1,J,N)
1 +AJP(I,J)*F(I,J+1,N)+AJM(I,J)*F(I,J-1,N)-AP(I,J)*F(I,J,N)
22 CONTINUE
DENOM=BL-PT(J-1)*BLM
IF(ABS(DENOM/BL).LT.1.D-10) DENOM=1.D50
PT(J)=BLP/DENOM
QT(J)=(BLC+BLM*QT(J-1))/DENOM
21 CONTINUE
BL=0.D0
DO 23 JJ=JST,M2
J=JT1-JJ
BL=BL*PT(J)+QT(J)
DO 23 I=IST,L2
23 F(I,J,N)=F(I,J,N)+BL
10 CONTINUE
C--------------------------------------------------------------
DO 90 J=JST,M2
PT(ISTF)=0.D0
QT(ISTF)=F(ISTF,J,N)
DO 70 I=IST,L2
DENOM=AP(I,J)-PT(I-1)*AIM(I,J)
PT(I)=AIP(I,J)/DENOM
TEMP=CON(I,J)+AJP(I,J)*F(I,J+1,N)+AJM(I,J)*F(I,J-1,N)
QT(I)=(TEMP+AIM(I,J)*QT(I-1))/DENOM
70 CONTINUE
DO 80 II=IST,L2
I=IT1-II
80 F(I,J,N)=F(I+1,J,N)*PT(I)+QT(I)
90 CONTINUE
C------------------------------------------------------------------
DO 190 JJ=JST,M3
J=JT2-JJ
PT(ISTF)=0.D0
QT(ISTF)=F(ISTF,J,N)
DO 170 I=IST,L2
DENOM=AP(I,J)-PT(I-1)*AIM(I,J)
PT(I)=AIP(I,J)/DENOM
TEMP=CON(I,J)+AJP(I,J)*F(I,J+1,N)+AJM(I,J)*F(I,J-1,N)
QT(I)=(TEMP+AIM(I,J)*QT(I-1))/DENOM
170 CONTINUE
DO 180 II=IST,L2
I=IT1-II
180 F(I,J,N)=F(I+1,J,N)*PT(I)+QT(I)
190 CONTINUE
C------------------------------------------------------------------
DO 290 I=IST,L2
PT(JSTF)=0.D0
QT(JSTF)=F(I,JSTF,N)
DO 270 J=JST,M2
DENOM=AP(I,J)-PT(J-1)*AJM(I,J)
PT(J)=AJP(I,J)/DENOM
TEMP=CON(I,J)+AIP(I,J)*F(I+1,J,N)+AIM(I,J)*F(I-1,J,N)
QT(J)=(TEMP+AJM(I,J)*QT(J-1))/DENOM
270 CONTINUE
DO 280 JJ=JST,M2
J=JT1-JJ
280 F(I,J,N)=F(I,J+1,N)*PT(J)+QT(J)
290 CONTINUE
C-------------------------------------------------------------------
DO 390 II=IST,L3
I=IT2-II
PT(JSTF)=0.D0
QT(JSTF)=F(I,JSTF,N)
DO 370 J=JST,M2
DENOM=AP(I,J)-PT(J-1)*AJM(I,J)
PT(J)=AJP(I,J)/DENOM
TEMP=CON(I,J)+AIP(I,J)*F(I+1,J,N)+AIM(I,J)*F(I-1,J,N)
QT(J)=(TEMP+AJM(I,J)*QT(J-1))/DENOM
370 CONTINUE
DO 380 JJ=JST,M2
J=JT1-JJ
380 F(I,J,N)=F(I,J+1,N)*PT(J)+QT(J)
390 CONTINUE
C*******************************************
999 CONTINUE
DO 400 J=2,M2
DO 400 I=2,L2
CON(I,J)=0.D0
AP(I,J)=0.D0
400 CONTINUE
RETURN
END
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SUBROUTINE SETUP
C******************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
PARAMETER (ID=400,JD=400,IMX=400)
PARAMETER (LIV=10)
PARAMETER (LV=LIV+3)
PARAMETER (LIV1=LIV+1,LIV2=LIV+2,LIV3=LIV+3)
CHARACTER*40 INPUTF,SAVEF,LISFIL
COMMON/FILE/INPUTF,SAVEF,LISFIL,TITLE(LV)
CHARACTER*10 TITLE
LOGICAL LSOLVE,LPRINT,LBLK,LSTOP,LINPUT,LSAVE
COMMON F(ID,JD,LV),CON(ID,JD),
1 AIP(ID,JD),AIM(ID,JD),AJP(ID,JD),AJM(ID,JD),AP(ID,JD),
2 X(ID),XU(ID),XDIF(ID),XCV(ID),XCVS(ID),
3 Y(JD),YV(JD),YDIF(JD),YCV(JD),YCVS(JD),
4 YCVR(JD),YCVRS(JD),ARX(JD),ARXJ(JD),ARXJP(JD),
5 R(JD),RMN(JD),SX(JD),SXMN(JD),XCVI(ID),XCVIP(ID)
COMMON DU(ID,JD),DV(ID,JD), FV(JD),FVP(JD),
1 FX(ID),FXM(ID),FY(JD),FYM(JD),PT(IMX),QT(IMX)
COMMON/INDX/NF,NFMAX,NP,NRHO,NGAM,L1,L2,L3,M1,M2,M3,
1 IST,JST,ITER,LAST,RELAX(LV),TIME,DT,XL,YL,
2 IPREF,JPREF,LSOLVE(LV),LPRINT(LV),LBLK(LV),MODE,NTIMES(LV),
3 RHOCON,LINPUT(LV),LSAVE(LV)
COMMON/CNTL/LSTOP
COMMON/SORC/SMAX,SSUM
COMMON/COEF/FLOW,DIFF,ACOF
COMMON Uold(ID,JD),Vold(ID,JD),Tfold(ID,JD),Tsold(ID,JD)
DIMENSION U(ID,JD),V(ID,JD),PC(ID,JD),Tf(ID,JD),Ts(ID,JD)
DIMENSION P(ID,JD),RHO(ID,JD),GAM(ID,JD)
EQUIVALENCE(F(1,1,LIV1),P(1,1)),(F(1,1,LIV2),RHO(1,1)),
1 (F(1,1,LIV3),GAM(1,1))
EQUIVALENCE(F(1,1,1),U(1,1)),(F(1,1,2),V(1,1)),(F(1,1,3),PC(1,1))
*,(F(1,1,5),Tf(1,1)),(F(1,1,6),Ts(1,1))
DIMENSION TH(ID),THU(ID),THDIF(ID),THCV(ID),THCVS(ID)
EQUIVALENCE(X,TH),(XU,THU),(XDIF,THDIF),(XCV,THCV)
1 ,(XCVS,THCVS),(XL,THL)
C******************************************************************
1 FORMAT('1',14X,'COMPUTATION IN CARTESIAN COORDINATES')
2 FORMAT('1',14X,'COMPUTATION FOR AXISYMMETRIC SITUATION')
3 FORMAT('1',14X,'COMPUTATION IN POLAR COORDINATES')
4 FORMAT(14X,38(1H*),//)
DATA ZERO/0.0D0/
C-------------------------------------------------------------------
ENTRY SETUP1
L2=L1-1
L3=L2-1
M2=M1-1
M3=M2-1
X(1)=XU(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3
ARXJ(J)=0.25D0*(1.D0+RMN(J)/R(J))*ARX(J)
65 ARXJP(J)=ARX(J)-ARXJ(J)
GO TO 68
67 DO 66 J=3,M3
ARXJ(J)=0.5D0*ARX(J)
66 ARXJP(J)=ARXJ(J)
68 ARXJP(2)=ARX(2)
ARXJ(M2)=ARX(M2)
DO 70 J=3,M3
FV(J)=ARXJP(J)/ARX(J)
70 FVP(J)=1.D0-FV(J)
DO 85 I=3,L2
FX(I)=0.5D0*XCV(I-1)/XDIF(I)
85 FXM(I)=1.D0-FX(I)
FX(2)=0.D0
FXM(2)=1.D0
FX(L1)=1.D0
FXM(L1)=0.D0
DO 90 J=3,M2
FY(J)=0.5D0*YCV(J-1)/YDIF(J)
90 FYM(J)=1.D0-FY(J)
FY(2)=0.D0
FYM(2)=1.D0
FY(M1)=1.D0
FYM(M1)=0.D0
CON,AP,U,V,RHO,PC,C,T AND P ARRAYS ARE INITIALIZED HERE
DO 95 J=1,M1
DO 95 I=1,L1
PC(I,J)=0.D0
U(I,J)=0.D0
V(I,J)=0.D0
Tf(i,j)=0.D0
Ts(i,j)=0.D0
CON(I,J)=0.D0
AP(I,J)=0.D0
RHO(I,J)=RHOCON
P(I,J)=0.D0
95 CONTINUE
OPEN(2,FILE=LISFIL)
IF(MODE.EQ.1) WRITE (1,1)
IF(MODE.EQ.2) WRITE (1,2)
IF(MODE.EQ.3) WRITE (1,3)
WRITE (1,4)
RETURN
C---------------------------------------------------------------
ENTRY SETUP2
COEFFICIENTS FOR THE U EQUATION
NF=1
IF(.NOT.LSOLVE(NF)) GO TO 100
IST=3
JST=2
CALL GAMSOR
REL=1.D0-RELAX(NF)
DO 102 I=3,L2
FL=XCVI(I)*V(I,2)*RHO(I,1)
FLM=XCVIP(I-1)*V(I-1,2)*RHO(I-1,1)
FLOW=R(1)*(FL+FLM)
DIFF=R(1)*(XCVI(I)*GAM(I,1)+XCVIP(I-1)*GAM(I-1,1))/YDIF(2)
CALL DIFLOW
102 AJM(I,2)=ACO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DIF(J)
CON(I,J)=CON(I,J)+DV(I,J)*(P(I,J-1)-P(I,J))
DV(I,J)=DV(I,J)/AP(I,J)
203 CONTINUE
CALL SOLVE
200 CONTINUE
COEFFICIENTS FOR THE PRESSURE CORRECTION EQUATION-------------------
NF=3
IF(.NOT.LSOLVE(NF)) GO TO 500
IST=2
JST=2
CALL GAMSOR
SMAX=0.D0
SSUM=0.D0
DO 390 J=2,M2
DO 390 I=2,L2
VOL=YCVR(J)*XCV(I)
390 CON(I,J)=CON(I,J)*VOL
DO 402 I=2,L2
ARHO=R(1)*XCV(I)*RHO(I,1)
CON(I,2)=CON(I,2)+ARHO*V(I,2)
402 AJM(I,2)=0.D0
DO 403 J=2,M2
ARHO=ARX(J)*RHO(1,J)
CON(2,J)=CON(2,J)+ARHO*U(2,J)
AIM(2,J)=0.D0
DO 403 I=2,L2
IF(I.EQ.L2) GO TO 404
ARHO=ARX(J)*(FX(I+1)*RHO(I+1,J)+FXM(I+1)*RHO(I,J))
FLOW=ARHO*U(I+1,J)
CON(I,J)=CON(I,J)-FLOW
CON(I+1,J)=CON(I+1,J)+FLOW
AIP(I,J)=ARHO*DU(I+1,J)
AIM(I+1,J)=AIP(I,J)
GO TO 405
404 ARHO=ARX(J)*RHO(L1,J)
CON(I,J)=CON(I,J)-ARHO*U(L1,J)
AIP(I,J)=0.D0
405 IF(J.EQ.M2) GO TO 406
ARHO=RMN(J+1)*XCV(I)*(FY(J+1)*RHO(I,J+1)+FYM(J+1)*RHO(I,J))
FLOW=ARHO*V(I,J+1)
CON(I,J)=CON(I,J)-FLOW
CON(I,J+1)=CON(I,J+1)+FLOW
AJP(I,J)=ARHO*DV(I,J+1)
AJM(I,J+1)=AJP(I,J)
GO TO 407
406 ARHO=RMN(M1)*XCV(I)*RHO(I,M1)
CON(I,J)=CON(I,J)-ARHO*V(I,M1)
AJP(I,J)=0.D0
407 AP(I,J)=AIP(I,J)+AIM(I,J)+AJP(I,J)+AJM(I,J)
PC(I,J)=0.D0
SMAX=MAX(SMAX,ABS(CON(I,J)))
SSUM=SSUM+CON(I,J)
403 CONTINUE
CALL SOLVE
COME HERE TO CORRECT THE PRESSURE AND VELOCITIES-------------------
DO 501 J=2,M2
DO 501 I=2,L2
P(I,J)=P(I,J)+PC(I,J)*RELAX(NP)
IF(I.NE.2) U(I,J)=U(I,J)+DU(I,J)*(PC(I-1,J)-PC(I,J))
IF(J.NE.2) V(I,J)=V(I,J)+DV(I,J)*(PC(I,J-1)-PC(I,J))
501 CONTINUE
500 CONTINUE
COEFFICIENTS FOR OTHER EQUATIONS-----------------------------------
IST=2
JST=2
DO 600 N=4,NFMAX
NF=N
IF(.NOT.LSOLVE(NF)) GO TO 600
CALL GAMSOR
REL=1.D0-RELAX(NF)
DO 602 I=2,L2
AREA=R(1)*XCV(I)
FLOW=AREA*V(I,2)*RHO(I,1)
DIFF=AREA*GAM(I,1)/YDIF(2)
CALL DIFLOW
602 AJM(I,2)=ACOF+MAX(ZERO,FLOW)
DO 603 J=2,M2
FLOW=ARX(J)*U(2,J)*RHO(1,J)
DIFF=ARX(J)*GAM(1,J)/(XDIF(2)*SX(J))
CALL DIFLOW
AIM(2,J)=ACOF+MAX(ZERO,FLOW)
DO 603 I=2,L2
IF(I.EQ.L2) GO TO 604
FLOW=ARX(J)*U(I+1,J)*(FX(I+1)*RHO(I+1,J)+FXM(I+1)*RHO(I,J))
DIFF=ARX(J)*2.D0*GAM(I,J)*GAM(I+1,J)/((XCV(I)*GAM(I+1,J)+
+ XCV(I+1)*GAM(I,J)+1.0D-30)*SX(J))
GO TO 605
604 FLOW=ARX(J)*U(L1,J)*RHO(L1,J)
DIFF=ARX(J)*GAM(L1,J)/(XDIF(L1)*SX(J))
605 CALL DIFLOW
AIM(I+1,J)=ACOF+MAX(ZERO,FLOW)
AIP(I,J)=AIM(I+1,J)-FLOW
AREA=RMN(J+1)*XCV(I)
IF(J.EQ.M2) GO TO 606
FLOW=AREA*V(I,J+1)*(FY(J+1)*RHO(I,J+1)+FYM(J+1)*RHO(I,J))
DIFF=AREA*2.D0*GAM(I,J)*GAM(I,J+1)/(YCV(J)*GAM(I,J+1)+
+ YCV(J+1)*GAM(I,J)+1.0D-30)
GO TO 607
606 FLOW=AREA*V(I,M1)*RHO(I,M1)
DIFF=AREA*GAM(I,M1)/YDIF(M1)
607 CALL DIFLOW
AJM(I,J+1)=ACOF+MAX(ZERO,FLOW)
AJP(I,J)=AJM(I,J+1)-FLOW
VOL=YCVR(J)*XCV(I)
APT=RHO(I,J)/DT
AP(I,J)=AP(I,J)-APT
CON(I,J)=CON(I,J)+APT*F(I,J,NF)
AP(I,J)=(-AP(I,J)*VOL+AIP(I,J)+AIM(I,J)+AJP(I,J)+AJM(I,J))
+/RELAX(NF)
CON(I,J)=CON(I,J)*VOL+REL*AP(I,J)*F(I,J,NF)
603 CONTINUE
CALL SOLVE
600 CONTINUE
TIME=TIME+DT
ITER=ITER+1
IF(ITER.GE.LAST) LSTOP=.TRUE.
RETURN
END
SUBROUTINE sinmesh(D,N,L)
! DIVIDES A LENGTH SYMMETRICALLY WITH FINER MESHES ON BOTH ENDS
! D(I)= GRID LENGTH OF INTERVAL I [d(i)=c*(sin(pi/2*N))**2*i]
! N = NUMBER OF NODES(NO OF INTERVALS+1)
! L = LENGTH TO BE DIVIDED
REAL L,SUM
DIMENSION D(N+1)
PI=3.1415927
A=PI/N
C=A*L/(2-A/2*(SIN(A/4)+SIN(PI-A/4)))
SUM=0
DO I=1,N-1
D(I)=C*SIN(A*I)
SUM=SUM+D(I)
END DO
DIF=(SUM-L)/(N-1)
DO I=1,N-1
D(I)=D(I)-DIF
END DO
! START D FROM 2
DO I=N,2,-1
D(I)=D(I-1)
END DO
D(1)=0
RETURN
END
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SUBROUTINE SUPPLY
C******************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
PARAMETER (ID=400,JD=400,IMX=400)
PARAMETER (LIV=10)
PARAMETER (LV=LIV+3)
PARAMETER (LIV1=LIV+1,LIV2=LIV+2,LIV3=LIV+3)
CHARACTER*40 INPUTF,SAVEF,LISFIL
CHARACTER*10 TITLE
COMMON/FILE/INPUTF,SAVEF,LISFIL,TITLE(LV)
! LOGICAL LSOLVE,LPRINT,LBLK,LSTOP,LINPUT,LSAVE
LOGICAL LSOLVE,LPRINT,LBLK,LINPUT,LSAVE
COMMON F(ID,JD,LV),CON(ID,JD),
1 AIP(ID,JD),AIM(ID,JD),AJP(ID,JD),AJM(ID,JD),AP(ID,JD),
2 X(ID),XU(ID),XDIF(ID),XCV(ID),XCVS(ID),
3 Y(JD),YV(JD),YDIF(JD),YCV(JD),YCVS(JD),
4 YCVR(JD),YCVRS(JD),ARX(JD),ARXJ(JD),ARXJP(JD),
5 R(JD),RMN(JD),SX(JD),SXMN(JD),XCVI(ID),XCVIP(ID)
COMMON DU(ID,JD),DV(ID,JD), FV(JD),FVP(JD),
1 FX(ID),FXM(ID),FY(JD),FYM(JD),PT(IMX),QT(IMX)
COMMON/INDX/NF,NFMAX,NP,NRHO,NGAM,L1,L2,L3,M1,M2,M3,
1 IST,JST,ITER,LAST,RELAX(LV),TIME,DT,XL,YL,
2 IPREF,JPREF,LSOLVE(LV),LPRINT(LV),LBLK(LV),MODE,NTIMES(LV),
3 RHOCON,LINPUT(LV),LSAVE(LV),
4amb1,amb2,amb3,amb4,amb5,amb6
DIMENSION U(ID,JD),V(ID,JD),PC(ID,JD)
DIMENSION P(ID,JD),RHO(ID,JD),GAM(ID,JD)
EQUIVALENCE(F(1,1,LIV1),P(1,1)),(F(1,1,LIV2),RHO(1,1)),
1 (F(1,1,LIV3),GAM(1,1))
EQUIVALENCE(F(1,1,1),U(1,1)),(F(1,1,2),V(1,1)),(F(1,1,3),PC(1,1))
DIMENSION TH(ID),THU(ID),THDIF(ID),THCV(ID),THCVS(ID)
EQUIVALENCE(X,TH),(XU,THU),(XDIF,THDIF),(XCV,THCV)
1 ,(XCVS,THCVS),(XL,THL)
C******************************************************************
10 FORMAT('1',26(1H*),3X,A10,3X,26(1H*))
20 FORMAT(1X,4H I =,I6,6I9)
30 FORMAT(1X,1HJ)
40 FORMAT(1X,I2,1P7E9.2)
50 FORMAT(1X,1H )
51 FORMAT(1X,'I =',2X,7(I4,1X))
52 FORMAT(1X,'X =',1P7E9.2)
53 FORMAT(1X,'TH =',1P7E9.2)
54 FORMAT(1X,'J =',2X,7(I4,1X))
55 FORMAT(1X,'Y =',1P7E9.2)
C******************************************************************
ENTRY UGRID
XU(2)=0.D0
DX=XL/DBLE(L1-2)
DO 1 I=3,L1
1 XU(I)=XU(I-1)+DX
YV(2)=0.D0
DY=YL/DBLE(M1-2)
DO 2 J=3,M1
2 YV(J)=YV(J-1)+DY
RETURN
C************************************************
ENTRY PRINT
IF(.NOT.LPRINT(3)) GO TO 80
CALCULATE THE STREAM FUNCTION---------------------------------------
F(2,2,3)=0.
DO 82 I=2,L1
IF(I.NE.2) F(I,2,3)=F(I-1,2,3)-RHO(I-1,1)*V(I-1,2)
1*XCV(I-1)
DO 82 J=3,M1
RHOM=FX(I)*RHO(I,J-1)+FXM(I)*RHO(I-1,J-1)
82 F(I,J,3)=F(I,J-1,3)+RHOM*U(I,J-1)*ARX(J-1)
80 CONTINUE
C IF(.NOT.LPRINT(np)) GO TO 90
C
CONSTRUCT BOUNDARY PRESSURES BY EXTRAPOLATION
DO 91 J=2,M2
P(1,J)=(P(2,J)*XCVS(3)-P(3,J)*XDIF(2))/XDIF(3)
91 P(L1,J)=(P(L2,J)*XCVS(L2)-P(L3,J)*XDIF(L1))/XDIF(L2)
DO 92 I=2,L2
P(I,1)=(P(I,2)*YCVS(3)-P(I,3)*YDIF(2))/YDIF(3)
92 P(I,M1)=(P(I,M2)*YCVS(M2)-P(I,M3)*YDIF(M1))/YDIF(M2)
P(1,1)=P(2,1)+P(1,2)-P(2,2)
P(L1,1)=P(L2,1)+P(L1,2)-P(L2,2)
P(1,M1)=P(2,M1)+P(1,M2)-P(2,M2)
P(L1,M1)=P(L2,M1)+P(L1,M2)-P(L2,M2)
PREF=P(IPREF,JPREF)
DO 93 J=1,M1
DO 93 I=1,L1
93 P(I,J)=P(I,J)-PREF
90 CONTINUE
C
c PRINT 50
write(7,50)
c write(7,*)
IEND=0
301 IF(IEND.EQ.L1) GO TO 310
IBEG=IEND+1
IEND=IEND+10
! IEND=MIN0(IEND,L1)
c PRINT 50
! write(7,50)
c write(*,50)
c PRINT 51,(I,I=IBEG,IEND)
! write(7,51) (i,i=ibeg,iend)
c write(*,51) (i,i=ibeg,iend)
IF(MODE.EQ.3) GO TO 302
c PRINT 52,(X(I),I=IBEG,IEND)
! write(7,52) (x(i),i=ibeg,iend)
c write(*,52) (x(i),i=ibeg,iend)
GO TO 303
c 302 PRINT 53,(X(I),I=IBEG,IEND)
302 write(7,53) (x(i),i=ibeg,iend)
c write(*,53) (x(i),i=ibeg,iend)
303 GO TO 301
310 JEND=0
c PRINT 50
! write(7,50)
c write(*,50)
311 IF(JEND.EQ.M1) GO TO 320
JBEG=JEND+1
JEND=JEND+10
! JEND=MIN0(JEND,M1)
c PRINT 50
! write(7,50)
c write(*,50)
! write(7,54) (j,j=jbeg,jend)
c write(*,54) (j,j=jbeg,jend)
! write(7,55) (y(j),j=jbeg,jend)
c write(*,55) (y(j),j=jbeg,jend)
c PRINT 54,(J,J=JBEG,JEND)
c PRINT 55,(Y(J),J=JBEG,JEND)
GO TO 311
320 CONTINUE
C
DO 999 NF=1,NGAM
IF(.NOT.LPRINT(NF)) GO TO 999
c PRINT 50
c PRINT 10,TITLE(NF)
! write(7,50)
c write(*,50)
! write(7,10) title(nf)
c write(*,10) title(nf)
IFST=1
JFST=1
IF(NF.EQ.1.OR.NF.EQ.3) IFST=2
IF(NF.EQ.2.OR.NF.EQ.3) JFST=2
IBEG=IFST-10
110 CONTINUE
! IBEG=IBEG+10
! IEND=IBEG+9
! IEND=MIN0(IEND,L1)
c PRINT 50
! write(7,50)
c write(*,50)
! write(7,20) (i,i=ibeg,iend)
c write(*,20) (i,i=ibeg,iend)
c PRINT 20,(I,I=IBEG,IEND)
c PRINT 30
! write(7,30)
c write(*,30)
!! JFL=JFST+M1
! DO 115 JJ=JFST,M1
! J=JFL-JJ
c PRINT 40,J,(F(I,J,NF),I=IBEG,IEND)
! write(7,40) J,(F(I,J,NF),I=IBEG,IEND)
c write(*,40) J,(F(I,J,NF),I=IBEG,IEND)
115 CONTINUE
! IF(IEND.LT.L1) GO TO 110
999 CONTINUE
RETURN
end
C ********************************************************
SUBROUTINE USER
C ********************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
PARAMETER (ID=400,JD=400,IMX=400)
PARAMETER (LIV=10)
PARAMETER (LV=LIV+3)
PARAMETER (LIV1=LIV+1,LIV2=LIV+2,LIV3=LIV+3)
CHARACTER*40 INPUTF,SAVEF,LISFIL
COMMON/FILE/INPUTF,SAVEF,LISFIL,TITLE(LV)
CHARACTER*10 TITLE
LOGICAL LSOLVE,LPRINT,LBLK,LSTOP,LINPUT,LSAVE
COMMON F(ID,JD,LV),CON(ID,JD),
1 AIP(ID,JD),AIM(ID,JD),AJP(ID,JD),AJM(ID,JD),AP(ID,JD),
2 X(ID),XU(ID),XDIF(ID),XCV(ID),XCVS(ID),
3 Y(JD),YV(JD),YDIF(JD),YCV(JD),YCVS(JD),YCVR(JD),
4 YCVRS(JD),ARX(JD),ARXJ(JD),ARXJP(JD),R(JD),RMN(JD),
5 SX(JD),SXMN(JD),XCVI(JD),XCVIP(JD)
COMMON DU(ID,JD),DV(ID,JD),FV(JD),FVP(JD),
1 FX(ID),FXM(ID),FY(JD),FYM(JD),PT(IMX),QT(IMX)
2 ,NCVX(ID),NCVY(JD),XZONE(ID),YZONE(JD),POWRX(ID),POWRY(JD)
COMMON/INDX/NF,NFMAX,NP,NRHO,NGAM,L1,L2,L3,M1,M2,M3,
1 IST,JST,ITER,LAST,RELAX(LV),TIME,DT,XL,YL,IPREF,
2 JPREF,LSOLVE(LV),LPRINT(LV),LBLK(LV),MODE,NTIMES(LV),
3 RHOCON,LINPUT(LV),LSAVE(LV)
COMMON/CNTL/LSTOP
COMMON/SORC/SMAX,SSUM,amb1,amb2,amb3,amb4,amb5,amb6
COMMON/COEF/FLOW,DIFF,ACOF
COMMON Uold(ID,JD),Vold(ID,JD),Tfold(ID,JD),cold(ID,JD),
*Pold(ID,JD),Psiol(ID,JD)
DIMENSION U(ID,JD),V(ID,JD),PC(ID,JD),C(ID,JD),xmu(id,jd),
*ama1(ID,JD),ama2(ID,JD),ama3(ID,JD),ama4(ID,JD),ama5(ID,JD),
* ama6(ID,JD)
DIMENSION P(ID,JD),RHO(ID,JD),GAM(ID,JD),coef1(id)
EQUIVALENCE(F(1,1,LIV1),P(1,1)),(F(1,1,LIV2),RHO(1,1)),
1 (F(1,1,LIV3),GAM(1,1))
EQUIVALENCE(F(1,1,1),U(1,1)),(F(1,1,2),V(1,1)),
1 (F(1,1,3),PC(1,1)),(F(1,1,4),C(1,1))
DIMENSION TH(ID),THU(ID),THDIF(ID),THCV(ID),THCVS(ID)
EQUIVALENCE(X,TH),(XU,THU),(XDIF,THDIF),(XCV,THCV),
1 (XCVS,THCVS),(XL,THL)
dimension somu(id,jd),somy(id,jd),umoy(id,jd),COEF2(id),
1somV(id,jd),somP(id,jd),somC(id,jd),s(id,jd)
dimension Xpi(id,jd),dMpi(id),b(id,jd),d2(id,jd),a(id,jd)
DIMENSION GAMU1(id,jd),gamc(id,jd),gamu2(id,jd),dp2(id)
dimension conu1(id,jd),conu2(id,jd),conc(id,jd),APu1(id,jd)
dimension apu2(id,jd),apc(id,jd),d(id),dmoy(id),c1(id),a1(id),
;b1(id),aS(id),bS(id)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCC--------LISTING DE LA PARTIE USER-----------CCCCCCCCC
C*************************************************************
C programme
C
C*************************************************************
c --------------
ENTRY GRID
mode=2
l1=250
m1=120
L5=L1-250
m5=46
!m7=m5+1
!m6=
xL=0.250
yL=0.0032
n=M1+1
L=yl
yl5=yl-0.002
!yl6=(yl-YL5)/
l2=l1-1
l3=l2-1
m2=m1-1
m3=m2-1
call ugrid
call sinmesh(D,n,l)
!YV(2)=0.
!DY=YL/FLOAT(M1-2)
c DO 2 J=3,M1
c WRITE(*,*)j,Yv(J)
c 2 PAUSE
! 2 YV(J)=YV(J-1)+D(i)
RETURN
c --------------
ENTRY START
LAST=1000
do k=1,6
lsolve(k)=.true.
lblk(5)=.true.
!Ntimes(k)=10
enddo
c********données Fixes****************************
dK=2.e-10
dR=0.95
Co=0.002
umoy22=0.002
dp=5.E+5
crt=1E-2
crt1=0
cccccccccccccccccc pr les donné
do i=1,l1
do j=1,m1
c P(2,j)=.E+5
c P(L2,j)=-1.5E+5
pc(j,l1)=0
!d(i)=c*(sin(pi/2*N))**2*i
b(i,j)=1.451e-9
Rho(i,j)=997.1*(1+0.694*C(i,j))
A(i,j)=1.61E-9*(1-14*C(i,J))
D2(i,j)=dMAX1(a(i,j),b(i,j))
!PRINT*,d(i,j)
XPI(i,j)=(805E+5)*C(i,j) !*1.E-7
xmu(i,j)=(0.891E-3)*(1+1.63*C(i,j))
c write(*,*) 'xmu(i,j)',i,j,xmu(i,j)
!Pref =0.5E+5
dp2(i)=(P(i,m5)-p(i,m5-1)) !*Pref !+10.e+5
c dp2(i)=P(i,m5-1)
!((p(2,m5+1)+P(L1,M5+1))/2)-1.E+5
! XpI(i,m5-1)=XPI(i,M5)+5E5
dmoy(i)=2*d2(i,M5)*d2(i,m5-1)/(d2(i,m5)+d2(i,m5-1)+1E-25)
dmpi(i)=xpi(i,M5)-xpi(i,m5-1)
!write(*,*) 'i dMPI(i)dp2(i)',i,Pref,p(i,m5),dp2(i)
enddo
enddo
cccccccccccccccccccccccpr les gam******************
do i=1,L1
do j=1,m1
gamU1(i,j)=xmu(i,j)
gamu2(i,j)=xmu(i,j)
gamc(i,j)=rho(i,j)*D2(i,j)
c gamU1(i,M5)=1.E-20
c gamu2(i,M5)=1.E-20
CONu1(i,j)=0.
CONu2(i,j)=0.
CONC(i,j)=0.
APU1(i,j)=0.
APu2(i,j)=0.
APC(i,j)=0.
!apu1(i,M5)=-1.
!apu2(i,M5)=-1.
!Conu1(i,M5)=0.
!Conu2(i,M5)=V(i,M5)
enddo
enddo
ccc***************************************************************************
c initialisation de la concentration
c*****************************ccccccccccccccccc************************
do i=1,l1
do j=1,m1
! u(2,j)=6*umoy22*(yv(j)/(YL))*(1-(yv(j)/yl))
!u(2,j)=0.
c u(2,j)=umoy22
!C(i,j)=0.
!C(1,j)=0.
C write(143,*)j,yv(j),u(2,j)
c P(i,j)=1.E+5
enddo
enddo
do i=1,l1
do j=m5,m1
!u(2,j)=6*umoy22*((yv(j)-yv(M5))/(0.002))*(1-((yv(j)-yv(M5))/
! .0.002))
! u(2,j)=umoy22
!
! C(i,j)=Co
! C(1,j)=Co
enddo
enddo
! do i=1,L1
! do J=1,M5
! c(i,j)=0
! enddo
! enddo
RETURN
C -------------
ENTRY DENSE
C -------------
!do i=1,l1
!S(i,m5)=(ydif(m5))/(rho(i,m5+1)*d2(i,M5)+1.e-25)
!s(i,m5)=2E12
! enddo
if(iter.le.last)then
relax(1)=0.0001d0
relax(2)=0.01d0
relax(4)=0.7d0
relax(5)=0.9d0
relax(5)=0.9d0
endif
if(iter.gt.2)then
amb1=0.
amb2=0.
amb3=0.
amb4=0.
amb5=0.
amb6=0.
endif
do 71 i=2,l2
do 71 j=3,m2
ama1(i,j)=abs((u(i,j)-uold(i,j))/(u(i,j)+1.e-25))
amb1=max(amb1,ama1(i,j))
71 continue
do 72 i=2,l2
do 72 j=3,m2
ama2(i,j)=abs((v(i,j)-vold(i,j))/(v(i,j)+1.e-25))
amb2=max(amb2,ama2(i,j))
72 continue
do 721 i=2,l2
do 721 j=3,m2
ama5(i,j)=abs((P(i,j)-Pold(i,j))/(P(i,j)+1.e-25))
amb5=max(amb5,ama5(i,j))
721 continue
do 722 i=2,l2
do 722 j=3,m2
ama6(i,j)=abs((Psiol(i,j)-F(i,j,3))/(Psiol(i,j)+1.e-25))
amb6=max(amb6,ama6(i,j))
722 continue
do 73 i=3,l2
do 73 j=2,m2
ama3(i,j)=abs((C(i,j)-Cold(i,j))/(C(i,j)+1.e-25))
amb3=max(amb3,ama3(i,j))
73 continue
xmaxerr=max(amb1,amb3)
do i=2,l1
do j=2,m1
uold(i,j)=u(i,j)
vold(i,j)=v(i,j)
Pold(i,j)=P(i,j)
enddo
enddo
do i=2,l2
do j=1,m1
cold(i,j)=c(i,j)
Psiol(i,j)=F(i,j,3)
enddo
enddo
RETURN
ENTRY BOUND
c-----sortie sortie sortie
! relax(1)=0.1 !4d0
! relax(2)=0.01 !44d0
! relax(3)=0.65d0
! relax(4)=0.65d0
do j=1,m1
! pc(j,l1)=0
! V(l1,j)=V(l2,j)
V(l1,j)=0.
U(l1,j)=U(l2,j)
c(L1,J)=C(L1-1,j)
c c(L1,J)=Co
ENDDO
c---condition sur la concentration au niveau de l'entrée
do j=M5,m1
u(2,j)=6*UMOY22*(yV(j)-yV(M5))/0.002*(1-(yV(j)-yV(M5))/0.002)
C P(1,j)=30E5
c write(*,*)j,u(2,j)
c pause
c u(2,j)=umoy22
v(1,j)=0.
enddo
do j=m5,m1
c(1,j)=co
enddo
ccondition sur I=+1 et j=1,M5coté permeat(solide pr delimité l'entrée)
do j=1,m5-1
v(1,j)=0.
u(2,j)=0.
c(1,j)=c(2,j)
END DO
********au niveau de la paroi non membranaire**********************
*******coté feed channel****
do i=2,l1
u(i,m1)=0.
ENDDO
do i=1,l1
v(i,m1)=0.
c(i,m1)=c(i,m2)
c c(i,m1)=Co
enddo
*******coté permeat*****
do i=2,l1
u(i,1)=0.
enddo
do i=1,l1
v(i,2)=0.
c(i,1)=c(i,2)
enddo
! return
! ENTRY membrane
C---------condition au limites au niveau de la membranne (partie du feed channel)
do i=1,L1
do j=M5,M1
! c(i,m5)=0.006
c(1,j)=0.002
U(i,M5)=0
V(i,M5)=dk*(dp2(i)-dMpi(i)) !
c(i,m5+1)=c(i,m5)+c(i,m5)*(0.95*(5E-6)*v(i,m5)*rho(i,M5)/
;(rho(i,m5)*D2(i,m5)+1e-25))
enddo
enddo
***********COTé Du permeat *************************
DO I=1,l1
do j=1,M5-1
U(i,M5-1)=0
v(i,M5-1)=V(i,M5)*rho(i,M5)/(rho(i,M5-1)+1E-25)
c(i,m5-1)=(c(i,m5-2)-(c(i,m5)*(ydif(m5))*rho(i,m5)*v(i,m5)*0.05/
;(rho(i,M5-1)*d2(i,M5)+1e-25)))/(1+(ydif(m5)*rho(i,m5-1)*v(i,m5-1)/
;(rho(i,m5-1)*d2(i,m5-1)+1e-25)))
enddo
enddo
RETURN
ENTRY OUTPUT
c ******my output***************************
ccccccccccc*************************************************ccccccccc
if(iter.le.last)then
goto 400
print 401
write(7,401)
401 format(1x,'iter',1x,'ssum',1x,'smax',1x,'time',1x,'v(10,10)',
*1x,'c(10,10)')
print*,last
400 print*,iter,ssum,smax,xmaxerr,V(10,m5),U(15,10)
print*,iter,ssum,smax,xmaxerr,V(L2,m5),U(L2,M5+10)
print*,iter,amb3,amb1,amb2,amb5
!print 402,iter,amb1,amb2,amb3,amb4,amb5
ITER=ITER+1
else
LSTOP=.TRUE.
402 format(i8,1p5e15.5)
endif
crt=1.E-6
crt1=1.E-4 !gam(i,M5)=1.e+05
if(iter.ge.Last-1.and.abs(ssum).lt.1.e-6)then
! if(iter.gt.10.and.abs(ssum).lt.1.e-6)then
! if(amb1.lt.crt.and.amb3.lt.crt.and.amb5.lt.crt)then
! if(amb2.lt.crt1)then
open(132,file='v.dat',status='unknown')
open(133,file='c.dat',status='unknown')
open(134,file='P.dat',status='unknown')
open(135,file='U.dat',status='unknown')
open(545,file='velocityV.dat',status='unknown')
open(12,file='Cmmbrn.dat',status='unknown')
open(15,file='VIM5.dat',status='unknown')
open(831,file='cy.dat',status='unknown')
do j=1,m1
write(831,*) yv(j),c(240,J),c(10,J)
enddo
do i=1,l1
do j=1,m1
write(132,*)xu(i),yv(j),v(i,j)
write(133,*)xu(i),yv(j),c(i,j)
write(135,*)xu(i),yv(j),U(i,j)
write(134,*)xu(i),yv(j),F(i,j,3)
enddo
enddo
do J=1,M1
write(545,*) YV(j),V(240,J),U(240,J)
enddo
do i=1,L1
write(12,*) x(i),c(i,M1),c(i,m5)
enddo
do i=1,L1
write(15,*) y(i),V(i,M5),V(i,m5-1)
enddo
lstop=.true.
endif
if(iter.eq.last)then
open(132,file='v.dat',status='unknown')
open(133,file='c.dat',status='unknown')
open(134,file='P.dat',status='unknown')
open(135,file='U.dat',status='unknown')
open(12,file='Cmmbrn.dat',status='unknown')
open(545,file='velocityV.dat',status='unknown')
!open(13,file='cy.dat',status='unknown')
open(15,file='VIM5.dat',status='unknown')
open(831,file='cy.dat',status='unknown')
do j=1,m1
write(831,*) yv(j),c(240,J),c(10,J)
enddo
do i=1,L1
write(15,*) y(i),V(i,M5),V(i,m5-1)
enddo
do i=1,l1
do j=1,M1
write(132,*)xu(i),yv(j),v(i,j)
write(133,*)x(i),y(j),c(i,j)
write(135,*)xu(i),yv(j),U(i,j)
write(134,*)xu(i),yv(j),F(i,j,3)
enddo
enddo
do i=1,L1
write(12,*) x(i),c(i,M1),c(i,m5)
enddo
!do j=m5-1,m5
!do i=1,l1
! write(15,*)yv(j),c(240,j)
! enddo
!enddo
do J=1,M1
write(545,*) YV(j),V(240,J),U(240,J)
!write(13,*)yv(j),c(240,j)
enddo
lstop=.true.
endif
! endif
! endif
c************************cccccccc*******************ccccccc********
C --------------
if(iter.le.last)then
F(2,2,3)=0.D0
DO I=2,L1
IF(I.NE.2) F(I,2,3)=F(I-1,2,3)-RHO(I-1,1)*V(I-1,2)
1*R(1)*XCV(I-1)
DO J=3,M1
RHOM=FX(I)*RHO(I,J-1)+FXM(I)*RHO(I-1,J-1)
F(I,J,3)=F(I,J-1,3)+RHOM*U(I,J-1)*ARX(J-1)
end Do
!IF(j.EQ.m5) then
!f(i,m5,5)=F(I,M5-1,5)/
! ;(1-(0.95*ydif(m5)*v(I,M5)/D2(I,M5)))
!endif
! print*,'f(i,m5-1,5),f(i,m5,5)',f(i,m5-1,5),f(i,m5,5)
! print*,'apppppppp',ap(i,m5-1),ap(i,m5)
!F(2,m5+1,3)=0.D0
!IF(j.E.m5) F(I,m5,5)=F(I,M5-1,5)/(1-(0.95*v(I,M5)/D(I,M5)
! !1*R(M5)*XCV(I-1)
! DO J=1,M5
! RHOM=FX(I)*RHO(I,J-1)+FXM(I)*RHO(I-1,J-1)
! F(I,J,3)=F(I,J-1,3)+RHOM*U(I,J-1)*ARX(J-1)
!write(*,*) 'bbbbbbbbbbbbbbbbbbb',f(i,j,3)
! end do
end Do
endif
! endif
RETURN
c --------------
ENTRY GAMSOR
C --------------
if(nf.eq.1)then
do i=1,l1
do j=1,M1
!m5
gam(i,j)=gamu1(i,j)
!gam(i,M5)=1.e+25
!gam(i,M5-1)=1.e+25
!gam(L1,j)=0.
enddo
enddo
do i=1,20
GAM(i,m5-1)=1E30
gam(i,M5)=1E30
enddo
do i=3,L2
do j=1,m1
ap(i,j)=0.
con(i,j)=0.
c ap(i,M5)=-1.
c Con(i,M5)=V(i,M5)
enddo
enddo
CONDITION SUR LAPARTIE SOLIDE
!do J=1,M5
!GAMu1(1,j)=0.89E-3 !1.4
!enddo
endif
if(nf.eq.2)then
do 560 i=1,l1
do 560 j=1,m1
gam(i,j)=gamU2(i,j)
!gam(L1,j)=0.
560 continue
do i=3,L2
do j=1,m1
ap(i,j)=0.
c ap(i,M5)=-1.
con(i,j)=0.
ENDDO
ENDDO
CONDITION SUR LAPARTIE SOLIDE
!do J=1,M5
!GAM(1,j)=0.89E-3 !1.4
!enddo
endif
if(nf.eq.4)then
do i=1,l1
do j=1,m1
gam(i,j)=gamC(i,j)
ap(i,j)=0
con(i,j)=0
! gam(i,M5)=0
!gam(i,M5)=rho(i,m5)*v(i,m5)*d2(i,m5)
! AP(i,M5)=-(V(i,M5)*V(i,M5)*rho(i,M5)*0.95)/(D2(i,M5)+1.E-25)
! con(i,M5)=0.
! gam(i,M5-1)=0
!gam(i,M5-1)=rho(i,m5-1)*v(i,m5-1)*d2(i,m5-1)
! AP(i,M5-1)=-(V(i,M5-1)*V(i,M5-1)*rho(i,M5-1))
! ;/(D2(i,M5-1)+1.E-25)
! con(i,M5-1)=C(i,M5)*(V(i,M5-1)*V(i,M5)*rho(i,M5)*0.05)
! 1/(D2(i,M5-1)+1.E-25)
!gam(L1,j)=0
C WRITE(*,*)'MMMKLKKJHJ',I,J, gam(i,j),AP(i,j),CON(i,j)
C IF(J.EQ.M5)PAUSE
C IF(J.EQ.M5-1)PAUSE
ENDDO
ENDDO
endif
c************************************************************************************
return
end |
Partager