General FREEFORM Examples
FREEFORM is the English-like conversational commands language that all ACRi software use to take input.
These examples are provided for two distinct purposes:
- To demonstrate the ease of use of the FREEFORM language, in case you would like to use an executable (ANSWER™, PORFLOW™, TIDAL™ or RADM™) from command line, rather than through CFDStudio™ environment. Note that when you setup a problem in CFDStudio™, you do not need to type in these commands; they are generated by the engine through the point-and-click approach.
- To illustrate the capabilities such as defining new field variables on the fly, defining new reaction mechanisms, etc, all without writing a single line of code. Note that other comparable software such as Fluent, Star-CD and CFX require you to write C or FORTRAN code for most of these tasks.
Color and Case Coding Guideline: Note that FREEFORM is case-insensitive, and the input is in plain text format. However, to highlight the keywords and modifiers, UPPER case letters are often used. The colors are simply for illustrational purposes. These are:
RED: keywords (first 4 letters of a word that starts at column 1)
BLUE: modifiers (first 4 letters of a recognized word that comes after a keyword -- every keyword has a unique set of modifiers, as outlined in the users manual) AND variables (these are both default variables such as X -- distance in axial direction -- and user-defined variables such as pmon - phase of the moon -- as an example)
GREEN: comments (start with "/" or "*" at column 1 or "$" or "!" at any column)
See FREEFORM™ front page to read more about FREEFORM™ command syntax.
PROBLEM 1
Description
The following FREEFORM™ commands illustrate the capabilities of ANSWER™ to dynamically define:
- New field variables,
- New transport
equations, and
- New reactions and sources.
************************************************************************
TITLE SQUARE CAVITY PROBLEM WITH
USER-DEFINED TRANSPORT & REACTION
************************************************************************
// This data
set for ACRi Software ANSWER illustrates the use of
// the
FREEFORM command language to dynamically define:
// >>
New Field Variables,
// >>
New Transport Equations, and
// >>
Complex Reactions and Sources
//
************************************************************************
/
// The
problem is set in the context of the classic Square Cavity
// with a
moving lid at the top.
//
// A new
species call DOGS is defined on the fly which is governed by
// a
transport equation. The transport properties and boundary
conditions
// for DOGS
are defined by simple commands.
//
// The
distribution of DOGS is effected by the availability of MEAT
// as a
sinusoidal function of Time, and a 1st-order Arrhenius reaction
// called
KILLed. These are defined on-the-fly.
//
// MEAT =
2.0 * SIN ( 0.06886 * Time + 1. ) +2.0
// KILLed =
-19.6 * exp(-937/T) DOGS^0.5
/
// In
addition in one part of the domain, the DOGS are regenerated as
// as a
function of U velocity if it is positive and eliminated if it is
// negative.
The function is defined as a arbitrary tabulated function
************************************************************************
/
GRID
NODEs BY 22 BY 22 ! Use structured mode of ANSWER
/
COORDINATE
X RANGE 1 ! Auto gridding; range specified
COORDINATE
Y RANGE
1 ! Auto gridding; range specified
/
***** Flow
conditions
WALL at all outer boundaries
BOUNdary
U: at boundary Y+, VALUE=1. ! Specify moving top wall
LAMINAR flow
VISCOSITY is 0.01
SET
T (temperature) = 293.15
/
***** Define
new variables on the fly
ALLOCATe "DOGS- Members of Canine Family"
ALLOCATe "MEAT- Food for Dogs"
/
//////////////////////////////////////////////////////////////////////
**** Define
Transport equation for DOGS and its attributes
//////////////////////////////////////////////////////////////////////
INITial value of
DOGS = 10
PRANDtl Number for
DOGS is 0.1
! Boundary
conditions for DOGS including a linear function at top
BOUNdary X- (left) for
DOGS: Value = 2
! Fixed value
BOUNdary X+ (right) for
DOGS: FLUX = 0
! No DOGS leave or enter
BOUNdary Y- (bottom) for
DOGS: FLUX = 1.E-4
! dogs enter from bottom
BOUNdary Y+ (top) for
DOGS: VALUe =
Linear function 2. +8. *
X
//////////////////////////////////////////////////////////////////////
// Define
MEAT as sinusoidal function of TIME; make it source for DOGS
//////////////////////////////////////////////////////////////////////
SET
MEAT = 2. * SIN ( 0.06886 * Time + 1. ) +2. ALWAys
SOURce for
DOGS is LINEAR function: 0. +1. *
MEAT per unit
VOLUme
! Assume
dogs die as a non-linear Arrhenius function of population
ALLOCATE 'KILL- Killed from various causes'
REACtion
KILL DOGS Z0 = 19.6 TEMPerature_activation = 937 power = 0.5
SOURce
REACTION type for
DOGS LINEar -1. * KILL
! Assume in
one subregion dogs die when U < 0 & are born when U > 0
SELECT subregion 5,5 to 7,7
SOURCE for
DOGS for SELECted region is a TABLE of 3 sets in terms of
U
// U SOURCE
-1 -0.01234
0. 0
1. 2.1234
//////////////////////////////////////////////////////////////////////
**** END of
specification for DOGS' transport equation
//////////////////////////////////////////////////////////////////////
REACtion default hydrocarbon OFF
DIAGNOSTIC
NODE print Time, U, V and DOGS AT (6,6) every 50 step
CONVERGENCE
REFErence U in LOCAL mode 1.E-6
/
OUTPUT
U DOGS, MEAT, KILL NARRow mode
HISTORY of
U DOGS MEAT and
KILL with PLOT output on file "DOGS.HIS"
HISTORY at (2,2) (5,5) (7,7) and (10,10)
every 16 STEPS
/
SOLVE
U V P & DOGS for 365 days in step of 0.1
END
PROBLEM 2
Description
The following commands were used
to set up and run a new 5 step methane combustion mechanism in
the University of Washington jet stirred reactor.
/-----------------------------------------------------------------/
TITLE Case K. COMBUSTION IN UW JSR -
5-STEP UW CH4/AIR MECH.
/-----------------------------------------------------------------/
/ ANSWER
Input File
/
/ Using UW
1-atm CH4-Air 5-Step Mechanism
/ 2-D
Problem
/
/ Reference:
Nicol, D.G., Malte, P.C., Hamer, A.J., Roby, R.J.,
/ Steele,
R.C., 1998, "Development of a Five-Step
/ Global
Methane Oxidation - NO Formation Mechanism
/ for
Lean-Premixed Gas Turbine Combustion," to
/ appear in
Transactions of ASME (Earlier version
/ of this
work also in Western States/CI paper number
/ 97S-039).
/
/------------------------GRID
SPECIFICATION-----------------------/
/ 2-D Grid
GRID 117 by 43
COORdinates
X JIK 'x_jsr.grd' in FULL
CYLIndrical
COORdinates
R JIK 'r_jsr.grd' in FULL
CYLIndrical
/----------------------DEFINE
BOUNDARY REGIONS--------------------/
/ Inlet Jet
LOCAte
ID=IN1 (1,1) (1,12)
INLEt
at X- ID=IN1
/ Outlet
Drain Hole
SELEct
(24,43) (30,43)
OUTLet
at R+ for the SELEcted subregion
/ Axis of
Symmetry
SYMMetry
at Y- axis
/ Set Walls
WALLs
at undefined outer boundaries
/------------------------CHEMICAL
REACTIONS-----------------------/
/ Set up
combustion from scratch (i.e., turn off all the default
/ reaction
details)
REACtion
OFF DEFAULT
/ Define
molecular weights of the species
GAS
FU=16.0
CO=28.0 CO2=44.0 H2O=18.0
N2=28.0
O2=32.0 NO=30.0
/Allocate
space for reaction rates, called R1, R2, R3, R4, R5
ALLOcate
R1
ALLOcate
R2
ALLOcate
R3
ALLOcate
R4
ALLOcate
R5
/ Define
reaction rates (NOTE: FU = CH4)
/ CH4 + 1.5
O2 => CO + 2 H2O
/ 1.66E+15 =
Pre-exponential (see reference)
/ 2.0643E+04
= Activation temp
/ 1.46 =
Exponent for FU
/ 0.5217 =
Exponent for O2
/ 0.0 = Temp
exponent
/ EBU = Want
to specify EBU rate for this reaction
/ TEMP =
Include this modifier because using activation
/
temperature (instead of activation energy)
REACtion
R1 FU
O2 1.66E+15
2.0643E+04 1.460 0.5217 0.0 EBU TEMP
/ CO + 0.5
O2 => CO2
REACtion
R2 CO
O2 7.98E+14
1.1613E+04 1.6904 1.570 0.0 EBU TEMP
/ CO2 =>
CO + 0.5 O2
REACtion
R3
CO2 2.23E+14
6.2281E+04 1.0 0.0 EBU TEMP
/ N2 + O2
=> 2 NO
REACtion
R4 CO
O2 8.83E+23
5.3369E+04 0.7211 4.0111 0.0 EBU TEMP
/ N2 + O2
=> 2 NO
REACtion
R5 N2
O2 9.27E+14
6.8899E+04 1.0 0.5 -0.5 EBU TEMP
/ EBU
coefficients for each mechanism
EBU
R1 FU 3.0
EBU
R2 CO
O2 3.0 1.75
EBU
R3 CO2 3.0
EBU
R4 N2 3.0
EBU
R5 N2 3.0
/---EBU 3.0
1000
/---------------SOURCE
TERMS FOR SPECIES DIFF EQ------------------/
/ Define
source terms for CH4, CO, and NO
/ CH4 source
term
SOURce
REACtion type FU LINEar -1.0 * R1
/
/ CO source
term ( 1.75 = CO/CH4; 0.6364 = CO/CO2 )
SOURce
REACtion type CO LINEar +1.75 *
R1 -1.0
* R2 +0.63636 *
R3
/
/ NO source
term ( 2.1429 = 2 * NO/N2 = 2 * NO/CO )
SOURce
REACtion type NO
LINEar
+2.1429 *
R4 +2.1429 *
R5
/
/------------ALGEBRAIC
EXPRESSIONS FOR OTHER SPECIES--------------/
/
/ Algebraic
equations for total H-atom (FH), total O-atom (FO),
/ CO2, H2O,
O2, and N2 by atom balance. FF is total C-atom.
SET
ALWAys LINEar FH = 0.0 +1.0 *
FF
SET
ALWAys LINEar FO = 0.2331 -0.2331 *
FF
SET
ALWAys LINEar CO2 = 2.75 *
FF -1.571 *
CO -2.75 * FU + 0.0
SET ALWAys
LINEar
H2O = 2.75 *
FH -2.75 *
FU +0.0
SET ALWAys
LINEar
O2 = 1.0 *
FO -0.571 *
CO -0.727 *
CO2 -0.889 *
H2O -0.533 *
NO + 0.0
SET ALWAys
LINEar
N2 = -1.0 *
FU -1.0 *
CO -1.0 *
CO2 -1.0 *
H2O -1.0 *
NO -1.0 *
O2 + 1.0
/------------------INITIAL
AND BOUNDARY CONDITIONS----------------/
/
/ Walls of
reactor are adiabatic
ADIAbatic
WALLS
/ Inlet
Jet/Initial Conditions (Fuel-Air Equivalence Ratio = 1.1)
SET
U X- 78.4
ID=IN1
SET
FU X- 0.06
ID=IN1
SET
FF X- 0.06
ID=IN1
SET
T
523.0
SET
K
100.0
SET
L
0.0004
/ Initialize
a 'hot' region to start combustion
INITIAL
T 2000.0 (2,2) (76,30)
/-------------------FLUID
PROPERTIES AND CONSTANTS----------------/
/ Density
calculated by Gas Law
DENSity
GAS
/ Specific
heat and species enthalpies calculated by polynomial
/
expressions
SPECific heat by NASA
POLYnomial expressions
/--------------------------SOLUTION
OPTIONS-----------------------/
/ Variable
limit setting
LIMIT
FU 1.0E-20 1.0
LIMIT
FF
1.0E-20 1.0
LIMIT
H2O 1.0E-20 1.0
LIMIT
CO2 1.0E-20 1.0
LIMIT
O2 1.0E-20 1.0
LIMIT
H2 1.0E-20 1.0
LIMIt
CO 1.0E-20 1.0
LIMIt
NO 1.0E-20 1.0
LIMIt
T 523.0 4000.0
/
/ Relaxation
Factors
RELAxation
U=0.3 V=0.3 W=0.3 P=0.3 K=0.3 E=0.3 T=0.3 FF=0.3 FU=0.3 CO=0.3 NO=0.3
/ Monitor
solution at (90,5) every 10 iterations
DIAGnostic output for
U, V, T, NO, FU,
FF at (90,5) in
every 1 steps
/------------------------OPERATIONAL
CONTROL----------------------/
/
Convergence criteria - based on global residual
CONVergence
GLOBAL 1.E-9 1
SOLVE
STEADY 5000
OUTPUT
U V W P T K E L H FF FH FO FU CO
O2 H2O CO2 NO N2 MU RHO
SAVE
U V W P T K E L H FF FH FO FU CO
O2 H2O CO2 NO N2 MU RHO on file 'CaseK.sav'
END
Related Links:
# FREEFORM Home Page
|