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

sampleDict over a surface doubles number of points

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 12, 2015, 06:07
Question sampleDict over a surface doubles number of points
  #1
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 9
Zen is on a distinguished road
Hello,

I have a very simple straight pipe simulation and I want to sample the final velocity U over a cross section of the pipe perpendicular to the streamwise direction at a certain location downstream of the inlet.

Everything works fine. However, I can see that my sampled U has twice as many values as the number of cell centres in my mesh (e.g. sampled U values= 1000, number of cell centres in mesh=500) and the same happens for the faceCentres file.

I have a structured mesh and, if I plot the sampled corss section, I can see my structured cells have been divided into triangles. Hence the double number of points.

Is there a way to deactivate this option?

Thanks for your attention,

Z
Zen is offline   Reply With Quote

Old   November 12, 2015, 06:56
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,926
Rep Power: 35
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Here is an excerpt from example sampleDict (located at $FOAM_APP/utilities/postProcessing/sampling/sample)

Code:
    constantPlane
    {
        type            plane;    // always triangulated
        basePoint       (0.0501 0.0501 0.005);
        normalVector    (0.1 0.1 1);

        //- Optional: restrict to a particular zone
        // zone        zone1;

        //- Optional: do not triangulate (only for surfaceFormats that support
        //            polygons)
        //triangulate     false;
    }
So you can try to add "triangulate false;" to your cutting plane description.
alexeym is offline   Reply With Quote

Old   November 12, 2015, 07:46
Default
  #3
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 9
Zen is on a distinguished road
Hi Alex,

Thanks for the reply. Attached is the sampleDict file for reference:

Code:
setFormat raw;

surfaceFormat foamFile;

interpolationScheme cell;

fields
(
        U
);

surfaces
(
  smoothU
  {
        type                    plane;
        basePoint               (0.001 0 0);
        normalVector            (1 0 0);
        //interpolate           true;
        traingulate             false;
  }
);
I've tried what you suggested but with no success, the number of U values and faceCenters values is still double than that of the number of cell centres.

I've also tried the following option:

Code:
        interpolate           true;
        //traingulate             false;
And this time the number of U values is equal to the number of points necessary to specify the verteces of each cell of the surface but still not equal to the number of cell centres. By 'verteces' of a cell I mean that if, for example, you have only one rectangular cell, its cell centre would be specified by one point only but 4 points are needed to specify its vertices.

I've also played around with the various interpolationScheme options but with no success.

P.S. I'm using openfoam-2.4.0
Zen is offline   Reply With Quote

Old   November 12, 2015, 09:08
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,926
Rep Power: 35
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

I do not know what am I doing wrong but here is my sampleDict

Code:
setFormat raw;
surfaceFormat foamFile; // vtk;
interpolationScheme cellPoint;

fields
(
    U
    p
);

sets
(
);

surfaces
(
    normal-plane
    {
        type            plane;
        basePoint       (2.5 0 0);
        normalVector    (1 0 0);
        interpolate     true;
	triangulate     false;
    }
);
And sample utility produces foamFile (or VTK) with exactly the same number of cells and points as patch inlet has (unfortunately I do not have compiled 2.4.0, so I tested it on 2.4.x). Geometry is cylindrical tube 5 m long in x direction, mesh is fully hexagonal.

You can find whole case folder at https://github.com/mrklein/foam-case.../master/sample.
alexeym is offline   Reply With Quote

Old   November 12, 2015, 10:09
Default
  #5
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 9
Zen is on a distinguished road
Thanks for the reply!

I tested your code and found out 2 things:

- The number of points in the faceCentres file is indeed the number of cell centres in your mesh (2912)
-However, the number of points in the U or p files is 2969 which is equal to the number of points in the 'points' file containing the coordinates of the cell vertices.

I took a snapshot with paraview to show where the velocity and pressure are defined (see attachment).

I do not know whether this happens also in your case or it is just my case.

Thanks,

Z
Attached Images
File Type: png points.png (36.2 KB, 60 views)
Zen is offline   Reply With Quote

Old   November 12, 2015, 10:26
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,926
Rep Power: 35
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Sorry, I have reread your posts, but still can not understand what you expect from points.

In case of tube, if we cut mesh with a plane normal to flow direction with triangulation being switched off, number of cells (or as it is plane - number of faces) should be equal to number of faces in inlet patch (and this is the case).

However number of vertices (points) should be greater than number of faces.
alexeym is offline   Reply With Quote

Old   November 12, 2015, 10:53
Default
  #7
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 9
Zen is on a distinguished road
Dear Alex,

I agree that number of cells (or faces) at the cut should be equal to that of the inlet patch and that the number of vertices should be greater.

However, I would expect the fields (U,p, etc) to be defined at the cell centres and thus be as many as the number of faces. However this is not the case as there are as many U (or p) values as the number of points in the sampled U (and p) files.

This means that these values are defined at the vertices whereas I would like to have them at the cell centres.
Zen is offline   Reply With Quote

Old   November 12, 2015, 15:08
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,926
Rep Power: 35
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well,

This sampleDict:

Code:
...
surfaceFormat foamFile;
interpolationScheme cell;
...
surfaces
(
    normal-plane
    {
        type            plane;
        basePoint       (2.5 0 0);
        normalVector    (1 0 0);
        interpolate     false;
        triangulate     false;
    }
);
Produces data files with 2912 data values (in scalarField/p and vectorField/U). Is it what you would like to get?
alexeym is offline   Reply With Quote

Old   November 13, 2015, 03:30
Default
  #9
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 9
Zen is on a distinguished road
Yes, that's exactly what I would like to have.
I've tried the settings above with of-2.4.0 and your test case and everything works fine but if I try with my test case cells are triangulated, I'm not really sure why.

Here is a link to the test case for reference: https://github.com/ZenBel/sample

Thanks again for the help,

Z
Zen is offline   Reply With Quote

Old   November 13, 2015, 04:56
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,926
Rep Power: 35
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Just a typo. Your plane description contains "traingulate" instead of "triangulate".
alexeym is offline   Reply With Quote

Old   November 13, 2015, 05:06
Default
  #11
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 9
Zen is on a distinguished road
I hate myself.

Thanks a lot Alex for your time and help!

Z
Zen is offline   Reply With Quote

Reply

Tags
double, number, sampledict, triangles

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
decomposePar -allRegions stru OpenFOAM Pre-Processing 2 August 25, 2015 03:58
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 12 August 7, 2015 18:45
[blockMesh] --> foam fatal error: lillo763 OpenFOAM Meshing & Mesh Conversion 0 March 5, 2014 10:27
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
CFX4.3 -build analysis form Chie Min CFX 5 July 12, 2001 23:19


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