CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Mesh structure of Open Foam. (https://www.cfd-online.com/Forums/openfoam/72589-mesh-structure-open-foam.html)

shinde.gopal February 11, 2010 01:22

Mesh structure of Open Foam.
 
Hi Foamers,

Can anybody explain me the underlying mesh connectivity of the mesh generated in OpenFoam by blockMesh.

Or

the reference where should I look for the same ?

rgds,
-Gopal :(

elvis February 11, 2010 09:46

Hello i do not know if this information is still valid (i mean using -blockTopology argument to dump out a blockTopology.obj file)http://openfoamwiki.net/index.php/BlockMesh

and can not try blockmesh right now.
But try to visualise some blockmesh-examples with the help of VTK (for example visit http://www.llnl.gov/visit/ mayavi http://mayavi.sourceforge.net/ or paraview that comes with OF)

just my 2 cents

elvis

tomislav_maric February 12, 2010 02:05

Check out the doxygen documentation: there you'll find the mesh classes. Doxygen is your friend. ;)

The basic idea is that you have a global pointField that holds all the mesh points.

The position of the points in this pointField is your connection to all the upper topologies: face, cell, even the patches, sets and zones... their core is in this idea.. because the upper sets are just lists of the lower ones. :D

like this:


Code:

pointField myLittleMeshPoints (3, point(0,0,0));

// let's make a triangle
myLittleMeshPoints[0] = point (0,0,0);
myLittleMeshPoints[1] = point (1,0,0);
myLittleMeshPoints[2] = point (1,1,0);

// create the label list for the face:
// check out Foam::face constructor, and
// you'll see that the constructor takes
// a label list reference as an argument.
//  face (const labelList &)
// NEVER PASS OBJECTS AS ARGUMENTS,
// ALWAYS REFERENCES.
// I'm just saying. :D

labelList myLittleFaceLabels (3,0);

// give the values of the label list
 // myLittleFaceLabels the position
// of the points in the global mesh
// pointField myLittleMesh

forAll (myLittleFaceLabels, labelI)
{
    myLittleFaceLabels[labelI] = labelI;
}

// call the constructor for the face.
face myLittleFace (myLittleFaceLabels);

// As the face is the list of point labels
// in the global mesh pointField, so is
// the cell a list of faces: a list of lists
// of labels in the global mesh pointField.
// This way you don't copy a bunch of
//  Foam::Vector<Cmpt> or Vector<scalar>
//  or point or vector (read: point) but instead
//  use the labels for the connectivity.

Try creating 4 points for a tetrahedron. create 4 faces manually as I've described. Create a face list. That's your cell. Check out the primitiveMesh constructor. Create the mesh from two of these cells. :) And so on... practice makes headache. :) Just kidding....

johndeas March 25, 2010 11:31

When defining a face from a list of point as per your example, does the ordering of the points matters ?

Will it matter when computing surface flux latter, for example ?

EDIT

Just found my answer in the user guide :)

sega March 25, 2010 11:37

Quote:

Originally Posted by johndeas (Post 251650)
When defining a face from a list of point as per your example, does the ordering of the points matters ?

Will it matter when computing surface flux latter, for example ?

Yes it matters: User Guide, 5.3.1.4

"The order in which the vertices are given must be such that, looking from inside the block and starting with any vertex, the face must be traversed in a clockwise direction to define the other vertices."

tomislav_maric March 25, 2010 12:26

Quote:

Originally Posted by johndeas (Post 251650)
When defining a face from a list of point as per your example, does the ordering of the points matters ?

Will it matter when computing surface flux latter, for example ?

EDIT

Just found my answer in the user guide :)

One interesting thing I found is that you may have multiple points appearing in the pointField that are connected to one face (face label list may have multiple global labels inside). If you are calculating the fluxes, and everything else that's Foam::mag dependent, it makes no difference. Still, I've managed to avoid multiple points so far. :D
I'm working on a 2D solver (gathering 3D cell centered data for the interpolation) so I just need to be careful to have the counter clockwise oriented polygons (that's what faces are) so that my area is calculated positively. Or, as the U-Guide states:
Code:

if (inside and looking out)
{
    clockwise orientation to get the outward pointing normal
}

If for some reason you need the opposite orientation, use

Code:

