contoh program fortran 77

Download contoh program fortran 77

Post on 03-Nov-2014

236 views

Category:

Documents

20 download

DESCRIPTION

bismillah

TRANSCRIPT

<p>C****************** PROGRAM SUNSET **************************** C C C A SOLVER FOR UNSTEADY NAVIER-STOKES EQUATIONS, TWO-DIMENSIONAL C C * * * * * * C C C THE PROGRAM " SUNSET " HAS BEEN DESIGNED FOR THE FLOW AND HEAT C C TRANSFER ANALYSIS OF UNSTEADY INCOMPRESSIBLE FLOWS WITH OR C C WITHOUT SWIRL. THE EQUATIONS OF CONTINUITY, NAVIER-STOKES AND C C ENERGY BALANCE ARE COUPLED AND SOLVED USING THE " SIMPLE " C C ALGORITHM PROPOSED BY DRS. PATANKAR AND SPALDING. FREE, FORCED C C AND COMBINED CONVECTION PROBLEMS CAN BE TREATED UNDER ARBITRARY C C INITIAL, BOUNDARY AND GEOMETRICAL CONDITIONS. A USER MAY COMBINE C C IT WITH ANY PARTICULAR HIGH REYNOLDS NUMBER TURBULENCE MODEL TO C C INVESTIGATE TURBULENT FLOW AND HEAT TRANSFER CHARACTERISTICS. C C C C******************************************************************** C CHARACTER*8 FILE1,FILE2 COMMON PHI(40,240),PHIOLD(40,240),GAM(40,40),SC(40,40), &amp; SP(40,40),AE(40,40),AW(40,40),AN(40,40), &amp; AS(40,40),SDX(40,40),SDY(40,40) DIMENSION U(40,40),V(40,40),PC(40,40),T(40,40),W(40,40),P(40,40) EQUIVALENCE (PHI(1,1),U(1,1)),(PHI(1,41),V(1,1)), &amp; (PHI(1,81),PC(1,1)),(PHI(1,121),T(1,1)), &amp; (PHI(1,161),W(1,1)),(PHI(1,201),P(1,1)) COMMON/BLOCK0/ NITERT,ITERT,INTPRI,NLUMP,ISCAN,JSCAN,DTIME, &amp; ISOLVE(10),IPRINT(10), &amp; LUMPE(10),LUMPW(10),LUMPN(10),LUMPS(10), &amp; IRMAX,JRMAX,RESMAX COMMON/BLOCK1/ NTIMST,ITURB,IRAD,IREAD,NPHI,IPHI,IU,IV,IPC,IT, &amp; IW,IP,NI,NJ,JDIM,IREF,JREF,RENO,GRNO,DIRCOS,PR, &amp; TIME,IFORS(40,40),ALPHA(10),NIM1,NJM1,NIP1,NJP1, &amp; IEND,JEND,ICNTDF COMMON/BLOCK2/ X(40),Y(40),XP(40),YP(40),DXP(40),DYP(40), &amp; DXU(40),DYV(40),DX(40),DY(40),DELX(40),DELY(40), &amp; FACX(40),FACY(40),RX(40),RY(40),BIGNO,ZERO C C C-----PREPARE FOR A START. CALL CONVOL CALL CONFIG CALL INITIA TIME=0. CALL DATAIN C-----IF IREAD = 1, OVERWRITE RESULTS AND GO ON FROM THAT TIME. IF(IREAD.NE.1) GO TO 2000 OPEN(11,FORM='UNFORMATTED',FILE='DATA',STATUS='UNKNOWN') READ(11) NI,NJ,TIME,PHI,PHIOLD,XP,YP C-----PRINT CONTROL PARAMETERS AND INITIAL VALUES TO START WITH. 2000 OPEN(21,FORM='FORMATTED',FILE='RESULT',STATUS='UNKNOWN') WRITE(21,100) NTIMST,NITERT,DTIME,RENO,GRNO,PR,ITURB,IRAD,ICNTDF WRITE(21,150) DO 1000 J=1,NJP1 JJ=NJP1-J+1 1000 WRITE(21,200) JJ,(IFORS(I,JJ),I=1,NIP1) JJ=0 WRITE(21,200) JJ,(I,I=1,NIP1) CALL PRINTS C-----START TIME MARCHING. DO 1100 ITIMST=1,NTIMST</p> <p>WRITE(6,*) ITIMST C-----SKIP BELOW FOR STEADY SOLUTIONS. IF(NTIMST.EQ.1) GO TO 1200 C-----ADVANCE TIME BY DTIME. TIME=TIME+DTIME C-----STORE OLD RESULTS IN PHIOLD. DO 1300 IPHI=1,NPHI J0=(IPHI-1)*JDIM DO 1300 J=1,NJP1 JJ=J0+J DO 1300 I=1,NIP1 1300 PHIOLD(I,JJ)=PHI(I,JJ) C-----SET BOUNDARY VALUES AT NEW TIME. CALL DATAIN C-----START ITERATION. 1200 DO 1400 ITERT=1,NITERT C-----SOLVE EQS. FOR U, V AND PC. DO 1500 IPHI=1,3 1500 CALL SOLPHI C-----CORRECT U, V AND P. CALL CORREC C-----MONITOR RESIDUAL, TYPICAL U, V AND P VALUES. WRITE(21,250) ITIMST,TIME,ITERT,RESMAX,IRMAX,JRMAX, &amp; U(ISCAN,JSCAN),V(ISCAN,JSCAN),P(ISCAN,JSCAN) IF(NPHI.LE.3) GO TO 1600 C-----SOLVE EQS. FOR OTHER SCALARS. DO 1700 IPHI=4,NPHI 1700 CALL SOLPHI C-----UPDATE BOUNDARY VALUES. 1600 CALL BOUNDS CALL DATAIN C-----PRINT RESULTS EVERY INTPRI ITERATIONS. 1400 IF(NTIMST.EQ.1.AND.MOD(ITERT,INTPRI).EQ.0) CALL PRINTS C-----PRINT RESULTS EVERY INTPRI TIME STEPS. 1100 IF(NTIMST.GT.1.AND.MOD(ITIMST,INTPRI).EQ.0) CALL PRINTS C-----PRINT RESULTS AT TERMINATION. IF(NTIMST.EQ.1.AND.MOD(NITERT,INTPRI).NE.0) CALL PRINTS IF(NTIMST.GT.1.AND.MOD(NTIMST,INTPRI).NE.0) CALL PRINTS C-----STORE RESULTS IN THE OUTPUT FILE. OPEN(12,FORM='UNFORMATTED',FILE='DATA',STATUS='UNKNOWN') WRITE(12) NI,NJ,TIME,PHI,PHIOLD,XP,YP C OPEN(91,FILE='U_VEL',STATUS='UNKNOWN') OPEN(92,FILE='V_VEL',STATUS='UNKNOWN') OPEN(93,FILE='TEMP',STATUS='UNKNOWN') OPEN(76,FILE='X_GRID',STATUS='UNKNOWN') OPEN(77,FILE='Y_GRID',STATUS='UNKNOWN') DO 4980 J=1,NJ WRITE(93,4971) (T(I,J),I=1,NI) WRITE(91,4971) (U(I,J),I=1,NI) 4980 WRITE(92,4971) (V(I,J),I=1,NI) C WRITE(76,3301) (X(I),I=1,NI) WRITE(77,3301) (Y(J),J=1,NJ) 4971 FORMAT(1X,230F12.6) 3301 FORMAT(1X,230F12.5) C 100 FORMAT(/10X,36H***** SUNSET ( A SOLVER FOR UNSTEADY, &amp; 50H NAVIER-STOKES EQUATIONS, TWO-DIMENSIONAL ) ****** &amp; //20X,45H MAXIMUM NUMBER OF TIME STEPS, NTIMST ----- =,I4</p> <p>/20X,45H ITERATION STEPS FOR EACH TIME STEP, NITERT =,I4 /20X,45H TIME INCREMENT, DTIME -------------------- =,1PE10.3 /20X,45H REYNOLDS NUMBER, RENO -------------------- =,E10.3 /20X,45H GRASHOF NUMBER, GRNO --------------------- =,E10.3 /20X,45H PRANDTL NUMBER, PR ----------------------- =,E10.3 /20X,45H ITURB = 1 FOR TURBULENT FLOW, ITURB ------ =,I4 /20X,45H IRAD = 1 FOR CYLINDRICAL COORDINATES, IRAD =,I4 /20X,45H ICNTDF = 1 FOR CENTRAL DIFFERENCE, ICNTDF =,I4) 150 FORMAT(//2X, 38H GEOMETRICAL CONFIGURATION, IFORS(I,J)/) 200 FORMAT(2X,51I2) 250 FORMAT(1X,7HITIMST=,I4,1X,5HTIME=,1PE12.5,1X,6HITERT=,I4,1X, &amp; 7HRESMAX=,1PE12.5,1X,6HIRMAX=,I3,1X,6HJRMAX=,I3,1X, &amp; 6HUSCAN=,1PE12.5,1X,6HVSCAN=,E12.5,1X,6HPSCAN=,E12.5) 400 FORMAT(A8) STOP END C******************************************************************** C SUBROUTINE INOUTS C C-----THIS SUBROUTINE HAS 4 ENTRIES, CONVOL, CONFIG, INITIA AND C-----PRINTS ASSOCIATED WITH INPUT AND OUTPUT PROCEDURES. C CHARACTER*4 HEADIN(7,10) COMMON PHI(40,240),PHIOLD(40,240),GAM(40,40),SC(40,40), &amp; SP(40,40),AE(40,40),AW(40,40),AN(40,40), &amp; AS(40,40),SDX(40,40),SDY(40,40) DIMENSION U(40,40),V(40,40),PC(40,40),T(40,40),W(40,40),P(40,40) EQUIVALENCE (PHI(1,1),U(1,1)),(PHI(1,41),V(1,1)), &amp; (PHI(1,81),PC(1,1)),(PHI(1,121),T(1,1)), &amp; (PHI(1,161),W(1,1)),(PHI(1,201),P(1,1)) COMMON/BLOCK0/ NITERT,ITERT,INTPRI,NLUMP,ISCAN,JSCAN,DTIME, &amp; ISOLVE(10),IPRINT(10), &amp; LUMPE(10),LUMPW(10),LUMPN(10),LUMPS(10), &amp; IRMAX,JRMAX,RESMAX COMMON/BLOCK1/ NTIMST,ITURB,IRAD,IREAD,NPHI,IPHI,IU,IV,IPC,IT, &amp; IW,IP,NI,NJ,JDIM,IREF,JREF,RENO,GRNO,DIRCOS,PR, &amp; TIME,IFORS(40,40),ALPHA(10),NIM1,NJM1,NIP1,NJP1, &amp; IEND,JEND,ICNTDF COMMON/BLOCK2/ X(40),Y(40),XP(40),YP(40),DXP(40),DYP(40), &amp; DXU(40),DYV(40),DX(40),DY(40),DELX(40),DELY(40), &amp; FACX(40),FACY(40),RX(40),RY(40),BIGNO,ZERO DIMENSION XPR(40),YPR(40),PHIPR(40,40) C DATA (HEADIN(I,1),I=1,7)/'X-DI','RECT','ION ','VELO','CITY', &amp; ', U ',' '/ DATA (HEADIN(I,2),I=1,7)/'Y-DI','RECT','ION ','VELO','CITY', &amp; ', V ',' '/ DATA (HEADIN(I,3),I=1,7)/'PRES','SURE',' COR','RECT','ION,', &amp; ' PC ',' '/ DATA (HEADIN(I,4),I=1,7)/'TEMP','ERAT','URE,',' T ',3*' '/ DATA (HEADIN(I,5),I=1,7)/'SWIR','L VE','LOCI','TY, ','W ', &amp; 2*' '/ DATA (HEADIN(I,6),I=1,7)/'PRES','SURE',', P ',4*' '/ C-------------------------------------------------------------------ENTRY CONVOL C C-----EVALUATE SPACINGS ASSOCIATED WITH CONTROL VOLUMES. C NIP1=NI+1</p> <p>&amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp;</p> <p>NIM1=NI-1 NJP1=NJ+1 NJM1=NJ-1 C 1100 DO 1100 I=2,NI DXP(I)=X(I)-X(I-1) XP(I)=0.5*(X(I)+X(I-1)) XP(1)=X(1)-0.5*DXP(2) XP(NIP1)=X(NI)+0.5*DXP(NI) DXP(1)=DXP(2) DXP(NIP1)=DXP(NI) DO 1200 I=1,NI DXU(I)=XP(I+1)-XP(I) DO 1300 J=2,NJ DYP(J)=Y(J)-Y(J-1) YP(J)=0.5*(Y(J)+Y(J-1)) YP(1)=Y(1)-0.5*DYP(2) YP(NJP1)=Y(NJ)+0.5*DYP(NJ) DYP(1)=DYP(2) DYP(NJP1)=DYP(NJ) DO 1400 J=1,NJ DYV(J)=YP(J+1)-YP(J) RETURN</p> <p>1200 1300</p> <p>1400</p> <p>C C--------------------------------------------------------------------ENTRY CONFIG C NULL=0 C-----SET IFORS( FLOW FIELD OR SOLID ) = 1 FOR FLOW FIELDS. DO 2100 I=1,NIP1 DO 2100 J=1,NJP1 2100 IFORS(I,J)=1 C-----SET IFORS = 0 FOR SOLID LUMPS OR VELOCITY-KNOWN FIELDS. IF(NLUMP.EQ.0) RETURN DO 2200 K=1,NLUMP DO 2200 I=LUMPW(K),LUMPE(K) DO 2200 J=LUMPS(K),LUMPN(K) 2200 IFORS(I,J)=NULL C-----SET IFORS = 2 AT NODES ADJACENT TO VELOCITY-KNOWN BOUNDARIES. DO 2300 K=1,NLUMP DO 2400 I=LUMPW(K),LUMPE(K) J=LUMPS(K)-1 IF(J.LE.1) GO TO 2450 IF(IFORS(I,J).EQ.1) IFORS(I,J)=2 2450 J=LUMPN(K)+1 IF(J.GE.NJP1) GO TO 2400 IF(IFORS(I,J).EQ.1) IFORS(I,J)=2 2400 CONTINUE DO 2300 J=LUMPS(K),LUMPN(K) I=LUMPW(K)-1 IF(I.LE.1) GO TO 2350 IF(IFORS(I,J).EQ.1) IFORS(I,J)=2 2350 I=LUMPE(K)+1 IF(I.GE.NIP1) GO TO 2300 IF(IFORS(I,J).EQ.1) IFORS(I,J)=2 2300 CONTINUE RETURN C C--------------------------------------------------------------------ENTRY INITIA</p> <p>C C C-----SET ZEROS TO INITIALIZE QUANTITIES. ZERO=0. NPHIP1=NPHI+1 DO 3100 IPHI=1,NPHIP1 J0=(IPHI-1)*JDIM DO 3100 J=1,NJP1 JJ=J0+J DO 3100 I=1,NIP1 3100 PHI(I,JJ)=ZERO DO 3200 J=1,NJP1 DO 3200 I=1,NIP1 SDX(I,J)=ZERO 3200 SDY(I,J)=ZERO C-----TO AVOID ZERO-DETERMINANT FOR PURE FREE CONVECTION. T(IREF,JREF)=1.E-30 RETURN C C------------------------------------------------------------------ENTRY PRINTS C C C-----PRINT PHI( FROM U TO P ) WHEN IPRINT = 1. NPHIP1=NPHI+1 DO 4100 IPHI=1,NPHIP1 IF(IPRINT(IPHI).EQ.0) GO TO 4100 C-----SET THE PRINTING RANGE AND COORDINATES FOR A PARTICULAR PHI. IEND=NIP1 JEND=NJP1 J0=(IPHI-1)*JDIM IF(IPHI.NE.IU) GO TO 4200 DO 4300 I=1,NI 4300 XPR(I)=X(I) IEND=NI GO TO 4400 4200 DO 4500 I=1,NIP1 4500 XPR(I)=XP(I) 4400 IF(IPHI.NE.IV) GO TO 4600 DO 4700 J=1,NJ 4700 YPR(J)=Y(J) JEND=NJ GO TO 4800 4600 DO 4900 J=1,NJP1 4900 YPR(J)=YP(J) 4800 J0=(IPHI-1)*JDIM C-----WHEN STORING PHI INTO PHIPR FOR PRINTING, EXTERPOLATE THE VALUE C-----ON THE VELOCITY-KNOWN BOUNDARY INTO THE FIELD INSIDE IT. DO 4805 J=1,JEND JJ=J0+J DO 4805 I=1,IEND 4805 PHIPR(I,J)=PHI(I,JJ) IF(IPHI.EQ.IP) GO TO 4850 DO 4810 J=2,NJ JJ=J0+J DO 4810 I=2,NI IF(IFORS(I,J).NE.2) GO TO 4810 IF(IPHI.EQ.IU) GO TO 4820 IF(IPHI.EQ.IV.AND.IFORS(I,J+1).NE.2) GO TO 4820 IF(IFORS(I+1,J).NE.0) GO TO 4830</p> <p>FAC=0.5*DXP(I)/DXU(I) PHIPR(I+1,J)=(PHI(I+1,JJ)-(1.-FAC)*PHI(I,JJ))/FAC 4830 IF(IFORS(I-1,J).NE.0) GO TO 4820 FAC=0.5*DXP(I)/DXU(I-1) PHIPR(I-1,J)=(PHI(I-1,JJ)-(1.-FAC)*PHI(I,JJ))/FAC 4820 IF(IPHI.EQ.IV) GO TO 4810 IF(IPHI.EQ.IU.AND.IFORS(I+1,J).NE.2) GO TO 4810 IF(IFORS(I,J+1).NE.0) GO TO 4840 FAC=0.5*DYP(J)/DYV(J) PHIPR(I,J+1)=(PHI(I,JJ+1)-(1.-FAC)*PHI(I,JJ))/FAC 4840 IF(IFORS(I,J-1).NE.0) GO TO 4810 FAC=0.5*DYP(J)/DYV(J-1) PHIPR(I,J-1)=(PHI(I,JJ-1)-(1.-FAC)*PHI(I,JJ))/FAC 4810 CONTINUE C-----EXTERPOLATION AT BOUNDARIES ENDS HERE. 4850 WRITE(21,500) (HEADIN(I,IPHI),I=1,7) IPR=-11 5000 IPR=IPR+12 IPREND=IPR+11 IPREND=MIN0(IPREND,IEND) WRITE(21,510) (I,I=IPR,IPREND) WRITE(21,520) DO 5100 J=1,JEND JJ=JEND-J+1 5100 WRITE(21,530) JJ,(PHIPR(I,JJ),I=IPR,IPREND),YPR(JJ) WRITE(21,540) (XPR(I),I=IPR,IPREND) IF(IPREND.LT.IEND) GO TO 5000 4100 CONTINUE 500 FORMAT(//1X,40(1H*),11X,7A4,11X,40(1H*)) 510 FORMAT(1H0,2X,1HI,3X,I3,11I10,8X,1HY) 520 FORMAT(3H J) 530 FORMAT(I4,1P12E10.2,0PF7.3) 540 FORMAT(/4H X =,1PE10.2,11E10.2/) RETURN END C C******************************************************************* C SUBROUTINE SOLPHI C C-----THIS SUBROUTINE IS WRITTEN IN SUCH A GENERAL MANNER THAT IT CAN C-----BE CALLED FOR ANY PARTICULAR PHI-EQUATION. C COMMON PHI(40,240),PHIOLD(40,240),GAM(40,40),SC(40,40), &amp; SP(40,40),AE(40,40),AW(40,40),AN(40,40), &amp; AS(40,40),SDX(40,40),SDY(40,40) DIMENSION U(40,40),V(40,40),PC(40,40),T(40,40),W(40,40),P(40,40) EQUIVALENCE (PHI(1,1),U(1,1)),(PHI(1,41),V(1,1)), &amp; (PHI(1,81),PC(1,1)),(PHI(1,121),T(1,1)), &amp; (PHI(1,161),W(1,1)),(PHI(1,201),P(1,1)) COMMON/BLOCK0/ NITERT,ITERT,INTPRI,NLUMP,ISCAN,JSCAN,DTIME, &amp; ISOLVE(10),IPRINT(10), &amp; LUMPE(10),LUMPW(10),LUMPN(10),LUMPS(10), &amp; IRMAX,JRMAX,RESMAX COMMON/BLOCK1/ NTIMST,ITURB,IRAD,IREAD,NPHI,IPHI,IU,IV,IPC,IT, &amp; IW,IP,NI,NJ,JDIM,IREF,JREF,RENO,GRNO,DIRCOS,PR, &amp; TIME,IFORS(40,40),ALPHA(10),NIM1,NJM1,NIP1,NJP1, &amp; IEND,JEND,ICNTDF COMMON/BLOCK2/ X(40),Y(40),XP(40),YP(40),DXP(40),DYP(40), &amp; DXU(40),DYV(40),DX(40),DY(40),DELX(40),DELY(40),</p> <p>&amp; C C</p> <p>FACX(40),FACY(40),RX(40),RY(40),BIGNO,ZERO DIMENSION FS(40),ASS(40)</p> <p>IF(ISOLVE(IPHI).EQ.0) RETURN C-----INITIALIZE THE MAXIMUM RESIDUAL, RESMAX. IF(IPHI.EQ.IPC) RESMAX=0. C-----SET DX, DY, DELX, DELY, RX AND RY. CALL SETDXY CALL SETRXY C-----SET DIFFUSION COEFFICIENTS, GAM. IF(IPHI.NE.IPC) CALL SETGAM C-----SET AS ALONG THE SOUTH-MOST BOUNDARY. DO 1100 I=2,IEND C-----FOR U-CONTROL VOLUME. IF(IPHI.NE.IU) GO TO 1200 VS=0.5*(V(I,1)+V(I+1,1)) GAMS=0.25*(GAM(I,1)+GAM(I+1,1)+GAM(I,2)+GAM(I+1,2)) GO TO 1300 C-----FOR V-CONTROL VOLUME. 1200 IF(IPHI.NE.IV) GO TO 1400 VS=0.5*(V(I,1)+V(I,2)) GAMS=GAM(I,2) GO TO 1300 C-----FOR SCALAR-CONTROL VOLUME. 1400 VS=V(I,1) GAMS=0.5*(GAM(I,1)+GAM(I,2)) 1300 FS(I)=VS*DX(I)*RY(1) C-----ONLY FOR THE PRESSURE CORRECTION. IF(IPHI.NE.IPC) GO TO 1500 ASS(I)=DX(I)*RY(1)*SDY(I,1) GO TO 1100 C-----FOR THE OTHER TRANSPORT EQUATIONS. 1500 DS=GAMS*DX(I)/DELY(1)*RY(1) A=0.5*FS(I)+DS ASS(I)=AMAX1(A,FS(I),0.) 1100 CONTINUE C-----ALL SET ALONG THE SOUTH-MOST BOUNDARY. GO ON TO THE NORTH. C DO 1600 J=2,JEND C-----SET AW ALONG THE WEST-MOST BOUNDARY. C-----FOR U-CONTROL VOLUME. IF(IPHI.NE.IU) GO TO 1700 UW=0.5*(U(1,J)+U(2,J)) GAMW=GAM(2,J) GO TO 1800 C-----FOR V-CONTROL VOLUME. 1700 IF(IPHI.NE.IV) GO TO 1900 UW=0.5*(U(1,J)+U(1,J+1)) GAMW=0.25*(GAM(1,J)+GAM(1,J+1)+GAM(2,J)+GAM(2,J+1)) GO TO 1800 C-----FOR SCALAR-CONTROL VOLUME. 1900 UW=U(1,J) GAMW=0.5*(GAM(1,J)+GAM(2,J)) 1800 FW=UW*DY(J)*RX(J) C-----ONLY FOR THE PRESSURE CORRECTION. IF(IPHI.NE.IPC) GO TO 2100 AWW=DY(J)*RX(J)*SDX(1,J) GO TO 2200 C-----FOR THE OTHER TRANSPORT EQUATIONS.</p> <p>2100 DW=GAMW*DY(J)/DELX(1)*RX(J) A=0.5*FW+DW AWW=AMAX1(A,FW,0.) C-----ALL SET ALONG THE WEST-MOST BOUNDARY. GO ON TO THE EAST. 2200 DO 1600 I=2,IEND C-----SET AW AND AS USING VALUES FROM THE PRECEDING OPERATIONS. AW(I,J)=AWW AS(I,J)=ASS(I) C-----FOR U-CONTROL VOLUME. IF(IPHI.NE.IU) GO TO 2300 UE=0.5*(U(I,J)+U(I+1,J)) GAME=GAM(I+1,J) VN=0.5*(V(I,J)+V(I+1,J)) GAMN=0.5*(1.-FACY(J))*(GAM(I,J)+GAM(I+1,J)) &amp; +0.5*FACY(J)*(GAM(I,J+1)+GAM(I+1,J+1)) GO TO 2400 C-----FOR V-CONTROL VOLUME. 2300 IF(IPHI.NE.IV) GO TO 2500 UE=0.5*(U(I,J)+U(I,J+1)) GAME=0.5*(1.-FACX(I))*(GAM(I,J)+GAM(I,J+1)) &amp; +0.5*FACX(I)*(GAM(I+1,J)+GAM(I+1,J+1)) VN=0.5*(V(I,J)+V(I,J+1)) GAMN=GAM(I,J+1) GO TO 2400 C-----FOR SCALAR CONTROL VOLUME. 2500 UE=U(I,J) GAME=(1.-FACX(I))*GAM(I,J)+FACX(I)*GAM(I+1,J) VN=V(I,J) GAMN=(1.-FACY(J))*GAM(I,J)+FACY(J)*GAM(I,J+1) 2400 FE=UE*DY(J)*RX(J) FN=VN*DX(I)*RY(J) C-----ONLY FOR THE PRESSURE CORRECTION. IF(IPHI.NE.IPC) GO TO 2600 AE(I,J)=DY(J)*RX(J)*SDX(I,J) AN(I,J)=DX(I)*RY(J)*SDY(I,J) AWW=AE(I,J) ASS(I)=AN(I,J) SC(I,J)=FW-FE+FS(I)-FN SP(I,J)=ZERO C-----FIND THE MAXIMUM RESIDUAL AND ITS LOCATION. IF(IFORS(I,J).EQ.0) GO TO 2700 RES=ABS(SC(I,J)) IF(RES.LE.RESMAX) GO TO 2700 RESMAX=RES IRMAX=I JRMAX=J GO TO 2700 C-----FOR THE OTHER TRANSPORT EQUATIONS. 2600 DE=GAME*DY(J)/DELX(I)*RX(J) A=-FACX(I)*FE+DE AE(I,J)=AMAX1(A,-FE,0.) IF(ICNTDF.EQ.1) AE(I,J)=A A=(1.-FACX(I))*FE+DE AWW=AMAX1(A,FE,0.) IF(ICNTDF.EQ.1) AWW=A DN=GAMN*DX(I)/DELY(J)*RY(J) A=-FACY(J)*FN+DN AN(I,J)=AMAX1(A,-FN,0.) IF(ICNTDF.EQ.1) AN(I,J)=A A=(1.-FACY(J))*FN+DN</p> <p>ASS(I)=AMAX1(A,FN,0.) IF(ICNTDF.EQ.1) ASS(I)=A SC(I,J)=ZERO C-----STORE THE PRESSURE GRADIENT TERMS FOR U AND V. IF(IPHI.EQ.IU) SC(I,J)=DY(J)*RX(J)*(P(I,J)-P(I+1,J)) IF(IPHI.EQ.IV) SC(I,J)=DX(I)*RX(J)*(P(I,J)-P(I,J+1)) RES=FE-FW+FN-FS(I) C-----SET SP TO ENSURE NUMERICAL STABILITY. SP(I,J)=-AMAX1(0.,RES) IF(ICNTDF.EQ.1) SP(I,J)=-RES 2700 FW=FE 1600 FS(I)=FN C-----ALL A-S ARE SET. EVALUATE SOURCES AND SOLVE MATRICES. CALL SOURCE CALL SOLMAT RETURN END C C******************************************************************* C SUBROUTINE UPDATE C C-----THIS SUBROU...</p>

Recommended

View more >