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

Sampling surfaces

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2009, 07:28
Default Sampling surfaces
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello World.

I have found it very useful to create foamFile's out of sample when sampling surfaces.

Is it possible to write these foamFiles with the appropriate headers?
Is there even a way of omitting the distinctive folders for scalar or vector fields?

S.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 21, 2009, 18:39
Default
  #2
Member
 
Eelco Gehring
Join Date: Mar 2009
Posts: 70
Rep Power: 17
feijooos is on a distinguished road
Sega,

I have some problems with sampling surfaces. I was wondering if you can point me in the right direction?

I want to sample the heat transfer coefficient that I output on the bottom wall of my domain. The heat transfer coefficient is defined as a surfaceScalarField. How do I set up my sampleDict to sample this surface?

Thanks
feijooos is offline   Reply With Quote

Old   July 22, 2009, 02:49
Default
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
As far as I can tell you this is rather simple.
Is assume the "bottom" is identical to a boundary patch?
If that's true you can sample this patch by putting its name to patchName:
Code:
surfaces(
    nameOfYourSampleSurface
    {
        type            patch;
        patchName       nameOfYourPatch;
    }
);
And don't forget to specify an appropriate output format
Code:
// Surface output format. Choice of
//      null        : suppress output
//      foamFile    : separate points, faces and values file
//      dx          : DX scalar or vector format
//      vtk         : VTK ascii format
//      raw         : x y z value format for use with e.g. gnuplot 'splot'.
//      stl         : ascii stl. Does not contain values!
surfaceFormat vtk;
Hope this helps.
ships26 likes this.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 22, 2009, 03:42
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by sega View Post
Is it possible to write these foamFiles with the appropriate headers?
As a quick hack that almost always works, you can force writing of the headers only. See, for example, the cellTable::writeDict() method in
src/conversion/meshTables/cellTable.C for an idea of how you might do it.

/mark
olesen is offline   Reply With Quote

Old   July 22, 2009, 06:00
Default
  #5
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Yes, looks like something I intend to do, but I'm not getting to it.

I don't see where I can input the class and object entries.
Is there some mapping involved?! (IOMap<...>)
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 23, 2009, 15:24
Default
  #6
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi,

does anyone know, if there is an option for the foamFile output, which omits the output of the points and faces except for the last write out? This would help saving disk space.

Fabian
nishant.kumar likes this.
braennstroem is offline   Reply With Quote

Old   July 27, 2009, 13:41
Default
  #7
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Quote:
Originally Posted by braennstroem View Post
Hi,

does anyone know, if there is an option for the foamFile output, which omits the output of the points and faces except for the last write out? This would help saving disk space.

Fabian
I'm not sure about this.
Maybe you can have a look into the code of the sample tool and find the place where the points and faces files are written.

Maybe you can wrap these lines in an if-Statement which checks if the last time step is reached.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   November 8, 2009, 03:09
Default
  #8
Member
 
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 17
sven is on a distinguished road
Unfortunately i dont completely understand how you sample surfaces. As far as I saw, this is what I have to put in my control dict-file:
Code:
surfaces(
    nameOfYourSampleSurface
    {
        type            patch;
        patchName       nameOfYourPatch;
    }
);
This leads to two questions:

  1. What is the difference between nameOfYourSampleSurface and nameOfYourPatch? Isnt this the same?
  2. How exactly d I put the lines above in the controlDict? like this
    Code:
    probes1
        {
            // Type of functionObject
            type probes;
    
            // Where to load it from (if not already in solver)
            functionObjectLibs ("libsampling.so");
            
            // Fields to be probed. runTime modifiable!
            fields
            (            
                gradT
            );
           
    
           outputControl outputTime;
            outputInterval 2;
    
    
    
           surfaces(
           NameOfYourSampleSurface
           {
            type            patch;
            patchname           YourPatchName; 
           }
           );
    
        }
Thanks a lot!
sven is offline   Reply With Quote

Old   November 8, 2009, 06:26
Default
  #9
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Quote:
Originally Posted by sven View Post
Unfortunately i dont completely understand how you sample surfaces. As far as I saw, this is what I have to put in my control dict-file:
Code:
surfaces(
    nameOfYourSampleSurface
    {
        type            patch;
        patchName       nameOfYourPatch;
    }
);
Yes and No. Your code is right so far, but you have to put it into a system/sampleDict! But together with many other informations about the sampling-process itself.

An example of a complete sampleDict can be found in
OpenFOAM/OpenFOAM-1.6/applications/utilities/postProcessing/sampling/sample/sampleDict

Quote:
Originally Posted by sven View Post
What is the difference between nameOfYourSampleSurface and nameOfYourPatch? Isnt this the same?
With the code mentioned above you will sample a patch which will be a boundary of your flow.
With patchName (nameOfYourPatch) you will define which patch you want to sample according to its name in blockMesh and with nameOfYourSampleSurface you will give the sample output a name.
So, the output file will be named after the latter.

