CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Native Meshers: snappyHexMesh and Others (http://www.cfd-online.com/Forums/openfoam-meshing-snappyhexmesh/)
-   -   SnappyHexMesh refuses to refine certain edges (http://www.cfd-online.com/Forums/openfoam-meshing-snappyhexmesh/101369-snappyhexmesh-refuses-refine-certain-edges.html)

TomP May 2, 2012 08:49

SnappyHexMesh refuses to refine certain edges
 
3 Attachment(s)
Dear all,

I have the following problem. I'm trying to mesh a radial fan with snappyHexMesh and for some reason it refines certain edges in the emesh file while it refuses to do it for others. Basically the blades are ok but the edges on the plates are not refined at all. Below you can find a picture of the mesh and the emesh file. The snappyHexMeshDict is also included in attachement. Anybody experienced this problem before?



Tom

mturcios777 May 2, 2012 12:41

Have you checked the eMesh files to ensure that the edge has been detected? Other than that, you may want to try changing the includedAngle option when running surfaceFeatureExtract. 91 seems to work pretty well for sharp edges.

TomP May 3, 2012 02:48

2 Attachment(s)
I investigated the issue somewhat further and so far this is what I found:
  • The edge is properly detected as can be seen in the second picture of my previous post. I used an angle of 150º which should detect all angles smaller than this value.
  • when I run snappyHexMesh it recognizes the feature edges but isn't able to find any featurePoints for the plates. I don't know what the definition of a featurePoint is but it seems to be the spot where a feature line starts. Because the feature edge is a circle there is no start and no end and therefore no FeaturePoints.
  • I can resolve it by setting the feature angle to 179. At that point the featureEdges are those of a cylinder with a certain number of sides (see the attached figures).
Personally I find this a rather bad fix (this setting also detect nearly every triangle in the blades) and I'm still wondering whether I'm doing something wrong or this just is a bug.

Tom

SirWombat May 3, 2012 04:46

Quote:

Originally Posted by TomP (Post 359012)
I don't know what the definition of a featurePoint is but it seems to be the spot where a feature line starts. Because the feature edge is a circle there is no start and no end and therefore no FeaturePoints.


I don't know either what FeaturePoints are, but you might try the following (as you probably already did for viewing the features in parafoam):

surfaceFeatureConvert TLR200x62E-real.eMesh TLR200x62E-real.obj

Then import the "TLR200x62E-real.obj" in Blender (www.blender.org).
  • Use MouseRightClick (==RMC) to select the Objects.
  • Use "A" to deselect.
  • Use "del" to delete objects, e.g. that standard box in the center.

Now enter Edit Mode by hitting "tab". You may now select single vertices on your "circle"-feature-edge and delete a few, so not to have a full circle.
http://www.nervus.de/openfoam/forum_20120503_1.jpg

After that, leave the Edit Mode by hitting "tab" again. Select all lines on screen using "Shift+RMC" or hit "A" twice. Then use "File -> Export -> Wavefront (.obj)" to export.

You may now convert the .obj back to your .eMesh file by using

surfaceFeatureConvert blender_edited_file.obj TLR200x62E-real.eMesh

I know this is a little tricky, especially when not having used Blender before, but it's a good way to get exactly those feature lines you want.

You may just attach your "stl", so we could give it a try.

Greets from Berlin,
SirWombat

TomP May 3, 2012 09:51

2 Attachment(s)
I agree that this is a workaround but not one I want to use when there are lots of these loops in my geometry. Also in blender I would not delete vertices because this removes the conected edges. It is better to select an edge (in edge select mode) an then press 'y'. This will separate this edge from the loop, effectively interupting the loop without loosing any valuable geometry. When you export to obj be sure to uncheck the export materials.
The resulting obj file isn't usable as such. Blender puts and f (probably from face) in front of the line definitions. This was quickly resolved by a find and replace in a text editor but it constitutes and extra step. Now you can convert the obj file back to the emesh format. But this file can't be used by snappyHexMesh. In the the header the time of creation is mentioned just before the object name. In a regular emesh file this is the location and snappyHexMesh needs the location or at least it doesn't like the creation date before the object name.
The result of this procedure is shown below. For the ring I interupted the edges and for the plate I did not. Still I think snappyhexMesh should recognize edge loops for refinement. I also added the stl file with the plates in attachement.

SirWombat May 4, 2012 03:24

Thx for the detailed description of the conversion from Blender .obj to OpenFOAM .eMesh I totally forget about that.
Seperating the edge instead of deleting a vertex seems a perfekt idea!

TomP May 10, 2012 08:15

1 Attachment(s)
A small update:
Feature points are points that are connected to more than 2 edges (e.g. corners of a cube). They are not the cause of the problems, because interrupting a loop actually brings down the number of connected edges.
So far edge refinement works as long as we interrupt the loop or we detect nearly every edge in the geometry. We just don’t know why.

There is something else I noticed. In the duct geometry for the fan I isolated the rim edge as a separate surface so that I could set a separate refinement level for it. Initially I only set the feature edge refinement level (of the rim) to a higher value but it didn’t refine near the rim. When I also raised the surface refinement level of the rim it still didn’t refine. Apparently I had to refine the attached housing geometry up to a certain level before it even noticed the rim. Once it “knows” it’s there everything again works as expected. Any thoughts on this?

lovecraft22 May 10, 2012 09:14

This may be a silly question but have you tried increasing this value here:

Quote:

nFeatureSnapIter 10;

kalle June 13, 2012 08:45

Resolved.

http://www.openfoam.org/mantisbt/view.php?id=552

Rophys October 24, 2013 10:31

3 Attachment(s)
Hi all,

I'm having some problems to get a very defined curve using the sHM. Please, see images attached. Anyone have some idea in how to improve this part of my mesh ?

I already tried the surfaceFeatureExtract and it didn't work.

Thanks a lot.

Tobi October 25, 2013 06:13

Hi Rophys,

you have to refine the cells in this Region.
Therefor you have a lot of opportunitys to do that.

a) Refine the surface there
b) build a closed surface around this Corner and refine the Region there
c) normally it should be possible to do it with the featureEdges (but as you said it is not working)

