CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   How to increase the output precision for a variable? (

ripperjack April 19, 2013 14:31

How to increase the output precision for a variable?
Hi all,

I am using OpenFOAM to simulate channel flows. I have a problem, and you guys can help me? Thanks.

I specified a very small temperature difference on top and bottom walls (e.g. 300.005 at top and 299.995 at the bottom wall), it seems that the temperature precision is not enough because when I check the T output in the flow field, the results are just 300.004, 300.003, etc. But what I expect is more accurate T value, like 300.004142, 300.003125. I want to increase the precision of temperature, how can I do it?


ripperjack April 19, 2013 15:52

I have checked my openfoam configuration, the $WM_PRECISION_OPTION=DP. It seems that it is double precision, but the output results just have 6 valid digits, it is weird....

Lieven April 19, 2013 15:55

U can control the "writePrecision" in the system/controlDict file.

Just a small question, how meaningful is writing the temperature up to 5 digits after the decimal point. Can't you assume the flow to be isothermal?



wyldckat April 19, 2013 15:59

Greetings ripperjack,

I was trying to make a witty comment, but I'm too burn out from the long week of work... oh well... :rolleyes:

So, here's what's happening: OpenFOAM is doing exactly what you told it to do! ;)

Check your "system/controlDict"; then check the user guide:
There are two very important details here:
  1. "writePrecision" - 6 is the default and is the number of digits stored in the files.
  2. "writeFormat" - well, you have to read both entries to figure it out, but the idea is that "binary" mode preserves the full data resolution! :D
Best regards,

ripperjack April 19, 2013 18:04

Hi Lieven wyldckat,

Many thanks for your reply! I am simulating heat transfer using DNS method, the velocity is very small, so is the temperature difference. Now my results make sense. Thanks again and have a great weekend!


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