Quote:
Originally Posted by sven View Post
How exactly d I put the lines above in the controlDict?
As mentioned above you will have to put the lines into its own dictionary.

Get back to us If you have further questions!
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   December 8, 2009, 09:45
Default sampling near to a curved surface
  #10
New Member
 
Cárdenas
Join Date: Sep 2009
Posts: 5
Rep Power: 17
carmir is on a distinguished road
Hello to All,

I have a question concerning the sample utility, and since I already got some help from this thread, I posted it here instead of creating a new one.

I'm simulating the flow past a circular cylinder and I'm interested in the skin friction (dU/dr) along its no slip surface. My idea is to get the velocity components at the cell centers of the first cell-row, and with the coordinates of the corresponding points compute afterwards in Matlab the gradients.

With the help of this thread I was able to sample the velocity fields on the cylinder surface using the patch option of the sample utility, but instead of getting the cell-center values, I got the surface values, which are of course zero (No slip boundary condition). Is there a posibility to sample the values at the center of the cells attached to the boundary patch? Here is my sampleDict file:

Code:
  8 FoamFile
  9 {
 10     version     2.0;
 11     format      ascii;
 12     class       dictionary;
 13     location    "system";
 14     object      sampleDict;
 15 }
 16 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 17
 18 setFormat     raw;
 19
 20 surfaceFormat raw;
 21
 22 interpolationScheme cell;
 23
 24 fields
 25 (
 26    U
 27 );
 28
 29 sets
 30 (
 31 );
 32
 33 surfaces
 34 (
 35        Zylinder
 36         {
 37            type         patch;
 38            patchName    CYLINDER;
 39         }
 40 );
 41
Thank you very much in advance for any help and suggestions.

Alejandro
carmir is offline   Reply With Quote

Old   December 8, 2009, 11:22
Default
  #11
Member
 
Eelco Gehring
Join Date: Mar 2009
Posts: 70
Rep Power: 17
feijooos is on a distinguished road
Alejandro,

Of course you are getting the values at the surface, since you've specified that:

