CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] extrudeMesh from STL Surface (https://www.cfd-online.com/Forums/openfoam-meshing/100081-extrudemesh-stl-surface.html)

TRT April 19, 2012 15:32

extrudeMesh from STL Surface
 
EDIT: Solved below.

Hi everyone,

I'm having a problem when running extrudeMesh from an STL surface. I'm doing this because I'm having problems with running the tandem snappyHexMesh+extrudeMesh, but that is another whole story (that I may post about in the future). This is a test surface I wrote quickly in order to test:

./constant/triSurface/mesh.stl
Code:


solid mesh
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 1.0 1.0 0.0
      vertex 0.0 1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 1.0 -1.0 0.0
      vertex 0.0 -1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 -1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex -1.0 1.0 0.0
      vertex 0.0 1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex -1.0 -1.0 0.0
      vertex 0.0 -1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 -1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
endsolid mesh

This is my extrudeMeshDict file:

./system/extrudeMeshDict
Code:


/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      extrudeProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

constructFrom      surface;

surface            "./constant/triSurface/mesh.stl";

flipNormals        false;

extrudeModel        linearNormal;

nLayers            1;

expansionRatio      1.0;

linearNormalCoeffs
{
    thickness      5.0;
}

mergeFaces          false;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

After running extrudeMesh I get a mesh with no points, no faces and no cells. The output shows:
Code:


[...]

Extruding surface with :
    points    : 9
    faces      : 8
    normals[0] : (0 0 1)

Mesh bounding box : (-1 -1 -5) (1 1 5)
        with span : (2 2 10)
Merge distance    : 0.0002

Collapsing edges < 0.0002 ...

Merging edge (3 12) since length 0 << 0.0002
Merging edge (1 10) since length 0 << 0.0002
Merging edge (2 11) since length 0 << 0.0002
Merging edge (5 14) since length 0 << 0.0002
Merging edge (7 16) since length 0 << 0.0002
Cell:1 uses faces:5(0 1 2 17 25) of which too many are marked for removal:
    0 1 2
Cell:3 uses faces:5(1 3 4 19 27) of which too many are marked for removal:
    1 3 4

[...]



Does anyone know why this is happening, how to avoid this, or how is this supposed to be done?

Thanks in advance.

//************************************************** ******

EDIT: I noticed that the problem was caused because OpenFOAM calculates the normal by applying the right-hand rule to the vertices, and not with the facet normal entry. I should have taken this into account. By sorting the vertices accordingly the mesh is generated OK.

The .stl file should read:

./constant/triSurface/mesh.stl
Code:


solid mesh
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 1.0 1.0 0.0
      vertex 0.0 1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 1.0 0.0 0.0
      vertex 0.0 1.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 1.0 -1.0 0.0
      vertex 1.0 0.0 0.0
      vertex 0.0 -1.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 -1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex -1.0 1.0 0.0
      vertex -1.0 0.0 0.0
      vertex 0.0 1.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex -1.0 -1.0 0.0
      vertex 0.0 -1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 -1.0 0.0
      vertex -1.0 0.0 0.0
    endloop
  endfacet
endsolid mesh


ltiago94 March 26, 2018 07:15

hello,

what do you mean by changing the vertices? When you draw the geometry and later save in stl format, you have to draw each vertice in the same order as you drew the base block mesh?

Thanks

Tiago


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