|
[Sponsors] |
February 21, 2007, 12:17 |
Variable precision
|
#1 |
Guest
Posts: n/a
|
Hello ladies and gentlemen,
I have a simple question regarding precision. In CFX-Post, is it possible to have the User Variables we create calculated in double presision ? Or to specify the number of decimals to keep ? If not, would temporarily changing of units help? As an example, I created a variable giving the distance normal to a wall and I hate to see -2.0E-7 [m] at the wall instead of a clean 0 [m]. Should I use [mm] to keep more decimals ? To satisfy your curiosity, this one variable is defined as follow: _____________________________ USER SCALAR VARIABLE: Ynorm Boundary Values = Conservative Calculate Global Range = Off Expression = maxVal(Y)@Inlet *cos(0.1745329) + (X^2+(Y^2 + Z^2))^0.5*sin(0.1745329-atan2((Y^2 + Z^2)^0.5, X)) Recipe = Expression Variable to Copy = Pressure END ______________________________ Thanks a lot ! Felix |
|
February 21, 2007, 17:02 |
Re: Variable precision
|
#2 |
Guest
Posts: n/a
|
Hi,
I recommend keeping your user variable in SI units (metres) and changing the display in CFX-Post to mm. This can be done in CFX-Post under edit/options - units. Select custom unit system and change the length unit to mm. Glenn Horrocks |
|
February 21, 2007, 17:46 |
Re: Variable precision
|
#3 |
Guest
Posts: n/a
|
Hi Glenn,
I'm sorry but I don't fully understand your answer. How will this help increase the numerical precision of my variable's evaluation ? Isn't this just a way to change the display ? Thanks, Felix |
|
February 21, 2007, 19:55 |
Re: Variable precision
|
#4 |
Guest
Posts: n/a
|
int(x) return the integer value. Sometimes I will use this to round to 2 decimal places, eg:
int(100*VarName)/100 |
|
February 22, 2007, 17:37 |
Re: Variable precision
|
#5 |
Guest
Posts: n/a
|
Hi,
You are correct, my suggestion was just a post processing display thing. To increase the precision of the numerics you have to use the double precision solver. Your only other option is to non-dimensionalise the simulation as a simple change of units will not increase the precision. This technique is not recommended. Glenn Horrocks |
|
February 24, 2007, 19:54 |
Re: Variable precision
|
#6 |
Guest
Posts: n/a
|
Hello all,
Thank you very much for your valuables suggestions. I don't think I will run my calculations in double precision for the moment although this surely is good to know for future work. I guess I'll use Drew's solution or just learn to live with some round-off errors ! I wish you all an excellent day, Felix |
|
February 25, 2007, 17:32 |
Re: Variable precision
|
#7 |
Guest
Posts: n/a
|
Hi,
Be aware that the int() CEL function truncates the number to the whole number, that is int(3.2)=3, int(3.9)=3, int(-3.2)=-3. To round to the nearest whole number use the nint() function - nint(3.2)=3, nint(3.9)=4, nint(-3.2)=-3. Also note nint() rounds .5 decimals to the nearest even number. Glenn Horrocks |
|
February 27, 2007, 18:53 |
Re: Variable precision
|
#8 |
Guest
Posts: n/a
|
Unfortunately all the calcuations in CFX Post are done in single precision.
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
emag beta feature: charge density | charlotte | CFX | 4 | March 22, 2011 10:14 |
error in COMSOL:'ERROR:6164 Duplicate Variable' | bhushas | COMSOL | 1 | May 30, 2008 05:35 |
what's wrong about my code for 2d burgers equation | morxio | Main CFD Forum | 3 | April 27, 2007 11:38 |
Env variable not set | gruber2 | OpenFOAM Installation | 5 | December 30, 2005 05:27 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |