CFX 5.5
? 2001AEA Technology
4-1
CFX Expression Language (CEL)
CFX 5.5
? 2001AEA Technology
4-2
Introduction
? CEL - CFX Expression Language.
CEL is an interpreted,declarative language which enables users to
enhance simulations without recourse to external fortran routines.
It uses mathematical expressions for physical quantities as
opposed to using fixed values.
Access to CFX-5 internal variables (including solution variables).
Can use built-in mathematical functions.
Can be used on any form which has an Expression Editor button.
Examples to use CEL:
> Complex boundary conditions.
> Variable material properties.
> Variable initial conditions.
> Extra terms to the governing equations.
CFX 5.5
? 2001AEA Technology
4-3
Values and Expressions
? CEL can be used to generate both values and expressions.
Values.
> Values are constants.
> Different units for dimensional values are available from the
Select Units list.
Expressions.
> Expressions are mathematical combinations of predefined
values,system variables (e.g,u,v,w,..),numerical constants,
and other predefined expressions.
> Can use in-line units when creating expression.
* e.g.,x + 5 [m].
? Expressions and values may be entered directly into physical quantity
forms,or they may be developed in the expression editor and referred
to by name.
CFX 5.5
? 2001AEA Technology
4-4
Rules for Expressions
? Rules for Expressions
Variables and expressions are case sensitive
Always use brackets to specify the order of operations
For multiple line expression,use operators to separate each line
> e.g.,A+ B/C
A+
B
/C
Expressions must be dimensionally consistent for addition and
subtraction operations
> 1.0[mm] + 0.45[yds] (valid)
> 2.5[s m^-1] - (3.0[m s^-1])^-1 (valid)
> 1.0[mm] + 0.3[kg] (invalid)
CFX 5.5
? 2001AEA Technology
4-5
Rules for Expressions
? Rules for Expressions
Fractional and decimal powers are allowed
> a^1/2 (valid)
> 1.0^0.5 (valid)
The units of expressions are not declared,They are the result of
units in the expression
> (a[kg m^-3] * b[m s^-1]) has units of [kg m^-2 s^-1]
CFX 5.5
? 2001AEA Technology
4-6
System Variables
CFX 5.5
? 2001AEA Technology
4-7
System Variable Prefixes
? System variable prefixes
In order to distinguish system variables of different components
and fluids,prefixes are used
Example:
> air.density
> air.viscosity
> air.carbondioxide.mf - the mass fraction of carbon dioxide in
air
CFX 5.5
? 2001AEA Technology
4-8
Available and Unavailable System Variables
? Variables are considered,available” or,unavailable”
depending on the current state of the model
CFX 5.5
? 2001AEA Technology
4-9
CEL Operators,Built-in Functions
and Constants
CFX 5.5
? 2001AEA Technology
4-10
Expression Editor
? Expression Editor
Interactive tool for developing and
managing expressions within CFX-Build
Create/Delete/Modify/Read/Write/Calculate
values and expressions
Can list available System Variables and
Functions for use in expressions
Available from many values forms and from
the Tools pull down menu
CFX 5.5
? 2001AEA Technology
4-11
The Calculate Action
? The calculate action is provided to
help verify that expressions are set up
correctly
It evaluates expressions
interactively using the same
routines that will be invoked
during the solver run
? Use the calculate action to evaluate
an expression
? Use the calculate action to create a
plot of expression
CFX 5.5
? 2001AEA Technology
4-12
CEL Example
? The following example shows how to set the viscosity to be a function
of temperature,The viscosity-temperature relation is taken as follows:
Te 10???
CFX 5.5
? 2001AEA Technology
4-13
CEL Example
? Alternatively,a file can be constructed with any text editor and read
into the Expression Editor
? Example,
# CEL CFX-Build 5.4 (PATRAN Version 8.5 )
# Author,cfds
# CreationDate,2000-06-01
# EndComments
C1 = 10,[ K^-1 ] # constant
C2 = 1,[ kg/ms ] # constant
vis = C2*exp(-C1*T) # viscosity
CFX 5.5
? 2001AEA Technology
4-14
CEL Example (B.C.)
The following example shows how to set angular velocity for a rotating wall using the u and v
components
CFX 5.5
? 2001AEA Technology
4-15
Summary
? CEL
Values/Expressions
Rules
System variables,functions and constant
? Examples using CEL