# Variable precision

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

 February 21, 2007, 12:17 Variable precision #1 Felix 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 Glenn Horrocks 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 Felix 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 drew 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 Glenn Horrocks 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 Felix 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 Glenn Horrocks 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 HekLer Guest   Posts: n/a Unfortunately all the calcuations in CFX Post are done in single precision.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post charlotte CFX 4 March 22, 2011 10:14 bhushas Main CFD Forum 1 May 30, 2008 04:35 morxio Main CFD Forum 3 April 27, 2007 10:38 gruber2 OpenFOAM Installation 5 December 30, 2005 05:27 lego CFX 3 November 5, 2002 21:09

All times are GMT -4. The time now is 21:26.