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

[mesh manipulation] Extract exteral surface from cellZone

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By fernexda
  • 1 Post By keitaro7_14

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2015, 16:06
Default Extract exteral surface from cellZone
  #1
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Dear all,

after spending a lot of time looking for this I couldn't find any answer, so I ask here.

I have a body (cylinder) and I've got his cells defined in a cellZone. I'd like to create a faceZone of the lateral surface of the cylinder. It is the body shown on the picture attached.

I've tried almost every option from topoSet, but I couldn't find an option to extract only the surface.

Is it possible to extract the lateral surface on a faceZone ???

Thank you very much for any answer.
Attached Images
File Type: jpg slidingCircle.jpg (46.5 KB, 81 views)
fernexda is offline   Reply With Quote

Old   January 23, 2015, 15:07
Default New formulation
  #2
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hi,
I've thought I may explain my problem in another way. It can be easily understood with the attached picture.

  • I have a 3D mesh with a cylinder inside (from which I have a cellZone and a faceZone)
  • I want a 2D mesh so I execute extrudeMesh
  • The problem is : the faceZone disappears after the extrusion !
I guess the faceZone changes because the mesh is extruded... But then why are inlet and outlet still there after the extrusion ?
I've tried creating a patch from the cylinder faceZone (with createBaffles) to see if it would also be kept after the extrusion, but it disappears... And I really need this faceZone...

I'm a bit desperate with this, and I would really appreciate any suggestion !

here is my extrudeMesh :
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      extrudeMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// What to extrude:
//      patch   : from patch of another case ('sourceCase')
//      mesh    : as above but with original case included
//      surface : from externally read surface

constructFrom patch;
sourceCase "../patch/";
sourcePatches (back);

// If construct from patch: patch to use for back (can be same as sourcePatch)
exposedPatchName front;

// Flip surface normals before usage. Valid only for extrude from surface or
// patch.
flipNormals true;

//- Linear extrusion in point-normal direction
extrudeModel        linearNormal;

nLayers             1;

expansionRatio      1.0;

linearNormalCoeffs
{
    thickness       1;
}

// Do front and back need to be merged? Usually only makes sense for 360
// degree wedges.
mergeFaces false;   //true;

// Merge small edges. Fraction of bounding box.
mergeTol 0;
Attached Images
File Type: jpg extrudeMesh.jpg (20.7 KB, 88 views)
fernexda is offline   Reply With Quote

Old   January 24, 2015, 14:27
Default
  #3
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Daniel,

This might be a bug in OpenFOAM 2.3.0 and it might have already been solved in 2.3.1.
The detail is that "faceZones" are not true patches, they are only reference lists of faces in the mesh, with some details on the normals for the zone; in other words, it contains only just enough information for some operations, it does not contain the full details needed for a proper patch.

Nonetheless, if the "cellZone" is preserved after extruding, then you should be able to extract a "faceSet" and/or "faceZone" from it.
Have a look at the main example file, whose path is given by the following command:
Code:
echo $FOAM_UTILITIES/mesh/manipulation/topoSet/topoSetDict
The steps should be something like:
  1. Create a "cellSet" from the existing "cellZone", by using:
    Code:
    source zoneToCell;
  2. Then do a "faceSet" from the new "cellSet", by using:
    Code:
    source cellToFace;
  3. Then create the "faceZone" from the "faceSet", by using:
    Code:
    source setToFaceZone;
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 25, 2015, 04:57
Default
  #4
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hi Bruno, thanks for the answer.

I've tried the exact same procedure you suggested, but the problem comes from the command to extract the faceSet from the cellSet :
Code:
source cellToFace;
It is defined as follows :
Code:
    {
        name    slidingCircle;
        type    faceSet;
        action  new;
        source  cellToFace;
        sourceInfo
        {
            option    all;//both
            set    slidingCircle;
        }
    }
The problem is that with both sourceInfo options (all AND both), the faces INSIDE the cylinder are also extracted (see pictures). And I only want the outer faces (and even better if I could have only the lateral faces).

I'll try to update to OF231 and keep you posted.
Attached Images
File Type: png faceZone.png (6.7 KB, 41 views)
File Type: png faceZone_zoom.png (5.4 KB, 70 views)
fernexda is offline   Reply With Quote

