|
[Sponsors] |
February 11, 2010, 07:06 |
jagged, ragged edges...
|
#1 |
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17 |
Dear everyone !
I am doing flow in 3D abdominal aorta. To create mesh I utilized snappyHexMesh. But I obtained strange jagged edges where inlet (outlet) patches are joining with rest of the mesh. I attached figures showing this problem. If some of you know how to deal with this issue pleas let me know !! Thanks Ziemowit Last edited by ziemowitzima; February 11, 2010 at 07:36. |
|
February 11, 2010, 07:11 |
|
#2 |
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17 |
Here is my snappyHexMeshDict:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | | \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh true; snap true; addLayers true; // Geometry. Definition of all surfaces. All surfaces are of class // searchableSurface. // Surfaces are used // - to specify refinement for any mesh cell intersecting it // - to specify refinement for any mesh cell inside/outside/near // - to 'snap' the mesh boundary to the surface geometry { aortwz.stl { type triSurfaceMesh; name aort; } inz.stl { type triSurfaceMesh; name in; } out1z.stl { type triSurfaceMesh; name out1; } out2z.stl { type triSurfaceMesh; name out2; } // refinementBox // { // type searchableBox; // min ( 0.07 0.05 -0.1); // max ( 0.26 0.25 0.2); // } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // Refinement parameters // ~~~~~~~~~~~~~~~~~~~~~ // While refining maximum number of cells per processor. This is basically // the number of cells that fit on a processor. If you choose this too small // it will do just more refinement iterations to obtain a similar mesh. maxLocalCells 1000000; // Overall cell limit (approximately). Refinement will stop immediately // upon reaching this number so a refinement level might not complete. // Note that this is the number of cells before removing the part which // is not 'visible' from the keepPoint. The final number of cells might // actually be a lot less. maxGlobalCells 2000000; // The surface refinement loop might spend lots of iterations refining just a // few cells. This setting will cause refinement to stop if <= minimumRefine // are selected for refinement. Note: it will at least do one iteration // (unless the number of cells to refine is 0) minRefinementCells 10; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 3; // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by its edges. // This is a featureEdgeMesh, read from constant/triSurface for now. features ( //{ // file "someLine.eMesh"; // level 2; //} ); // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies two levels for every surface. The first is the minimum level, // every cell intersecting a surface gets refined up to the minimum level. // The second level is the maximum level. Cells that 'see' multiple // intersections where the intersections make an // angle > resolveFeatureAngle get refined up to the maximum level. refinementSurfaces { aort { // Surface-wise min and max refinement level level (4 4); } in { // Surface-wise min and max refinement level level (4 4); } out1 { // Surface-wise min and max refinement level level (4 4); } out2 { // Surface-wise min and max refinement level level (4 4); } } // Resolve sharp angles resolveFeatureAngle 60; // Region-wise refinement // ~~~~~~~~~~~~~~~~~~~~~~ // Specifies refinement level for cells in relation to a surface. One of // three modes // - distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in // descending order. // - inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. // - outside. Same but cells outside. refinementRegions { // in // { // mode inside; // levels ((1E15 4)); // } } // Mesh selection // ~~~~~~~~~~~~~~ // After refinement patches get added for all refinementSurfaces and // all cells intersecting the surfaces get put into these patches. The // section reachable from the locationInMesh is kept. // NOTE: This point should never be on a face, always inside a cell, even // after refinement. locationInMesh (1.5 1.25 5); } // Settings for the snapping. snapControls { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 4; //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 4.0;//4 //- Number of mesh displacement relaxation iterations. nSolveIter 30; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 7; } // Settings for the layer addition. addLayersControls { relativeSizes true; // Per final patch (so not geometry!) the layer information layers { aort { nSurfaceLayers 2; } out1 { nSurfaceLayers 2; } out2 { nSurfaceLayers 2; } in { nSurfaceLayers 2; } } // Expansion factor for layer mesh expansionRatio 1; //- Wanted thickness of final added cell layer. If multiple layers // is the // thickness of the layer furthest away from the wall. // Relative to undistorted size of cell outside layer. finalLayerThickness 0.3; //- Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // Relative to undistorted size of cell outside layer. minThickness 0.1; //- If points get not extruded do nGrow layers of connected faces that are // also not grown. This helps convergence of the layer addition process // close to features. nGrow 1; // Advanced settings //- When not to extrude surface. 0 is flat surface, 90 is when two faces // make straight angle. featureAngle 60; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 1;//1 // Number of smoothing iterations of interior mesh movement direction nSmoothNormals 3; // Smooth layer thickness over surface patches nSmoothThickness 10; // Stop layer growth on highly warped cells maxFaceThicknessRatio 0.5; // Reduce layer growth where ratio thickness to medial // distance is large maxThicknessToMedialRatio 0.3; // Angle used to pick up medial axis points minMedianAxisAngle 130; // Create buffer region for new layer terminations nBufferCellsNoExtrude 0; // Overall max number of layer addition iterations nLayerIter 50; } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 65; //- Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 20; maxInternalSkewness 4; //- Max concaveness allowed. Is angle (in degrees) below which concavity // is allowed. 0 is straight face, <0 would be convex face. // Set to 180 to disable. maxConcave 80; //- Minimum projected area v.s. actual area. Set to -1 to disable. minFlatness 0.5; //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-13; //- Minimum face area. Set to <0 to disable. minArea -1; //- Minimum face twist. Set to <-1 to disable. dot product of face normal //- and face centre triangles normal minTwist 0.02; //- minimum normalised cell determinant //- 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; //- minFaceWeight (0 -> 0.5) minFaceWeight 0.02; //- minVolRatio (0 -> 1) minVolRatio 0.01; //must be >0 for Fluent compatibility minTriangleTwist -1; // Advanced //- Number of error distribution iterations nSmoothScale 4; //- amount to scale back displacement at error points errorReduction 0.75; } // Advanced // Flags for optional output // 0 : only write final meshes // 1 : write intermediate meshes // 2 : write volScalarField with cellLevel for postprocessing // 4 : write current intersections as .obj files 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; // ************************************************** *********************** // |
|
February 11, 2010, 07:38 |
|
#3 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Ziemowit,
In my limited experience, snappyHexMesh gets a bit annoyed when there are perpendicular edges. So, by what I know, you have two options:
I've read somewhere on this forum about defining line edges on the snappyHexMeshDict, but last time I saw something about it, it was still on the TODO list for snappyHexMesh Best Regards, Bruno Santos Last edited by wyldckat; February 11, 2010 at 07:40. Reason: missing a space :P |
|
February 12, 2010, 06:07 |
|
#4 |
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17 |
Hi Bruno,
Thanks for your quick answer and help. I tried to use Explicit feature edge refinement: features ( { file "someLine.eMesh"; level 2; } ); In the file someLine.eMesh I defined outflow edge (set of 132 points going around it circumference) and then edges. But this didnt improved anything. I think that it is because I defined 131 edges from point to point. Similar like in igloo example. Do you know how to use it to define one edge as spline for example ? Best Regards ZM |
|
February 12, 2010, 07:02 |
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Ziemowit,
Sadly, like I said, I have limited experience with snappyHexMesh. I have only dealt with the motorBike tutorial, and I have yet to test the igloo tutorial! And like I said, I don't know if they have already implemented the edge part of snappyHexMesh My last advice is to search this forum for "snappyHexMesh edge" and hope to find some thread that already answers your question, or that have asked the same issue about the edge feature! Best regards, Bruno Santos Last edited by wyldckat; February 12, 2010 at 07:03. Reason: typo... |
|
April 1, 2010, 00:46 |
|
#6 |
Member
|
My (perhaps incorrect) understanding is that cranking up the 60 in...
// Resolve sharp angles resolveFeatureAngle 60; Is intended to do this? Would you volunteer to experiment? My geometries at hand don't lend themselves to quickly inspecting this? Ben Racine |
|
April 1, 2010, 06:18 |
|
#7 |
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17 |
Hi Ben,
Thanks for you interest. Of course I will experiment with "Resolve sharp angles" value. But please let me know what value do u suggest ? 90 ? All Best Ziemowit |
|
June 24, 2010, 04:05 |
|
#9 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
I've written a little program that might help, I call it snapEdge.
http://openfoamwiki.net/index.php/Contrib_snapEdge |
|
June 24, 2010, 05:15 |
|
#10 |
Senior Member
stephane sanchi
Join Date: Mar 2009
Posts: 314
Rep Power: 18 |
Hi Niklas,
thanks a lot for the utility snapEdge. I would like to try it. Could you explain me how and where to install the directory snapEdge. Best Regards, Stephane. |
|
June 24, 2010, 05:33 |
|
#11 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
I updated the wiki with some instructions.
|
|
June 24, 2010, 06:20 |
|
#12 |
Senior Member
stephane sanchi
Join Date: Mar 2009
Posts: 314
Rep Power: 18 |
Hi Niklas,
I did another way for the installation. 1. Download snapEdge.tgz 2. Unpack it with 'tar zxfv snapEdge.tgz 3. Put the snapEdge folder in .../OpenFOAM/OpenFOAM-1.6.x/applications/utilities/preProcessing 4. Step back into .../OpenFOAM/OpenFOAM-1.6.x/ 5. ./Allwmake and then the snapEdge command runs well. Thanks a lot Niklas ! I have attached 2 snapshots of a cube (before and after using the snapEdge utility). I have used your own settings. The length of my cube is 10 meters. Maybe you know how to modify the settings (parameters) in order to obtain a perfect cube. Thanks again. Stephane. |
|
June 24, 2010, 07:20 |
|
#13 | |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
Quote:
// only move those points that are closer to the features than the tolerance*| edge length | tolerance 2.0; // 1.0 = move the points to the edge, 0 = dont move the point relaxation 1.0; // number of iterations to move points towards edge nIterations 1; |
||
June 24, 2010, 07:59 |
|
#14 |
Senior Member
stephane sanchi
Join Date: Mar 2009
Posts: 314
Rep Power: 18 |
hi,
no the result remains the same ! I attach a zipped tar file. If you have time you can try to improve the mesh. tar xvzf cube.tar.gz and run the following commands: blockMesh snappyHexMesh -overwrite snapEdge Regards, Stephane |
|
June 24, 2010, 08:30 |
|
#15 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
OK, no I see the problem. Your points are right on the vertices of the stl-triangles.
in snapEdge.C change Code:
if ((lam0 > 0.0) && (lam0 < 1.0)) Code:
if ((lam0 >= 0.0) && (lam0 <= 1.0)) Code:
if ((lam1 > 0.0) && (lam1 < 1.0)) Code:
if ((lam1 >= 0.0) && (lam1 <= 1.0)) |
|
June 24, 2010, 08:46 |
|
#16 |
Senior Member
stephane sanchi
Join Date: Mar 2009
Posts: 314
Rep Power: 18 |
Hi,
I made the changes. Now along the edges the mesh is perfect. Some small problems remain at the corners. Have a closer look at the second picture. Stephane. |
|
June 24, 2010, 08:48 |
|
#17 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
yeah, you have to live with that for now. I still dont know how to fix that
|
|
June 24, 2010, 09:14 |
|
#18 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
hmmm...try this
replace Code:
if (d0 < minDist0) Code:
if ((d0 < minDist0) && (d0 > VSMALL)) Code:
if (d1 < minDist1) Code:
if ((d1 < minDist1) && (d1 > VSMALL)) |
|
June 24, 2010, 09:52 |
|
#19 |
Senior Member
stephane sanchi
Join Date: Mar 2009
Posts: 314
Rep Power: 18 |
The grid at the corner is improved. Now the corner locations are right, but still a very small problem remains. Look at the attached picture. Thanks !
Stephane |
|
June 24, 2010, 10:18 |
|
#20 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
right,
the points can now belong to more than 1 edge and because of that you should decrease the tolerance to below 1, otherwise the corners will attract more points set tolerance 0.99 and this will fix it |
|
Tags |
edges, jagged edges, snappyhexmesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] snappyHexMesh sticking point | natty_king | OpenFOAM Meshing & Mesh Conversion | 11 | February 20, 2024 10:12 |
[snappyHexMesh] snappyHexMesh does not create any mesh except one for the reference cell | Arman_N | OpenFOAM Meshing & Mesh Conversion | 1 | May 20, 2019 18:16 |
[snappyHexMesh] sHM layer process keeps getting killed | MBttR | OpenFOAM Meshing & Mesh Conversion | 4 | August 15, 2016 04:21 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |