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/)
-   -   sampleDict and controlDict (https://www.cfd-online.com/Forums/openfoam-post-processing/116371-sampledict-controldict.html)

musahossein April 17, 2013 19:00

sampleDict and controlDict
 
Dear all: I am trying to understand the difference between the functionality of sampleDict and ControlDict. If, for example, I need pressure output in OpenFoam and use the following commands in controlDict, I find that putting them in sampleDict does the same thing. So why not put all the commands in controlDict and not use sampleDict at all -- or are there more differences between the two than what meets the eye?:

wallPressure
{
type surfaces;
functionObjectLibs ("libsampling.so");
outputControl outputTime;
surfaceFormat raw;
interpolationScheme cell;

fields ( alpha1
p
);
surfaces
(
leftwalls
{
type patch;
patches (leftWall);
interpolate true;
triangulate false;
}
rightwalls
{
type patch;
patches (rightWall);
interpolate true;
triangulate false;
}
);
}

wyldckat April 18, 2013 17:55

Greetings Musaddeque,

The difference is that:
  • utility sample (the one that uses "sampleDict") is used after the solver has finished executing things.
  • The sampling function objects on the other hand (the ones in "controlDict"), can be used while the solver is still running.
Both exist because it all depends on how much sampling one really wants to perform :)


For example:
  • sampling every time iteration might be quick for monitoring a couple of points;
  • but if you want 10 section cuts for only the last iteration, then you use sample.
Best regards,
Bruno

musahossein April 18, 2013 21:49

Many thanks for your explanation. Now I get the picture.

Sujatha September 27, 2013 12:43

Some one please help,

I am a newbie to OpenFOAM and have a doubt related to the above posts.
I need to find the pressure at a point in all the time steps, so what is the procedure that I need to follow.
I will be grateful to get some hint.
Thanks in advance.
Regards,

wyldckat September 27, 2013 19:31

Greetings Sujatha and welcome to the forum!

There are at least 2 ways you can do this:
  • You can use sample application, along with a "sampleDict". You can find examples by running:
    Code:

    find $FOAM_TUTORIALS $FOAM_UTILITIES -name sampleDict
  • You can use probeLocations application, along with a "probesDict". You can find examples by running:
    Code:

    find $FOAM_TUTORIALS $FOAM_UTILITIES -name probesDict
Best regards,
Bruno

musahossein September 27, 2013 23:34

Ms Sujatha: Yes please do follow suggestion by Mr Bruno - he is one of the many geniuses on the forum who has helped many a lost foamers find the way -- I speak from experience. So best wishes. Now I have a question for Mr Bruno: Bruno, I tried to run the point probe in OpenFoam. I am running sloshingtank 2d (interdymfoam solver) and when I put the point probe very close to the wall, the solver will give error messages during the run. Also, if I am using moving mesh, then does the probe move with the mesh so that it is probing the same point each time? If not then dont you think it is a major error in OpenFoam? I look forward to your comments.

wyldckat September 28, 2013 06:12

Hi Musaddeque,
Quote:

Originally Posted by musahossein (Post 453957)
Now I have a question for Mr Bruno: Bruno, I tried to run the point probe in OpenFoam. I am running sloshingtank 2d (interdymfoam solver) and when I put the point probe very close to the wall, the solver will give error messages during the run. Also, if I am using moving mesh, then does the probe move with the mesh so that it is probing the same point each time? If not then dont you think it is a major error in OpenFoam? I look forward to your comments.

Mmm... good question. OpenFOAM does have the ability to transform coordinates for sampling, but I can't remember if I ever saw such transformation of probes and section cuts for dynamic mesh solvers...

I've done a quick search and found this bug report: http://www.openfoam.org/mantisbt/view.php?id=744 - I had looked into this back then and I never managed to use this myself.
In addition, I found this old thread: http://www.cfd-online.com/Forums/ope...-problems.html

:eek: I think I've figured it! At least in theory. You need to create a "pointSet" first for the initial mesh and use that point set for the sampling.
Please share the dictionary you've used for sampling, as well as instructions on how you've used it, so that I can test and create a variant for moving meshes.

