Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

CFX-Post

Master Contents
CFX-Post

Master Index

Help On Help

Retrace

CFX Command Language


Overview of the CFX Command Language (CCL) p. 164 CCL Syntax (p. 165) Object Creation and Deletion (p. 172) CFX Expression Language (CEL) (p. 173)

Page 163

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Overview of the CFX Command Language (CCL)


The CFX Command Language (CCL) is the internal communication and command language of CFX-Post. It is a simple language that can be used to create objects or perform actions in the Post-processor. All CCL statements can be classified into one of three categories: 1. Object and parameter definitions. 2. Actions. 3. Power Syntax. Object and parameter definitions are discussed in Object Creation and Deletion (p. 172 in CFX-Post). A list of all objects and parameters that can be used in CFX-Post can be found in CCL Details (p. 229 in CFX-Post). CCL actions are commands which perform a specific task (e.g. reading a Session file). These commands are discussed in Command Actions (p. 185 in CFX-Post). CCL supports programming through Power Syntax. This utilises the Perl programming language to allow loops, logic and custom macros (subroutines). Power Syntax allows Perl commands to be embedded into CCL to achieve powerful quantitative Post-processing. Details can be found in Power Syntax (p. 209 in CFX-Post). State and Session files contain object definitions using CCL. In addition Session files can contain CCL action commands. The CCL written to these files can be viewed and modified in a text editor. You can also use a text editor to create your own Session and State files to read into CFX-Post using CCL. Advanced users can interact with CFX-Post directly through CCL by entering it in the Command Editor window (see Command Editor (p. 157 in CFX-Post)) or by running CFX-Post in Line Interface mode (see Line Interface Mode (p. 221 in CFX-Post) for details). Details of the CCL syntax are discussed on the following pages.

Page 164

