# CFX Expressions

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 24, 2009, 11:35 CFX Expressions #1 New Member   lex Join Date: Nov 2009 Posts: 2 Rep Power: 0 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

 November 24, 2009, 17:48 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 10,797 Rep Power: 84 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.

 November 24, 2009, 20:40 #3 Senior Member     George Join Date: Mar 2009 Location: Birmingham, UK Posts: 257 Rep Power: 9 if you have a number that is divided by zero A = x/y where y -1

 November 25, 2009, 09:36 #4 New Member   lex Join Date: Nov 2009 Posts: 2 Rep Power: 0 Hi, Thanks for the advice. Problem resolved. Lex

November 25, 2009, 10:25
#5
Member

Join Date: Mar 2009
Posts: 44
Rep Power: 8
Quote:
 Originally Posted by ckleanth if you have a number that is divided by zero A = x/y where y -1
Except for y=1-1e-15[m]. So use:
A = sign(y)*x/ max(abs(y),1e-15[m])

 January 7, 2010, 00:05 #6 New Member   Javier Larrondo Join Date: Jun 2009 Posts: 17 Blog Entries: 1 Rep Power: 8 in CFDPOST-ANSYS v12, the function sign() is not found? do I need to do something different? Cheers, Javier

January 7, 2010, 09:12
#7
Senior Member

Join Date: Jul 2009
Posts: 211
Rep Power: 9
Quote:
 Originally Posted by jalarron 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?

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Val Main CFD Forum 3 June 10, 2011 02:20 Joseph CFX 14 April 20, 2010 15:45 Alphonso CFX 1 August 1, 2008 14:01 Rui CFX 9 May 28, 2007 05:59 Pandu Sattvika CFX 1 December 1, 2001 05:07

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