Upload
nicholasjvaughan
View
29
Download
0
Embed Size (px)
DESCRIPTION
expression language
Citation preview
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
Introduction to CFX-Build127 CFX-5.5.1
CFX Expression Language
Introduction to CFX Expression Language (CEL) p. 128 CEL Fundamentals p. 129
CEL Examples p. 142
The Expression Editor p. 146
CEL Technical Details p. 147
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
Introduction to CFX Expression Language (CEL)CEL is an interpreted, declarative language which has been developedto enable CFX-5 users to enhance their simulations without recourseto writing and linking separate external FORTRAN routines.128 Introduction to CFX Expression Language (CEL) CFX-5.5.1
The Expressions you create using CEL can be used in the FluidDomains, Boundary Conditions, Initial Values, Solver Control andMesh Adaption forms in CFX-Build where a value is required for input.
CEL can be used to:
Define material properties which depend on other variables.
Specify complex boundary conditions.
Add terms to the solved equations.
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
CEL Fundamentals
How CEL Interacts with the CFX-5 Solver
Val129 CEL Fundamentals CFX-5.5.1
At various points in the flow solver operation, the calculation requiresinformation such as the rate of flow at an inlet boundary, or the viscosityin some part of the fluid. This dependence can be specified in a simplemanner, but more complex dependencies may be developed by usingCEL.
Consider the case of flow through a pipe. You may wish to set avelocity profile at the inlet which will typically be greatest at the centre.The profile can be expressed mathematically in terms of a function ofx, y and z, which are CFX-5 System Variables known to the CFX-5Solver. The mathematical definition of the profile is called anExpression, and the value of this expression is a Term which is input tothe flow solver. You can define many terms in CFX-5 by way ofexpressions: fluid properties, sub-domain sources, boundaryconditions and initial values are all CFX-5 terms which can bedescribed using expressions.
A key feature of CEL is that it is used dynamically by the CFX-5 Solver.For example, you can set viscosity to be dependent on temperatureusing CEL, and the current heat transfer CFD solution will be computedfor this relationship.
ues and ExpressionsCEL can be used to generate both Values and Expressions. Values aredimensional (i.e. with units) or dimensionless constants. The simplesttype of definition is the dimensionless value, for example:
b = 3 .743
You can also specify a value with units, for example:
g = 9.81 [m s^-2]The dimensions of the quantities of interest for CFD calculations canbe written in terms of mass, length, time, temperature and angle. Theconcept of units is fundamental to the behaviour of values andexpressions.
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
Values can be used directly, or they can be used as part of anExpression. For example, you can use an expression to add two valuestogether:
= + .
CFX130 CEL Fundamentals CFX-5.5.1
In this example, you may wish to pre-define and, but this is not required. However, in order to add twoquantities together, they must have the same dimension, i.e. it ismeaningful to add a quantity in inches to one expressed in metres, butit is not meaningful to add one expressed in kilograms to one in squarefeet.
Expressions can also be functions of other (pre-defined) expressions: = +
Units follow the conventions in the rest of CFX-5, in that a calculationhas a set of solution units (by default, SI units), and that any quantitycan be defined either in terms of the solution units, or any other set ofunits with the correct form.
An expression does not have its own units string, but if it referencesquantities which have dimensions, these will determine the resultingunits for the expression. For example, if an expression dependsinversely on the square of the x coordinate, then it has implieddimensions of length to the power -2.
Expression Language StatementsThe CFX Expression Language is declarative. You declare the nameand definition of the expression (and an optional comment ordescription) using expression language statements. The statementsmust conform to a predefined syntax which is similar to FORTRANmathematical statements.
The statement must consist of the following:
a number, optionally with associated units. This defines a constant.Constants without units are termed dimensionless.
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
one or more references to constants, system variables, or existinguser variables, separated by + (addition), - (subtraction),* (multiplication), / (division) and ^ (exponentiation), with optionalgrouping of these by parentheses. The syntax rules for theseexpressions are the same as those for conventional arithmetic.
Use
Expr
Mult131 CEL Fundamentals CFX-5.5.1
of Constants
Constants do not need to be defined prior to being used in anexpression. For example, you could choose to evaluate the expressionx + 5 [m]. Or, you could define a constant, b = 5 [m] and thencreate an expression x + b.
The use of constants may be of benefit in generating complicatedexpressions or if you have several expressions that use the sameconstants.
ession Syntax
All numbers are treated as real numbers.
The precedence of operators is as follows (from highest to lowest): The unary minus or negation operator - as in -x.
The power operator ^ as in x^y.
Multiplication and division as in x*y/z.
Addition and subtraction as in x+y-z.
Note a difference from FORTRAN is that in FORTRAN, if A has thevalue 1, then -A**2 is interpreted as -(A**2) and has the value -1. InCEL -A^2 is interpreted as (-A)^2 and has the value 1. For clarity, youcan always use brackets to specify the order of operations.
iple-Line Expressions
It is often useful, particularly with complex expressions, to use morethan one line when creating your expression. CFX-5 allows you to usemultiple lines to generate an expression, provided each line isseparated by an appropriate operator.
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
For example, you may have an equation, A + B/C, that consists of threecomplex terms, A, B, and C. In this case, you could use three lines tosimplify creating the expression:
A +B
CFX
Syst
Nam
u
v
w
vels
vels
vels
p
pab
ptot
ptot
vfc
vf132 CEL Fundamentals CFX-5.5.1
/ C
Note that the operator may be used at the of a line (A +) or at thebeginning of a line (/ C). You do not need to enter the operator twice.Once the expression has been created, it will appear in the ExistingDefinitions listbox as if it was generated on a single line (A + B/C).
-5 System Variables, Built-in Functions and Constants
em Variables
The following System Variables are available for use with CEL whendefining expressions:
e Units Meaning
m s^-1 Velocity in the x coordinate direction
m s^-1 Velocity in the y coordinate direction
m s^-1 Velocity in the z coordinate direction
tn u m s^-1 Velocity in Stationary Frame in the x coordinatedirection
tn v m s^-1 Velocity in Stationary Frame in the y coordinatedirection
tn w m s^-1 Velocity in Stationary Frame in the z coordinatedirection
kg m^-1 s^-2 Pressure
s kg m^-1 s^-2 Absolute Pressure
kg m^-1 s^-2 Total Pressure
stn kg m^-1 s^-2 Total Pressure in Stationary Frame
Dimensionless Conservative Volume Fraction
Dimensionless Volume Fraction
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
density kg m^-3 Density
mw kg mol^-1 Molar Mass
enthalpy m^2 s^-2 Static Enthalpy
spe
Mac
Mac
beta
visc
visc
con
Cp
Cv
abs
scat
extin
refra
ke
ed
tef
edd
sstr
T
Ttot
Ttot
htot
roth
htot
radi
Name Units Meaning133 CEL Fundamentals CFX-5.5.1
edofsound m s^-1 Local speed of sound in fluid
h Dimensionless Mach Number
hstn Dimensionless Mach Number in Stationary Frame
K^-1 Thermal Expansivity
osity kg m^-1 s^-1 Dynamic Viscosity
kin m^2 s^-1 Kinematic Viscosity
d kg m s^-3 K^-1 Thermal Conductivity
m^2 s^-2 K^-1 Specific Heat Capacity at Constant Pressure
m^2 s^-2 K^-1 Specific Heat Capacity at Constant Volume
orb m^-1 Absorption Coefficient
ter m^-1 Scattering Coefficient
ct m^-1 Extinction Coefficient
c Dimensionless Refractive Index
m^2 s^-2 Turbulent kinetic energy
m^2 s^-3 Turbulent eddy dissipation
s^-1 Turbulent Eddy Frequency
y viscosity kg m^-1 s^-1 Eddy Viscosity
nr s^-1 Shear strain rate
K Temperature
K Total Temperature
stn K Total Temperature in Stationary Frame
m^2 s^-2 Total Enthalpy
alpy m^2 s^-2 Rothalpy
stn m^2 s^-2 Total Enthalpy in Stationary Frame
nt kg s^-3 Radiative Emission
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
emis Dimensionless Emissivity
radinc kg s^-3 Incident Radiation
rademis kg s^-3 Radiative Emission
mfc
mf
tmf
mol
mol
x
y
z
r
thet
t
rNo
sub
mea
af
mix
den
mix
mix
mix
mix
AV n
Name Units Meaning134 CEL Fundamentals CFX-5.5.1
Dimensionless Conservative Mass Fraction
Dimensionless Mass Fraction
Dimensionless Total Bounded Mass Fraction
f Dimensionless Molar Fraction
conc m^-3 mol Molar Concentration
m Direction 1 in Reference Coordinate Frame
m Direction 2 in Reference Coordinate Frame
m Direction 3 in Reference Coordinate Frame
mRadial spatial location,
a rad Angle, arctan(y/x)s Time
Dim Dimensionless Non-dimensional radius (only available when arotating domain exists)
domain Dimensionless Sub-domain variable(1.0 in Sub-domain, 0.0 elsewhere)
n particle diameter m Mean Particle Diameter
Dimensionless Contact Area Fraction
ture length scale m Mixture Model Length Scale
eff kg m^-3 Effective Density
frc Dimensionless Mixture Fraction Mean
var Dimensionless Mixture Fraction Variance
varn Dimensionless Mixture Fraction Normalised Variance
sclds kg m^-3 s^-1 Mixture Fraction Scalar Dissipation Rate
ame Additional Variable name
r x2 y2+=
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
Many variables have a long and a short form (e.g. Pressure or p). CELonly supports the short form for variable names, as shown in the abovetable.
System Variable Prefixes
Spec135 CEL Fundamentals CFX-5.5.1
In order to distinguish system variables of the different componentsand fluids in your CFX-5 model, prefixes are used. For example, ifcarbon dioxide is a material used in the fluid air, then some of thesystem variables that you might expect to see are:
air.density - the density of airair.viscosity - the viscosity of airair.carbondioxide.mf - the mass fraction of carbon dioxide in air
In a single phase simulation the fluid prefix may be omitted, howeverfor multiphase cases you must include the fluid prefix to distinguishbetween different fluids.
ial System Variables - r, theta, rNoDim and subdomain
The following system variables have special meaning in CFX-5 and aredefined as follows:
r is defined as the normal distance from the third axis with respect tothe Reference Coordinate Frame. theta is defined as the angularrotation about the third axis with respect to the Reference CoordinateFrame.
Note: theta is expressed in Radians and will have values between -pi and pi.
r and theta are particularly useful for describing radial distributions, forinstance the velocity profile at the inlet to a pipe.
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
Expr
Y136 CEL Fundamentals CFX-5.5.1
rNoDim is a dimensionless system variable which can be useful forrotating machinery applications. It is a ratio of radii, defined to be zeroat the minimum radius and unity at the maximum radius, so that ingeneral,
where R is the radius of any point in the Domain from the axis ofrotation. rNoDim is only available for Domains defined with a rotatingframe of reference.
subdomain is essentially a step function variable, defined to be unitywithin a Sub-domain and zero elsewhere. This is useful for describingdifferent initial values or fluid properties in different regions of theDomain.
ession names
Your CEL expression name can be any name that does not conflict withthe name of a CFX-5 system variable, mathematical function, or anexisting CEL expression. All FUNCTION and VARIABLE names listedin the /etc//VARIABLES file are reservednames and should not be used.
XZ
ReferenceCoordinate Frame
thetar
rNoDimR R
min
Rmax Rmin-----------------------------=
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
Scalar expressions
A scalar expression is a real valued expression using pre-definedvariables, user variables and literal constants (e.g. 1.0). Note that literalconstants have to be of the same dimension. Scalar expressions caninclude the operators + - * / and ^ and several of the mathematical
Expr137 CEL Fundamentals CFX-5.5.1
functions found in standard FORTRAN (e.g. sin() and exp()).An expressions value is a real value and has specified dimensions(except where it is dimensionless - but this is also a valid dimensionsetting).For example, if t is time and L is a length then the result of L/t has thesame dimensions as speed.
The + and - operators are only valid between expressions with thesame dimensions and result in an expression of those dimensions.
The * and / operators combine the dimensions of their operands in theusual fashion. X^I, where I is an integer, results in an expressionwhose dimensions are those of X to the power I. The trigonometricfunctions all work in terms of an angle in radians and a dimensionlessratio.
ession properties
There are three properties of expressions:
An expression is a simple expression if the only operations are +, -,*, / and there are no functions used in the expression.
An expression is a constant expression if all the numbers in theexpression are explicit (i.e. they dont depend on values from thesolver).
An expression is an integer expression if all the numbers in theexpression are integers and the result of each function or operationis an integer.
For example (3+5)/2 is a simple, constant, integer expression.However, 2*(1/2) is not a constant integer expression, since the resultof 1/2 is 0.5, not an integer. Also 3.*4 is not a constant integerexpression, since 3. is not an integer. Moreover 2^3 is not a simple,constant, integer expression, since ^ is not in the list (+, -, *, /).
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
Expressions are evaluated at runtime and in single precision floatingpoint arithmetic.
Available and Unavailable System Variables
CEL
Ope
-x
x+y
x-y138 CEL Fundamentals CFX-5.5.1
CFX-5 System Variables and user-defined expressions will beavailable or unavailable depending on the simulation you areperforming and the expressions you wish to create. In somecircumstances, System Variables are logically unavailable; forinstance, time (t) is not available for steady-state simulations. In others,the availability of a System Variable is not allowed for physical modelreasons. For example, density can be a function of pressure (p),temperature (T) and location (x, y, z), but no other system variables.See The RULES and VARIABLES Files (p. 97 in CFX-5 Solver andSolver Manager) for information on how to find dependencies for allparameters.
CFX-Build checks expressions for syntax and use of system variableswhen you use the -Apply- button to create Fluid Domains, BoundaryConditions and Initial Values or Initial Guess.
The expression definition can depend on any system variable. If,however, that expression depends on a system variable which isunavailable for a particular context, then that expression will also beunavailable.
operators and built-in functions
CFX-5 provides a range of mathematical operators as built-inmathematical functions to help you create complex expressions usingthe Expression Editor.
rator First OperandsDimensions [x]
SecondOperandsDimensions [y]
OperandsValues (Approx)
ResultsDimensions
Any Any [x]Any [x] Any [x]Any [x] Any [x]
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
x*y Any Any Any [x]*[y]x/y Any Any y0 [x]/[y]x^y consexpr
x^y simpexpr
x^y & co
*For y
Operator First OperandsDimensions [x]
SecondOperandsDimensions [y]
OperandsValues (Approx)
ResultsDimensions139 CEL Fundamentals CFX-5.5.1
The following mathematical functions are available for use with all CELexpressions. In the Function column in the table below, [ ] denotes adimensionless quantity and [a] denotes any dimension of the firstoperand.
(if y is a simple,tant, integeression)
Any Dimensionless Any* [x]^y
(if y is anyle, constant,ession)
Any Dimensionless x > 0 [x]^y
(if y is not simplenstant)
Dimensionless Dimensionless x > 0 Dimensionless
< 0, x must be non-zero.
Function OperandsValues
ResultsDimensions
sin( [radians] ) Any Dimensionlesscos( [radians] ) Any Dimensionlesstan( [radians] ) Any ** Dimensionlessasin( [ ] ) -1 x 1 Angleacos( [ ] ) -1 x 1 Angleatan( [ ] ) Any Angleatan2( [a], [a] ) Any Angleexp( [ ] ) Any Dimensionlessloge( [ ] ) 0 < x Dimensionlesslog10( [ ] ) 0 < x Dimensionlessabs( [a] ) Any [x]sqrt( [a] ) 0 x [x]^0.5step( [ ] ) * Any Dimensionless
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
CEL
Use
min( [a], [a] ) Any [x]max( [a], [a] ) Any [x]
Function OperandsValues
ResultsDimensions140 CEL Fundamentals CFX-5.5.1
constants
The Expression Editor provides the following useful constants fordeveloping expressions using CEL.
of Offset Temperature
When using temperature values in expressions it is generally safer toonly use units of [K]. When units are used that posses an offsettemperature scale are used (e.g. [C]), they are converted internally to[K]. When a term is specified with a simple temperature unit (to thepower of unity), then any units conversion will include the offsetbetween temperature scales. However, in all other cases the offset isignored since this is usually the most appropriate behaviour. Youshould therefore take care when specifying an expression involvingnon-unit powers of temperature. For example, each of the expressionsbelow is equivalent:
Temperature = 30 [C]Temperature = 303.15 [K]Temperature = 0 [C] + 30 [K]Temperature = 273.15 [K] + 30 [K]
*step(x) is 0 for negative x, 1 for positive x and 0.5 for x=0.** note that tan(x) is undefined for npi/2 where n=1, 3, 5 .. .
Constant Units Description
e Dimensionless Constant: 2.7182818
g m s^-2 Acceleration due to gravity: 9.8066502
pi Dimensionless Constant: 3.1415927
R J mol^-1 K^-1 Universal Gas Constant: 8314.5
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
These are only equivalent because all units are to the power of unityand units other than [K] appear no more than once in each expression.The following expression will not produce the expected result:
Temperature = 0 [C] + 30 [C]
Usi141 CEL Fundamentals CFX-5.5.1
This is equivalent to 576.30 [K], since each value is converted to [K]and then summed. The two expression below are equivalent (asexpected) because the offset in scales is ignored for non-unit powersof temperature:
Specific Heat = 4200 [J kg^-1 C^-1]Specific Heat = 4200 [J kg^-1 K^-1]
ng ExpressionsThe interaction with CEL consists of two phases:
a definition phase, and,
a use phase.
The definition phase consists of creating a set of values andexpressions of valid syntax. The purpose of the Expression Editor is tohelp you to do this.
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
CEL ExamplesIn addition to the examples presented below, the following links to theCFX-5 Tutorials contain examples of creating CEL expressions in yourmodel:
Exa142 CEL Examples CFX-5.5.1
Creating an Expression for Temperature Dependent Viscosity(p. 121 in CFX-5 Tutorials).
Expression Method for the Inlet Velocity Profile (p. 294 inCFX-5 Tutorials).
Creating an Expression for Shear Rate Dependent Viscosity(p. 354 in CFX-5 Tutorials).
mple 1: Reynolds Number Dependent ViscosityIn this example it is assumed that some of the fluid properties, includingthe dynamic viscosity, are not known. However the Reynolds number,inlet velocity and a length scale are known. The flow is compressibleand therefore the density is variable.
Given this information it is possible to calculate the fluid dynamicviscosity based on the Reynolds number. The Reynolds number isgiven by:
where is density, U a velocity scale, L a length scale and thedynamic viscosity. The velocity scale is taken as the inlet velocity, thelength scale as the inlet width and the density is calculated as theaverage density over the inlet area.
The LIBRARY section of the CCL (CFX Command Language) fileappears as follows:
LIBRARY :CEL :
EXPRESSIONS :Re = 4.29E6 [ ]Vel = 60 [m s^-1]L=1.044[m]Visc=areaAve(density)@in*Vel*L/Re
Re UL-----------=
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
ENDENDMATERIAL : Air Ideal Gas
Option = Pure SubstancePROPERTIES :
Option = Ideal Gas
Exa143 CEL Examples CFX-5.5.1
Molar Mass = 2.896E1 [kg kmol^-1]Dynamic Viscosity = ViscSpecific Heat Capacity = 1.E3 [J kg^-1 K^-1]Thermal Conductivity = 2.52E-2 [W m^-1 K^-1]
ENDEND
END
This shows that four CEL expressions have been created. The firstthree expressions define constant values that are used in the Viscexpression. The Visc expression calculates the dynamic viscositybased on the equation for Reynolds number given above. Within theexpression the function areaAve(density)@in is used to evaluatethe average density at the inlet. Note that this function is supported inthe CFX-5 Solver but is not yet supported in CFX-Build. You musttherefore create this expression by editing a definition file, see Editinga Definition File (p. 75 in CFX-5 Solver and Solver Manager). For alist of CEL functions that are supported in the CFX-5 Solver seeAdditional CEL Functions (p. 91 in CFX-5 Solver and SolverManager). To allow the expression to be created in CFX-Build you cancreate it initially as a constant value, then edit the definition file.
The Visc expression can now be used to replace the value ofDynamic Viscosity in the MATERIAL > PROPERTIES section.
mple 2: Feedback to Control Inlet TemperatureIn this example a feedback loop is used to control the outlettemperature by varying the temperature at an inlet. To illustrate theexample consider the geometry shown below:
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
Side InletFlow = 5 m/sT = 375 oK
MFlT
Temperature Control InletFlow = 1 m/sT = Tcontrol144 CEL Examples CFX-5.5.1
Fluid from a main and a side inlet enter at temperatures of 275 oK and375 oK respectively. The temperature of the fluid entering from the thirdinlet depend on the outlet temperature. When the outlet temperature isgreater than 325 oK, the fluid from the third inlet is set to 275 oK. Whenthe outlet temperature is less than 325 oK, the fluid from the third inletis set to 375 oK. In addition an expression is used to set the dynamicviscosity to be a linear function of temperature.
The LIBRARY section of the CCL (CFX Command Language) fileappears as follows. Note that the the \ character indicates a linecontinuation in CCL.
LIBRARY:MATERIAL: Water at STP Modified
Option = Pure SubstancePROPERTIES:
Option = General FluidDensity = 9.999E2 [kg m^-3]Dynamic Viscosity = VisTSpecific Heat Capacity = 4.21E3 [J kg^-1 K^-1]Thermal Conductivity = 5.69E-1 [W m^-1 K^-1]
END # PROPERTIESEND # MATERIAL Water at STP Modified
CEL:EXPRESSIONS:
Tupper = 375.0 [ K ] # Upper temp.Tlower = 275.0 [ K ] # Lower temp.Visupper = 0.000545 [ N s m^-2 ] # Vis. at TupperVislower = 0.0018 [ N s m^-2 ] # Vis. at TlowerVisT = Vislower+(Visupper-Vislower)*(T-Tlower)/ \
(Tupper-Tlower)# Vis.-Temp. relationship
ain Inletow = 0.5 m/s= 275 oK
Outlet
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
Tm=(Tupper+Tlower)/2Tout=areaAve(Water at STP Modified.T)@outletTcontrol=Tlower*step((Tout-Tm)/1[K]) \
+Tupper*step((Tm-Tout)/1[K])END # EXPRESSIONS
END # CEL145 CEL Examples CFX-5.5.1
END # LIBRARY
The first four expressions, Tupper, Tlower, Visupper andVislower are simply constant values to define temperature andviscosity values. The expression VisT produces a linear function forthe dynamic viscosity taking a value of Visupper at Tupper and avalue of Vislower at Tlower. The expression Tm sets the desiredvalue of the outlet temperature. In this case it is set to a mean value ofthe two inlet temperatures.
Tout calculates the outlet temperature using the areaAve function.Note that this function is supported in the CFX-5 Solver but is not yetsupported in CFX-Build. You must therefore create this expression byediting a definition file, see Editing a Definition File (p. 75 in CFX-5Solver and Solver Manager). For a list of CEL functions that aresupported in the CFX-5 Solver see Additional CEL Functions (p. 91in CFX-5 Solver and Solver Manager). To allow the expression to becreated in CFX-Build you can create it initially as a constant value, thenedit the definition file.
Finally the expression Tcontrol is used to set the temperature of thethird inlet. Two step functions are used so that the temperature is equalto Tlower when Tout-Tm is positive (i.e. the outlet temperature isgreater than Tm), and is equal to Tupper when Tout-Tm is positive.
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp
The Expression EditorThe Expression Editor is an interactive tool accessible through theCFX-Build Main Form Tools menu, allowing you to developexpressions for use within CFX-5. A detailed description of the
Ses146 The Expression Editor CFX-5.5.1
Expression Editor is given in Expression Editor (p. 285 in CFX-BuildBasic Functions).
sion File FunctionsOne important feature in CFX-Build is the use of session file functions.A session file function is one whose function call (including allarguments) is written to the session file for the run, enabling it to bereplayed through CFX-Build to repeat the same sequence ofoperations automatically. Since the session file is an ASCII text file, thiscan be modified with a text editor to enable not just playback of anidentical series of keystrokes, but also to perform a series of studies inwhich one or more parameters varies over a range.
The session file function calls are a strict analogue of the actions youperform on the screen. If you choose Create from the action menu andValue from the object menu, then select the first item and the toggleAdd After, then the session file function call would look like:
expr_ed_create_value("c", "1.234", "inch sec^-1", "usersdescription", "a", "Add After", ierr)
where the first four arguments define the entity to be created, the nextargument (a) is the listbox selection, followed by the toggle setting.The final argument is an error status.
For more information on session files, see Session File (p. 9), PlaySession File (p. 99) and Session File/Journal File (p. 408 inCFX-Build Basic Functions).
Page
Introduction to CFX-Build RetraceMasterContents
MasterIndex
Help OnHelp
CEL Technical DetailsCEL is a byte code compiled language. Compiled languages, such asFORTRAN, rely on a translation program to convert them into thenative machine language of the host platform. Interpreted languages147 CEL Technical Details CFX-5.5.1
are of two types: the fully interpreted languages such as the UNIX Cshell, and the byte code compiled languages such as CEL. With bytecodes, host machines are loaded with a client program (written in acompiled language and compiled for that machine architecture) whichinterprets the byte stream. The advantage of the byte code is that theycan be the same on all host platforms, obviating the need for platformdependent codes.
Since the byte codes are interpreted, there is no need to re-linkexecutable programs to perform a different calculation. Furthermore,many of the problems encountered by writing and linking in separateroutines, for instance in C or FORTRAN, are averted, and the timetaken to set up and debug complicated problems reducedconsiderably.
The link between CEL and the CFX-5 Solver is accomplished throughan internal program called genicode. Genicode generates intermediatecode from your CEL definitions and writes to a file which is theninterpreted by the CFX-5 Solver during the solution process.
Introduction to CFX-Build
Page
RetraceMasterContents
MasterIndex
Help OnHelp148 CEL Technical Details CFX-5.5.1
CFX ExpressionLanguageIntroduction to CFX Expression Language (CEL)CEL FundamentalsHow CEL Interacts with the CFX5 SolverValues and ExpressionsCFX Expression Language StatementsCFX5 System Variables, Built-in Functions and ConstantsUsing Expressions
CEL ExamplesExample 1: Reynolds Number Dependent ViscosityExample 2: Feedback to Control Inlet Temperature
The Expression EditorSession File Functions
CEL Technical Details