CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   zero divide (http://www.cfd-online.com/Forums/cfx/116116-zero-divide.html)

D.ko April 13, 2013 06:01

zero divide
 
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?

RicochetJ April 15, 2013 05:08

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.


All times are GMT -4. The time now is 12:23.