|
楼主 |
发表于 2005-8-26 09:43
|
显示全部楼层
回复:(visualsun)[转帖]CFX火灾模拟使用说明
(二)副程式部分 <BR><BR>本算例中的火源可為一定質量以及定能量的傳輸,再以設定的結構中並不包含此類設定,故需自行編寫程式附於上述的主程式中。 <BR><BR>編寫此程式所用的語言為FORTRAN,所有的變數說明以及指令編排皆註解於此程式中,讀者逐一研讀每一行指令即能了解。以下為副程式的部分,前面加有C字者為注釋,真正程式執行時並不會用到。使用者可以修改的部分,前面標以阿拉伯數字,並逐一解釋: <BR><BR><BR><BR> SUBROUTINE USRSRC(IEQN,ICALL,CNAME,CALIAS,AM,SP,SU,CONV <BR><BR> + ,U,V,W,P,VFRAC,DEN,VIS,TE,ED,RS,T,H,RF,SCAL <BR><BR> + ,XP,YP,ZP,VOL,AREA,VPOR,ARPOR,WFACT,IPT <BR><BR> + ,IBLK,IPVERT,IPNODN,IPFACN,IPNODF,IPNODB,IPFACB <BR><BR> + ,WORK,IWORK,CWORK) <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C <BR><BR>C UTILITY SUBROUTINE FOR USER-SUPPLIED SOURCES <BR><BR>C <BR><BR>C >>> IMPORTANT <<< <BR><BR>C >>> <<< <BR><BR>C >>> USERS MAY ONLY ADD OR ALTER PARTS OF THE SUBROUTINE CWITHIN <<< <BR><BR>C >>> THE DESIGNATED USER AREAS C<<< <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C <BR><BR>C THIS SUBROUTINE IS CALLED BY THE FOLLOWING SUBROUTINES <BR><BR>C CUSR SCDF SCDS SCED SCENRG SCHF SCMOM SCPCE CSCSCAL <BR><BR>C SCTE SCVF <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C CREATED <BR><BR>C 08/03/90 ADB <BR><BR>C MODIFIED <BR><BR>C 04/03/91 ADB ALTERED ARGUMENT LIST. <BR><BR>C 28/08/91 IRH NEW STRUCTURE <BR><BR>C 28/09/91 IRH CHANGE EXAMPLE + ADD COMMON BLOCKS <BR><BR>C 10/02/92 PHA UPDATE CALLED BY COMMENT, ADD RF ARGUMENT, <BR><BR>C CHANGE LAST DIMENSION OF RS TO 6 AND IVERS TO 2 <BR><BR>C 03/06/92 PHA ADD PRECISION FLAG AND CHANGE IVERS TO 3 <BR><BR>C 23/11/93 CSH EXPLICITLY DIMENSION IPVERT ETC. <BR><BR>C 07/12/93 NSW INCLUDE CONV IN ARGUMENT LIST AND CHANGE IVERS <BR><BR>C TO 4 <BR><BR>C 03/02/94 PHA CHANGE FLOW3D TO CFDS-FLOW3D <BR><BR>C 03/03/94 FHW CORRECTION OF SPELLING MISTAKE <BR><BR>C 08/03/94 NSW CORRECT SPELLING <BR><BR>C 09/08/94 NSW CORRECT SPELLING. <BR><BR>C MOVE 'IF(IUSED.EQ.0) RETURN' OUT OF USER AREA. <BR><BR>C INCLUDE COMMENT ON MASS SOURCES. <BR><BR>C 19/12/94 NSW CHANGE FOR CFX-F3D <BR><BR>C 02/07/97 NSW UPDATE FOR CFX-4 <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C <BR><BR>C SUBROUTINE ARGUMENTS <BR><BR>C <BR><BR>C IEQN - EQUATION NUMBER <BR><BR>C ICALL - SUBROUTINE CALL <BR><BR>C CNAME - EQUATION NAME <BR><BR>C CALIAS - ALIAS OF EQUATION NAME <BR><BR>C AM - OFF DIAGONAL MATRIX COEFFICIENTS <BR><BR>C SU - SU IN LINEARISATION OF SOURCE TERM <BR><BR>C SP - SP IN LINEARISATION OF SOURCE TERM <BR><BR>C CONV - CONVECTION COEFFICIENTS <BR><BR>C U - U COMPONENT OF VELOCITY <BR><BR>C V - V COMPONENT OF VELOCITY <BR><BR>C W - W COMPONENT OF VELOCITY <BR><BR>C P - PRESSURE <BR><BR>C VFRAC - VOLUME FRACTION <BR><BR>C DEN - DENSITY OF FLUID <BR><BR>C VIS - VISCOSITY OF FLUID <BR><BR>C TE - TURBULENT KINETIC ENERGY <BR><BR>C ED - EPSILON <BR><BR>C RS - REYNOLD STRESSES <BR><BR>C T - TEMPERATURE <BR><BR>C H - ENTHALPY <BR><BR>C RF - REYNOLD FLUXES <BR><BR>C SCAL - SCALARS (THE FIRST 'NCONC' OF THESE ARE MASS FRACTIONS) <BR><BR>C XP - X COORDINATES OF CELL CENTRES <BR><BR>C YP - Y COORDINATES OF CELL CENTRES <BR><BR>C ZP - Z COORDINATES OF CELL CENTRES <BR><BR>C VOL - VOLUME OF CELLS <BR><BR>C AREA - AREA OF CELLS <BR><BR>C VPOR - POROUS VOLUME <BR><BR>C ARPOR - POROUS AREA <BR><BR>C WFACT - WEIGHT FACTORS <BR><BR>C <BR><BR>C IPT - 1D POINTER ARRAY <BR><BR>C IBLK - BLOCK SIZE INformATION <BR><BR>C IPVERT - POINTER FROM CELL CENTERS TO 8 NEIGHBOURING VERTICES <BR><BR>C IPNODN - POINTER FROM CELL CENTERS TO 6 NEIGHBOURING CELLS <BR><BR>C IPFACN - POINTER FROM CELL CENTERS TO 6 NEIGHBOURING FACES <BR><BR>C IPNODF - POINTER FROM CELL FACES TO 2 NEIGHBOURING CELL CENTERS <BR><BR>C IPNODB - POINTER FROM BOUNDARY CENTERS TO CELL CENTERS <BR><BR>C IPFACB - POINTER FROM BOUNDARY CENTERS TO BOUNDARY FACESS <BR><BR>C <BR><BR>C WORK - REAL WORKSPACE ARRAY <BR><BR>C IWORK - INTEGER WORKSPACE ARRAY <BR><BR>C CWORK - CHARACTER WORKSPACE ARRAY <BR><BR>C <BR><BR>C SUBROUTINE ARGUMENTS PRECEDED WITH A '*' ARE ARGUMENTS THAT MUST <BR><BR>C BE SET BY THE USER IN THIS ROUTINE. <BR><BR>C <BR><BR>C NOTE THAT WHEN USING MASS SOURCES, THE FLOWS THROUGH MASS FLOW <BR><BR>C BOUNDARIES ARE UNCHANGED. THE USER SHOULD THEREFORE INCLUDE AT <BR><BR>C LEAST ONE PRESSURE BOUNDARY FOR SUCH A CALCULATION. <BR><BR>C <BR><BR>C NOTE THAT OTHER DATA MAY BE OBTAINED FROM CFX-4 USING THE <BR><BR>C ROUTINE GETADD, FOR FURTHER DETAILS SEE THE VERSION 4 <BR><BR>C USER MANUAL. <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C <BR><BR> LOGICAL LDEN,LVIS,LTURB,LTEMP,LBUOY,LSCAL,LCOMP <BR><BR> + ,LRECT,LCYN,LAXIS,LPOROS,LTRANS <BR><BR>C <BR><BR> CHARACTER*(*) CWORK <BR><BR> CHARACTER CNAME*6, CALIAS*24 <BR><BR>C <BR><BR>C+++++++++++++++++ USER AREA +++++++++++++++++++++++++++++ <BR><BR>C---- AREA FOR USERS EXPLICITLY DECLARED VARIABLES <BR><BR>C <BR><BR>C+++++++++++++++++ END OF USER AREA 1 +++++++++++++++++++ <BR><BR>C <BR><BR> COMMON <BR><BR> + /ALL/ NBLOCK,NCELL,NBDRY,NNODE,NFACE,NVERT,NDIM <BR><BR> + /ALLWRK/ NRWS,NIWS,NCWS,IWRFRE,IWIFRE,IWCFRE <BR><BR> + /ADDIMS/ NPHASE,NSCAL,NVAR,NPROP <BR><BR> + ,NDVAR,NDPROP,NDXNN,NDGEOM,NDCOEF,NILIST,NRLIST,NTOPOL <BR><BR> + /CHKUSR/ IVERS,IUCALL,IUSED <BR><BR> + /DEVICE/ NREAD,NWRITE,NRDISK,NWDISK <BR><BR> + /IDUM/ ILEN,JLEN <BR><BR> + /LOGIC/ LDEN,LVIS,LTURB,LTEMP,LBUOY,LSCAL,LCOMP <BR><BR> + ,LRECT,LCYN,LAXIS,LPOROS,LTRANS <BR><BR> + /MLTGRD/ MLEVEL,NLEVEL,ILEVEL <BR><BR> + /SGLDBL/ IFLGPR,ICHKPR <BR><BR> + /SPARM/ SMALL,SORMAX,NITER,INDPRI,MAXIT,NODREF,NODMON <BR><BR> + /TRANSI/ NSTEP,KSTEP,MF,INCORE <BR><BR> + /TRANSR/ TIME,DT,DTINVF,TPARM <BR><BR>C <BR><BR>C+++++++++++++++++ USER AREA 2 +++++++++++++++++++++++++++++++++ <BR><BR>C---- AREA FOR USERS TO DECLARE THEIR OWN COMMON BLOCKS <BR><BR>C THESE SHOULD START WITH THE CHARACTERS 'UC' TO ENSURE <BR><BR>C NO CONFLICT WITH NON-USER COMMON BLOCKS <BR><BR>C <BR><BR>C+++++++++++++++++ END OF USER AREA 2 +++++++++++++++++++++++++ <BR><BR>C <BR><BR> DIMENSION AM(NCELL,6,NPHASE),SP(NCELL,NPHASE),SU(NCELL,NPHASE) <BR><BR> +,CONV(NFACE,NPHASE) <BR><BR>C <BR><BR> DIMENSION <BR><BR> +U(NNODE,NPHASE),V(NNODE,NPHASE),W(NNODE,NPHASE),P(NNODE,NPHASE) <BR><BR> +,VFRAC(NNODE,NPHASE),DEN(NNODE,NPHASE),VIS(NNODE,NPHASE) <BR><BR> +,TE(NNODE,NPHASE),ED(NNODE,NPHASE),RS(NNODE,NPHASE,6) <BR><BR> +,T(NNODE,NPHASE),H(NNODE,NPHASE),RF(NNODE,NPHASE,4) <BR><BR> +,SCAL(NNODE,NPHASE,NSCAL) <BR><BR>C <BR><BR> DIMENSION <BR><BR> + XP(NNODE),YP(NNODE),ZP(NNODE) <BR><BR> +,VOL(NCELL),AREA(NFACE,3),VPOR(NCELL),ARPOR(NFACE,3) <BR><BR> +,WFACT(NFACE) <BR><BR> +,IPT(*),IBLK(5,NBLOCK) <BR><BR> +,IPVERT(NCELL,8),IPNODN(NCELL,6),IPFACN(NCELL,6),IPNODF(NFACE,4) <BR><BR> +,IPNODB(NBDRY,4),IPFACB(NBDRY) <BR><BR> +,IWORK(*),WORK(*),CWORK(*) <BR><BR>C <BR><BR>C+++++++++++++++++ USER AREA 3 ++++++++++++++++++++++++++ <BR><BR>C---- AREA FOR USERS TO DIMENSION THEIR ARRAYS <BR><BR>C <BR><BR>C---- AREA FOR USERS TO DEFINE DATA STATEMENTS <BR><BR>C <BR><BR>C+++++++++++++++++ END OF USER AREA 3 ++++++++++++++++++++ <BR><BR>C <BR><BR>C---- STATEMENT FUNCTION FOR ADDRESSING <BR><BR> IP(I,J,K)=IPT((K-1)*ILEN*JLEN+(J-1)*ILEN+I) <BR><BR>C <BR><BR>C----VERSION NUMBER OF USER ROUTINE AND PRECISION FLAG <BR><BR>C <BR><BR> IVERS=4 <BR><BR> ICHKPR = 1 <BR><BR>C <BR><BR>C+++++++++++++++++ USER AREA 4 +++++++++++++++++++++++++++++ <BR><BR>C---- TO USE THIS USER ROUTINE FIRST SET IUSED=1 <BR><BR>C <BR><BR> IUSED=1 <BR><BR>C <BR><BR>C+++++++++++++++++ END OF USER AREA 4 ++++++++++++++++++++++ <BR><BR>C <BR><BR> IF (IUSED.EQ.0) RETURN <BR><BR>C <BR><BR>C---- FRONTEND CHECKING OF USER ROUTINE <BR><BR> IF (IUCALL.EQ.0) RETURN <BR><BR>C <BR><BR>C---- ADD TO SOURCE TERMS <BR><BR> IF (ICALL.EQ.1) THEN <BR><BR><BR><BR>1 CALL GETVAR('USRSRC','H ',IVAR) <BR><BR>2 CALL GETVAR('USRSRC','SCAL ',IAAAA) <BR><BR>3 CALL GETSCA('MASS FRACTION1',IBBBB,CWORK) <BR><BR><BR><BR>4 IF (IEQn.EQ.IVAr) THEN <BR><BR>5 CALL IPREC('SOLID 43','BLOCK','CENTRES',IPT,ILEN,JLEN, <BR><BR> + KLEN,CWORK,IWORK) <BR><BR>6 RHEAT = 232323*2.5 <BR><BR>C LOOP OVER PATCH <BR><BR>7 DO 103 K = 4,5 <BR><BR>8 DO 102 J = 3,5 <BR><BR>9 DO 101 I = 300,310 <BR><BR>C USE STATEMENT FUNCTION IP TO GET ADDRESSES <BR><BR>10 INODE = IP(I,J,K) <BR><BR>C PUT IN A FIXED FUEL-BURNING RATE <BR><BR>11 SU(INODE,1)=SU(INODE,1)+RHEAT*VOL(INODE) <BR><BR>12 101 CONTINUE <BR><BR>13 102 CONTINUE <BR><BR>14 103 CONTINUE <BR><BR>15 ENDIF <BR><BR><BR><BR>16 IF (IEQn.EQ.(IAAAA+IBBBB-1)) THEN <BR><BR>17 CALL IPREC('SOLID 43','BLOCK','CENTRES',IPT,ILEN,JLEN, <BR><BR>18 + KLEN,CWORK,IWORK) <BR><BR><BR><BR>19 DO 106 K = 4,5 <BR><BR>20 DO 105 J = 3,5 <BR><BR>21 DO 104 I = 300,310 <BR><BR>22 INODE = IP(I,J,K) <BR><BR>23 SU(INODE,1)=SU(INODE,1)+0.09*VOL(INODE) <BR><BR>24 104 CONTINUE <BR><BR>25 105 CONTINUE <BR><BR>26 106 CONTINUE <BR><BR>27 ENDIF <BR><BR>C <BR><BR>C+++++++++++++++++ END OF USER AREA 5 ++++++++++++++++++++++++ <BR><BR> ENDif <BR><BR>C <BR><BR>C---- OVERWRITE SOURCE TERMS <BR><BR> IF (ICALL.EQ.2) THEN <BR><BR><BR><BR> ENDIF <BR><BR><BR><BR> RETURN <BR><BR> END <BR><BR> |
|