CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

CFX Expressions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 24, 2009, 11:35
Default CFX Expressions
  #1
lex
New Member
 
lex
Join Date: Nov 2009
Posts: 2
Rep Power: 0
lex is on a distinguished road
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
lex is offline   Reply With Quote

Old   November 24, 2009, 17:48
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 24, 2009, 20:40
Default
  #3
Senior Member
 
ckleanth's Avatar
 
George
Join Date: Mar 2009
Location: Birmingham, UK
Posts: 257
Rep Power: 18
ckleanth is on a distinguished road
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])
__________________
Top 4 tips
1. Knowledge is everything and Ignorance is dangerous.
2. Understand your limitations and try to eliminate them.
3. Get yerself a bike and hoon the chuffer. You will soon learn why dogs like to hang their heads out the car window.
4. Please before asking any questions on how to run simulations in CFX, go though all the tutorials
ckleanth is offline   Reply With Quote

Old   November 25, 2009, 09:36
Default
  #4
lex
New Member
 
lex
Join Date: Nov 2009
Posts: 2
Rep Power: 0
lex is on a distinguished road
Hi,

Thanks for the advice. Problem resolved.

Lex
lex is offline   Reply With Quote

Old   November 25, 2009, 10:25
Default
  #5
Member
 
Join Date: Mar 2009
Posts: 44
Rep Power: 17
Timon is on a distinguished road
Quote:
Originally Posted by ckleanth View Post
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])
Timon is offline   Reply With Quote

Old   January 7, 2010, 00:05
Default
  #6
New Member
 
Javier Larrondo
Join Date: Jun 2009
Posts: 17
Blog Entries: 1
Rep Power: 17
jalarron is on a distinguished road
in CFDPOST-ANSYS v12, the function sign() is not found? do I need to do something different?
Cheers,
Javier
jalarron is offline   Reply With Quote

Old   January 7, 2010, 09:12
Default
  #7
Senior Member
 
Join Date: Jul 2009
Posts: 260
Rep Power: 18
kingjewel1 is on a distinguished road
Quote:
Originally Posted by jalarron View Post
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?
kingjewel1 is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pros and Cons for CFX, CFdesign, COMSOL Val Main CFD Forum 3 June 10, 2011 03:20
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 16:45
Importing solutions in CFX. Alphonso CFX 1 August 1, 2008 15:01
PhD using CFX Rui CFX 9 May 28, 2007 06:59
CFX 4.4 installation problem Pandu Sattvika CFX 1 December 1, 2001 05:07


All times are GMT -4. The time now is 18:55.