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

sampling on cellSet

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes
  • 1 Post By ashvinc9
  • 1 Post By roenby
  • 3 Post By ykanani
  • 1 Post By sebastien_F1
  • 5 Post By mzubiald

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2013, 03:44
Default sampling on cellSet
  #1
Senior Member
 
Tarak
Join Date: Aug 2010
Location: State College, PA
Posts: 111
Rep Power: 16
Tarak is on a distinguished road
Hii,

I need to use the "sample" utility to sample field values in a cellSet. Can someone please tell me the entries needed in sampleDict to do this?

Thanks
Tarak is offline   Reply With Quote

Old   May 22, 2013, 04:47
Default
  #2
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 18
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by Tarak View Post
Hii,

I need to use the "sample" utility to sample field values in a cellSet. Can someone please tell me the entries needed in sampleDict to do this?

Thanks
I think the following link will solve your problem..

http://www.cfd-online.com/Forums/ope...ampledict.html
Tushar@cfd is offline   Reply With Quote

Old   May 22, 2013, 12:13
Default
  #3
Senior Member
 
Tarak
Join Date: Aug 2010
Location: State College, PA
Posts: 111
Rep Power: 16
Tarak is on a distinguished road
Hii Tushar,

Thanks for your reply. If I understand correctly, the link talks about sampling on a patch, which I can do by writing something like
surfaces
(
airfoil
{
type patch;
patches (airfoil);;
// interpolate false;
}
);

inside sampleDict.
But I need to sample data along a cellSet (not patch)
Tarak is offline   Reply With Quote

Old   May 23, 2013, 01:33
Default
  #4
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 18
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by Tarak View Post
Hii Tushar,

Thanks for your reply. If I understand correctly, the link talks about sampling on a patch, which I can do by writing something like
surfaces
(
airfoil
{
type patch;
patches (airfoil);;
// interpolate false;
}
);

inside sampleDict.
But I need to sample data along a cellSet (not patch)
By the cellSet do you mean to say a line/surface inside the fluid domain?

If suppose you want to plot along a line follow the below shown procedure.

Make your sampleDict like the one shown below:

interpolationScheme cellPoint;

setFormat raw;

surfaceFormat raw;

sets
(
name
{
type uniform;
axis y;
start (0 0 0.0005);
end (0 0.425 0.0005);
nPoints 800; }
);
fields (U p);

In a similar fashion you can progress for the surface with some changes like surfaces instead of sets, type patch..etc.
Tushar@cfd is offline   Reply With Quote

Old   May 23, 2013, 02:09
Default
  #5
Senior Member
 
Tarak
Join Date: Aug 2010
Location: State College, PA
Posts: 111
Rep Power: 16
Tarak is on a distinguished road
Hii Tushar,

