CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   CFX Expressions (http://www.cfd-online.com/Forums/cfx/70433-cfx-expressions.html)

lex November 24, 2009 11:35

CFX Expressions
 
Hi all,

Can anyone explain how do i add a condition if i want to avoid zero division error (Esp expressions)?

Below is the expression i have enter.

EXPRESSIONS:
Esp = (Uf^3)/(0.41*z)
Uf = sqrt(k*sqrt(0.09))
Ug = 13 [m s^-1]
Uz = Ug*((z/Zg)^0.25)
Zg = 400 [m]
k = 1.5*(Uz*0.12)^2

Need to set a condition that z must be greater than zero and not more than 400 m.

Thanks in advance.

Lex

ghorrocks November 24, 2009 17:48

You can do conditional stuff either using the step() function, or if you use V12 you can use the new "if" statement. Look in the CEL reference guide for details.

ckleanth November 24, 2009 20:40

if you have a number that is divided by zero

A = x/y where y -1<y<1

the follwing is numericaly similar and you dont have divide by zero

A = x/ (y + 1e-15[m])

lex November 25, 2009 09:36

Hi,

Thanks for the advice. Problem resolved.

Lex

Timon November 25, 2009 10:25

Quote:

Originally Posted by ckleanth (Post 237578)
if you have a number that is divided by zero

A = x/y where y -1<y<1

the follwing is numericaly similar and you dont have divide by zero

A = x/ (y + 1e-15[m])

Except for y=1-1e-15[m]. So use:
A = sign(y)*x/ max(abs(y),1e-15[m])

jalarron January 7, 2010 00:05

in CFDPOST-ANSYS v12, the function sign() is not found? do I need to do something different?
Cheers,
Javier

kingjewel1 January 7, 2010 09:12

Quote:

Originally Posted by jalarron (Post 241707)
in CFDPOST-ANSYS v12, the function sign() is not found? do I need to do something different?
Cheers,
Javier

I found that by adding 1e-15 or so didn't work for me. Is there a difference between Version11 (which I'm running) and V12?


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