CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

sampleDict and controlDict

Register Blogs Community New Posts Updated Threads Search

Like Tree36Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 17, 2013, 20:00
Default sampleDict and controlDict
  #1
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
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;
}
);
}
peppino and shincoast like this.
musahossein is offline   Reply With Quote

Old   April 18, 2013, 18:55
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
__________________
wyldckat is offline   Reply With Quote

Old   April 18, 2013, 22:49
Default
  #3
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Many thanks for your explanation. Now I get the picture.
musahossein is offline   Reply With Quote

Old   September 27, 2013, 13:43
Post
  #4
New Member
 
Join Date: Jul 2013
Posts: 27
Rep Power: 13
Sujatha is on a distinguished road
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,
Sujatha is offline   Reply With Quote

Old   September 27, 2013, 20:31
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
__________________
wyldckat is offline   Reply With Quote

Old   September 28, 2013, 00:34
Default
  #6
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
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.
musahossein is offline   Reply With Quote

Old   September 28, 2013, 07:12
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musaddeque,
Quote:
Originally Posted by musahossein View Post
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

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
alia, yuhan1991, shincoast and 1 others like this.
__________________
wyldckat is offline   Reply With Quote

Old   September 28, 2013, 10:41
Post
  #8
New Member
 
Join Date: Jul 2013
Posts: 27
Rep Power: 13
Sujatha is on a distinguished road
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,
Sujatha is offline   Reply With Quote

Old   September 29, 2013, 18:31
Default Point probe close to wall gives errors
  #9
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
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);

}
}

Last edited by wyldckat; October 6, 2013 at 13:42. Reason: Added [CODE][/CODE]
musahossein is offline   Reply With Quote

Old   September 29, 2013, 18:39
Default
  #10
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
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
musahossein is offline   Reply With Quote

Old   October 6, 2013, 14:29
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
yuhan1991 and qjh888 like this.
__________________
wyldckat is offline   Reply With Quote

Old   April 1, 2014, 17:51
Default
  #12
Senior Member
 
Join Date: Jul 2009
Posts: 260
Rep Power: 18
kingjewel1 is on a distinguished road
Sorry i have to ask this here: can i use sampleDict on a decomposed case? Ie one that has just been run in parallel?
kingjewel1 is offline   Reply With Quote

Old   April 1, 2014, 20:03
Default
  #13
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by kingjewel1 View Post
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.
musahossein is offline   Reply With Quote

Old   April 2, 2014, 04:04
Default
  #14
Senior Member
 
Join Date: Jul 2009
Posts: 260
Rep Power: 18
kingjewel1 is on a distinguished road
Quote:
Originally Posted by musahossein View Post
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.
kingjewel1 is offline   Reply With Quote

Old   April 5, 2014, 17:13
Default
  #15
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@kingjewel1:
Quote:
Originally Posted by kingjewel1 View Post
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
__________________
wyldckat is offline   Reply With Quote

Old   April 6, 2014, 11:56
Default
  #16
Senior Member
 
Join Date: Jul 2009
Posts: 260
Rep Power: 18
kingjewel1 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
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.
kingjewel1 is offline   Reply With Quote

Old   May 10, 2014, 21:37
Default
  #17
New Member
 
Anastasios Stampoultzoglou
Join Date: May 2014
Posts: 21
Rep Power: 12
Tasos is on a distinguished road
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.

Last edited by wyldckat; May 11, 2014 at 06:26. Reason: Added [CODE][/CODE]
Tasos is offline   Reply With Quote

Old   May 11, 2014, 06:30
Default
  #18
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
__________________
wyldckat is offline   Reply With Quote

Old   August 26, 2014, 15:11
Default Sampling data in a window and save backup every other time steps
  #19
New Member
 
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12
rcarmi is on a distinguished road
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
rcarmi is offline   Reply With Quote

Old   August 29, 2014, 09:33
Default backing up data
  #20
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
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 is offline   Reply With Quote

Reply

Tags
controldict, interpolate, sampledict


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



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