17.2.3. Power Syntax Subroutines

17.2.3.1. area(Location, Axis)

real area("Location", "Axis")

Returns the area of a 2D locator. For details, see area.

17.2.3.2. areaAve(Variable, Location, Axis)

real areaAve("Variable", "Location", "Axis")

Returns the area-weighted average of the variable at a 2D locator. For details, see areaAve.

17.2.3.3. areaInt(Variable, Location, Axis)

real areaInt("Variable", "Location", "Axis")

Returns the result of the variable integrated over the 2D location. For details, see areaInt.

17.2.3.4. ave(Variable, Location)

real ave("Variable", "Location")

Returns the arithmetic average of the variable at a location. For details, see ave.

17.2.3.5. calcTurboVariables()

void calcTurboVariables()

Calculates all 'extra' turbo variables. (Works only in turbo mode.)

17.2.3.6. calculate(function,...)

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.

17.2.3.7. calculateUnits(function,...)

string,string calculateUnits(function,...)

Evaluates the named function with the supplied argument list, and returns the value and units.

17.2.3.8. collectTurboInfo()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.9. comfortFactors()

This is an internal subroutine that is used only to initialize report templates.

For details, see Comfort Factors Macro.

17.2.3.10. compressorPerform(Location, Location, Location, Var, Args)

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)

17.2.3.11. compressorPerformTurbo()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.12. copyFile(FromPath, ToPath)

void copyFile("FromPath", "ToPath")

A utility function for copying files.

17.2.3.13. count(Location)

real count("Location")

Returns the number of nodes on the location. For details, see count.

17.2.3.14. countTrue(Expression, Location)

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.

17.2.3.15. cpPolar(Location, Var, Arg, Var, Location, Arg)

This is a special macro; for details, see Cp Polar Plot Macro. For example:

cpPolar("Plane 1", "Y", 0.3, "X", "Inlet", 10000)

17.2.3.16. evaluate(Expression)

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.

17.2.3.17. evaluateInPreferred(Expression)

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.

17.2.3.18. exprExists(Expression)

bool exprExists("Expression")

Returns true if an expression with this name exists; false otherwise.

17.2.3.19. fanNoiseDefault()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.20. fanNoise()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.21. force(Location, Axis)

real force("Location", "Axis")

Returns the force on a 2D locator. For details, see force.

17.2.3.22. forceNorm(Location, Axis)

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.

17.2.3.23. getBladeForceExpr()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.24. getBladeTorqueExpr()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.25. getCCLState()

This is an internal debugging call.

17.2.3.26. getChildrenByCategory(Object Path, Category)

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.

17.2.3.27. getChildren(Object Path, Child Type)

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.

17.2.3.28. getExprOnLocators()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.29. getExprString(Expression)

string getExprString("Expression")

Returns the value and the units of the expression in the form "value units". For example: "100 m".

17.2.3.30. getExprVal(Expression)

real getExprVal("Expression")

Returns only the "value" portion of the expression (units are not included).

17.2.3.31. getObjectName(Object Path)

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.

17.2.3.32. getParameterInfo(Object Path, Parameter Name, Info Type)

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

17.2.3.33. getParameters(Object Path)

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.

17.2.3.34. getTempDirectory()

string getTempDirectory()

Returns the temporary directory path.

17.2.3.35. getType(Object Path)

string getType("Object Path")

Returns the object type.

17.2.3.36. getValue(Object Path, Parameter Name)

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.

17.2.3.36.1. Example
  1. Create a text object called Text 1.

  2. In the Text String box, enter Here is a text string.

  3. Click Apply to create the text object.

  4. In the Command Editor dialog box, enter the following:

    !string = getValue( "/TEXT:Text 1/TEXT ITEM: Text Item 1", "Text String");
    ! print $string;
    
  5. Click Process, and the string will be printed to your terminal window.

The same procedure can be carried out for any object.

17.2.3.37. getViewArea()

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.

17.2.3.38. isCategory(Object Path, Category)

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"; 
! }

17.2.3.39. Length(Location)

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."


17.2.3.40. lengthAve(Variable, Location)

real lengthAve("Variable", "Location")

Returns the length-based average of the variable on the line locator. For details, see lengthAve.

17.2.3.41. lengthInt(Variable, Location)

real lengthInt("Variable", "Location")

Returns the length-based integral of the variable on the line locator. For details, see lengthInt.

17.2.3.42. liquidTurbPerformTurbo()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.43. liquidTurbPerform()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.44. massFlow(Location)

real massFlow("Location")

Returns the mass flow through the 2D locator. For details, see massFlow.

17.2.3.45. massFlowAve(Variable, Location)

real massFlowAve("Variable","Location")

Returns the average value of the variable, weighted by mass flow, through the 2D locator. For details, see massFlowAve.

17.2.3.46. massFlowAveAbs(Variable, Location)

real massFlowAveAbs("Variable","Location")

Returns the average value of the variable, weighted by absolute mass flow, through the 2D locator. For details, see massFlowAveAbs.

17.2.3.47. massFlowInt(Variable, Location)

real massFlowInt("Variable", "Location")

Returns the integral of the variable, weighted by mass flow, over the 2D locator. For details, see massFlowInt.

17.2.3.48. maxVal(Variable, Location)

real maxVal("Variable", "Location")

Returns the maximum value of the variable at the location. For details, see maxVal.

17.2.3.49. minVal(Variable, Location)

real minVal("Variable", "Location")

Returns the minimum value of the variable at the location. For details, see minVal.

17.2.3.50. objectExists(Object Path)

bool objectExists("Object Path")

A return of 1 indicates that the object exists; 0 otherwise.

17.2.3.51. probe(Variable, Location)

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.

17.2.3.52. pumpPerform()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.53. pumpPerformTurbo()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.54. range(Variable, Location)

real,real range("Variable", "Location")

Returns the minimum and maximum values of the variable at the location.

17.2.3.55. reportError(String)

void reportError("String")

Pops up an error dialog box.

17.2.3.56. reportWarning(String)

void reportWarning("String")

Pops up a warning dialog box.

17.2.3.57. showPkgs()

void showPkgs()

Prints to the console a list of packages available that may contain other variables or subroutines in Power Syntax.

17.2.3.58. showSubs(packageName)

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.

17.2.3.59. showVars(packageName)

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.

17.2.3.60. spawnAsyncProcess(command, arguments)

bool spawnAsyncProcess("command", "arguments")

Spawns a forked process. For example:

! spawnAsyncProcess("dir", "c:/");

Displays the contents of c:\ in the console window.

17.2.3.61. sum(Variable, Location)

real sum("Variable", "Location")

Returns the sum of the variable values at each point on the locator. For details, see sum.

17.2.3.62. torque(Location, Axis)

real torque("Location", "Axis")

Returns the computed value of torque at the 2D locator about the specified axis. For details, see torque.

17.2.3.63. turbinePerform()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.64. turbinePerformTurbo()

This is an internal subroutine that is used only to initialize report templates.

17.2.3.65. verboseOn()

bool verboseOn()

Returns 1 or 0 depending if the Perl variable $verbose is set to 1.

17.2.3.66. volume(Location)

real volume("Location")

Returns the volume of a 3D locator. For details, see volume.

17.2.3.67. volumeAve(Variable, Location)

real volumeAve("Variable", "Location")

Returns the average value of a variable over the 3D locator. For details, see volumeAve.

17.2.3.68. volumeInt(Variable, Location)

real volumeInt("Variable", "Location")

Returns the integral of a variable over the 3D locator. For details, see volumeInt.