Your Problem does not depend on the "surfaceFeatureExtract". This tool is for exploding the edges out of your geometry so that openfoam can snap the cell vertex to that lines. But if you have just one cell that goes around the whole curve it is not possible to get a better resolution :)

Regards Tobi

Rophys October 25, 2013 06:34

Thanks Tobi,

I'll try your hints. :D

NejcB February 8, 2014 05:58

Quote:

Originally Posted by Rophys (Post 458800)
Hi all,

I'm having some problems to get a very defined curve using the sHM. Please, see images attached. Anyone have some idea in how to improve this part of my mesh ?

I already tried the surfaceFeatureExtract and it didn't work.

Thanks a lot.

Hi Rophys,

Maybe you could try with the minVolCollapseRatio enabled under meshQualityControls.

Regards,
Nejc

OvGU November 14, 2014 22:39

surface refinement problem
 
1 Attachment(s)
I was able to creat a layer and refinement over surface but still found some refinement problem on surface. If anybody can give some idea ...........


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;//false; // decide to add viscous layers ?


geometry // Load in STL files here
{
inlet_1.stl {type triSurfaceMesh; name inlet_1;}
outlet.stl {type triSurfaceMesh; name outlet;}
inlet_2.stl {type triSurfaceMesh; name inlet_2;}
inlet_3.stl {type triSurfaceMesh; name inlet_3;}
wall.stl {type triSurfaceMesh; name wall;}
//cylinder.stl {type triSurfaceMesh; name volume;}
refineCylinder {type searchableCylinder; point1 (0 0 0); point2 (0 0 2); radius 0.13;}
//refinementBox {type searchableBox; min (-0.5 -0.5 -0.5); max ( 0.5 0.5 0.5);}
};

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 "inlet_1.eMesh"; level 2;}
{file "outlet.eMesh"; level 2;}
{file "wall.eMesh"; level 3;}
{file "inlet_2.eMesh"; level 2;}
{file "inlet_3.eMesh"; level 2;}
);

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

refinementSurfaces // Surface-wise min and max refinement level
{
inlet_1 {level (2 2);}
outlet {level (2 2);}
wall {level (5 5);}
inlet_2 {level (2 2);} // was 4 4
inlet_3 {level (2 2);} // was 4 4
}


resolveFeatureAngle 80; // Resolve sharp angles // Default 30
refinementRegions // In descending levels of fine-ness
{refineCylinder {mode distance; levels ((1E15 2));}} // (0.002 3) (0.01 2));}} // was ((0.001 4) (0.003 3) (0.01 2))
locationInMesh (0.01 0.01 0.01); //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

// New settings from openfoam 2.2 onwards for SHMesh

implicitFeatureSnap false; // default is false - detects without doing surfaceFeatureExtract
explicitFeatureSnap true; // default is true
multiRegionFeatureSnap false; // 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
{
wall
{nSurfaceLayers 3;} // was 3
//visc_refine_1
// {nSurfaceLayers 3;} // was 3
//visc_refine_2
// {nSurfaceLayers 3;} // was 3
}

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;


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