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

[snappyHexMesh] SHM Causing STL to become blocky/pixelated

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 2 Post By Yann
  • 1 Post By CfdUser5855
  • 1 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 10, 2022, 14:00
Exclamation SHM Causing STL to become blocky/pixelated
  #1
New Member
 
Anon
Join Date: Dec 2020
Posts: 20
Rep Power: 3
CfdUser5855 is on a distinguished road
Hi All,

When I run SHM on my current case, it ruins the quality of the STL. I've tried a host of different SHM setups, but from reading of others issues, the most important changes I've made are changing Explicit feature edge refinement levels, and included angle in surfaceFeatureExtract from 180 down to 120 in 10 degree intervals. But neither of these helps

Attached is my SHM file, and images of how my STL looks before and after SHM.=, and a third image shows the SHM from the outside of the domain.

Any advice would be greatly appreciated


FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
castellatedMesh true;
snap true;
addLayers true;


geometry
{

refinementBox
{
type searchableBox;
min (-2233 -2451600 -2000);
max (44 -2440000 -1000);
}
DuneField
{
type triSurfaceMesh;
file "DuneField.stl";
}


};



// Settings for the castellatedMesh generation.
castellatedMeshControls
{

// Refinement parameters
// ~~~~~~~~~~~~~~~~~~~~~

maxLocalCells 100000000;

maxGlobalCells 200000000;

minRefinementCells 0;

maxLoadUnbalance 0.10;

nCellsBetweenLevels 8;

features
(
{
file "DuneField.eMesh";
level 2;
}
);

refinementSurfaces
{
DuneField
{
// Surface-wise min and max refinement level
level (5 5);
}

}

// Resolve sharp angles
resolveFeatureAngle 30;


// Region-wise refinement
// ~~~~~~~~~~~~~~~~~~~~~~

refinementRegions
{
/* refinementBox
{
levels ((0 1));
mode inside;
} */
}


// Mesh selection
// ~~~~~~~~~~~~~~


locationInMesh (-1000 -2450000 -1600);

allowFreeStandingZoneFaces true;
}



// Settings for the snapping.
snapControls
{

nSmoothPatch 5;

tolerance 1.0;

nSolveIter 30;

nRelaxIter 5;

nFeatureSnapIter 10;

implicitFeatureSnap false;

explicitFeatureSnap true;

multiRegionFeatureSnap false;
}



// Settings for the layer addition.
addLayersControls
{
relativeSizes true;

// Per final patch (so not geometry!) the layer information
layers
{
/* Mesa
{
nSurfaceLayers 3;
} */
}

// Expansion factor for layer mesh
expansionRatio 1.1;

finalLayerThickness 0.2;

minThickness 0.1;

nGrow 0;

featureAngle 60;

slipFeatureAngle 30;

nRelaxIter 3;

nSmoothSurfaceNormals 1;

nSmoothNormals 3;

nSmoothThickness 10;

maxFaceThicknessRatio 0.5;

maxThicknessToMedialRatio 0.3;

minMedianAxisAngle 90;


nBufferCellsNoExtrude 0;

nLayerIter 50;
}


meshQualityControls
{
// #include "meshQualityDict"

maxNonOrtho 45;
// Advanced
maxBoundarySkewness 0.1;

maxInternalSkewness 0.1;


maxConcave 80;


minVol 1e-13;


minTetQuality 1e-30;


minArea -1;

minTwist 0.01;

minDeterminant 0.001;

minFaceWeight 0.05;

minVolRatio 0.01;

minTriangleTwist -1;

nSmoothScale 4;

errorReduction 0.75;
}

writeFlags
(
scalarLevels
layerSets
layerFields // write volScalarField for layer coverage
);

mergeTolerance 1e-6;
Attached Images
File Type: jpg Screenshot from 2022-05-10 17-51-53.jpg (91.5 KB, 20 views)
File Type: jpg Screenshot from 2022-05-10 17-52-28.jpg (92.1 KB, 14 views)
File Type: jpg Screenshot from 2022-05-10 17-59-19.jpg (103.7 KB, 14 views)
CfdUser5855 is offline   Reply With Quote

Old   May 11, 2022, 04:12
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 563
Rep Power: 19
Yann will become famous soon enough
Hi Anon,

On your screenshot it looks like castellated mesh. Are you running snappyHexMesh with the overwrite option? If not, are your displaying the last timestep in paraView?

Regards,
Yann
Yann is offline   Reply With Quote

Old   May 11, 2022, 05:31
Default
  #3
New Member
 
Anon
Join Date: Dec 2020
Posts: 20
Rep Power: 3
CfdUser5855 is on a distinguished road
HI Yann,

I do not have the overwrite option in my SHM file, but the images were taken when I was using the last time step from the process


What do you think the issue might be?
CfdUser5855 is offline   Reply With Quote

Old   May 11, 2022, 06:27
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 563
Rep Power: 19
Yann will become famous soon enough
Hard to say, could you post your snappyHexMesh log to see if there is any helpful information in it?