Thanks for your reply. By cellSet I meant the list of cells which we can create based on multiple criteria (See section 5.1 of http://openfoamwiki.net/index.php/TopoSet).
Tarak is offline   Reply With Quote

Old   May 23, 2013, 02:40
Default
  #6
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 18
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by Tarak View Post
Hii Tushar,

Thanks for your reply. By cellSet I meant the list of cells which we can create based on multiple criteria (See section 5.1 of http://openfoamwiki.net/index.php/TopoSet).

Hi Tarak,

Thanks for explaining..
Try looking at the already available topoSetDict with the OF. $tutorial/incompressible/pimpleFoam/TjunctionFan/system/ .
May be bad co-ordinates could be sometimes a problem with the effecting running of utility.
Tushar@cfd is offline   Reply With Quote

Old   July 9, 2013, 17:18
Default
  #7
Senior Member
 
Francois Beaubert
Join Date: Mar 2009
Location: Lille, France
Posts: 147
Rep Power: 17
francois is on a distinguished road
Tarak, Did you find a solution to sample your data on a cellSet/faceSet ? Thanks Regards François
francois is offline   Reply With Quote

Old   July 9, 2013, 18:44
Default sampling of cellSet
  #8
New Member
 
Ashvin Chaudhari
Join Date: Aug 2011
Location: Finland
Posts: 23
Rep Power: 15
ashvinc9 is on a distinguished road
Hi,
One can first run the topoSetDict and try to make a cellSet. Below is the code to keep in topoSetDict in order to make box typed cellSet.

Code:
actions
(
    {
        name    c0; // name of the cellSet
        type    cellSet;
        action  new;
        source  boxToCell; //box type of cellSet
        sourceInfo
        {
            box (1 0.5 0) (3 1.5 0.5); //size or dimensions of the Box, you may change this 
        }
    }
);
After creating the cellSet, one can run following command to produce a VTK file of that cellSet, e.g.,

Code:
foamToVTK -cellSet c0 -latestTime
Hope this helps !

- Ashvin
lukasf likes this.
ashvinc9 is offline   Reply With Quote

Old   July 11, 2013, 08:34
Default
  #9
Senior Member
 
Francois Beaubert
Join Date: Mar 2009
Location: Lille, France
Posts: 147
Rep Power: 17
francois is on a distinguished road
Thanks Ashvin for your tip.

Indeed it's possible to obtain VTK file from cellSet with foamToVTK but i'm looking for something different: I'll like to obtain a raw file of the sampled cellSet which I can load into python.

Is it possible to do it without writing a parser to convert the VTK file to raw data ?

Have a nice day
Regards

Francois
francois is offline   Reply With Quote

Old   July 14, 2013, 22:34
Default
  #10
Senior Member
 
Tarak
Join Date: Aug 2010
Location: State College, PA
Posts: 111
Rep Power: 16
Tarak is on a distinguished road
Hii Francois,

No, I couldn't find a solution. Please let me know if you have one.
Tarak is offline   Reply With Quote

Old   August 21, 2013, 11:08
Default Simple sampling using cellSet
  #11
Member
 
Johan Roenby
Join Date: May 2011
Location: Denmark
Posts: 93
Rep Power: 21
roenby will become famous soon enough
Dear Tarak

Maybe I misunderstood something, but I think what you are trying to do is straight forward:

The cellSet you create e.g. with topoSet will be in a file, say, <case>/constant/polyMesh/sets/c0. This contains a list of cell indices, e.g. for all cells having centres within a box defined in your topoSetDict.

If the field that you want to sample is a volVectorField (such as the velocity field U) or volScalarField (such as the pressure field p) then the file <case>/<time>/<volFieldName> contains a list with N vectors or scalars, where N is the number of cells in your domain. The n'th value in the list is the field value at the n'th cell.

So if your cellSet contains the values (0 4 10) your sampling is simply a matter of picking out elements 0, 4 and 10 in the files <case>/<time>/<volFieldName>.

Of course for this to be usefull you also need the cell centres for these cells. This can be calculated with the utility writeCellCentres (type writeCellCentres -help in the terminal).

Hope this helped.

Johan

Ps: If the field you want to sample is a surfaceScalarField or a surfaceVectorField the values in the time directories are the field values on the cell faces. Then I suppose you can do exactly the same using a faceSet. The n'th value in your <case>/<time>/<surfaceField> corresponds to the n'th face in your <case>/constant/polyMesh/faces file (the numbers in this faces file refers to the elements in the constant/polyMesh/points file). Unfortunetaly, I don't think there is any writeFaceCentres utility currently so you would have to calculate the face centres yourself. For this you can extract the points for the faces in your faceSet using writeMeshObject -faceSet <faceSetFileName>.
Kummi likes this.
roenby is offline   Reply With Quote

Old   June 15, 2017, 19:04
Default Solved: sampling on cellSet
  #12
Member
 
Yousef
Join Date: Feb 2015
Posts: 40
Rep Power: 11
ykanani is on a distinguished road
Quote:
Originally Posted by Tarak View Post
Hii,

I need to use the "sample" utility to sample field values in a cellSet. Can someone please tell me the entries needed in sampleDict to do this?

Thanks
It is an old thread but I thought the answer may help others who are looking for this feature. OpenFOAM 4.1 has an option called volRegion which can be used as a a functionObject in the controlDict. Please read the description at:

OpenFOAM-4.x/src/functionObjects/field/fieldValues/volRegion/volRegion.H

and find the sample controlDict at:

OpenFOAM-4.x/src/functionObjects/field/fieldValues/controlDict

This is very good feature for those who would like to have a time series of sampled data at a particular volume (defined by a cellZone) of the grid in cases where it is not feasible (e.g. huge grid sizes) to store timeseries of the whole grid. This time series later can be used for DMD analysis for example.


With a small modification, you can change the time interval that you want the data to be sampled (which can be different than the main time interval), For example you can write:

Code:
cellObj1
    {
        type            volRegion;
        libs ("libfieldFunctionObjects.so");
        enabled         true;
        writeControl    adjustableRunTime;
        writeInterval   0.01;
        log             true;
        writeFields     true;
        regionType      cellZone;
        name      d0z;
        operation       none;

        fields
        (
            p
            U
        );
    }
Please note that you need to have cellZone (not the cellSet) to perform this sampling. You need to first define a cellSet and then create a cellZone based the defined cellSet.

As mentioned in the header file, the following operations also can be performed on the volume:

none | no operation
sum | sum
sumMag | sum of component magnitudes
average | ensemble average
weightedAverage | weighted average
volAverage | volume weighted average
weightedVolAverage | weighted volume average
volIntegrate | volume integral
min | minimum
max | maximum
CoV | coefficient of variation: standard deviation/mean


Regards,
Yousef
mgg, jiaodanuma and Camille.d like this.
ykanani is offline   Reply With Quote

Old   October 24, 2017, 08:19
Default
  #13
New Member
 
sebastien vilfayeau
Join Date: Feb 2012
Posts: 14
Rep Power: 14
sebastien_F1 is on a distinguished road
Hi,

Have you tried it?

volRegion is class not a function object. This will not work.

Cheers,
Sebastien
marcel16j likes this.
sebastien_F1 is offline   Reply With Quote

Old   January 12, 2018, 04:58
Default
  #14
Senior Member
 
Join Date: Nov 2009
Posts: 111
Rep Power: 16
Gearb0x is on a distinguished road
I am trying to perform the same thing i.e. get the scalar field value for all cells belonging to a set.

Until now, what I am trying to do (combination of topoSet + sampleDict) does not work.

If someone has found a solution to this issue, I am interested
Gearb0x is offline   Reply With Quote

Old   February 27, 2018, 12:21
Default
  #15
Member
 
Yousef
Join Date: Feb 2015
Posts: 40
Rep Power: 11
ykanani is on a distinguished road
Quote:
Originally Posted by sebastien_F1 View Post
Hi,

Have you tried it?

volRegion is class not a function object. This will not work.

Cheers,
Sebastien
Yes I definitely tried it otherwise I would not post it here. I am attaching a test case. You can run this using icoFoam. Then look for sampled data under time folders and not the postProcessing folder.

Sorry for the late reply. I just saw the new posts.

Regards
Attached Files
File Type: zip CavityVolRegionProbe.zip (45.2 KB, 87 views)
ykanani is offline   Reply With Quote

Old   January 16, 2019, 11:36
Default
  #16
New Member
 
Jin Zhang
Join Date: May 2018
Location: Germany
Posts: 15
Rep Power: 8
sjlouie91 is on a distinguished road
Hi Yousef,


I'm now trying to do the similar work because I need to get a sampled specified volume field for my LES simulation.

Although 'volRegion' can be used for the cellZone, I can only get the volume-averaged value for this cellZone rather than the values for each cell in this cellZone. The attached file that you give also shows the same problem.


So do you know any other utilities to get the values for each cell in the specified volume?



Best regards,
Jin
sjlouie91 is offline   Reply With Quote

Old   February 13, 2020, 16:51
Default
  #17
New Member
 
Shawn
Join Date: Dec 2019
Posts: 5
Rep Power: 6
kennymhx is on a distinguished road
Quote:
Originally Posted by sjlouie91 View Post
Hi Yousef,


I'm now trying to do the similar work because I need to get a sampled specified volume field for my LES simulation.

Although 'volRegion' can be used for the cellZone, I can only get the volume-averaged value for this cellZone rather than the values for each cell in this cellZone. The attached file that you give also shows the same problem.


So do you know any other utilities to get the values for each cell in the specified volume?



Best regards,
Jin
Dear Jin

I am now running across the same problem as you. Have you solved this problem? I know that 'volRegion' can be used for cellZone, but I can only get the volume-averaged value rather than the values for each cell in cellZone.



Kind regards,
Shawn
kennymhx is offline   Reply With Quote

Old   May 27, 2020, 17:49
Default
  #18
New Member
 
Matthieu ZUBIALDE
Join Date: Mar 2019
Posts: 2
Rep Power: 0
mzubiald is on a distinguished road
Hello,
I have finally found one solution to the above problem.
I am working on OpenFOAM 5.


1. Create a "topoSetDict" file into /system that contain:
Code:
actions
(
    // cellZone
    {
        name     user_cellZone;
        type       cellSet;
        action    new;
        source   boxToCell;
        sourceInfo
        {
            box (x_min y_min z_min)(x_max y_max z_max);
        }
    }
 );
2. Create the corresponding cellSet with the command line:
Code:
$ toposet
3. Convert cellSet to cellZone:
Code:
$ setsToZones
At this stage, you may have a file "user_cellZone" into "/constant/polyMesh/sets/" defining the cellSet and into the file "/constant/polyMesh/cellZones" the definition of the converted cellZone.

4. Add into "/system/controlDict"
Code:
functions
{    

    volFieldValue1
    {
        type                volFieldValue;
        libs                 ("libfieldFunctionObjects.so");
        log                  true;
        writeControl     writeTime;
        writeFields       true;
        regionType       cellZone;
        name               user_cellZone;
        operation         volAverage;
        fields
        (
            U
        );
    }
 }
5. Running the postProcess command you will obtain:
- the file volFieldValue.dat into /postProcessiong/volFieldValue1 containing the result of the cellZone volume average.
- into your latestTime folder, the file "U_cellZone-user_cellZone" containing the values of U for all the cells included into the cellZone.
mzubiald is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
sampling interval and sampling frequency beauty FLUENT 13 November 9, 2022 09:23
topoSet geometry than more than 1 box Grimoli OpenFOAM Pre-Processing 1 April 14, 2013 09:54
Creating a cellSet fom yPlus buffi OpenFOAM Post-Processing 0 December 17, 2012 05:19
[mesh manipulation] cellSet - how to define a hollow cylinder RugbyGandalf OpenFOAM Meshing & Mesh Conversion 2 December 17, 2012 03:34
sampling Data during calculation JimKnopf OpenFOAM Post-Processing 0 May 27, 2011 05:10


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