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

[snappyHexMesh] Advice on how to keep cells inside a closed contour

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2015, 12:37
Default Advice on how to keep cells inside a closed contour
  #1
New Member
 
Cristina Moreira
Join Date: Jan 2015
Location: Portugal
Posts: 28
Rep Power: 11
CrisMoreira is on a distinguished road
Hi Foamers,
I'm new to OF and so i'm struggling with a complex structure.
My structure has a curve configuration and on top of that there's a bunch of openings (see picture).
My problem is that after running SHM the contour of the structure+openings isn't deleted and only the cells between the openings and inside the contour are kept.
The .stl was created using Salome and with Helyx i saw that it was ok.
As you can see in the picture, the SHM is cutting the main contour (structure) but keeping the cells of the openings assuming that it isn't a contour.
I wanna create "holes" in the mesh to let the fluid pass through.
I tried to use a different .stl for the openings but the result was the same.
After some research i thought that maybe if i use multiRegionFeatureSnap the problem could be solved. But it persisted.

Can anyone, please, tell me if there's a way of doing this and give me some guidance?

Best regards

Cristina

Openings:
https://www.dropbox.com/s/ulcj371mt7...te181.bmp?dl=0

Problem:
https://www.dropbox.com/s/pq1pl8aoyo...tura2.png?dl=0

SHM:

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

// Which of the steps to run
castellatedMesh true;    // make basic mesh ?
snap            true;    // decide to snap back to surface ?
addLayers       true;   // decide to add viscous layers ?


geometry // Load in STL files here
{
    ramp.stl {type triSurfaceMesh; name ramp;}

    refinementBox {type searchableBox; min (0.0 0.0 0.32); max (9.86 0.33 0.54);}
};

castellatedMeshControls
{
    maxLocalCells 1000000;  //max cells per CPU core
    maxGlobalCells 2000000; //max cells to use before mesh deletion step
    minRefinementCells 10;  //was 0 - zero means no bad cells are allowed during refinement stages
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 1;  // expansion factor between each high & low refinement zone

    // Explicit feature edge refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    features // taken from STL from each .eMesh file created by "SurfaceFeatureExtract" command
    (
        {file "ramp.eMesh"; level 3;} 

    );

    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    refinementSurfaces // Surface-wise min and max refinement level
    {
    ramp {level (3 3);}

    }  


    resolveFeatureAngle 80;  // Resolve sharp angles // Default 30
    refinementRegions        // In descending levels of fine-ness
    {volume {mode distance; levels ((0.0006 4) (0.002 3) (0.01 2));}} // was ((0.001 4) (0.003 3) (0.01 2))
    locationInMesh (0 0.02 0);  //to decide which side of mesh to keep **
    allowFreeStandingZoneFaces true;
}


// Settings for the snapping.
snapControls
{
    nSmoothPatch 3;
    tolerance 4.0;
    nSolveIter 30;
    nRelaxIter 5;
    nFeatureSnapIter 15; // default is 10
    


implicitFeatureSnap false; // default is false - detects without doing surfaceFeatureExtract
explicitFeatureSnap true; // default is true
multiRegionFeatureSnap true; // deafault is false - detects features between multiple surfaces

}



// Settings for the layer addition.
addLayersControls //add the PATCH names from inside the STL file so STLpatchName_insideSTLName 
{
    relativeSizes false; // was true
    layers
    {

    }

    expansionRatio 1.3;
    finalLayerThickness 0.00016; //was 0.00016
    minThickness 0.00008; //was 0.00008
    nGrow 0; // was 1 


    // Advanced settings

    featureAngle 80; // was 70 //- When not to extrude surface. 0 is flat, 90 is right angle.
    nRelaxIter 3;  //- Max# of snapping relaxation iter. Should stop before upon reaching a correct mesh.
    nSmoothSurfaceNormals 1;  // Number of smoothing iterations of surface normals
    nSmoothNormals 3; // Number of smoothing iterations of interior mesh movement direction
    nSmoothThickness 10;  // Smooth layer thickness over surface patches
    maxFaceThicknessRatio 0.5; // Stop layer growth on highly warped cells
    maxThicknessToMedialRatio 0.3; // Reduce layer growth where ratio thickness to medial distance is large
    minMedianAxisAngle 130;  // Angle used to pick up medial axis points
    nBufferCellsNoExtrude 0;   // Create buffer region for new layer terminations
    nLayerIter 50; // Overall max number of layer addition iterations
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minFlatness 0.5;
    minVol 1e-13;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;

    // Advanced

    nSmoothScale 4;
    errorReduction 0.75;
}

