|
[Sponsors] |
April 20, 2020, 17:24 |
UDF Double Precision Error?
|
#1 |
Member
j
Join Date: Apr 2020
Posts: 34
Rep Power: 0 |
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.
|
|
April 20, 2020, 17:37 |
Double Precision
|
#2 |
Senior Member
|
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.
__________________
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. |
|
April 21, 2020, 05:24 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
how do you display your variables?
__________________
best regards ****************************** press LIKE if this message was helpful |
|
Tags |
blowing up, double precision, error |
|
|
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 |