CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Function with parameters (

foo7 September 16, 2011 09:42

Function with parameters
Hello guys.

I'm trying to simulate a multicomponent gas flow.
The gas has more than 20 different components, each one with different properties.
The heat capacity of each component follows the following law:

Cp(a,b,c,d,e,T) = a*T +b*(T^2)+c*(T^-1) +d*(e)

Where a,b,c,d and e are parameters which differ from component to component and T is the gas temperature.

I'd like to know if there's a way within CFX for me to write this function Cp(a,b,c,d,e,T) and call it within the materials properties.

This way, when I'm setting each components properties I don't need to write the whole expression, just call the Cp(a,b,c,d,e,T) with the appropriate parameters a,b,c,d and e.

thanks a lot

ghorrocks September 17, 2011 07:09

You cannot do CEL functions like this. You can write a fortran subroutine to do it. But I would just write it all out in CEL. Using a text editor it should not be too hard to knock up the CEL expressions for each of the 20 components.

I realise this is not "elegant" and a computer scientist would choke on his weeties, but it should work, is straightforward and will get the job done.

All times are GMT -4. The time now is 02:52.