0% found this document useful (0 votes)
37 views10 pages

CodeManual Lamflame

The document describes a FORTRAN program for simulating laminar reacting flows in two dimensions and axisymmetric coordinates. It summarizes the governing equations, species equations, and energy equation used in the program. It also describes the computational domain, boundary conditions, and execution of the simulation code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views10 pages

CodeManual Lamflame

The document describes a FORTRAN program for simulating laminar reacting flows in two dimensions and axisymmetric coordinates. It summarizes the governing equations, species equations, and energy equation used in the program. It also describes the computational domain, boundary conditions, and execution of the simulation code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

A FORTRAN Program for Simulating Laminar

Reacting Flows (lamflam.f)


(Two-dimensional and Axi-symmetric)

-4 -4

-3.5

-3 -3

-2.5

-2 -2
Y(cm)

-1.5
X

-1 -1

-0.5

0 0

0.5

1
-2 -1 0 1 2 -2 -1 0 1 2
Y X (cm)
The Governing Equations

The non-dimensional governing equations in two-dimensions and axi-symmetric co-


ordinates and the boundary conditions in the gas phase are summarized below.

Continuity equation

∂ (ρθ ) ∂
+ (θρu ) + ∂ (θρv ) + α vθ = 0
∂t ∂z ∂r r

X-Momentum Equation

    

( ) 
(ρθu ) + ∇ ⋅  ρuθU − µθ (∇u ) = − ∂ p + θ  ∂  1 µ ∂ u − 2 µ  ∂ v  + ∂ µ ∂ v   +

∂ 
∂t  Re  ∂ z Re  ∂ z  3 ∂z 3  ∂ r  ∂ r  ∂ z  

 (ρ − ρ ∞ )  1  ∂ u 1  ∂ v  
3
U αθ
+  B  g+  µ − µ   
U R  (ρ f − ρ ∞ ) Re  r  ∂ r 3  ∂ z  

Y-Momentum Equation

    

( ) 
(ρθv ) + ∇ ⋅  ρvθU − µθ ∇v  = − ∂ θp + θ  ∂ µ ∂ u  + ∂  1 µ ∂ v − 2 µ  ∂ u   +
 
∂ 
∂t  Re  ∂ r Re  ∂ z  ∂ r  ∂ r  3 ∂ r 3  ∂ z  

αθ  1  4µ ∂ v 2µ v  
 − 
Re  r  3 ∂ r r  

where R = e µ ∗
R R L U ρ∗
, LR = ,
α∗
T =
(LR ∗ LR ) UR =U∞ +UB
UR R α∗
U B = [g β (T − T )α * ]1 / 3 is the reference buoyancy induced velocity and U ∞ is the
R R ∞ F

imposed forced velocity at the inlet.

Species equation

  
(ρθYi ) +  ∂  ρθYi u − 1 ρDi ∂Yi  + ∂  ρθYi v − 1 ρDi ∂Yi   = α  1 1 ρDi ∂Yi 
∂    
∂t ∂ z  Lei ∂ z  ∂ r  Lei ∂ r    Lei r ∂ r 
where i = F , O2 , C 2 , OH 2O, N 2
diffusion time
Lei =
convection or conduction time
,
L2 D∗ L2 D∗ α ∗
= R i = R2 i∗ = ∗
LR U R LR α Di

Lewis number for species i