Best regards,
Bruno

Sujatha September 28, 2013 09:41

Thanks a lot Mr. Bruno for your timely and quick reply. That hint helped me , I could do it with the probesDict and the pressure is obtained.
As Mr.Musahossein has quoted you helped me find the way.
I am grateful.
Regards,

musahossein September 29, 2013 17:31

Point probe close to wall gives errors
 
Bruno:

Here is the sampleDict file that I am using to look at pressures very close to the tank wall. The tank is 1mX1mX0.1. The solver is interDymFOam and the problem is sloshingtank2D. The water depth is 0.5. The centroid (0,0,0) is at mid point along the tanks just at the transition between the water and air. The point probe is at 0.49m and 0.3m below the water level at rest. When I run the sample file, I get error mesages that the probe location is out outside the tank or something to that effect. However, when I place the proble at 0.45m, there are no errors. If you require, I can sent you the tank mesh file, but I dont thin the tank has anything to do with it.

Any help advice will be appreciated, thanks.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
interpolationScheme cell;
graphFormat gnuplot;

//surfaceFormat    raw;
surfaceFormat raw;


//setFormat    ASCII;
setFormat    raw;

sets
(
// evaluate phase and pressure close to tank rightwall using line probe
  right
  {
        type    uniform;
        axis    xyz;
        start  ( 0  0.45  0.60);
        end    ( 0  0.45  -0.40);
        nPoints 100;
  }

);

fields (alpha1
    p);

surfaceFormat raw;
surfaces
(
//    compute wallPressure at left and rightwalls
            leftwall
        {
        type        patch;
        patches        (leftWall);
        rhoName rhoInf;
        rhoInf 998.2; //Reference density for fluid
        outputInterval: 1.0
        interpolate    true;
        triangulate    false;
        }
            rightwalls
                {
                type        patch;
                patches        (rightWall);
        rhoName rhoInf;
        rhoInf 998.2; //Reference density for fluid
        outputInterval: 1.0
        interpolate    true;
                triangulate    false;
                }
);

fields (alpha1
    p);

functions
{
probes1
{

type probes;
functionObjectLibs ("libsampling.so");
region region1;
probeLocations
(
(0 0.49 -0.3)
);

fields (p);

}
}


musahossein September 29, 2013 17:39

Bruno:

I asked the same question a while back.At that time I reproduced the error message that came on the scree. Here is the URL to that post:

http://www.cfd-online.com/Forums/ope...ct-issues.html

I hope this will clarify the situation better.

Thankyou
Musa

wyldckat October 6, 2013 13:29

Hi Musa,

OK, since you've split your question into two separate threads, I'll address the usage of "sampleDict" here.
The example file provided for this utility: https://github.com/OpenFOAM/OpenFOAM...ple/sampleDict - indicates that it can use a cloud of points, which acts similarly to the probe.

But neither the probes nor the cloud of points will move along with your geometry. These points are fixed in space.

Now, based on your other thread, it seems that you want to sample a point in a patch, not a point strictly inside the domain. For this, you can use the "faceSource" function object: http://foam.sourceforge.net/docs/cpp/a00608.html - if you search here on the forum, I think there is already a couple of examples on how to use this.

I'm going to answer on the other thread now, namely this one: http://www.cfd-online.com/Forums/ope...ct-issues.html

Best regards,
Bruno

kingjewel1 April 1, 2014 16:51

Sorry i have to ask this here: can i use sampleDict on a decomposed case? Ie one that has just been run in parallel?

musahossein April 1, 2014 19:03

Quote:

Originally Posted by kingjewel1 (Post 483313)
Sorry i have to ask this here: can i use sampleDict on a decomposed case? Ie one that has just been run in parallel?

Yes you can. Howver make sure to "gather" all the parallel output by typing 'reconstructPar' in the case directory once the parallel case is complete. Depending on the size of your data it make take a little while. The run 'sample' in the case directory. That will run the sampleDict file on the parallel processing results.

I hope that answers your question.

