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

Volume sampling on the run

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By tomf
  • 1 Post By zhangyan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 28, 2020, 22:19
Default Volume sampling on the run
  #1
Member
 
Join Date: May 2017
Posts: 41
Rep Power: 8
Ryan. is on a distinguished road
Hi,

is there any OpenFOAM function object similar to surfaceSampling but for the volume? I want to sample a volume region or the whole domain on the run. I don't want to do the reconstruction as it's time-consuming and I am only interested in a small region near the outlet.

thanks in advance,
Ryan

Last edited by Ryan.; April 28, 2020 at 22:19. Reason: volume sampling, runtime sampling, VTK, Openfoam
Ryan. is offline   Reply With Quote

Old   April 30, 2020, 10:34
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 634
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

I am not sure what you exactly want to do, but maybe the volFieldValue functionObject is of help?

It uses a volRegion for doing some stuff.

This means you would need a cellSet or cellZone and then probably you need to specify whatever you need in the volFieldValue part.

I am not sure what the limitations are. Maybe you can make a small case to experiment on.

Good luck,
Tom
Ryan. likes this.
tomf is offline   Reply With Quote

Old   May 4, 2020, 02:44
Default
  #3
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 11
zhangyan is on a distinguished road
Maybe you can try this:
https://github.com/StachuraMichal/Op...sampleCellZone
Ryan. likes this.
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   May 6, 2020, 19:02
Default
  #4
Member
 
Join Date: May 2017
Posts: 41
Rep Power: 8
Ryan. is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
Thanks a lot. This is precisely what I was looking for. The only issue is that it only writes the points to the file but doesn't write the mesh. Do you know how to append the mesh to the samples?
Ryan. is offline   Reply With Quote

Old   January 31, 2022, 10:39
Default
  #5
Senior Member
 
Lukas Fischer
Join Date: May 2018
Location: Germany, Munich
Posts: 117
Rep Power: 7
lukasf is on a distinguished road
Hi Ryan,


have you found a solution to sample volumes and to visualize those with paraview?


Happy for any help.


Lukas
lukasf is offline   Reply With Quote

Old   January 31, 2022, 18:02
Default
  #6
Member
 
Al Csc
Join Date: Jul 2018
Posts: 30
Rep Power: 7
al.csc is on a distinguished road
Quote:
Originally Posted by lukasf View Post
Hi Ryan,


have you found a solution to sample volumes and to visualize those with paraview?


Happy for any help.


Lukas
Here an example for ESI version:

Code:
functions
{
    type    sets;
    libs    (sampling);
    log     on;
    enabled true;

    writeControl    timeStep;
    writeInterval   1;
    setFormat       raw; //or vtk for Paraview
    interpolationScheme cell;
    fields ( U );
    sets
    (
        centres
        {
            type    cellCentre;
           bounds  (0 0 0) (0.1 0.1 0.1);
        }
    );
}

Paste it at the end of your controlDict and adjust it for your case.

Cheers!
al.csc is offline   Reply With Quote

Old   February 2, 2022, 09:21
Default
  #7
Senior Member
 
Lukas Fischer
Join Date: May 2018
Location: Germany, Munich
Posts: 117
Rep Power: 7
lukasf is on a distinguished road
Quote:
Originally Posted by al.csc View Post
Here an example for ESI version:

Code:
functions
{
    type    sets;
    libs    (sampling);
    log     on;
    enabled true;

    writeControl    timeStep;
    writeInterval   1;
    setFormat       raw; //or vtk for Paraview
    interpolationScheme cell;
    fields ( U );
    sets
    (
        centres
        {
            type    cellCentre;
           bounds  (0 0 0) (0.1 0.1 0.1);
        }
    );
}
Paste it at the end of your controlDict and adjust it for your case.

Cheers!
Hi Ryan,


thank you.

I works. However, when I want to visualize the .vtk files with ParaView I do not like the way the file is displayed. Somehow, it only consists out of points.

Hence, I prefer this way:


Code:
    volFieldValue1
    {
        type                volFieldValue;
        libs                 ("libfieldFunctionObjects.so");
        log                  false; //true;
        writeControl adjustableRunTime;
        writeFormat     ascii; //binary;
        writeInterval 1e-5;
        writeFields       true;//writes the fields of the volume
        //timeStart       0;
        //timeEnd         1000;
        regionType       cellSet; //cellZone;
        name               box; // box is the cellSet or cellZone defined by the topoSetDict
        operation         none; 
        fields
        (
            U T p
        );
    }
However, this code did not work for the ESI version v1912. The fields where just empty. However, using version V2112 (same code) results in all values written into the files.

One receives a file in postProcessing/volFieldValue1 which is not important.
The volume field is directly written to the time directories or time directories of the processor0.

In this directory I run this command.

Code:
                         foamToVTK -cellSet box -useTimeName -excludePatches '(".*")' -noFaceZones
This way I get .vtk files which are visualized more nicely in ParaView.
Moreover, I source a non ESI openfoam Version for the foamToVTK command because this way the "-useTimeName" is available which I prefer.
lukasf 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
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 04:37
surface sampling during simulation run moh-farmani OpenFOAM Programming & Development 1 July 18, 2016 02:19
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 07:09
[Commercial meshers] CuBit t42 OpenFOAM Meshing & Mesh Conversion 6 July 10, 2008 07:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


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