real areaAve("Variable", "Location", "Axis")
Returns the area-weighted average of the variable at a 2D locator. For details, see areaAve.
real areaInt("Variable", "Location", "Axis")
Returns the result of the variable integrated over the 2D location. For details, see areaInt.
real ave("Variable", "Location")
Returns the arithmetic average of the variable at a location. For details, see ave.
real calculate(function,...)
Evaluates the named function with the supplied argument list, and returns the float result. The function name is a required argument, which can be followed by a variable length list of arguments.
string,string calculateUnits(function,...)
Evaluates the named function with the supplied argument list, and returns the value and units.
This is an internal subroutine that is used only to initialize report templates.
For details, see Comfort Factors Macro.
This is a special macro; for details, see Gas Compressor Performance Macro. For example:
compressorPerform("Inlet", "Outlet", "Blade", "X", 600, 0.03, 10, 1.2)
real countTrue("Expression", "Location")
Returns the number of mesh nodes on the specified region that
evaluate to "true", where true means greater than or
equal to 0.5. "Expression"
should contain
one of the logical operators =, >, <, <=, or >=. The countTrue
function is valid for 1D, 2D, and 3D locations. For details, see countTrue.
This is a special macro; for details, see Cp Polar Plot Macro. For example:
cpPolar("Plane 1", "Y", 0.3, "X", "Inlet", 10000)
real,string evaluate("Expression")
Returns the value of the expression and the units. Only one
expression can be evaluated each time the subroutine is executed.
The main advantage of using evaluate
is that
it takes any CEL expression. This means that you do not have to learn
any other quantitative power syntax routines described in this section.
Also, evaluate will return the result units in addition to the value.
An example is:
evaluate("areaAve(Velocity v)\@Location 1")
In this case, another subroutine is evaluated. The evaluate
command takes an any expression as the argument,
or more precisely, any expression that resolves to a quantity. This
means that you cannot use:
"2*Pressure"
but you can use:
"2*minVal(Pressure)\@locator 1"
or
"100 [m]"
This is simply an alternative way of typing:
! $myVal = 2 * minVal("Pressure", "Location");
The reason that the @
is escaped
calling evaluate()
is to avoid Perl treating
it as a special character.
real,string evaluateInPreferred("Expression")
Returns the value of the expression in your preferred units. Preferred units are the units of the data that CFD-Post uses when information is displayed to you and are the default units when you enter information (as contrasted with units of the data that are stored in results files). Use the Edit > Options > Common > Units dialog box to set your preferred units.
real forceNorm("Location", "Axis")
Returns the per unit width force on a line in the direction of the specified axis. It is available only for a polyline created by intersecting a locator on a boundary. For details, see forceNorm.
string getChildrenByCategory("Object Path", "Category")
Returns the children of an object that belong to the specified
category in a comma-separated list. Each object type (for example,
a PLANE) can have multiple categories associated with it such as "geometry",
"surface", and so on). Categories are specified in <CFXROOT>
/etc/CFXPreRules.ccl
and <CFXROOT>
/etc/CFXPostRules.ccl.
For example, to get a comma-separated list of all surfaces in a state at the top level (that is, not sub-objects of other objects):
! $surfaces = getChildrenByCategory("/", "surface" );
Use 'split ","
' to convert the string
into an array of strings.
string getChildren("Object Path", "Child Type")
Returns the children of an object in a comma-separated list.
If Child Type
is not an empty string, this
subroutine return only children of the specified type.
string getExprString("Expression")
Returns the value and the units of the expression in the form "value units". For example: "100 m".
real getExprVal("Expression")
Returns only the "value" portion of the expression (units are not included).
string getObjectName("Object Path")
Extracts the name of an object from its full path. For example:
!string = getObjectName("/USER SURFACE:User Surface 1")
returns "User Surface 1". This is the form needed for evaluating a CEL expression.
string getParameterInfo("Object Path", "Parameter Name", "Info Type")
Returns the requested information for a parameter of an object. Object Path
returns the name or path of an object; "/"
or an empty string specifies the root.Parameter Name
returns the name of the parameter. Info Type
returns the type of data requested; this can be one of "type", "value",
"default value", or "allowed values". For example:
! $info = getParameterInfo("/USER DEFINED/POINT:Point 1", "Symbol Size", "default value"); ! print "getParameterInfo returned=$info\n";
prints:
getParameterInfo returned=2.5
string getParameters("Object Path")
Returns the parameters of an object in a comma-separated list.
Use 'split ","
' to convert the string into
an array of strings.
string getValue("Object Path", "Parameter Name")
Takes a CCL object and parameter name and returns the value of the parameter.
Returns the value stored in Parameter Name
.
Create a text object called Text 1.
In the Text String box, enter
Here is a text string
.Click
to create the text object.In the Command Editor dialog box, enter the following:
!string = getValue( "/TEXT:Text 1/TEXT ITEM: Text Item 1", "Text String"); ! print $string;
Click Process, and the string will be printed to your terminal window.
The same procedure can be carried out for any object.
string,string getViewArea()
Calculates the area of the scene projected in the view direction. Returns the area and the units in an array of strings.
bool isCategory("Object Path", "Category")
A return of 1 indicates that the object matches the passed category;
0 otherwise. Categories are specified in <CFXROOT>
/etc/CFXPreRules.ccl
and <CFXROOT>
/etc/CFXPostRules.ccl.
For example, the following prints "Plane 1 is a surface":
! if( isCategory( "Plane 1", "surface" )) { ! print "Plane 1 is a surface\n"; ! }
real Length("Location")
Returns the length of a line locator. For details, see length.
Note: While using this function in Power Syntax the leading character is capitalized to avoid confusion with the Perl internal command "length."
real lengthAve("Variable", "Location")
Returns the length-based average of the variable on the line locator. For details, see lengthAve.
real lengthInt("Variable", "Location")
Returns the length-based integral of the variable on the line locator. For details, see lengthInt.
real massFlowAve("Variable","Location")
Returns the average value of the variable, weighted by mass flow, through the 2D locator. For details, see massFlowAve.
real massFlowAveAbs("Variable","Location")
Returns the average value of the variable, weighted by absolute mass flow, through the 2D locator. For details, see massFlowAveAbs.
real massFlowInt("Variable", "Location")
Returns the integral of the variable, weighted by mass flow, over the 2D locator. For details, see massFlowInt.
real maxVal("Variable", "Location")
Returns the maximum value of the variable at the location. For details, see maxVal.
real minVal("Variable", "Location")
Returns the minimum value of the variable at the location. For details, see minVal.
real probe("Variable", "Location")
Important: This calculation should only be performed for point locators described by single points. Incorrect solutions will be produced for multiple point locators.
Returns the value of the variable at the point locator. For details, see probe.
real,real range("Variable", "Location")
Returns the minimum and maximum values of the variable at the location.
void showPkgs()
Prints to the console a list of packages available that may contain other variables or subroutines in Power Syntax.
void showSubs("packageName")
Prints to the console a list of the subroutines available in the specified package. If no package is specified, CFD-Post is used by default.
void showVars("packageName")
Prints to the console a list of the Power Syntax variables and their current value defined in the specified package. If no package is specified, CFD-Post is used by default.
bool spawnAsyncProcess("command", "arguments")
Spawns a forked process. For example:
! spawnAsyncProcess("dir", "c:/");
Displays the contents of c:\ in the console window.
real sum("Variable", "Location")
Returns the sum of the variable values at each point on the locator. For details, see sum.
real torque("Location", "Axis")
Returns the computed value of torque at the 2D locator about the specified axis. For details, see torque.
real volumeAve("Variable", "Location")
Returns the average value of a variable over the 3D locator. For details, see volumeAve.
real volumeInt("Variable", "Location")
Returns the integral of a variable over the 3D locator. For details, see volumeInt.