Creating Expressions in Ansys CFX

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. a b

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 (orN s/m2). 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/m3. 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





Mastering Anys CFD – An Affordable Online CFD Course

In this course you will learn how to setup, solve and post process CFD problems of practical important in various CFD codes such as Fluent, CFX, ICEMCFD, Design Modeler, Ansys Meshing and Ansys Workbench.

Course link : CFD Course
This is online on-demand video course with life time access. Which implies once you buy this course, you will get for ever access to this great course. Currently there are 72 video lectures spanning over 7.5 hours. Contents are being on regular basis and you get all new addition in the price you have already paid (9.99 – 24.99 USD)

You will also get all input, output, solved cases and power point slides.

Course fees fluctuates on the as per different marketing programs. But here we are providing you best possible price and we will update coupon codes on regular basis. Here is list of current coupon codes for the month of May 2018.


Here is image of course on



Turbomachinery modeling in Ansys workbench: Axial Turbine or Compressor

Steps : 1. Open workbench and create cell for each program 2

2. Import geometry in designmodeler and create flow path. Export coordinates on blade in turbogrid format 


3.  Create mesh in Turbogrid   


4. Setting boundary conditions and problem setup in CFX-Pre 6   


5. Getting solution in CFX-Solver   


6. Post processing in CFD-Post 



Solver settings for Conjugate Heat Transfer

Conjugate heat transfer (CHT) can be defined as the simulation of solid zone and fluid zone simultaneously . In solid zone we will only solve conduction equation (simplified form of energy equation) and in fluid zone continuity, momentum and energy equation. We can activate body forces due to gravity and buoyancy forces by defining operating density in operating pressure panel and thereby activating natural convection mode. During initial phase of solution due to different behaviour of solid and fluid zones, solution diverges immediately when solved in steady state mode due to buildup of initial transients (they are not real and will have no effect on final solution). Therefore in this blog we have discussed two approaches i.e. transient solution with only one iteration per time step and pseudo transient solver. It is FAQ that what solver settings I should use for any CFD problem including conjugate heat transfer modeling. Even advanced users get confused, let alone the “novice”. This question is even more demanding with inclusion of advanced models such as heat transfer, multiphase flow modeling etc. For current problem Fluent 15.0 is used with two different settings discussed later. In this blog I have tried to clarify different flow schemes for the conjugate heat transfer problem. In this simulation heat transfer from computer chip (producing 75 W) is to be dissipated into the still air via natural convection heat transfer mode. Fins are attached to CPU chip to enhance the heat transfer rate. External air modelled with zero velocity using pressure inlet (zero gauge pressure) and pressure outlet (zero gauge pressure). For the fins, chip and board solid zones are defined. Inter fluid-solid or solid-solid coupling is done via coupled boundary conditions. Chip is modelled as source term to energy equation using volumetric heat generation. First we have tried steady state solver but in vain. After that we have used two settings with similar results with different no of iterations to converge solution. These cases are: 1. PISO coupling scheme with transient solver: Time step was chosen as 10 s arbitrarily and one iteration per time step. It is found lower time steps induces unsteadiness and due to that solution does not converge. It is recommended to initially use 1000s as time step to make the solution stabilize. 2. Coupled pressure based solver with pseudo transient solver: Time step method is user defined with 10s time step for fluid and 1000s for solid. Conclusions: 1. Solution converges faster (10x sometimes) with Pseudo transient. 2. Overall results are same.

Recommendation: For steady state coupled problems always use pseudo transient Solver with coupled pressure based solver 

heatsink Setup Output1 mesh a001 CAD model Solver settings for transient + Piso b photo hosting a Solver settings for transient solver Solver settings for Coupled pressure based + pseudo transient c d Results for Pseudo transient and coupled pressure solver contour1 contour2 contour3 contour4 Results for transient solver with PISO scheme. trasient 1 jpg Kostenlos Bilder hochladen trasient 2jpg trasient 3jpg trasient 34pg

Simulation of Centrifugal Compressor in Ansys Workbench

Here I am going to explain the method to simulate the centrifugal compressor, the long awaited blog. Main attraction of this blog is to demonstrate the technique to handle the CAD model with blades and hub only imported as IGES/Step or parasolid file. Usually people convert the IGES or parasolid file in turbogrid (*.tur) format and get high quality hexa mesh in Turbogrid. The main problem with this approach:

1. Consistency problem. Different people may get different blade shape, casing and hub profile.

2. No easy / straight forward approach. I have been using Gambit to get coordinates. And some also use Gridgen or other softwares long with excel to do this work. While working in Gambit there are number of times when files get corrupted and some times Gambit crashes and wasting efforts of days (sometimes even weeks). There is also problem of persistence e.g. If some one want to change the number of profiles along span from two to five or ten. In Gambit or Gridgen it means starting from scratch each time.

3. Gambit and gridgen do not support extensive geometric operations while designmodeler provides CAD like environment.

Brief steps are :

1. Open workbench and drag the geometry icon into main window and open the designmodeler.

2. Apply operations in blade modeler mode of DM like creating flow passage and export points.

3. Open Turbogrid and use ATM optimized approach for best quality mesh.

4. Process mesh in CFX-Pre like setting up solver parameters, boundary conditions and turbulence model.

5. Start solver and solve problem

6. Post process results. Continue reading

Free webinar on “Turbomachinery CFD in Ansys Workbench”

Recently we have published a blog on “Turbomachinery CFD using Ansys Workbench” and now we are arranging free webinar on the same topic

Following topics will be covered:

1. Working with Ansys workbench

2. Importing and cleanup geometry in designmodeler (DM).

3. Creating blade profiles for turbogrid in Blade editor mode of DM

4. Creation of high quality hexa mesh using ATM optimized topology in Turbogrid

5. Importing mesh into CFX-Pre and setting up problem

6. Solving simulation and post processing results in CFD solver and CFX post respectively.

7. Some discussion on compressor maps and how to get one from CFD simulation

For Registration: Please fill the Registration form given below or fill contact us form here

Date and time : 1100 hrs (Pakistan Standard Time), August 31, 2014

Venue :