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

zero divide

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2013, 06:01
Default zero divide
  #1
New Member
 
DongGunKo
Join Date: Apr 2013
Posts: 13
Rep Power: 13
D.ko is on a distinguished road
in UDF
i code like below

RET(ILOC,1)=d*DEXP(exvar)
and exvar = c/kb (d is very small value)
kb is boltzman constant so it has very small value and c is constant
when i apply this UDF in cfx, solver shows error message that Zero divide . But it is not zero.
i annouced exvar and kb as double precision

when i made
RET(ILOC,1)=DSQRT(exvar)
it also shows same error, so i changed
exvar = kb/c
RET(ILOC,1)=1/DSQRT(exvar)
and it works.
but DEXP is not the case. i cannot change that
how can i get result?
D.ko is offline   Reply With Quote

Old   April 15, 2013, 05:08
Default
  #2
Senior Member
 
JuPa's Avatar
 
Mr CFD
Join Date: Jun 2012
Location: Britain
Posts: 361
Rep Power: 14
JuPa is on a distinguished road
Sounds like rounding error. Try double precision and your problem may go away.

HOWEVER read about what double precision is, and what it means when you switch it on.
JuPa is offline   Reply With Quote

Reply

Tags
fortran code, udf and programming, zero divide


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
how to normalize velocities? must we divide by kinematic viscosity or diffusivity ? lbmagis FLUENT 1 March 11, 2013 14:27
divide error despite of being everything in comment immortality OpenFOAM Running, Solving & CFD 4 February 17, 2013 07:10
How to divide all entries in 0/p by rho lentschi OpenFOAM 1 March 16, 2011 13:42
how to divide domain? manish Phoenics 0 May 10, 2006 02:25
Floating point error: divide by zero Chris FLUENT 2 April 15, 2005 02:33


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