kingjewel1 April 2, 2014 03:04

Quote:

Originally Posted by musahossein (Post 483331)
Yes you can. Howver make sure to "gather" all the parallel output by typing 'reconstructPar' in the case directory once the parallel case is complete. Depending on the size of your data it make take a little while. The run 'sample' in the case directory. That will run the sampleDict file on the parallel processing results.

I hope that answers your question.

Thank you, ive been looking for that information all over, especially the reconstructpar bit.

wyldckat April 5, 2014 16:13

Greetings to all!

@kingjewel1:
Quote:

Originally Posted by kingjewel1 (Post 483313)
Sorry i have to ask this here: can i use sampleDict on a decomposed case? Ie one that has just been run in parallel?

I don't have much experience with sample, but according to whatever this command gives you:
Code:

sample -help
it should state whether it works in parallel or not. Example from OpenFOAM 2.3.x:
Code:

Usage: sample [OPTIONS]
options:
  -case <dir>      specify alternate case directory, default is the cwd
  -constant        include the 'constant/' dir in the times list
  -dict <file>      read control dictionary from specified location
  -latestTime      select the latest time
  -noFunctionObjects
                    do not execute functionObjects
  -noZero          exclude the '0/' dir from the times list, has precedence
                    over the -zeroTime option
  -parallel        run in parallel
  -region <name>    specify alternative mesh region
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -time <ranges>    comma-separated time ranges - eg, ':10,20,40:70,1000:'
  -srcDoc          display source code in browser
  -doc              display application documentation in browser
  -help            print the usage

Using: OpenFOAM-2.3.x (see www.OpenFOAM.org)
Build: 2.3.x-9d0ee4591849

It does state that you can use it in parallel, the same way you run solvers in parallel as well!

Best regards,
Bruno

kingjewel1 April 6, 2014 10:56

Quote:

Originally Posted by wyldckat (Post 484055)
Greetings to all!

@kingjewel1:

I don't have much experience with sample, but according to whatever this command gives you:
Code:

sample -help
it should state whether it works in parallel or not. Example from OpenFOAM 2.3.x:
Code:

Usage: sample [OPTIONS]
options:
  -case <dir>      specify alternate case directory, default is the cwd
  -constant        include the 'constant/' dir in the times list
  -dict <file>      read control dictionary from specified location
  -latestTime      select the latest time
  -noFunctionObjects
                    do not execute functionObjects
  -noZero          exclude the '0/' dir from the times list, has precedence
                    over the -zeroTime option
  -parallel        run in parallel
  -region <name>    specify alternative mesh region
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -time <ranges>    comma-separated time ranges - eg, ':10,20,40:70,1000:'
  -srcDoc          display source code in browser
  -doc              display application documentation in browser
  -help            print the usage

Using: OpenFOAM-2.3.x (see www.OpenFOAM.org)
Build: 2.3.x-9d0ee4591849

It does state that you can use it in parallel, the same way you run solvers in parallel as well!

Best regards,
Bruno

Hi @Bruno,

Thank you for that. My question was not whether
Code:

sample
could be executed IN parallel but whether it could be executed ON a parallel decomposed case. It seems not and that
Code:

reconstructPar
must be run first.:)

Tasos May 10, 2014 20:37

Hi everyone,

I am a very new openFoam user and i am trying a lot! All the discussion with Mr Bruno helped me a lot, but i have some extra questions. I use this sampleDict:

Code:

interpolationScheme cellPoint;

setFormat      gnuplot;

sets
(
    Tasos
    {
        type    face;
        axis    y;
        start  ( 4.018 0 0 );
        end    ( 4.018 0.7 0 );
        nPoints 100;
    }
);

fields          ( U );

and i have a graph for each time step (graph y-U for each specific time step)
now i want to make a graph of U - time.

Can you help me, please, because i am in confusion :/

Thanks a lot,
Tasos.

wyldckat May 11, 2014 05:30

Greetings Tasos,

If you can provide an example case with instructions on how to get to the point you are right now, it'll be easier to help you, because it takes considerable time to set-up a similar case and to do some trial-and-error to figure out the best solution.

