CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   density, viscosity expressions CFX (

selvam2487 July 23, 2013 13:25

density, viscosity expressions CFX
1 Attachment(s)
Hello Friends,

I wanted to give expressions for temperature dependent fluid properties (density, viscosity etc.) for T junction flows in CFX. I fitted the trendline and got polynomial equations for each fluid property as function of temperature in Excel. But when I substituted those equations in CFX and tried seeing the plot, it is completely wrong from what is shown in my excel sheet. I could not understand how this happens. I am attaching the excel sheet along with this post. Kindly guide me as to what is happening/ what is the mistake I am doing?

Thanks in advance.


ghorrocks July 23, 2013 16:58

And what do you get in CFX?

Are you sure you have CFX using the correct units?

evcelica July 23, 2013 18:22

You are obviously not using enough decimals. format trendline and pick the equation and format it as text. you will get much more digits.

selvam2487 July 25, 2013 08:45

expressions in cfx
1 Attachment(s)
Dear Glenn,

I tried again using the modified expressions in cfx. But it is not working. I am attaching a picture which shows the polynomial equations obtained from excel and implementing it in cfx. The results are drastically different. Visocsity becomes negative if I implement it in CFX. I don't understand how it works. Please give me suggestions as to what I am doing wrong.

singer1812 July 25, 2013 11:54

I think something is wrong with your trendline eqn. Type that exact equation in a cell with the temp cells as the input.

I bet it doesnt match your actual data.

evcelica July 25, 2013 13:49

Wasn't I clear enough the first time?

YOU NEED TO USE MORE THAN 1 DIGIT when you use higher order polynomials:

Use This function for viscosity:
5.41924E-12x4 - 8.34074E-09x3 + 4.82854E-06x2 - 0.001248669x + 0.122192878
Not this:
5E-12x4 - 8E-09x3 + 5E-06x2 - 0.0012x + 0.1222

Use this for density:
5.36279E-06x3 - 0.008336901x2 + 3.261356376x + 624.9598808

Jan Smedseng July 26, 2013 12:12

Importing MS Excel data in ANSYS CFX

I try to give you another solution.

If you have an array of values in MS Excel, you should save them in a CSV File (comma separated values).
The values of the columns are separated by a comma - values of different rows are separated by the line number.

You can import such a file in ANSYS CFX by defining a user function. Its not so complicated: CFX Pre >> "Expressions, Functions and Variables" >> "User Functions" *right click* "Insert" >> "User Function".

Now you have to define the units of the argument and the returned value of this function. If you want to calculate the density depending on temperature, the argument units are C or K (in CFX [C] or[K]).
The result units are kg/m (in CFX [kg/m^3]).

Now keep on with a right click in the large listbox and choose "import data".

Select the CSV File (just selecting, no double click), you exported in MS Excel (you have to change the selection filter to |all files *.*|).

In column selection you have to specify the column number of the argument- and result values. Now, click Ok!

In an expression, you can use the return value of this function by typing the name of the user function followed by brackets with the variablename of the depending value:

Expression_Density = User Function1(T)

In this example, the Function you defined is called "User Function1".
T is the short name of the temperature in CFX.

There are two disadvantages: You have no access to this data in CFD Post and you have no continuous function.
But the advantage is, that you got clipped, linear interpolated values of the function. A polynom of an high order may fit the values of the function inside the domain of its definition quite well. Exceeding this range, the polynom runs to large (pos/neg) values.

You also need to use much more positionis after devision in the coeffficient, when you multiply it with x^12 :).


Jan Smedseng
CFX Berlin Software GmbH

All times are GMT -4. The time now is 00:33.