[转帖]CFX火灾模拟使用说明
CFX計算流力軟體使用說明CFX程式有具體結構化,所有執行動作都由數段命令式的指令所構成, 並且需要配合正確的幾何圖檔,與普通FORTRAN或是C等不同,是屬於高階語言,接近人類的口語。
以下將程式分成數段分別加以說明。此說明的方法是根據程式所區分的結構, 逐項參考說明內容。說明的對象是計算公館捷運站內發生火源強度10MW的火災時的三維計算模型。
(一) 主程式部分
一>>CFX4
>>SET LIMITS
TOTAL REAL WORK SPACE 20000000
TOTAL INTEGER WORK SPACE 4000000
(這段程式的目的在於定義硬體所分配的工作,告知電腦所要工作的模型需要多少空間,所以定義的數字只能多不能少。若定義太少,則CFX4無法運作,會有訊息告知你工作空間定義不足。)
>>OPTIONS
THREE DIMENSIONS
CARTESIAN COORDINATES
TURBULENT FLOW
HEAT TRANSFER
COMPRESSIBLE FLOW
BUOYANT FLOW
TRANSIENT FLOW
MASS FRACTION EQUATIONS 1
USE DATABASE
(目的在於定義流場需要哪些物理現象,由本例中可知有紊流、熱傳、可壓縮流、浮力、質傳等等現象。且知是以三維的方式運算。最後一行告知所使用到的物理參數對照CFX4內所設定好的值)
>>USER FORTRAN
USRSRC
(在這裡必須利用USER FORTRAN 叫出一個名為USRSRC的副程式以便把流場中的熱傳源以及質傳源加入計算,故必須在此部份加以宣告)
二>>MODEL DATA
>>MATERIALS DATABASE
>>SOURCE OF DATA
PCP
(宣告所需的物理參數參照CFX4軟體內的PCP方式)
>>FLUID DATA
FLUID 'AIR'
MATERIAL TEMPERATURE 298.0
MATERIAL PHASE 'GAS'
(宣告流場中的流體為空氣,且一些有關空氣的物理參數對照CFX4內所預設的298K時的值,空氣的相為氣體。)
>>PHYSICAL PROPERTIES
>>BUOYANCY PARAMETERS
GRAVITY VECTOR 0.000000E+00 0.000000e+00 -9.800000e+00
BUOYANCY REFERENCE DENSITY 1.2000E+00
(定義流場中的重力值為9.8,而浮力作用的參考密度為1.2)
>>MASS TRANSFER PARAMETERS
>>DIFFUSIVITIES
MASS FRACTION1 1.6400E-05
(宣告質傳主角的擴散係數為0.0000164)
>>MOLECULAR WEIGHTS
MASS FRACTION1 4.4000E+01
(宣告質傳主角的分子量為44)
>>SPECIFIC HEATS
MASS FRACTION1 1.120000E+03
(宣告質傳主角的比熱為1120)
>>TURBULENCE PARAMETERS
>>TURBULENCE MODEL
TURBULENCE MODEL 'K-EPSILON'
END
(宣告紊流模式的計算為 模式)
>>TRANSIENT PARAMETERS
>>FIXED TIME STEPPING
TIME STEPS 5*10
INITIAL TIME 0.0
(宣告transient的計算是以fixed time stepping的方式,一共計算5個時間步,每個時間步為10秒,起始時間為0。)
三>>SOLVER DATA
>>PROGRAM CONTROL
MAXIMUM NUMBER OF ITERATIONS 20
OUTPUT MONITOR POINT 1 1 1
MASS SOURCE TOLERANCE 1.0000E-4
(宣告解方程式時最大的疊代數為20,而收斂的條件是MASS SOURCE TOLERANCE小於或者等於1.0000E-4,這個單位為單位時間內所有格點質量的差異。最後宣告模型的(I,J,K)=(1,1,1)的位置格點之值作為計算暫存檔,以作為參考的位置。)
>>EQUATION SOLVERS
PRESSURE 'STONE'
ENTHALPY 'STONE'
(宣告PRESSURE以及ENTHALPY兩個參數以'STONE'的方式求解)
>>UNDER RELAXATION FACTORS
ENTHALPY 1.0000E+00
MASS FRACTION1 1.0000E+00
(宣告鬆弛參數(RELAXATION FACTORS)對MASS FRACTION1以及ENTHALPY為1.0,而其他沒有宣告的變數則為預設值)
四>>MODEL BOUNDARY CONDITIONS
>>INLET BOUNDARIES
PATCH NAME 'INLET1'
U VELOCITY 10.0
TEMPERATURE 2.9800E+02
(宣告名稱為'INLET1'的邊界,其速度為10(m/s),溫度為298K。)
五>>OUTPUT OPTIONS
>>DUMP FILE OPTIONS
EACH TIME STEP
ALL VARIABLES
END
(宣告DUMP FILE內所解的的結果中,所有變數在每個時間步皆要表現出來。)
>>PRINT OPTIONS
>>WHAT
U
V
W
END
(宣告在輸出文字檔中,將三個速度向量U、V、W以矩陣的格式表現)
>>WHEN
EACH TIME STEP
FINAL SOLUTION
END
(宣告在輸出文字檔中,分別在每個時間步以及最後的結果中,將三個速度向量U、V、W以矩陣的格式表現)
>>WHERE
BLOCK NAME 'SOLID 10'
K PLANES 23
BLOCK NAME 'SOLID 16'
K PLANES 21
BLOCK NAME 'SOLID 36'
K PLANES 30
BLOCK NAME 'SOLID 40'
K PLANES 20
END
(宣告在輸出文字檔中,將區塊10的k=23、區塊16的k=21、區塊36的k=30、區塊40的k=20處的三個速度向量U、V、W以矩陣的格式表現)
>>STOP
(宣告程式結束)
===============================================================
来自:清洁能源网
回复:(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>回复:(visualsun)[转帖]CFX火灾模拟使用说明
C <BR><BR>C+++++++++++++++++ USER AREA 6 +++++++++++++++++++++++++++++ <BR><BR>C <BR><BR>C EXAMPLE (HEAT SOURCE) OVERWRITE WITH 100W PER UNIT VOLUME IN <BR><BR>C ALL INTERIOR CELLS <BR><BR>C <BR><BR>C CALL GETVAR('USRSRC','H ',IVAR) <BR><BR>C <BR><BR>C IF (IVAR.EQ.IEQN) THEN <BR><BR>C USE IPALL TO FIND 1D ADDRESSES OF ALL CELL CENTRES <BR><BR>C CALL IPALL('*','*','BLOCK','CENTRES',IPT,NPT,CWORK,IWORK) <BR><BR>C LOOP OVER ALL INTERIOR CELLS <BR><BR>C DO 200 I=1,NPT <BR><BR>C USE ARRAY IPT TO GET ADDRESS <BR><BR>C INODE=IPT(I) <BR><BR>C OVERWRITE SOURCE TERMS <BR><BR>C SU(INODE,1)=100.0*VOL(INODE) <BR><BR>C 200 CONTINUE <BR><BR>C ENDIF <BR><BR>C <BR><BR>C---- END OF EXAMPLE <BR><BR>C+++++++++++++++++ END OF USER AREA 6 ++++++++++++++++++++++++++ <BR><BR>C <BR><BR>C ENDIF <BR><BR>C RETURN <BR><BR>C END <BR><BR>C SUBROUTINE USRTRN(U,V,W,P,VFRAC,DEN,VIS,TE,ED,RS,T,H,RF,SCAL, <BR><BR>C + XP,YP,ZP,VOL,AREA,VPOR,ARPOR,WFACT,CONV,IPT, <BR><BR>C + IBLK,IPVERT,IPNODN,IPFACN,IPNODF,IPNODB,IPFACB, <BR><BR>C + WORK,IWORK,CWORK) <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C <BR><BR>C <BR><BR>C THE END OF EACH TIME STEP <BR><BR>C THIS SUBROUTINE IS CALLED BEFORE THE START OF THE RUN AS WELL AS AT <BR><BR>C THE END OF EACH TIME STEP <BR><BR>C <BR><BR>C >>> IMPORTANT <<< <BR><BR>C >>> <<< <BR><BR>C >>> USERS MAY ONLY ADD OR ALTER PARTS OF THE SUBROUTINE WITHIN <<< <BR><BR>C >>> THE DESIGNATED USER AREAS <<< <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C <BR><BR>C THIS SUBROUTINE IS CALLED BY THE FOLLOWING SUBROUTINES <BR><BR>C CUSR TRNMOD <BR><BR>C <BR><BR>C********************************************************************** <BR><BR>C CREATED <BR><BR>C 27/04/90 ADB <BR><BR>C MODIFIED <BR><BR>C 05/08/91 IRH NEW STRUCTURE <BR><BR>C 01/10/91 DSC REDUCE COMMENT LINE GOING OVER COLUMN 72. <BR><BR>C 29/11/91 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 05/06/92 PHA ADD PRECISION FLAG AND CHANGE IVERS TO 3 <BR><BR>C 03/07/92 DSC CORRECT COMMON MLTGRD. <BR><BR>C 23/11/93 CSH EXPLICITLY DIMENSION IPVERT ETC. <BR><BR>C 03/02/94 PHA CHANGE FLOW3D TO CFDS-FLOW3D <BR><BR>C 22/08/94 NSW MOVE 'IF(IUSED.EQ.0) RETURN' OUT OF USER AREA <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 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 CONV - CONVECTION COEFFICIENTS <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 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>C <BR><BR>C LOGICAL LDEN,LVIS,LTURB,LTEMP,LBUOY,LSCAL,LCOMP <BR><BR>C + ,LRECT,LCYN,LAXIS,LPOROS,LTRANS <BR><BR>C <BR><BR>C CHARACTER*(*) CWORK <BR><BR>C <BR><BR>C++++++++++++++++ USER AREA 1 +++++++++++++++++++++++++++++ <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>C COMMON <BR><BR>C + /ALL/ NBLOCK,NCELL,NBDRY,NNODE,NFACE,NVERT,NDIM <BR><BR>C + /ALLWRK/ NRWS,NIWS,NCWS,IWRFRE,IWIFRE,IWCFRE <BR><BR>C + /ADDIMS/ NPHASE,NSCAL,NVAR,NPROP <BR><BR>C + ,NDVAR,NDPROP,NDXNN,NDGEOM,NDCOEF,NILIST,NRLIST,NTOPOL <BR><BR>C + /CMBEBR/ CFL,CFU,DENS,DIMS <BR><BR>C + ,ALIN,ACROSS,SLIN,SCROSS,SNA,SNE <BR><BR>C + ,ACHEM,TACT,EFU,EOX,DIE,RBMAX,CMBPAR(9) <BR><BR>C + /CHKUSR/ IVERS,IUCALL,IUSED <BR><BR>C + /CONC/ NCONC <BR><BR>C + /DEVICE/ NREAD,NWRITE,NRDISK,NWDISK <BR><BR>C + /IDUM/ ILEN,JLEN <BR><BR>C + /LOGIC/ LDEN,LVIS,LTURB,LTEMP,LBUOY,LSCAL,LCOMP <BR><BR>C + ,LRECT,LCYN,LAXIS,LPOROS,LTRANS <BR><BR>C + /MLTGRD/ MLEVEL,NLEVEL,ILEVEL <BR><BR>C + /SGLDBL/ IFLGPR,ICHKPR <BR><BR>C + /SPARM/ SMALL,SORMAX,NITER,INDPRI,MAXIT,NODREF,NODMON <BR><BR>C + /TIMUSR/ DTUSR <BR><BR>C + /TRANSI/ NSTEP,KSTEP,MF,INCORE <BR><BR>C + /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>C DIMENSION <BR><BR>C + U(NNODE,NPHASE),V(NNODE,NPHASE),W(NNODE,NPHASE),P(NNODE,NPHASE) <BR><BR>C +,VFRAC(NNODE,NPHASE),DEN(NNODE,NPHASE),VIS(NNODE,NPHASE) <BR><BR>C +,TE(NNODE,NPHASE),ED(NNODE,NPHASE),RS(NNODE,NPHASE,6) <BR><BR>C +,T(NNODE,NPHASE),H(NNODE,NPHASE),RF(NNODE,NPHASE,4) <BR><BR>C +,SCAL(NNODE,NPHASE,NSCAL) <BR><BR>C DIMENSION <BR><BR>C + XP(NNODE),YP(NNODE),ZP(NNODE) <BR><BR>C +,VOL(NCELL),AREA(NFACE,3),VPOR(NCELL),ARPOR(NFACE,3) <BR><BR>C +,WFACT(NFACE),CONV(NFACE,NPHASE) <BR><BR>C +,IPT(*),IBLK(5,NBLOCK) <BR><BR>C +,IPVERT(NCELL,8),IPNODN(NCELL,6),IPFACN(NCELL,6),IPNODF(NFACE,4) <BR><BR>C +,IPNODB(NBDRY,4),IPFACB(NBDRY) <BR><BR>C +,IWORK(*),WORK(*),CWORK(*) <BR><BR><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>C 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>C IVERS=3 <BR><BR>C 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>C IUSED=1 <BR><BR>C <BR><BR>C++++++++++++++++ END OF USER AREA 4 ++++++++++++++++++ <BR><BR>C <BR><BR>C IF (IUSED.EQ.0) RETURN <BR><BR>C <BR><BR>C---- FRONTEND CHECKING OF USER ROUTINE <BR><BR>C IF (IUCALL.EQ.0) RETURN <BR><BR>C <BR><BR>C++++++++++++++++ USER AREA 5 +++++++++++++++++++++++++++ <BR><BR>C <BR><BR>C---- EXAMPLE (SET TIME INCREMENT FOR NEXT TIME STEP) <BR><BR>C <BR><BR>C DTUSR = 0.1 <BR><BR>C <BR><BR>C----END OF EXAMPLE <BR><BR>C <BR><BR>C----TO SET TIME INCREMENT FOR NEXT TIME STEP <BR><BR>C----FOR REFERENCE EXAMPLE 17 <BR><BR>C----CHECK THAT THE TIME STEP IS LESS THAN OR EQUAL TO DTBMAX <BR><BR>C <BR><BR>C WRITE (NWRITE,'(/1X,A,1P,E12.3/)') <BR><BR>C + 'MAXIMUM BURNING RATE ',RBMAX <BR><BR>C DTBMAX=0.25/(RBMAX+1.0E-20) <BR><BR>C IF (DT.GT.DTBMAX) DTUSR=DTBMAX <BR><BR><BR><BR>C++++++++++++++++ END OF USER AREA 5 ++++++++++++++++++++++ <BR><BR>C <BR><BR>C RETURN <BR><BR>C END <BR>回复:(visualsun)[转帖]CFX火灾模拟使用说明
(1) 說明: <BR><BR>以上所附之副程式為CFX4所提供的一個副程式,其功用為允許使用者在流場中加入一個source,我們利用它加入一個質量分率以及一個發熱量的source。而使用者所能更改的部分為程式中USER AREA的部分,我們只改變AREA 5的部分,我們分別說明如下: <BR><BR><BR><BR>1: CALL GETVAR這程式使我們能加入soure,而參數H代表要加入的變數為heat flux。 <BR><BR>2: CALL GETVAR這程式使我們能加入soure,而變數SCAL代表要加入的變數是mass fraction。 <BR><BR>3:CALL GETVAR這程式使我們在加入heat flux source後,亦能同時加入mass flux source(名稱為主程式中的”MASS FRACTION”,也就是二氧化碳)。 <BR><BR>4-5:當equation number等於行號1裡的equation number時,在BLOCK NAME為”solid 43”的區塊中做指令輸入。 <BR><BR>6-15:在此區塊的I方向的第300到第310個格點處、J方向的第3到第5個格點處、K方向的第4到第5個格點處,每個格點加入232323*2.5的heat source,由此算出全部的由此算出全部的heat flux約為10MW。 <BR><BR>16-26:同理當equation number等於行號2、3裡的equation number時,在BLOCK NAME為”solid 43”的區塊中做指令輸入,同樣在I方向的第300到第310個格點處、J方向的第3到第5個格點處、K方向的第4到第5個格點處,每個格點加入0.182的mass fraction source,至於加入的mass fraction由主程式定義,由此可以知道是二氧化碳。 <BR><BR><BR><BR>(2)附註: <BR><BR>1. 主程式中邊界未定義其PATCH型態處,CFX4自動將其設定為絕緣的WALL。 <BR><BR>2. 火災模擬時的time step最好先設定較小值,如此一來程式較容易收斂。而當流場跑到穩定發展時,即可提高time step,如此一來可大量節省運算時間。<BR> 哦,很久以前的帖子啦。有应用实例吗? :@) :@) :@) :@) 没有实例 啊看不懂源代码 thank a lot for sharing!
页:
[1]