Overview of the CFX Command Language (CCL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

CCL Syntax
Basic Terminology The following is an example of a CCL object to define an isosurface.
ISOSURFACE: Iso1 Variable = Pressure Value = 15000 [Pa] Colour = 1,0,0 Transparency = 0.5 END

ISOSURFACE is an object type Iso1 is an object name Variable = Pressure is a parameter Variable is a parameter name Pressure is a parameter value If the object type ISOSURFACE does not need a name it is called a singleton object. Only one object of a given singleton type can exist. The Data Hierarchy Data is entered via parameters, these are grouped into objects which are stored in a tree structure.
OBJECT1: object name name1 = value name2 = value END

Objects and parameters may be placed in any order, provided that the information is set prior to being used further down the file. If data is set in one place and modified in another the latter definition overrides the first. In CFX-Post, all object definitions are only one object level deep (i.e. Objects contain parameters, but not other objects).

Page 165

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Simple Syntax Details


The following applies to any line that is not a Power Syntax or Action line, i.e. does not start with a ! or >. Case Sensitivity Everything in the file is sensitive to case. Case sensitivity is not ideal for users typing in many long parameter names, but it is essential for bringing the CFX Expression Language (CEL) into CCL. This is because some names used to define CCL objects (such as Fluids, Materials and Additional Variables) are used to construct corresponding CEL names. Case sensitive CEL names have been in use since CFX-5.2 (e.g. t = time and T = temperature). For simplicity and consistency, we recommend the following convention is used in the standard code and its documentation: singletons and object types use upper case only parameter names, and pre-defined object names, are mixed case. We try to follow the following conventions: (1) Major words start with an upper case letter, while minor words such as prepositions and conjunctions are left in lower case, e.g Mass Flow in (2) case is preserved for familiar names, e.g. for variables k or r, or for abbreviation RNG. user object names conventions are left to the user to choose. CCL Names Definition Names of singletons, types of object, names of objects, and names of parameters all follow the same rules: In simple syntax, a CCL name must be at least one character. This first character must be alphabetic; there may be any number of subsequent characters and these can be alphabetic, numeric, space or tab. The effect of spaces in CCL names is: Spaces appearing before or after a name are not considered to be part of the name.
Page 166

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Single spaces appearing inside a name are significant. Multiple spaces and tabs appearing inside a name are treated as a single space. Indentation Nothing in the file is sensitive to indentation. The indentation will be used, however, when displaying contents of the file for easier reading. End of line comment character The # character is used for this. Any text to the right of this character will be treated as comments. Any characters may be used within comments. Continuation character If a line ends with the character \ the following line will be linked to the existing line. There is no restriction on the number of continuation lines. Named Objects A named object consists of an object type at the start of a line, followed by a : followed by an object name. Subsequent lines may define parameters and child objects associated with this object. The object definition is terminated by the string END on a line by itself. Object names must be unique within the given scope, and the name must not contain an underscore. Singleton Objects A singleton object consists of an object type at the start of a line, followed by a :. Subsequent lines may define parameters and child objects associated with this object. The object definition is terminated by the string END on a line by itself. The difference between a singleton object and a named object is that (after the data has been processed), a singleton can appear just once as the child of a parent object, whereas there may be several instances of a named object of the same type defined with different names.
Page 167

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Parameters A parameter consists of a parameter name at the start of a line followed by an = character followed by a parameter value. A Parameter may belong to many different object types. For example U Velocity = 1.0 [m/s] may belong to an initial value object and U Velocity = 2.0 [m/s] may belong to a boundary condition object. Both refer to the same definition of U velocity in the rules file. Lists Lists are used within the context of parameter values and are comma separated. Parameter values All parameter values are initially handled as data of type String, and should first of all conform to the following definition of allowed String values: String Any characters can be used in a parameter value. String values or other parameter type values are normally unquoted. If any quotes are present, they are considered part of the value. Leading and trailing spaces are ignored. Internal spaces in parameter values are preserved as given, although a given application is free to subsequently assume a space condensation rule when using the data. The characters '$' and '#' have a special meaning. A string beginning with '$' is evaluated as a Power Syntax variable, even if it occurs within a simple syntax statement. This is useful for performing more complex Power Syntax variable manipulation, and then using the result as part of a parameter or object definition. The appearance of '#' anywhere in the CCL file denotes the start of a comment. The characters such as [ ] { } are special only if used in conjunction with $. Following a $, such characters will terminate the preceding Perl variable name.
Page 168

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Other characters that might be special elsewhere in power syntax are escaped automatically when they appear in parameter values. For example, @ % and & are escaped automatically. Parameter values can contain commas, but if the string is processed as a List or part of a List then the commas may be interpreted as separators (see below under List data types). Some examples of valid parameter values using special characters in power syntax are:
Estimated cost = \$500 Title = Run\#1 Sys Command = "echo Starting up Stress solver ; fred.exe &" Pressure = $myArray[4] Option = $myHash{"foo"} Fuel = C${numberCatoms}H${numberHatoms}

Parameter values for data types other than String, will additionally conform to one of the following definitions. String List A list of string items separated by commas. Items in a String List should NOT contain a comma unless contained between parentheses. One exception can be made if the String List to be is interpreted as a Real List (see below). Otherwise each item in the String List follows the same rules as String data. Example: Integer Sequence of digits containing no spaces or commas. If a real is specified when an integer is needed the real is rounded to the nearest integer. Integer List List of integers, comma separated.
names

= one, two, three, four

Page 169

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Real A single precision real number which may be specified in integer, floating point or scientific format, followed optionally by a dimension. Units use the same syntax as CEL. Expressions are allowed to include commas inside function call argument lists. Example usage:
a a a A real a a = 12.24 = 1.224E01 = 12.24 [m s^-1] may also be specified as an expression such as = myvel^2 + b = max(b,2.0)

Real List List of reals, comma separated. Note that all items in the list must have the same dimensions. Those items which are expressions, are allowed to include commas inside function call argument lists, and the enclosed commas will be ignored when the list is parsed into individual items. Example usage:
a = 1.0 [m/s], 2.0 [m/s], 3.0 [m/s], 2.0*myvel, 4.0 [cm/s]

The list syntax 5*2.0 used in CFX-Build to represent 5 entries of the value 2.0 is not supported within CCL and hence within CFX-Post. In CFX-Build the data is expanded prior to being written to the CCL file. Logical Several forms are acceptable: YES or TRUE or 1 or ON are all equivalent; NO or FALSE or 0 or OFF are all equivalent; initial letter variants Y, T, N, F are accepted (O is not accepted (for On/Off); all case variants are accepted. The preferred form, recommended for GUI output files and for user documentation is, Yes/No. Logical strings are also case insensitive (YeS, nO) Logical List List of Logicals, comma separated.

Page 170

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Escape character The \ character to be used as an escape character, for example to allow $ or # to be used in strings.

Page 171

CCL Syntax

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Object Creation and Deletion


You can create objects in CFX-Post by entering the CCL definition of the object into the Command Editor window, or by reading the object definition from a Session or State file. The object will be created and any associated graphics shown in the viewer. For a list of valid CCL objects see CCL Details (p. 229 in CFX-Post). You can modify an existing object by entering the object definition with the modified parameter settings into the Command Editor window. Only those parameters which are to be changed need to be entered. All other parameters will remain unchanged. There may be a significant degree of interaction between objects in CFX-Post. For example, a vector plot may depend on the location of an underlying plane, or an isosurface may depend on the definition of a CEL expression. If changes to one object affect other objects, the other objects will be updated automatically. To delete an object, type >delete <ObjectName>. If you delete an object that is used by other objects, warnings will result, but the object will still be deleted.

Page 172

Object Creation and Deletion

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

CFX Expression Language (CEL)


The CFX Expression Language (CEL) is integrated into CFX-Post. You can use an expression defined with CEL in place of any number in CFX-Post. Within the post-processor you can: Create new expressions. Set any numeric parameter in a CFX-Post object based on an expression (and the object will update if the expression result changes). Create user-defined variables from expressions. Directly use the post-processor quantitative functions in an expression. Specify units as part of an expression. You cannot (yet): Automatically read CEL expressions from pre-processing set-up in the results file. All expressions in the post-processor are defined in the EXPRESSIONS singleton object. Each expression is a simple name = expression statement within that object. New expressions are added by defining new parameters within the expressions object (the EXPRESSIONS object is special, in that it does not have a predefined list of valid parameters). Important: Since Power Syntax uses Perl mathematical operators, you should exercise caution when combining CEL with Power Syntax expressions. For example, in CEL, 2 2 is represented as 2^2, but in Perl, would be written 2**2. If you are unsure about the validity of an operator in Perl, please consult a Perl reference guide.

Page 173

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

CEL Functions, Constants and System Variables


Quantitative Functions in CEL The quantitative functions available from the Function Calculator in the CFX-Post GUI are integrated into CEL and can be used in any expression. The general syntax used for these functions in CEL is:
[<Fluid>.]<function>[_<Axis>[_<Coord Frame>]]([<Expression>])@<Location>

where terms in [ ] can be optional depending on the function used and terms in < > should be replaced with the required entry. Some examples are given below.
area()@inlet area_x()@inlet areaAve(Pressure - 10000 [Pa])@outlet Water at RTP.force_z()@Default

[<Fluid>.] is always an optional argument which will default to all fluids in the domain if not specified. For multiphase results it can be set to any single fluid in the domain by entering the fluid name followed by a period before the function definition. See the table below for a list of functions that accept this option. <function> specifies the quantitative function to evaluate. See the table below for a list of functions. [_<Axis>_[<Coord Frame>]] can be an optional or a required argument depending on the function evaluated. [_<Axis>_[<Coord Frame>]] can be replaced with _x, _y or _z (lower case only) to specify the default X, Y and Z axis and should follow the function name. You can use an axis from a different coordinate frame by following the axis specification with the name of the Coordinate Frame, e.g. _x_CoordFrame1. ([<Expression>]) is a required argument for some functions and should be left blank as in the above area example (i.e. ())for other function (see the table below for a list). Any valid expression or variable can be used. You can also use a variable as part of an expression as shown in the above areaAve example. @<Location> is required for all quantitative functions.

Page 174

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Consistent units must be maintained when adding, subtracting or comparing values. The following table contains the quantitative function available for use with CEL. The operation performed by the function and the arguments accepted are also shown. A detailed description of the calculation performed by each function is not provided here, see Function Selection (p. 128) for this information.
Function Name area (p. 176) Operation Area projected to axis (no axis specication returns total area) Area-weighted average Area-weighted integral Arithmetic average Number of calculation points Force on a surface in the specied direction Length normalised force on a curve in the specied direction Length of a curve Length-weighted average Length-weighted integration Total mass ow Mass-weighted average Mass-weighted integral Maximum Value Required Arguments @<Location> Optional Arguments _<Axis>

areaAve (p. 176) areaInt (p. 177) ave (p. 177) count (p. 177) force (p. 177) forceNorm (p. 178)

<Expression> @<Location> <Expression> <Location> <Expression> @<Location> @<Location> _<Axis> @<Location> _<Axis> @<Location> @<Location> <Expression> @<Location> <Expression> @<Location> @<Location> <Expression> @<Location> <Expression> @<Location> <Expression> @<Location>

_<Axis> _<Axis>

<Fluid>. <Fluid>.

length (p. 178) lengthAve (p. 178) lengthInt (p. 179) massFlow (p. 179) massFlowAve (p. 179) massFlowInt (p. 179) maxVal (p. 179)

<Fluid>. <Fluid>. <Fluid>.

Page 175

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents Operation Minimum Value Value at a point

Master Index

Help On Help Required Arguments

Retrace Optional Arguments

Function Name minVal (p. 179) probe (p. 180) sum (p. 180) torque (p. 180) volume (p. 180) volumeAve (p. 180) volumeInt (p. 180)

<Expression> @<Location> <Expression> @<Location> <Expression> @<Location> _<Axis> @<Location> @<Location> <Expression> @<Location> <Expression> @<Location> <Fluid>.

Sum over the calculation points Torque on a surface about the specied axis Volume of a 3-D location Volume-weighted average Volume-weighted integral

area
area[_<Axis>]()@<Location>

An error is raised if the location specified is not a 2-D Object. If an axis is not specified the total area of the location is calculated. See area (p. 129) for a function description. Example: area()@Isosurface1 calculates the total area of the location Isosurface1. Example: area_y()@Isosurface1 calculates the projected area of Isosurface1 onto a plane normal to the Y-axis. areaAve
areaAve[_<Axis>](<Expression>)@<Location>

An error is raised if the location specified is not a 2-D Object. See areaAve (p. 130) for a function description. Example: (Pressure - 1[bar])/ (0.5*Density*(areaAve(Velocity)@inlet)^2) calculates the Pressure coefficient Cp. You can create an expression using this, and then create a User Variable using the expression. The User Variable can then be plotted on objects like any other variable.
Page 176

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

areaInt
areaInt[_<Axis>](<Expression>)@<Location>

An error is raised if the location specified is not a 2-D Object. Axis is optional and if not specified the integration is performed over the total face area. If axis is specified, then the integration is performed over the projected face area. See areaInt (p. 130) for a function description.

Example: areaInt_y_Frame2(Pressure)@boundary1 calculates the pressure force acting in the y-direction of the coordinate frame Frame2 on the locator boundary1. This differs from a calculation using the force function which calculates the total force on a wall boundary (i.e. viscous forces on the boundary are included). ave
ave(<Expression>)@<Location>

The ave function can be used on Point, 1-D, 2-D and 3-D locations. See ave (p. 131) for a function description. Example: ave(Yplus)@Default calculates the mean Yplus values from each node on the default walls. count
count()@<Location>

The count function is valid for point, 1-D, 2-D and 3-D locations. See count (p. 132) for a function description. Example: count()@Polyline1 returns the number of points on the specified Polyline locator. force
[<Fluid>.]force_<Axis>()@<Location>

Page 177

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Force calculations on boundaries require additional momentum flow data. This can be include in the Results file by adding the Expert Control Parameter output eq flows and setting its value to T. See force (p. 132) for a function description. Example: Water at RTP.force_x()@wall1 returns the total force in the x-direction acting on wall1 due to the fluid Water at RTP. forceNorm
[<Fluid>.]forceNorm_<Axis>()@<Location>

Returns the per unit width force on the specified line in the direction of the specified axis. An error will be raised if the location specified is not one-dimensional. See forceNorm (p. 133) for a function description. Example: forceNorm_y()@Polyline1 calculates the per unit width force in the y-direction on the selected Polyline. length
length()@<Location>

A 1-D location should be specified (specifying a 2-D location will not produce an error, the sum of the edge lengths from the elements in the locator will be returned). Note that when using this function in Power Syntax the leading character should be capitalised to avoid confusion with the Perl internal command length. See length (p. 133 in CFXPost) for a function description. Example: length()@Polyline1 returns the length of the Polyline. lengthAve
lengthAve(<Expression>)@<Location>

A 1-D or 2-D location must be specified. See lengthAve (p. 134) for a function description. Example: lengthAve(T)@Polyline1 calculates the average Temperature on Polyline1 weighted by the distance between each point (T is the System Variable for Temperature).

Page 178

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

lengthInt
lengthInt(<Expression>)@<Location>

A 1-D location must be specified. See lengthInt (p. 134) for a function description. massFlow
[<Fluid>.]massFlow()@<Location>

Computes the mass flow through the specified 2-D location. See massFlow (p. 134) for a function description. Example: Air at STP.massFlow()@DegassingOutlet calculates the mass flow of Air at STP through the selected location. massFlowAve
[<Fluid>.]massFlowAve(<Expression>)@<Location>

An error is raised if the location specified is not 2-D. See massFlowAve (p. 134) for a function description. Example: massFlowAve(Density)@Plane1 calculates the average Density on Plane1 weighted by the mass flow at each point on the location. massFlowInt
[<Fluid>.]massFlowInt(<Expression>)@<Location>

An error is raised if the location specified is not 2-D. See massFlowInt (p. 135) for a function description. maxVal
maxVal(<Expression>)@<Location>

Point, and one, two and three-dimensional locators can be specified. See maxVal (p. 135) for a function description. minVal
minVal(<Expression>)@<Location>

Point, and one, two and three-dimensional locators can be specified. See minVal (p. 135) for a function description.
Page 179

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

probe
probe(<Expression>)@<Location>

Valid only for Point locators, this will return the value of a variable at a given location. See probe (p. 135) for a function description. sum
sum(<Expression>)@<Location>

One, two and three-dimensional locators can be specified. See sum (p. 136) for a function description. torque
[<Fluid>.]torque_<Axis>()@<Location>

An error is raised if the location specified is not 2-D.See torque (p. 136) for a function description. volume
volume()@<Location>

An error is raised if the location specified is not a 3-D Object. See volume (p. 136) for a function description. volumeAve
volumeAve(<Expression>)@<Location>

An error is raised if the location specified is not a 3-D Object. Any variable or valid expression (see CEL Functions, Constants and System Variables (p. 173 in CFX-Post)) can be used as the <Expression> argument. See volumeAve (p. 137) for a function description. volumeInt
volumeInt(<Expression>)@<Location>

A 3-D Object must be selected as the location. See volumeInt (p. 137) for a function description. Example: volumeInt(Density)@StaticMixer calculates the total fluid mass in the domain StaticMixer.

Page 180

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

CEL Standard Functions The following is a list of standard functions that are available in CFX-Post. In the table below:
Note: [ ] denotes a dimensionless quantity. [a] denotes any dimensions of first operand. Result [] [] [] [radian] [radian] [radian] [radian] [] [] [] [a] [a^0.5] [] [a] [a] Function sin cos tan asin acos atan atan2 exp loge log10 abs sqrt step min max Operands ([radian]) ([radian]) ([radian]) ([ ]) ([ ]) ([ ]) ([ ],[ ])) ([ ]) ([ ]) ([ ]) ([a]) ([a]) ([ ]) ([a],[a]) ([a],[a])

CEL Constants The following predefined constants can be used within CEL expressions.
Constant e g pi
Page 181

Units <none> m^2 s^-2 <none>

Description Constant : 2.7182817 Accn. due to gravity : 9.806 Constant : 3.1415927


CFX-5.5.1

CFX Expression Language (CEL)

CFX-Post Advanced

Master Contents Constant R

Master Index Units m^2 s^-2 K^-1

Help On Help

Retrace

Description Universal Gas Constant : 8314.5

CEL System Variables The following System Variables are available for use with CEL when defining expressions:
Name x y z r theta t u v w p vf ke ed eddy viscosity T sstrnr density viscosity Cp cond enthalpy
Page 182

Meaning Direction 1 in Reference Coordinate Frame Direction 2 in Reference Coordinate Frame Direction 3 in Reference Coordinate Frame Radial spatial location, r = Angle, arctan(y/x) Time Velocity in the x coordinate direction Velocity in the y coordinate direction Velocity in the z coordinate direction (absolute) Pressure Volume Fraction Turbulent kinetic energy Turbulent eddy dissipation Eddy Viscosity Temperature Shear strain rate Density Dynamic Viscosity Specic Heat Capacity at Constant Pressure Thermal Conductivity Specic Enthalpy
CFX-5.5.1

x +y

CFX Expression Language (CEL)

CFX-Post Advanced

Master Contents Name beta speedofsound subdomain mean diameter deneff

Master Index

Help On Help Meaning

Retrace

Thermal Expansivity Local speed of sound in uid Subdomain variable (1.0 in Subdomain, 0.0 elsewhere) Mean Diameter Effective Density Additional Variable name

AV name

The r, theta t and subdomain values in the above table can only be used if the variables associated with them are output from the solver. r and theta are not calculated by CFX-Post from x, y, z but expressions to do so can be defined. subdomain is not usually defined in CFX-Post. Where appropriate, fluid or component names may be prefixed to these variables i.e. Water at STP.v.

Page 183

CFX Expression Language (CEL)

CFX-5.5.1

CFX-Post Advanced

Master Contents

Master Index

Help On Help

Retrace

Page 184

CFX Expression Language (CEL)

CFX-5.5.1

You might also like