CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF Double Precision Error?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2020, 17:24
Default UDF Double Precision Error?
  #1
Member
 
j
Join Date: Apr 2020
Posts: 34
Rep Power: 0
buckngnr11 is on a distinguished road
Probably a dumb question. I'm using a double precision solver, and using a UDF to make various calculations. When I display the output of the calculations in the console I notice that some of the variables appear to have a floating point error (values are on order E+200). The variable being calculated here involves no division, just multiplying two very small numbers (1e-8 and another of order 1e-9). I suspect that I'm having a precision error. I'm assigning all variables to be type real. Not sure what my options are to remedy this other than hardcoding any large numbers to zero. I'd rather have a more elegant solution since I'm not entirely positive this is necessarily the issue.
buckngnr11 is offline   Reply With Quote

Old   April 20, 2020, 17:37
Default Double Precision
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
As far as double precision is concerned, it is machine dependent. However, 1e-8 or 1e-9 is quite large as compared to machine precision if you are using double precision. So, these should be treated properly as finite numbers without any issue. However, it matters for what parameter in Fluent are you using these numbers. E.g., there are certain limits set in Fluent, which could be changed by user, if required, that do not allow numbers to be smaller than a certain limit. If you are using single precision, then certainly these numbers will be treated as 0. Also note that in UDF, use 1.e-9 and not 1e-9.
buckngnr11 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 21, 2020, 05:24
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
how do you display your variables?
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
blowing up, double precision, error


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
UDF for DPM particle deposition modelingpa haghshenasfard Fluent UDF and Scheme Programming 10 September 15, 2019 03:03
Compile calcMassFlowC aurore OpenFOAM Programming & Development 13 March 23, 2018 08:43
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 07:25
what's wrong about my code for 2d burgers equation morxio Main CFD Forum 3 April 27, 2007 11:38


All times are GMT -4. The time now is 17:15.