CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   CEL expression with cubic function (https://www.cfd-online.com/Forums/cfx/131831-cel-expression-cubic-function.html)

magicalmarshmallow March 21, 2014 10:50

CEL expression with cubic function
 
Hi,

I am looking to define a specific oil that I have used and need to input its properties into CFX. They density, Kinematic Viscosity and Heat capacity are defined by cubic functions which are all similar this

885.597 - (0.689367(T [C]))+(19228*10^-04*(T [C])^2)-(8.87642*10^-7*(T [C])^3)

However when I plot this, CFX says I have an error either side of the '-' sign at position 8. Correcting that to [C], the error moves along...Has anyone got a solution to this. I'm sure it's staring me in the face

Please & Cheers

singer1812 March 21, 2014 13:14

(885.597 - (0.689367*(t/1 [k]))+(19228*10^-04*((t/1 [k]))^2)-(8.87642*10^-7*((t/1 [k]))^3))*1 [whatever units you need this in]

magicalmarshmallow March 22, 2014 14:52

Doesn't seem to like this. The generated plot is increasing, but the function is decreasing, with increasing temperature.
I've also tried breaking it up, defining variables a, b & c, then adding/subracting them together, but no joy.
Any further ideas?

ghorrocks March 23, 2014 04:18

Some comment:
Are you sure the original function is correct?

It might be wise to not assume the order of operations is as you expect - for instance the section 8.87642*10^-7*(t/1[k]) could be interpreted as:
8.87642*10^(-7*(t/1[k]))
8.87642*(10^-7)*(t/1[k])
(8.87642*10)^(-7*(t/1[k]))
And these will all give very different answers.

So I would put lots of brackets in the expression to make sure there is no assumed order of operations anywhere.

brunoc March 25, 2014 16:36

Quote:

Originally Posted by magicalmarshmallow (Post 481311)
Hi,

I am looking to define a specific oil that I have used and need to input its properties into CFX. They density, Kinematic Viscosity and Heat capacity are defined by cubic functions which are all similar this

885.597 - (0.689367(T [C]))+(19228*10^-04*(T [C])^2)-(8.87642*10^-7*(T [C])^3)

However when I plot this, CFX says I have an error either side of the '-' sign at position 8. Correcting that to [C], the error moves along...Has anyone got a solution to this. I'm sure it's staring me in the face

Please & Cheers

There are lots of problems in your equation. First, I'm not sure what you're trying to do with this:

0.689367(T [C])

but my guess is you're expecting CFX to use temperature in Celcius, which it won't do unless you change it in the Options (it defaults to SI, so Kelvin). A better option would be to rewrite your equation considering the temperature will be in [K].

Second, try using proper scientific number format:
19228*10^-04 => 19228E-04
8.87642*10^-7 => 8.87642E-07

(...)

Last, use the appropriate units for each constant. So, if this is for density, use something like:

A = 885.597 [kg/m^3]
B = -0.689367 [kg/(m^3 K)]
C = 19228E-04 [kg/(m^3 K^2)]
D = -8.87642E-7 [kg/(m^3 K^3)]
TCelsius = T - 273.15 [K]

rho = A + B * TCelsius + C * TCelsius^2 + D * TCelsius^3


Hope it helps.


All times are GMT -4. The time now is 08:56.