You seem to have a relatively high aspect ratio in your initial mesh. Considering your domain I understand why you do so, but snappy does a better job at snapping mesh to geometry when the initial mesh aspect ratio is close to 1. So maybe you can try to adjust your blockMesh settings to have an aspect ratio of 1 and see if the final mesh is better with this setting. (You can mesh only a portion of your full domain if it gets too heavy to mesh the full domain)

I hope this helps,
Yann
Yann is offline   Reply With Quote

Old   May 11, 2022, 06:43
Default
  #5
New Member
 
Anon
Join Date: Dec 2020
Posts: 20
Rep Power: 3
CfdUser5855 is on a distinguished road
Hi Yann,

While improving the aspect ratio has not changed much, increasing the resolution of the mesh does slightly improve it (but even a resolution of ~1 m is still causing blocks to form). I've attached the log file of the run, I hope there's something in there that will shine a light on the issue.


Thank you for having a look at this
Attached Files
File Type: txt SHM_Log.txt (114.2 KB, 2 views)
CfdUser5855 is offline   Reply With Quote

Old   May 11, 2022, 07:07
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 563
Rep Power: 19
Yann will become famous soon enough
I missed it in your previous post but is there a reason why you changed the non orthogonality and skewness parameters in the meshQualityControls?

Try meshing with the default meshQualityControls and see if you get a better snapping.

Yann
Yann is offline   Reply With Quote

Old   May 11, 2022, 07:16
Default
  #7
New Member
 
Anon
Join Date: Dec 2020
Posts: 20
Rep Power: 3
CfdUser5855 is on a distinguished road
Hi Yann,

If you're referring to the post about the SHM not refining, the reason my parameters are different is honestly only because it finally allowed the mesh to refine.


When you say default meshQualityControl, do you mean what I have in my previous post?
CfdUser5855 is offline   Reply With Quote

Old   May 11, 2022, 07:26
Default
  #8
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 563
Rep Power: 19
Yann will become famous soon enough
No I mean the default mesh quality setup:

Code:
maxNonOrtho 65;

maxBoundarySkewness 20;
maxInternalSkewness 4;
AtoHM and CfdUser5855 like this.
Yann is offline   Reply With Quote

Old   May 11, 2022, 07:37
Default
  #9
New Member
 
Anon
Join Date: Dec 2020
Posts: 20
Rep Power: 3
CfdUser5855 is on a distinguished road
Hi Yann,


Fantastic, that solved it. Slight quality issues but I think if I smooth the STL and then retry, that will be it perfect.


Thank you so much for your help with this, you've saved a real headache
Attached Images
File Type: jpg Screenshot from 2022-05-11 11-34-13.jpg (82.0 KB, 8 views)
Yann likes this.
CfdUser5855 is offline   Reply With Quote

Old   May 11, 2022, 07:50
Default
  #10
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 563
Rep Power: 19
Yann will become famous soon enough
Glad I could help!

To elaborate a bit further: having stricter mesh quality parameters means snappy will have less room to snap/morph the mesh to conform it to your geometry.

If you have a look at your snappy log file, during the morphing phase you can see a lot of cells/faces trigger errors due to your low tolerance on non-orthogonality and skewness. This is probably why snappy struggles to snap the mesh properly.

Code:
Checking initial mesh ...
Checking faces in error :
    non-orthogonality > 45  degrees                        : 42328
    faces with face pyramid volume < 1e-13                 : 0
    faces with face-decomposition tet quality < 1e-30      : 0
    faces with concavity > 80  degrees                     : 0
    faces with skewness > 0.1 (internal) or 0.1 (boundary) : 7496
    faces with interpolation weights (0..1)  < 0.05        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.01                           : 0
    faces on cells with determinant < 0.001                : 0
Detected 49824 illegal faces (concave, zero area or negative cell pyramid volume)
Checked initial mesh in = 0.74 s
Cheers,
Yann
CfdUser5855 likes this.
Yann is offline   Reply With Quote

Reply

Tags
blockmesh, snappyhexmesh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[CAD formats] Creating waterproof STL using snappyHexMesh or salome Tobi OpenFOAM Meshing & Mesh Conversion 58 May 13, 2020 07:01
[CAD formats] Degenerate triangles in STL for use in sHM Dreoasteh OpenFOAM Meshing & Mesh Conversion 1 September 27, 2017 11:17
[snappyHexMesh] Checkinf if SHM stl files are watertight fracasce OpenFOAM Meshing & Mesh Conversion 2 April 25, 2017 07:50
[snappyHexMesh] SHM does not follow STL geometry well Illmatic OpenFOAM Meshing & Mesh Conversion 7 July 23, 2016 12:07
[snappyHexMesh] sHM with cyclic patch on stl geometry johannesk OpenFOAM Meshing & Mesh Conversion 2 August 21, 2009 10:08


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