CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   creating an expression (https://www.cfd-online.com/Forums/cfx/20323-creating-expression.html)

 ioana April 28, 2004 05:10

creating an expression

Hello everybody!

I have to model the absorption coefficient of the air and gas mixture and this is:

a = 0.01 if T< 323 K

a=0.01 +(3/49/377)(T/-323) if 323<=T<700 K

a=3.5 +(3.5/700)(T-700) if T>700

How can I set this? I tried to set it the in the expression editor but I don't know how to set the "if" argument...

Can you give me a suggestion?

Ioana

 pi April 28, 2004 08:25

Re: creating an expression

Hi Ioana, the only way using CEL that comes into mind is using nested step functions. If your picewise function a is a=a1 for T<T1 a=a2 for T between T1 and T2 a=a3 for T>T2, then try:

f1=step(T-T1) f2=step(T-T2) A(T)=a1+(a2-a1)*f1

so then your desired function is a(T)=A+(a3-A)f2

regards pi

 ioana April 29, 2004 11:06

Re: creating an expression

Hi Pi!

There is no other way to do it? I don't know CEL and unfortunately I do not understand of word of your explanation. I saw that the help doesn't provide more suggestions in this direction, so I guess I have to look for another way. ioana

 pi April 29, 2004 11:35

Re: creating an expression

Hi Ioana, the typing in my message yesterday was not very clear. sorry. Type the right units for the absortion coef where is indicated below and load it into pre as a CCL:

LIBRARY:LIBRARY CEL:CEL

EXPRESSIONS:EXPRESSIONS

T1=323 [K]

T2=700[K]

f1=step((T-T1)/1 [K])

f2=step((T-T2)/1 [K])

a1 = 0.01 [units?]

a2=0.01 +(3/49/377)(T-323[K]) [units?]

a3=3.5 +(3.5/700)(T-700[K]) [units?]

A=a1+(a2-a1)*f1

a=A+(a3-A)*f2

END

END

END

hope it is more clear. regards

 ioana April 30, 2004 04:10

Re: creating an expression

Dear Pi,

Thank you very much for your help. I will load the file in pre.

Have a nice day,

Ioana

 All times are GMT -4. The time now is 10:13.