Old   January 25, 2015, 05:31
Default
  #5
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hello again,

I've tried with OF231 with the same results... Even when I create two patches (with createBaffles) before the extrusion, they disappear after the extrusion.

So extrudeMesh seems to delete faces from
  • faceSet
  • faceZone
  • patches...
This seems to be a problem without a solution... Or does anyone know how to prove me wrong ?
fernexda is offline   Reply With Quote

Old   January 25, 2015, 10:40
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Daniel,

Can you please provide a test case for testing this? Because setting one up takes quite a long time to do so.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 25, 2015, 14:00
Default
  #7
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hi Bruno,
thanks for taking the time.

An example case can be found here (sorry it's rather big because of the stl geometry...) :

https://cloud.utc.fr/public.php?serv...f5b53df8ececcc

I'm using snappyHexMesh, but I'm having bad mesh quality, although I'm doing a 2D simulation. So to improve the mesh quality I've tried to used the idea from here : http://upcommons.upc.edu/pfc/bitstre...9/1/memory.pdf, which consist in the following process :

  1. snappyHexMesh with
    Code:
    castellatedMesh true;
    snap            false;
    addLayers       false;
  2. extrudeMesh
  3. snappyHexMesh with
    Code:
    castellatedMesh false;
    snap            true;
    addLayers       false;


The main difference with the pdf above, is that I create a faceZone and a cellZone (slidingCircle) with snappyHexMesh. The problem is that after extruding (step 2), the faceZone from the slidingCircle disappears, and I think the snapping process (from step 3) requires this faceZone to run correctly.


That why I was trying to recover that faceZone.


In the end, the slidingCircle is supposed to rotate inside the background mesh. And the mesh quality is so great with snappyHexMesh that I would love finding a solution to this, instead of using unstructured mesh.


Thank you for your advice.


Regards,
Daniel
fernexda is offline   Reply With Quote

Old   January 25, 2015, 16:21
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Daniel,

OK, now I have a clearer understanding of what's going on!
I'm even surprised that extrudeMesh is able to preserve the "cellZone", based only in the "front" patch to create the new mesh.

The solution is theoretically simple enough: you need in the second pass with snappyHexMesh to also include the castellation step, but in this pass, you should not use the refinement levels. In other words, try using:
Code:
    refinementSurfaces
    {
       slidingCircle
       {
            level           (0 0);

            faceZone        slidingCircle;
            faceType        boundary;
            cellZone        slidingCircle;
            cellZoneInside  inside;
        }
    }
Attached is the file "meshFiles.tar.gz" that has the proposed modification; STL file was omitted. This way you don't even need to use topoSet.

The downside is that the primary "slidingCircle" faceZone looks a bit strange, but the second one, namely "slidingCircle_slave" looks fine.

Best regards,
Bruno
Attached Files
File Type: gz meshFiles.tar.gz (22.8 KB, 13 views)
wyldckat is offline   Reply With Quote

Old   January 26, 2015, 04:32
Default
  #9
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hi Bruno,

thank you SO MUCH for finding this solution !! I had lost hope to go any further in this mesh creation !

So now it works just fine except, as you said, the boundary of the slidingCircle that doesn't look good at all (see picture attached)...

The outer mesh seems ok, but the inner mesh seems somehow to have snapping troubles...

I've tried changing some parameters (meshQuality, snapping parameters, with explicit feature edges refinement) but I couldn't decrease this gap...

Any idea on how to make it better ?

Thanks again for spending so much time on this.

Regards,
Daniel
Attached Images
File Type: jpg mesh_gap.jpg (32.5 KB, 50 views)
fernexda is offline   Reply With Quote

Old   January 26, 2015, 12:10
Default
  #10
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hi !
So the only parameter that seems to make a difference is refining the
Code:
feature
in the castellatedMeshControls... But the result still looks crapy (see attachement).

This is strange, because when I process in this order :
  1. castellation AND snapping steps
  2. extrudeMesh
the interface is much better (although the main quality is worse and the process takes longer, since the snapping process operates on more cells).


I'm losing faith in SHM... I wish there was a version for 2D meshes.


But still, is there are any suggestions, I'd be delighted
Attached Images
File Type: png error_SHM.png (4.6 KB, 36 views)
fernexda is offline   Reply With Quote

Old   January 26, 2015, 15:47
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer:
  • snappyHexMesh is only able to do as good a job as the base mesh you give it. Have a look at this thread: http://www.cfd-online.com/Forums/ope...mesh-used.html - and read/study as many posts on that thread as you can!
  • In addition, try foamyHexMesh... better yet, try foamyQuadMesh.
wyldckat is offline   Reply With Quote

Old   January 28, 2015, 08:21
Default
  #12
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Hi,

I've tried what you suggested, but nothing worked... I'll try to figure something else then.

And I wanted to thank you for the time you've spent on my case, it's such a pleasure to see how fast and efficiently we get answers on this forum
fernexda is offline   Reply With Quote

Old   January 28, 2015, 15:15
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by fernexda View Post
And I wanted to thank you for the time you've spent on my case, it's such a pleasure to see how fast and efficiently we get answers on this forum
You got lucky this time I have several posts on my to-do list that are waiting since October 2014 or even farther in the past

Another suggestion is to try SwiftBlock and/or SwiftSnap:
wyldckat is offline   Reply With Quote

Old   January 30, 2015, 11:34
Default
  #14
Member
 
daniel fernex
Join Date: Oct 2014
Location: Braunschweig, Germany
Posts: 36
Rep Power: 11
fernexda is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
  • snappyHexMesh is only able to do as good a job as the base mesh you give it.
That is VERY right And now I've solved my problem !

The thing is, snappying right after the castellation gave me very poor mesh quality, hence the extrusion in between.

BUT the problem is that my background mesh only had 1 cell in the Z direction, and since the snappying process is 3D, it was having troubles to snap cells that are very small on x and y, but huge on z...

So I've put cells in the Z direction of the background mesh, and the mesh resulting from castel+snap is perfect ! So I can extrude normally after this and I avoid the strange surface problem.

I'm friend again with snappyHexMesh
wyldckat likes this.
fernexda is offline   Reply With Quote

Old   December 10, 2021, 04:16
Default
  #15
Member
 
JuanMi
Join Date: Nov 2017
Posts: 41
Rep Power: 8
keitaro7_14 is on a distinguished road
Quote:
Originally Posted by fernexda View Post
Hi Bruno, thanks for the answer.

I've tried the exact same procedure you suggested, but the problem comes from the command to extract the faceSet from the cellSet :
Code:
source cellToFace;
It is defined as follows :
Code:
    {
        name    slidingCircle;
        type    faceSet;
        action  new;
        source  cellToFace;
        sourceInfo
        {
            option    all;//both
            set    slidingCircle;
        }
    }
The problem is that with both sourceInfo options (all AND both), the faces INSIDE the cylinder are also extracted (see pictures). And I only want the outer faces (and even better if I could have only the lateral faces).

I'll try to update to OF231 and keep you posted.
Although the thread has been resolved, I would like to add one additional point.

With the procedure initially outlined by wyldckat, it is possible to get the faceZone using the delete action. We can select all the faces with the option all, and then substract the internal faces with option both.

Here my proposal ( I hope it can be useful to someone)

Code:
    {
        name    slidingCircle;
        type    faceSet;
        action  new;
        source  cellToFace;
        sourceInfo
        {
            option    all;
            set    slidingCircle;
         }
     }
     {
        name    slidingCircle;
        type    faceSet;
        action  delete;
        source  cellToFace;
        sourceInfo
        {
            option    both;
            set    slidingCircle;
         }
      }
derekm likes this.
keitaro7_14 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
[snappyHexMesh] Surface triangulation using snappyHexMesh shaileshbg OpenFOAM Meshing & Mesh Conversion 4 October 17, 2019 04:42
cellZone not taking all the cells inside rahulksoni OpenFOAM 0 January 16, 2019 01:16
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan OpenFOAM Meshing & Mesh Conversion 3 October 22, 2015 11:05
[snappyHexMesh] snappyHexMesh matches wrong cells to CellZone Siegunn OpenFOAM Meshing & Mesh Conversion 4 July 31, 2015 05:10
[waves2Foam] waveNGauges for extract surface elevation affected forces? hchen OpenFOAM Community Contributions 6 June 18, 2015 02:48


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