Expression is a powerful tool in CFX. It is based on CFX expression language (CEL). CEL can be used to:

- Define material properties that depend on other variables.
- Specify complex boundary conditions.
- Add terms to the solved equations.
- Defining an expression for evaluation of derived variable in CFD Post, e.g.
*drag coefficient *

CEL can be used to define values and expressions. values can be dimensional or non dimensional. For example you can assign a constant:

**a = 3.14 **

Or you can assign a number with units. For example velocity has units of meter per second. In CEL, you must enclose units in square brackets, and give space between two units. For power use ^ sign and -ve sign for the unit in denominator. See example below.

**Velocity = 5 [m s^-1] **

Here I have created expressions for different requirements. They are created from variables and also from other expressions. angle of attack is set to 10 deg. Velocity in x and y direction are set as Uinf times the cos and sin components respectively. similar drag and lift coefficients are defined from X and Y component of force receptively. This is part of airfoil simulation in CFX (cfx file can be provided on request)

Here I have placed the some common variables with units, taken from CFX-Pre user guide.

Here I am giving one example of using expression to create expressions for density and viscosity. These material properties will be used to define the new custom material. This is part of online course at udemy **CFD course**

In order to define expression, go to tree outline. And then go to **Expressions, Functions and Variables **and then right click on Expressions and click on insert to insert new expression.

This will open a dialouge box and put the name for expression.

Put name as vis (shortcut for viscosity) and click on OK.

This will open a new dialogue box for entering expression details.

In second half of above dialogue box (Details of **vis**), type the value of **vis** as 0.002, press space-bar and put square bracket. Inside square bracket put units for viscosity in SI units. In SI system, units of viscosity *we are talking about dynamics viscosity) are **Pa.S** (or**N s/m**^{2}). So type Pa (P in capital letters and a in small letters, as defined by CFX internal working) and press space-bar and type s (small letter). You will notice that the units are changed to italic fonts, which is indication that entered units are acceptable by CFX syntax.

Now the dialogue box for **vis expression** will look as follows:

In above half the expression name is shown along with the value and units. In the second half you see the definition of expression for viscosity. If you want to change any thing, you can edit it and click on apply to redefine your expression.

Similarly define the expression for the density (den) as shown below:

Notice that the units of density are **kg**/**m**^{3}. First enter (inside square brackets) kg, in small letters, then press space-bar, and now enter m followed by ^ sign and finally type -3 and close square bracket and click on apply. Again you can notice that units are in italic fonts, which is indication that syntax is correct. Please note that if you have entered wrong units, CFX will not warn you. It only warns you, if the syntax is wrong.

You can watch video here for defining expression of density and viscosity in CFX-Pre: Defining expressions in CFX

Subscribe to our course on ICEM CFD Hexa and CFX at udemy by clicking link CFD course

If you have any query please feel free to ask or email at farcfd@gmail.com.