CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Variable precision

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2007, 12:17
Default 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
  Reply With Quote

Old   February 21, 2007, 17:02
Default 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
  Reply With Quote

Old   February 21, 2007, 17:46
Default 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
  Reply With Quote

Old   February 21, 2007, 19:55
Default 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
  Reply With Quote

Old   February 22, 2007, 17:37
Default 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
  Reply With Quote

Old   February 24, 2007, 19:54
Default 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
  Reply With Quote

Old   February 25, 2007, 17:32
Default 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
  Reply With Quote

Old   February 27, 2007, 18:53
Default Re: Variable precision
  #8
HekLer
Guest
 
Posts: n/a
Unfortunately all the calcuations in CFX Post are done in single precision.
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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


All times are GMT -4. The time now is 06:34.