// Advanced

debug 0;


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1E-6;
CrisMoreira is offline   Reply With Quote

Old   July 14, 2015, 14:30
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
if you post your entire case, then we can debug it. The issue isn't quite clear so we will need just a bit more information.
chegdan is offline   Reply With Quote

Old   July 14, 2015, 19:40
Default
  #3
New Member
 
Cristina Moreira
Join Date: Jan 2015
Location: Portugal
Posts: 28
Rep Power: 11
CrisMoreira is on a distinguished road
I'm so sorry Dan but i can't put here the entire case.
I know it's hard to help without further information but if you could only point me a direction of what could be wrong, i would appreciate it.

Best regards

Cristina
CrisMoreira is offline   Reply With Quote

Old   July 14, 2015, 19:47
Default
  #4
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Cristina,

No worries, it is most likely that your location in mesh is not within your opening itself and during the castellation step, the cells are swept away in the undesired region. Make sure that you have a the proper location (i.e. material point) for what represents your fluid region. If you are doing a CHT type simulation then you can think about the multregion support in snappy.
chegdan is offline   Reply With Quote

Old   July 22, 2015, 18:18
Default
  #5
New Member
 
Cristina Moreira
Join Date: Jan 2015
Location: Portugal
Posts: 28
Rep Power: 11
CrisMoreira is on a distinguished road
Hi Dan,

I'm sorry for the delay, i had to much work.

My mesh is 10x0.34x0.8 and the openings are ~ at 9.5m so the point, (0 0.02 0), in mesh is further away from the openings.

I'm not doing a CHT simulation so i had removed the multiregional option.

Right now i'm on a battle against time, but in a week or so i will try again.

Thank you so much for your help, i really appreciate it.

Best regards

Cristina
CrisMoreira is offline   Reply With Quote

Old   July 23, 2015, 11:24
Default
  #6
Member
 
DanielP
Join Date: Jan 2015
Posts: 33
Rep Power: 11
danielpiaget is on a distinguished road
Hello Cristina,

Regarding the stl surface file, have you included the curve part in your the stl surface file? Is your stl file a close surface ? Also, make sure that your initial mesh (generated with blockMesh I assume) englobes the entire stl surface before generating a mesh with snappy.

Regards,

Daniel
danielpiaget is offline   Reply With Quote

Old   July 23, 2015, 11:36
Default
  #7
New Member
 
Cristina Moreira
Join Date: Jan 2015
Location: Portugal
Posts: 28
Rep Power: 11
CrisMoreira is on a distinguished road
Hi Daniel,

First of all thank you for your reply.
Yes, i did and without the openings everything work just fine. The problem appears after the consideration of the openings.
I double check everything and couldn't find any problem regarding the .stl.
The base mesh was done using blockMesh, using a domain 10x0.34x0.8 that englobes all .stl surface.

Best Regards

Cristina
CrisMoreira is offline   Reply With Quote

Old   July 23, 2015, 12:16
Default
  #8
Member
 
DanielP
Join Date: Jan 2015
Posts: 33
Rep Power: 11
danielpiaget is on a distinguished road
Hello Cristina,

Then the problem seems to be coming from the intersection (for the openings) of the stl file and the base mesh. Before the Castellated mesh is generated, snappyHexMesh will compute all the edges of the base mesh that intersect the stl surface. The tolerance of the mesh (or resolution) plays an important part in finding out all the edges that intersect the stl surface.

I suggest that your blockMesh be a cube with perfect cubic elements (let's say 11 X 11 X11 with a subdivion in the xyz direction of 10). This will help in the Snap mesh step.Make sure that you have a big enough offset between the stl surface and the initial mesh surfaces.

Daniel
danielpiaget 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
Problem with divergence TDK FLUENT 13 December 14, 2018 06:00
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 08:54
snappyHexMesh in parallel - FOAM Fatal IO Error mturcios777 OpenFOAM Running, Solving & CFD 4 August 10, 2012 19:18
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23


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