On the other hand, why not use ParaView to do the plot of U over time? If you want to plot with gnuplot, you can export the data to CSV after plotting.

Best regards,
Bruno

rcarmi August 26, 2014 14:11

Sampling data in a window and save backup every other time steps
 
Hi all,

Here is my question and I guess I can do that with the controlDict.

I want to simulate something kind of big and cannot save all the data (too much space and saving data slow down the simulation) yet I want backup just in case I need to crash the simulation for a bit and restart later from latest time step (example I need to run another simulation quickly and I don't need the big one for now so I can resume it later).

So here is what I would like to do :

at every 0.05s sample the data in a box (where do I define this box) for all the flow field parameters

then at every 1s I want to back up the entire simulation (domain larger than the area of interest).

I am doing that with IHFOAM by the way.

Best

Remi

musahossein August 29, 2014 08:33

backing up data
 
I dont know whether you can back up data every 1s or at any time interval. Openfoam does not give you the option. Also, why backup results data? It will take a huge amount of space and may not be efficient to restore. Why cant you just back up the input data and the associated files (system, constant etc) so that in the event of a crash, you can rerun your case.

musahossein November 15, 2014 10:15

How to use endTime in ControlDict
 
Dear all:

I am using OpenFoam 2.2.1 , InterDyMFoam/SloshingTank2D as follows:

I am running a code that will modify the displacement .dat file in OpenFoam/SloshingTank2D as follows: Each time the file is overwritten with 2 lines of data with a begin time and end time and corresponding displacements as follows:
2
(
( 0.19 (( 0.0265476475 0.00 0.00) ( 0.00 0.00 0.00)))
( 0.21 (( 0.0369661065 0.00 0.00) ( 0.00 0.00 0.00)))
)

The first column is time and the next column are the displacements associated with the time. Since both the time column and the displacement column will change as the new data is created, I would like to get an output at each end time (0.21 in this case). Can anyone suggest how I can use startFrom and stopAt to do this? In the OpenFoam Manual, for controlDict under "startFrom", there are options such as firstTime, startTime and latestTime options. so for example if the file previous to the one above is as follows:
2
(
( 0.17 (( -0.0665476475 0.00 0.00) ( 0.00 0.00 0.00)))
( 0.19 (( 0.0369661065 0.00 0.00) ( 0.00 0.00 0.00)))
)

Should I use the latestTime option? What about the stopAt option? looks like I only have the writeNow option. Is that correct? Any suggestions or comments would be appreciated, Thanks.

wyldckat November 17, 2014 15:22

Greetings Musaddeque,

If you have a certain code that generates the file for the movement, then you can also have that code generate a file that has the times for start and stop.
For example, the new file "system/controlDict.start_stop" would have this:
Code:

newStartTime 0.17;
newStopTime 0.19;

And your file "system/controlDict" would (for example) be something like this:
Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "controlDict.start_stop"

application    icoFoam;

startFrom      startTime;

startTime      $newStartTime;

stopAt          endTime;

endTime        $newEndTime;

//....

I didn't add more lines, as I was only trying to exemplify the main detail.

This is further explained in the release notes for one of OpenFOAM's versions... er, I have no idea in which version of OpenFOAM this was included. OK, it's explained in the User Guide: http://www.openfoam.org/docs/user/ba...8-1040004.2.10 - section 4.2.10 The #include and #inputMode directives

Best regards,
Bruno

musahossein November 18, 2014 21:01

Thankyou very much for your response. I am trying that approach.

musahossein November 22, 2014 20:51

Quote:

Originally Posted by wyldckat (Post 519632)
Greetings Musaddeque,

If you have a certain code that generates the file for the movement, then you can also have that code generate a file that has the times for start and stop.
For example, the new file "system/controlDict.start_stop" would have this:
Code:

newStartTime 0.17;
newStopTime 0.19;

And your file "system/controlDict" would (for example) be something like this:
Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "controlDict.start_stop"

application    icoFoam;

startFrom      startTime;

startTime      $newStartTime;

stopAt          endTime;

endTime        $newEndTime;

//....

I didn't add more lines, as I was only trying to exemplify the main detail.

This is further explained in the release notes for one of OpenFOAM's versions... er, I have no idea in which version of OpenFOAM this was included. OK, it's explained in the User Guide: http://www.openfoam.org/docs/user/ba...8-1040004.2.10 - section 4.2.10 The #include and #inputMode directives

Best regards,
Bruno

I have made the code to do what you suggested. I have verfied that at each time step the start and end times in controlDict gets updated correctly. So I am running the case with 12 pieces of data, at time intervals of 0.02 seconds. However after generating for force file with time stamp of 0.08, OpenFOAM gives the following error and shuts down:

Code:

{stuff deleted}

#19    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f7219c39de5]
#20    interDyMFoam() [0x43c56d]
[5]
[5]
[5] --> FOAM FATAL ERROR:
[5] current time (0.12) is greater than the maximum in the data table (0.12)
[5]
[5]    From function solidBodyMotionFunctions::tabulated6DoFMotion::transformation()[2]
[2]
[2] --> FOAM FATAL ERROR:
[2] current time (0.12) is greater than the maximum in the data table (0.12)
[2]
[2]    From function solidBodyMotionFunctions::tabulated6DoFMotion::transformation()
[2] [4]
[4]
[4] --> FOAM FATAL ERROR:
[4] current time (0.12) is greater than the maximum in the data table (0.12)
[4]
[4]    From function solidBodyMotionFunctions::tabulated6DoFMotion::transformation()
[4]    in file solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C at line [3]
[3]
[3] --> FOAM FATAL ERROR:
[3] current time (0.12) is greater than the maximum in the data table (0.12)
[3]
[3]    From function solidBodyMotionFunctions::tabulated6DoFMotion::transformation()
[3]    in file solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C[1]

{stuff deleted}

What does this error mean? My code that is coupling with OpenFOAM provides start and end times with 0.02 second intervals, and the final time should be 0.12. Any suggestions will be greatly appreciated.

Thankyou

wyldckat November 23, 2014 15:35

Hi Musaddeque,

My guess is that this message:
Quote:

Code:

current time (0.12) is greater than the maximum in the data table (0.12)

is in fact referring to two different values, such as "0.120000001" and "0.120000000", respectively. This would easily lead to "0.120000001 > 0.120000000" being true.

A possible solution is to change your file to have something like this example, for 0.17 to 0.19:
Code:

4
(
(  0.16  ((  -0.0665476475  0.00  0.00)  (  0.00  0.00  0.00)))
(  0.17  ((  -0.0665476475  0.00  0.00)  (  0.00  0.00  0.00)))
(  0.19  ((  0.0369661065  0.00  0.00)  (  0.00  0.00  0.00)))
(  0.20  ((  0.0369661065  0.00  0.00)  (  0.00  0.00  0.00)))
)

This way you enforce that the values after the limits are still the ones you want/need.

Best regards,
Bruno

musahossein November 23, 2014 21:59

Bruno, thanks again
 
Quote:

Originally Posted by wyldckat (Post 520667)
Hi Musaddeque,

My guess is that this message:
is in fact referring to two different values, such as "0.120000001" and "0.120000000", respectively. This would easily lead to "0.120000001 > 0.120000000" being true.

A possible solution is to change your file to have something like this example, for 0.17 to 0.19:
Code:

4
(
(  0.16  ((  -0.0665476475  0.00  0.00)  (  0.00  0.00  0.00)))
(  0.17  ((  -0.0665476475  0.00  0.00)  (  0.00  0.00  0.00)))
(  0.19  ((  0.0369661065  0.00  0.00)  (  0.00  0.00  0.00)))
(  0.20  ((  0.0369661065  0.00  0.00)  (  0.00  0.00  0.00)))
)

This way you enforce that the values after the limits are still the ones you want/need.

Best regards,
Bruno

Bruno:
The numbers that my code sends to openfoam -- startTime, endTime, and the displacements are all followed by "0d0" after the last digit. This will ensure that there are no unintended digits. So if an updated time is 0.12, then the code will send 0.120d0, i.e. 0.1200000...to the end. Maybe that is where the conflict was. Even when I set the writeinterval in controlDict to 0.0005, the last OpenFoam time would be 0.1195 -- never quite reaching 0.1200. So what I did was subtract a small number say 0.0001 from the start time and add the same number to the end time in the displacement file, so that my displacement file would look like:

2
(0.1200001 (0, start_displacement) .... other columns deleted)
(0.1400001 (0, end_dispalcement)......other columns deleted)

However, in the controlDict file, the startTime and endTime are kept as

0.1200 and 0.1400.

Given a larger time range in the displacement file, OpenFOAM now accepts the update and does the analysis w/o problems (well until the next time). So thank you for your suggestion. But may I suggest that OpenFOAM standardize the way numbers are dealt with so it keeps track of significant digits and sets all other numbers after it to zero. I am sure this way errors such as the one I came across can be avoided. I am not sure though, however, why OpenFOAM refused to write data after 0.1195, eventhough the write interval was 0.0005, and there was a displacement associated with 0.1200000.

musahossein November 27, 2014 11:39

Quote:

Originally Posted by musahossein (Post 520710)
Bruno:
The numbers that my code sends to openfoam -- startTime, endTime, and the displacements are all followed by "0d0" after the last digit. This will ensure that there are no unintended digits. So if an updated time is 0.12, then the code will send 0.120d0, i.e. 0.1200000...to the end. Maybe that is where the conflict was. Even when I set the writeinterval in controlDict to 0.0005, the last OpenFoam time would be 0.1195 -- never quite reaching 0.1200. So what I did was subtract a small number say 0.0001 from the start time and add the same number to the end time in the displacement file, so that my displacement file would look like:

2
(0.1200001 (0, start_displacement) .... other columns deleted)
(0.1400001 (0, end_dispalcement)......other columns deleted)

However, in the controlDict file, the startTime and endTime are kept as

0.1200 and 0.1400.

Given a larger time range in the displacement file, OpenFOAM now accepts the update and does the analysis w/o problems (well until the next time). So thank you for your suggestion. But may I suggest that OpenFOAM standardize the way numbers are dealt with so it keeps track of significant digits and sets all other numbers after it to zero. I am sure this way errors such as the one I came across can be avoided. I am not sure though, however, why OpenFOAM refused to write data after 0.1195, eventhough the write interval was 0.0005, and there was a displacement associated with 0.1200000.

In order to "force" OpenFOAM to create files at 0.02 second intervals, I noted that if I tweaked the start time be subtracting 0.00001 seconds to it and adding the same to the end time, OpenFOAM would run without crashing and ceate time files at 0.02 second intervals. But alas I was mistaken. I put in 2000 data points (0.02 second intervals). Now OpenFOAM still does not write at 0.02 second intervals after 21 seconds into the data, which is approx half way into the run. Instead of creating files at 21.70 and 21.72 seconds, it creates a file 21.71999999 seconds. I have no idea how it comes up with this precision. It seems like no matter what time I put for the data write interval in controlDict, OpenFOAM will do what it will! Any suggestions?

musahossein November 27, 2014 15:33

OpenFOAM write interval doesnt always work
 
As a follow up to the previous thread, in control dict I specify the write time as 0.02 as shown below:

Code:

FoamFile
 {
 version    2.0;
 format      ascii;
 class      dictionary;
 location "system";
 object      controlDict;
 }
 // * * * * * * * * new file * * * * * * * * * * * * * * * * * * * * * * * * * * //
 application    interDyMFoam;
 startFrom        latestTime;
 startTime  21.70000;
 stopAt endTime;
 endTime  21.72000;
 deltaT 0.0005;
 writeControl    adjustableRunTime;
 writeInterval 0.02;
 purgeWrite 0;
 writeFormat    ascii;
 writePrecision 6;
 writeCompression compressed;
 timeFormat      general;
 timePrecision 6;
 runTimeModifiable yes;
 adjustTimeStep  yes;
 maxCo 0.5;
 maxAlphaCo 0.5;
 maxDeltaT 1;

But during OpenFoam run, I end up with the following time stamp on the oputput files:

Code:

.
.
.
21.68
21.7199999999

Looks like it not only missed writing output at 21.70, but it didnt quite get to 21.72.

Any suggestions advice would be greatly apprciated. Thanks!

wyldckat January 25, 2015 11:21

Hi Musaddeque,

Sorry, I wasn't able to look into this any sooner. And I know there is a bug report related to this issue, but I haven't found it yet.

OK, the latest error seems to be because the time snapshot 21.70 doesn't exist and because you have these settings:
Code:

startFrom        latestTime;
 startTime  21.70000;
 endTime  21.72000;
timePrecision 6;

But since you have only these time folders:
Code:

21.68
21.7199999999

Then it's not able to 21.70 because it doesn't exist and it's not able to find "21.7199999999" because it has a precision higher than 6... although I'm not certain about this one.

Can you please provide a test case? Because I'm not able to reproduce this error.

Best regards,
Bruno

edit: OK, found it: http://www.cfd-online.com/Forums/ope...ct-number.html

musahossein January 25, 2015 15:56

OpenFOAM write interval doesnt always work
 
WyldKat:

Thanks for your response. I cant provide a test case as I have coupled at program with openfoam. The program looks for specific files with specific time stamps. As a result, if it does not find the file 27.72 for example, it will give an error. I got around this problem for the time being by:
1.Increasing the time stamp by a range. So for example, instead of supplying the start time as 2.00 seconds of simulation time, I will supply 1.999999. Similarly, I will increase the end time by a small amount say 0.0001. So the code now looks for something within that range.
2. Increasing the writPrecision in controlDict to 6.

Both these appear to help and I have running simulations w/o problems on this issue. I will try OpenFOAM version 2.3 soon.

Thanks

rocap June 4, 2015 15:00

Dear all.



I have the same type of problem as musahossein. I’am working on foam-extend 3.1 on a turbine simulation. I am using pimpleDyMFoam to solve the simulation.



What I need to do now, is to set probes on one face of the blades. But probes can’t be fixed. I need them to follow the blades to always get the pressure at the good point.


I read all your previous post but I could not fix my problem.



Do you have an idea about the way I can do this? It also need to be run in parallel. I don’t know if it’s possible with this “moving” probes.


Best Regards
Romain

wyldckat June 12, 2015 18:38

Greetings Romain and welcome to the forum!

AFAIK, "moving probes" is only somewhat implemented in OpenFOAM 2.2.x and newer: http://www.openfoam.org/mantisbt/view.php?id=1090
It's in this commit: https://github.com/OpenFOAM/OpenFOAM...f27b5d573c2a9b

I don't know if this feature has been back-ported to foam-extend already or not.

Best regards,
Bruno

okcfdlab June 16, 2015 19:44

Sample can be run in parallel on a decomposed case in exactly the same manner as the case itself is run in parallel.

For instance, if you have a case decomposed into four processor directories, you can run sample in parallel on four processors by

mpirun -np 4 sample -parallel

This is much faster than running reconstructPar and then sample.

rocap June 18, 2015 11:36

Dear Bruno

Thanks for your reply and your help. I will try it and I will let you know

regards

gautami August 14, 2015 06:27

Dear All,

I am working on the interDyMFoam/floatingObject tutorial. I need guidance with post processing. I am trying to get fluid velocities and acceleration values at specific points in the computational domain.

1.In the "sampleDict/controlDict" file can I use the option "type cloud" and read the points from a file.
2.Is it possible to get the acceleration data for these specific points by using "fields" (as U for velocity).

Thank you.

gautami August 17, 2015 12:39

Dear Mr Bruno,

I am trying to use sampleDict utility with cloud of points option. Kindly can you please guide me as to how I could read the coordinates of the cloud points form a data file (as I need to track up to 150 points). Your help is highly appreciated.Thank you.

Regards,
Gautami.

wyldckat August 18, 2015 14:08

Quick answers:
Quote:

Originally Posted by gautami (Post 559575)
1.In the "sampleDict/controlDict" file can I use the option "type cloud" and read the points from a file.

...and...
Quote:

Originally Posted by gautami (Post 559907)
how I could read the coordinates of the cloud points form a data file (as I need to track up to 150 points).

You can't. There is no CSV option for loading points for sampling: https://github.com/OpenFOAM/OpenFOAM...ple/sampleDict
The best you can do is use "#include" to include the file that has the data, but the data must be formatted in OpenFOAM's own interpretation of the data, e.g.:
Code:

    somePoints
    {
        type    cloud;
        axis    xyz;
        points  (
#include "$FOAM_CASE/the_data.txt"
);
    }

There the file "the_data.txt" would be located in the case main folder and the content would have to be something like this:
Code:

(0.049 0.049 0.00501)
(0.051 0.049 0.00501)

Warning: I have not tested if this works as intended.


Quote:

Originally Posted by gautami (Post 559575)
2.Is it possible to get the acceleration data for these specific points by using "fields" (as U for velocity).

...not very easily. The acceleration field isn't used in most solvers. Nonetheless, instructions on how to perhaps do this are provided here: http://www.cfd-online.com/Forums/ope...tml#post196210 - post #3

gautami August 19, 2015 13:34

Dear Mr Bruno,

Thank you very much for your reply.

As per your suggestion I have used "#include option" in the "sampleDict" utility, to read the coordinate of the points from file "mordata" as:

Code:

sets
(
    somePoints
    {
        type    cloud;
        axis    xyz;
        #include "mordata"
        points;
    }
);

(The mordata file is located in the system folder and the content, as an example for 6 points is: as described in
http://cfd.direct/openfoam/user-guid...c-file-format/)

Code:

points
(
(0 0 0)
(1 0 1.1)
(2 0 1.2)
(3 0 1.3)
(4 0 1.4)
(5 0 1.5)
);

I was able to run sample without any error and could see sub folders postProcesisng/sets/(time folders) were created with the required field data at the points.

However when I try to implement the same in "controlDict" utility to obtain the data runtime I end up getting the following error:

Code:

/opt/OpenFOAM-2.2.0/bin/tools/RunFunctions: line 42:  8205 Segmentation fault      $APP_RUN "$@" > log.$APP_NAME 2>&1
This is how I implement the above in controlDict

Code:

functions
{
  points
    {
    type            sets;
        functionObjectLibs ("libsampling.so");
        outputControl  outputTime;
        interpolationScheme cellPoint;
        setFormat      raw;
        sets
        (
          somePoints
            {
              type cloud;
              axis xyz;
              #include "mordata"
              points;
            }
        );
        fields
        (
            U
        );
    }
}

Kindly can you please help me with this issue.Thank you.

(I would like to mention here that, the option probes and wallPressure/surfaces in controlDict works fine, but the line option and points option in controlDict gaves me this error similar to the above error.

Code:

: /opt/OpenFOAM-2.2.0/bin/tools/RunFunctions: line 42: 18418 Segmentation fault $APP_RUN "$@" > log.$APP_NAME 2>&1.
I have posted this issue in the thread: http://www.cfd-online.com/Forums/ope...s-runtime.html)

Your guidance will be invaluable.

Regards,
Gautami.

R.Mah July 7, 2016 05:31

Hello Mr Bruno,
I was looking how to extraxt points from my configuration for the postprocessing till I found these posts above, I kindly would like to know how can I extract points from differents lines from my geometry and save it with a format that OpenFOAM would read it, (I´m using type cloud for sampling)
The point is to sample the concentration in these differents cells on each time step

moh-farmani July 17, 2016 10:00

Hi Bruno
first thanks for your kindness and time. I want to take the velocity profile at every time steps over some surfaces located in computational doamin during running, and as my case is big so i can't save all fields every time steps and i couldn't use sampleDict.
could you please let me know the way?


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