Foam::face Foam::face::reverseFace()
but this won't give you the handle on the points.

pvpnr May 29, 2012 16:33

Quote:

Originally Posted by tomislav_maric (Post 245796)
Check out the doxygen documentation: there you'll find the mesh classes. Doxygen is your friend. ;)

The basic idea is that you have a global pointField that holds all the mesh points.

The position of the points in this pointField is your connection to all the upper topologies: face, cell, even the patches, sets and zones... their core is in this idea.. because the upper sets are just lists of the lower ones. :D

like this:


Code:

pointField myLittleMeshPoints (3, point(0,0,0));

// let's make a triangle
myLittleMeshPoints[0] = point (0,0,0);
myLittleMeshPoints[1] = point (1,0,0);
myLittleMeshPoints[2] = point (1,1,0);

// create the label list for the face:
// check out Foam::face constructor, and
// you'll see that the constructor takes
// a label list reference as an argument.
//  face (const labelList &)
// NEVER PASS OBJECTS AS ARGUMENTS,
// ALWAYS REFERENCES.
// I'm just saying. :D

labelList myLittleFaceLabels (3,0);

// give the values of the label list
 // myLittleFaceLabels the position
// of the points in the global mesh
// pointField myLittleMesh

forAll (myLittleFaceLabels, labelI)
{
    myLittleFaceLabels[labelI] = labelI;
}

// call the constructor for the face.
face myLittleFace (myLittleFaceLabels);

// As the face is the list of point labels
// in the global mesh pointField, so is
// the cell a list of faces: a list of lists
// of labels in the global mesh pointField.
// This way you don't copy a bunch of
//  Foam::Vector<Cmpt> or Vector<scalar>
//  or point or vector (read: point) but instead
//  use the labels for the connectivity.

Try creating 4 points for a tetrahedron. create 4 faces manually as I've described. Create a face list. That's your cell. Check out the primitiveMesh constructor. Create the mesh from two of these cells. :) And so on... practice makes headache. :) Just kidding....

can you tell exactly how this type of tetrahedron can be created

maalan July 7, 2015 09:18

Quote:

Originally Posted by tomislav_maric (Post 245796)
Check out the doxygen documentation: there you'll find the mesh classes. Doxygen is your friend. ;)

The basic idea is that you have a global pointField that holds all the mesh points.

The position of the points in this pointField is your connection to all the upper topologies: face, cell, even the patches, sets and zones... their core is in this idea.. because the upper sets are just lists of the lower ones. :D

like this:


Code:

pointField myLittleMeshPoints (3, point(0,0,0));

// let's make a triangle
myLittleMeshPoints[0] = point (0,0,0);
myLittleMeshPoints[1] = point (1,0,0);
myLittleMeshPoints[2] = point (1,1,0);

// create the label list for the face:
// check out Foam::face constructor, and
// you'll see that the constructor takes
// a label list reference as an argument.
//  face (const labelList &)
// NEVER PASS OBJECTS AS ARGUMENTS,
// ALWAYS REFERENCES.
// I'm just saying. :D

labelList myLittleFaceLabels (3,0);

// give the values of the label list
 // myLittleFaceLabels the position
// of the points in the global mesh
// pointField myLittleMesh

forAll (myLittleFaceLabels, labelI)
{
    myLittleFaceLabels[labelI] = labelI;
}

// call the constructor for the face.
face myLittleFace (myLittleFaceLabels);

// As the face is the list of point labels
// in the global mesh pointField, so is
// the cell a list of faces: a list of lists
// of labels in the global mesh pointField.
// This way you don't copy a bunch of
//  Foam::Vector<Cmpt> or Vector<scalar>
//  or point or vector (read: point) but instead
//  use the labels for the connectivity.

Try creating 4 points for a tetrahedron. create 4 faces manually as I've described. Create a face list. That's your cell. Check out the primitiveMesh constructor. Create the mesh from two of these cells. :) And so on... practice makes headache. :) Just kidding....


Hi Tomislav!

I'm trying to build a cylinder made of points by using pointField. If you have a look at the pointField class, you'll see that the write function is missing, so can I write and read this list of points in file? Up to the moment I've been able of writing them by using:

OFstream cylinderPoints("cylinderPoints");

but I'm sure that something better can be done... :D

Regards,
--
Antonio


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