CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   probes, time precision (https://www.cfd-online.com/Forums/openfoam-post-processing/231516-probes-time-precision.html)

breznak November 8, 2020 09:25

probes, time precision
 
Hello,

I did a steady state RANS simulation with 2000 iterations.

After that, I tried to start LES from this 2000 folder, with collecting some variables with probes.

but if I see the result file,

Code:

# Probe 0 (-0.925 0.04 1.6)
# Probe 1 (0 0.04 1.85)
# Probe 2 (0.925 0.04 1.6)
# Probe 3 (-0.15 0.04 0.01)
# Probe 4 (0.045 0.04 0.02)
#        Probe              0              1              2              3              4
#        Time
          2000        1.78184      0.6442999    0.00558417      141.3473      -404.4807
          2000      1.841377      0.686592    0.03120884      141.6884      -404.1845
          2000      1.855883      0.695026    0.04811285        141.968      -404.1179
          2000      1.888686      0.7184033    0.05930709      142.2264      -404.1271
          2000      1.914136      0.7344452    0.06844439      142.4588      -404.1508

and so on...

because my time step size is contant with 2e-7,

it should be

2000
2000.0000002
2000.0000004
2000.0000006
and so on...

I already tried to change time and write precision in controlDict. Do you have any idea?

Tobermory November 15, 2020 14:28

What did you change the time precision to? It seems like you need something like 11 at least, which is rather high. Can you not just rename this to start at zero, and then you can deal with a more manageable precision level.

Gerry Kan November 16, 2020 05:06

Ahoj Breznak:

Based on similar experience with I think there is some kind of hard-coded precision in reading and writing out time in OpenFOAM. I noticed that everything beyond the 6th sig. fig will be ignored, so 2000.0000002 and 2000.0000004 gets written to 2000 in your case.

I don't know the part of the code which dictates this, though, as I kind of worked around it, as my time precision needed not be as high as you, but my problem occurred as I was defining a table value for a Function1 object for a boundary condition (uniformFixedValue). OpenFOAM returned an error because it thought I was defining two different values at the same time, as the difference in time was originally below the 6th sig. fig..

Perhaps this could give you a place to look for a solution.

Gerry.

Tom Lauriks June 9, 2021 08:18

I'm running into the same issue.

I've not yet tried to implement a solution, but I think that there should be 2 solutions.

Firstly, my time step dirs are much more precise than what is written out by the probes. Hence, a more precise time specification should be available in openfoam. As a matter of fact, I've seen a couple of times in the log file in the past, that openfoam automaticaly increases the time accuracy if needed (e.g. if the Courant number becomes too high).
Hence, the limited time accuracy in the probes output, if not adjustable by the controlDict, will be a consequence of the code in the sampling function object. A solution would be to adapt the code of this function object.

As I find this rather cumbersome for such a minor glitch, I think that a quicker solution can be, to write a script (e.g. python, linux bash) that extracts the time steps from the log file, as these are more accurate. Then replace the time steps in the probes file with the extracted time steps.

Tom Lauriks June 10, 2021 03:50

It seems like I answered to quickly. When I set "writePrecision 9;" in controlDict, I do indeed get the corresponding time precision in the probes output file, e.g. 0.000249586821 is one of my time steps in this file. (openfoam v2012).

I've noticed that setting "timePrecision" doesn't matter for this problem. "writePrecision" determines the writing precision. If it is set too low, time steps are written out not accurately, even if "timePrecision" is high. On the other hand, when using a variable time step size, openfoam will automatically increase the time step accuracy if needed.


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