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

zero divide

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 13, 2013, 06:01
Default zero divide
  #1
New Member
 
DongGunKo
Join Date: Apr 2013
Posts: 13
Rep Power: 4
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
 
RicochetJ's Avatar
 
Mr CFD
Join Date: Jun 2012
Location: Britain
Posts: 291
Rep Power: 6
RicochetJ 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.
RicochetJ is offline   Reply With Quote

Reply

Tags
fortran code, udf and programming, zero divide

Thread Tools
Display Modes

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 On
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 15:27
divide error despite of being everything in comment immortality OpenFOAM Running, Solving & CFD 4 February 17, 2013 08:10
How to divide all entries in 0/p by rho lentschi OpenFOAM 1 March 16, 2011 14: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 20:17.