CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Info(messageStream) - Specifying the Precision

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

Sponsored Links

LinkBack Thread Tools Display Modes
Old   August 4, 2013, 08:47
Default Info(messageStream) - Specifying the Precision
Join Date: Aug 2012
Posts: 76
Rep Power: 6
HakikiCanakkaleli is on a distinguished road
Sponsored Links

== 1 ==

Is it possible to specify the precision of an output number which is, say, a variable type of doubleScalar with Info in OpenFOAM?

== 2 ==
For example:

doubleScalar variable = 2.0000000001;
Info << "variable: " << variable << endl;
== 3 ==
In another thread, the following was given once:

Originally Posted by akidess View Post
printf is pure C, it's C++ descendant is cout. Assuming Info is built upon cout, you can do:

Info << setw(7);
Info <<   fixed    << a << '\t' << b << '\t' << c << endl;
Try it.
However, it does not work as confirmed by another reader as well.

== 4 ==

Many thanks for any help.
HakikiCanakkaleli is offline   Reply With Quote
Sponsored Links

Old   August 14, 2013, 14:25
Join Date: Aug 2012
Posts: 76
Rep Power: 6
HakikiCanakkaleli is on a distinguished road
The answer that I found is that:

#include "IOmanip.H"


Info << setprecision(10);
Info << " i " << xx << endl;

Simply, identical to that of C++ standard, had forgotten the header file.
HakikiCanakkaleli is offline   Reply With Quote

Old   August 14, 2013, 14:36
Senior Member
mkraposhin's Avatar
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 330
Rep Power: 12
mkraposhin is on a distinguished road
google: format with cout
mkraposhin is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] ICEM output precision papis ANSYS Meshing & Geometry 4 July 9, 2013 09:54
Double precision case open in single precision solver. cinwendy FLUENT 6 March 27, 2013 04:19
Switch from single precision to double precision kk81 OpenFOAM Bugs 0 March 11, 2010 07:14
Number of elements x double precision matheusguzella ANSYS Meshing & Geometry 2 October 7, 2009 10:15
what's wrong about my code for 2d burgers equation morxio Main CFD Forum 3 April 27, 2007 10:38

Sponsored Links

All times are GMT -4. The time now is 02:24.