33 surfaces
34 (
35 Zylinder
36 {
37 type patch;
38 patchName CYLINDER;
39 }

Look into sampling a field instead of a surface. There is a example 'sampleDict' in applications/utilities/postProcessing/sampling/sample which can help you out.
feijooos is offline   Reply With Quote

Old   December 8, 2009, 14:37
Default
  #12
Member
 
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 17
sven is on a distinguished road
I think there are better ways to do what you want. There are two post processing tools you can use:

  1. wallShearStress, which calculates the wall shear stress at each patch (note that the number itself is already divided by density)
  2. wallGradU which calculates the velocity gradient at each boundary, which is exactly what you want
I hope this helps.

Sven
sven is offline   Reply With Quote

Old   December 9, 2009, 08:59
Default
  #13
New Member
 
Cárdenas
Join Date: Sep 2009
Posts: 5
Rep Power: 17
carmir is on a distinguished road
Eelco, thanks for the confirmation, so the surface sample makes only sense for values other than the imposed ones.

Sven, both utilities wallShearStress and wallGradU helped me a lot, thank you very much for the hint. They even give the derivatives already in normal and tangential direcctions, exactly in the way I need them.

So, thanks again!

Alejandro
carmir is offline   Reply With Quote

Old   April 2, 2010, 12:51
Default
  #14
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
panda60 is on a distinguished road
Dear Sebastian,
Have you solve your problem ? Maybe the things we want to do is the same.
I use functionObject to sampling internal surface data, and will generate many folders, like scalarField, vectorField. The data format whick TimeVaryingMappedFixedValue needed is a little difference from sampling data. Because I have 100000 time steps, and total 150 G space. If modify every time step data one by one will need a lot of time. Maybe we can make our own code to do this convertion, but 150G data is also a large work.
So the best way is to sample the data and save to correct data format and folder.
Do you have some commont ?
Thank you.
panda60 is offline   Reply With Quote

Old   April 27, 2010, 09:08
Default
  #15
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
panda60 is on a distinguished road
Dear all,
How can I create my own functionObject ?
my purpose is to extract a plane data of internal domain in every time step, and save to disk.
I noticed "surfaces functionObject" can do the similar thing, so I want to modify surfaces functionObject.I found it belongs to sampling,
So I copy src/sampling directory to another position.
I changed the name to LIB = $(FOAM_USER_LIBBIN)/libmysampling.

in sampling\sampledSurface\sampledSurfaces, I found 2 places had name "surfaces",

*.H file:
public:
//- Runtime type information
TypeName("surfaces");
*.C文file:
PtrList<sampledSurface> newList
(
dict.lookup("surfaces"),
sampledSurface::iNew(mesh_)
);

I changed these "surfaces" to "mysurfaces", and compiled, no problem.
but when I used, had the following mistake,

Starting time loop
--> FOAM Warning :
From function dlLibraryTable:pen(const dictionary& dict, const word& libsEntry, const TablePtr tablePtr)
in file lnInclude/dlLibraryTableTemplates.C at line 68
library "libmysampling.so" did not introduce any new entries

Unknown function type mysurfaces
Valid functions are :
5
(
surfaces
fieldAverage
fieldMinMax
sets
probes
)

From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 89.
FOAM exiting

It seems that my modified name haven't been registed in functionObject.
Could anyone can give me some help ?

Thanks.

I am using like this in my controlDict file:
extraction
{
type mysurfaces;
functionObjectLibs ("libmysampling.so");
enabled true;
outputControl timeStep;
outputInterval 1;
surfaceFormat foamFile;
interpolationScheme cellPointFace;
fields
(
U
T
);
mysurfaces
(
aplane
{
type plane;
basePoint (-0.4 0 0.5);
normalVector (1.0 0 0);
}
);
}
panda60 is offline   Reply With Quote

Old   May 27, 2010, 04:27
Default
  #16
New Member
 
Subodh Kumar
Join Date: Apr 2009
Location: India
Posts: 9
Rep Power: 17
Subodh is on a distinguished road
Send a message via Yahoo to Subodh
Hello Panda,

It might be late to reply your post.
you are getting those error because you might have forgotten to override following virtual functions, and to add FuctionObjects header file and C file in your mysampling directory, and of course include functionObject.C in Make/files file.

updateMesh(const mapPolyMesh&)

movePoints(const pointField&)
Subodh is offline   Reply With Quote

Old   May 28, 2010, 03:03
Default vortex shedding frequency
  #17
Senior Member
 
NAVEEN.K.M
Join Date: Mar 2009
Location: Bangalore, Karnataka, india
Posts: 114
Rep Power: 17
naveen is on a distinguished road
hi,

myself Naveen working on flow around a circular cylinder of diameter 2m using OpenFOAM 1.4.1 and 1.5 versions past 1 month. I am getting pressure and velocity contours correctly in both the versions.I am facing difficult to get the vortex shedding frequency in OpenFOAM.

Can you please suggest me how to get the strouhal number and vortex shedding frequency in OpenFOAM 1.5.

Flow conditions (laminar flow):

Reynolds number---------> 150 (based on cylinder diameter)
velocity------------------------>1 m/s
viscosity------>0.01333 m2/sec(based on cylinder diameter)
diameter of cylinder--------> 2 meters
OpenFOAM version-------->1.4.1, 1.5
solver----------------------------->icoFoam

can you please give me a suggestion how to get these values using the probes function and FFT.

waiting for your response

Regards,

Naveen
naveen is offline   Reply With Quote

Old   May 28, 2010, 06:47
Default
  #18
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
panda60 is on a distinguished road
Dear Subodh Kumar,

I modified the original sample tool in OpenFOAM-1.6/SRC directory and recompile again. If it will bring some risk to my simulation ?

Because I don't know how functionObject works. For example, If I generate another functionObject "libmysampling.so" , and then I delete this libmysampling.so , if this new name still exists in functionObject list ?
panda60 is offline   Reply With Quote

Old   May 28, 2010, 11:45
Default
  #19
New Member
 
Subodh Kumar
Join Date: Apr 2009
Location: India
Posts: 9
Rep Power: 17
Subodh is on a distinguished road
Send a message via Yahoo to Subodh
Hello Panda,

No, modifying sample utility not bring any risk to your simulation. sample is not at all related to simulation. It is a post processing tool, which you could used after simulation.

According to me modifying sample is not a good idea, because you will not be able to get standard behavior of it if you need in future, thats why it is always recommended to customize and created new library according to your requirements.

Library and Functionobject are two different thing. Library could be used for many purposes for example to convert Cartesian coordinate to cylindrical, or to calculate and print parameters values at every iteration and stuff like that. FunctionObject is a way through which a exe is asked to repeat a action at every iteration.

Now if we want to calculate something and print it at every iteration then we create a functionObject in controlDict file and in body of functionObject we load library by command " functionObjectLibs ("libmysampling.so"); ".

To answer your another question, if you have deleted the library that you are loading through functionObject, then OpenFOAM will throw error, saying your library does not exist. If you have deleted the library and not loading it through functionObject then there should not be any problem at all.

Above is my understanding about Function Object and library, Please correct me if I am wrong.
Subodh is offline   Reply With Quote

Old   May 29, 2010, 09:39
Default
  #20
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
panda60 is on a distinguished road
Dear Subodh Kumar,

Thank you very much. Now I am little understand. I think you are right. Modifying the original one is not a good idea.
panda60 is offline   Reply With Quote

Reply

Tags
sample


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
Importing or Creating 2D Flat Surfaces into CFX Sam CFX 5 March 30, 2013 12:11
creating new surfaces fluentguy FLUENT 1 May 7, 2009 04:34
Faceted surfaces in ICEM Chriss Main CFD Forum 1 May 6, 2008 16:18
Surfaces lost from ICEM to CFX-Pre 5.7 Mark CFX 6 October 1, 2004 00:07
Surfaces Mark FLUENT 2 February 9, 2004 11:41


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