= =
LeFi 1.0 =
LeO 2 1.11 =
LeCO 2 1.39 LeH 2O 0.83
LeN 2 = 1.0
− Eg
) where Da = B g ρ α
* *
ω i′′′= f i ω F′′′ = f i Da ρ 2YF YO 2 exp(
T 2
UR
For example if fuel is Methane, the stoichiometric combustion of fuel in air can thus
be written as:

CH4 + 2 (O2 + 3.76 N2) → CO2 + 2 H2O + 7.52 N2

For the above one-step methane and Air stoichiometric reaction, the stoichiometric
ratios are, fF = −1, fO2 = −4.0, fCO2 = 2.75, fH2O = 2.25, fN2 = 13.16

Energy Equation
.

(ρθC pT ) +  ∂θ  ρC p uT − 1 k∂T  + ∂θ 
 ρC vT −
1 k∂T   αθ  1 k∂T 
 =  
∂t ∂ z  Pr Re ∂ z  ∂ r Pr Re ∂ r   Pr Re  r ∂ r 
p

N  1  N  
∑1  Le ρθDi C pi (∇Yi ∇T ) − ∑ (θω i′′′hi ) + θ∇C p .∇T  k 
 C 
  1  p 
T
N (hi 0 + ∫ c p ,i dT )
where c p = ∑ c p ,i Yi , hi =
T0 = 2 9K 8
i =1 (c ∗p T∞ )

In the above governing equations:


For axisymmetric case α=1, θ =1
For two-dimensional case α=0, r=1, dr=dy, dz=dx, θ =1

Case Study of Burke Schumann flame:

Computational domain:

wall
outlet
Air inlet

Fuel inlet
axis

Both the fuel inlet and air inlet velocity are equal and the wall is assumed to be cold.
The boundary conditions are:
A X =t x m (ua x p os it r nr)
u = (U ∞ ) / U R , v = 0
T =1
YO 2 = 0.23 , Yi = 0 (i = F , C 2 ,O
H 2 O ) (at air inlet)

YF = 1 , Yi = 0 (i = O2 , CO2 , H 2 O) (at fuel inlet)

A X =t x m (d i n o w o e nr ) x
ux = 0 , vx = 0 ,
Tx = 0 , (Yi )x = 0
where i = O2 , CO2 , H 2 O, F

At Y = y min (axis)
ux = 0 , v = 0 ,
Tx = 0 , (Yi )x = 0
where i = O2 , CO2 , H 2 O, F

At Y = y max ( wall )
u = 0 ,v = 0,
T = 1, (Yi )x = 0
where i = O2 , CO2 , H 2 O, F
Execution of the Code (lamflam.f)
Input

READ INPUT : Control parameters and data (input)


GRID : Setup new grid structure (grid_input)
READ_INITIAL_PROFILE : Read initial profiles and old grid (fort.1l)

Main Iteration

OLDS :Store the old values for later comparison

SIMPLER/PISO

UHATS : Compute pseudovelocity u


VHATS : Compute pseudovelocity v
PRESSURE : Compute pressure field P
GLOBAL : Check global mass balance
USTARS : Compute intermediate velocity u*
VSTARS : Compute intermediate velocity v*
PPRIME : Compute pressure correction P'
CORVEL : Correct velocity field in response to P'
PPRIME1 : pressure correction P’’ (PISO)
CORVEL1 : Correct velocity field in response to P'’ (PISO)
DISSIPATION : Calculate epsilon for k-epsilon model
KINETIC : Calculate k for the k-epsilon model
OXYGEN : Compute oxygen mass fraction Y02
FUEL : Compute fuel mass fraction y F
CARBON : Compute carbon dioxide mass fraction y CO2
WATER : Compute water vapor mass fraction YH2O
PPRFIND : Find locations of maxi-min pressure correction (P’)
TEMP : Compute temperature field
DENS : Compute gas mixture density
WRITE : Writes data every 500 iterations to a file (fort.13)

End of SIMPLER/PISO

End of Main Iteration


REACT : Calculate reaction rate (reac)
PLOTDATA : Writes data files for plots (TECPLOT)
vec.dat (velocity field), scalar.dat (scalar field),
massflx.dat (o2/Fuel mass flux field)

6
GRIDS AND GRID_INPUT FILE

The domain is sub-divided into blocks and mesh generated for each of these blocks. Note there are 6
segments (including one single cell segment at X=0) along X and 2 segments along Y

X-S E G # 0

XLP Y: P yrolys is length


Y -S E G # 2
XLP HYE NT: E ntranc e length

Y U + Vf

Y -S E G # 1
X-S E G # -2 X-S E G # -1 X-S E G # 1 V X-S E G # 2
X-S E G # -3 f

O X F res h fuel
Line of s ym m etry XLP Y XLE NTP HY

Figure 1: Grid blocks. There are 6 segments (including one single cell segment at X=0) along X
and 2 segments along Y

GRID PARAMETERS (file: grid_input)


2 1 2 1
0.5 1.5
2 2
1.1 1.2
0.005 0.04
0.04 0.1
0.25 0.25
2 2
1.1 1.1
0.005 0.005
0.02 0.02

!----READ GRID PARAMETERS FROM THE INPUT FILE (grid_input)

READ(42,*) n_tblk_x,nfstbx,n_tblk_y,nfstby
READ(42,*) (sx_blk(i),i=nfstbx,n_tblk_x+nfstbx)
READ(42,*) (nconst_x(i),i=nfstbx,n_tblk_x+nfstbx)
READ(42,*) (r_x(i),i=nfstbx,n_tblk_x+nfstbx)
READ(42,*) (dmin_x(i),i=nfstbx,n_tblk_x+nfstbx)
READ(42,*) (dmax_x(i),i=nfstbx,n_tblk_x+nfstbx)
READ(42,*) (sy_blk(i),i=nfstby,n_tblk_y+nfstby-1)

8
READ(42,*) (nconst_y(i),i=nfstby,n_tblk_y+nfstby-1)
READ(42,*) (r_y(i),i=nfstby,n_tblk_y+nfstby-1)
READ(42,*) (dmin_y(i),i=nfstby,n_tblk_y+nfstby-1)
READ(42,*) (dmax_y(i),i=nfstby,n_tblk_y+nfstby-1)

Variable Definition:

! nfstbx/nfstby : left most segment number in X/Y direction


! n_tblk_x/n_tblk_y : total number of segments along X/Y
! sx_blk/sy_blk : segment length non-dimensional X/Y direction
! r_x/r_y : grid expansion ratio for a segment in X/Y direction
! dmax_x,dmax_y : maximum size of sub-division in a segment (non-dim)
! dmin_x,dmin_y : minimum size of sub-division in a segment (non-dim)
! nx_blk,ny_blk : number of sub-divisions in a segment
! nconst_x,nconst_y : number of uniforms subdivisions in a segment

GRID INFORMATION (from file: gridinfo)

Number of grid points in segment 1 = 21


Number of grid points in segment 2 = 21
Total number of grid points along Y = 42

SEGMENT DETAILS
seg # seg length dy(max) dy(min) exp-ratio nconst
------------------------------------------------------------------------
-
1 0.2500 0.0200 0.0050 1.1000 2
2 0.2500 0.0200 0.0050 1.1000 2
0.5000

SEGMENTS ALONG X
--------------------------------------------------------------
Number of grid points in segment 1 = 27
Number of grid points in segment 2 = 20
Total number of grid points along X = 47

SEGMENT DETAILS
seg # seg length dx(max) dx(min) exp-ratio nconst
------------------------------------------------------------------------
-
1 0.5000 0.0400 0.0050 1.1000 2
2 1.5000 0.1000 0.0390 1.2000 2
2.0000

9
INPUT FILE (input)

FLOW PARAMETERS
----------------
2.0 1.0000E-03 0.0
ve0 deltat GLEVEL
ITERATION CONTROLS
-------------------
500000 0 0
nall ntstart ntimstp
4 4 4 4
nswpu nswpv nswpw nswpp
4 4 4
nswpppr nswpt NSWPTFO
OPTION FLAGS
-------------
0 1 1 1 0
iunsteady iaxisym ireac ipiso iturb
0 1 1 1 1
istart isimplr iplot iskpp ivarpro
CONVERGENCE CONTROLS
---------------------
1.000000E-01 1.000000E-01 9.000000E-01 1.000000E-01
udamp vdamp pdamp tdamp
1.000000E-02 1.000000E-01 1.000000E-01
pprdamp YODAMP YFDAMP
ERROR CHECKS
---------------------
-1.0e-8 -1.0e-8 -1.0e-8 -1.0e-8 -1.0e-8 -1.0e-8
erp eru erv erppr erff ertemp
FLAME STABILIZATION AND VARIABLE GRID INFORMATION
--------------------
0 1
ncell ivarcell
GAS PHASE DATA & PROPERTIES
----------------------------
2.09E+04 1.49E+11 4.0E+03 300.0 1.00000E+00
eg(cal/gmol) bg(cm3/g/s) qg(cal/g) tref xoamb
4.166670E+00 2.750000E-04 2.130000E+00 4.10000E-04 3.300000E-01
tstar rstar(g/cm3) astar(cm2/s) visstar(g/cm/s) cp(cal/g/K)
STOICHIOMERTIC RATIOS
------------------------------
4.0 2.75 2.25 13.16
fo fco2 fh2o fn2
FUEL INFORMATION
-----------------------------------
0.717 16.00 0.136 1.200E-03
rf wmf coef1 coef2

14
OPEN(UNIT=9,FILE='input')

READ(9,*)
READ(9,*)
READ(9,*)ve0,deltat,GLEVEL
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)nall,ntstart,ntimstp
READ(9,*)
READ(9,*)nswpu,nswpv,nswpw,nswpp
READ(9,*)
READ(9,*)nswpppr,nswpt,NSWPTFO
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)iunsteady,iaxisym,ireac,ipiso,iturb
READ(9,*)
READ(9,*)istart,isimplr,iplot,iskpp,ivarpro
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)udamp,vdamp,pdamp,tdamp
READ(9,*)
READ(9,*)pprdamp,YODAMP,YFDAMP
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)erp,eru,erv,erppr,erff,ertemp
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)ncell,ivarcell
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)eg,bg,qg,tref,xoamb
READ(9,*)
READ(9,*)tstar,rstar,astar,visstar,cp
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)fo,fco2,fh2o,fn2
READ(9,*)
READ(9,*)
READ(9,*)
READ(9,*)rf,wmf,coef1,coef2

CLOSE(9)

15
COMPILING AND RUNNING CODE (lamflam.f) ON LINUX/UNIX PLATFORM

Compiling
ifort lamflam.f –o flame

Data/Parameter Input files


input,grid_input

Old grid / Initial profile


fort.11

Running the compiled code


flame (OR ./flame)

To restart once a run is complete ( grids must not be changed at restart)


1. Use new profiles computed fort the new run: cp fort.13 fort.11
2. Set the flag ‘istart’ in the input file, ‘input’ to ‘1’

16

You might also like