In the meshing process, if the geometry has sharp angles that you want to resolve, then edge refinement is needed, otherwise, the meshed edge would look blunt, which is not acceptable.
One should play with four parameters when trying to control the quality of edge refinement.
Explicit features
includeAngle
, The angle controlling the explicit feature edge extractionfeatures
>level
, The explicit feature edge refinement level
Implicit features
resolveFeatureAngle
, The angle controlling the implicit feature edge resolutionrefinementSurfaces
>level(CRL SRL)
,the curvature refinement level after the surface refinement level
The extraction of explicit feature edges and the refinement around which
The explicit features edges can either be generated automatically by using the command surfaceFeatureExtract
or converted from obj
files generated in software like Blender with the command surfaceFeatureConvert
when people have more control over where he wants better refinement. Here the former method is introduced.
In the file surfaceFeatureExtractDict
, the parameter includedAngle
controls the extraction of the surface features. If the angle is larger than the includedAngle
value, the angle would be captured.
A larger value contributes to a better extraction. For example, If someone wants to capture the edge at a 175° obtuse angle as the feature edge, he has to set the includedAngle
to at least 175°.
surfacemesh.stl
{
...
{
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 150;
}
...
In the file snappyHexMeshDict
, choose the suitable refine level in the castellatedMeshControls
section.
castellatedMeshControls
{
...
// 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 "featureEdges.eMesh";
level 2;
}
);
...
In the terminal, the surfaceFeatureExtract
command will read the surfaceFeatureExtractDict
, extract the feature edges, and save the eMesh
file ready for snappyHexMesh to read.
It is worth mentioning that the explicit feature extraction is optional. Many users just skip it and instead uses refinement based on implicit features.
The implicit feature edge resolution and the curvature refinement level
Under the section castellatedMeshControls
in the dictionary snappyHexMeshDict
, the resolveFeatureAngle
value is used to decide whether to do curvature refinement. When the angle is larger than the resolveFeatureAngle
value, the cells will be further refined. In other words, a smaller value brings better resolution. Mind the angle in this figure, which is different from the angle in the above one in the previous section. In the same example, if I want to resolve the edge at a 175° obtuse angle as the feature edge, I have to set the resolveFeatureAngle
to less than 5°.
castellatedMeshControls
{
...
resolveFeatureAngle 30;
...
}
In the subsection refinementSurfaces
, call the surfaces where you want to refine and give the level
values. In this case, when the edge is resolved, snappyHexMesh will do curvature refinement to level 6, otherwise just simple surface refinement level 5.
castellatedMeshControls
{
...
refinementSurfaces
{
motorBike
{
//The surface refinement level and the curvature refinement level
level (5 6);
}
}
...
}
Play with the four parameters
Play with the four parameters, i.e. two angles and two levels, and you will get the satisfying refinement effect.
These are some case photos I saw on wolfdynamics.com, which could work as decent references.
You may notice in the last comparison, the small resolveFeatureAngle
value made the whole surface refined. In some cases, there are indeed obtuse angles to resolve and it seems we have to choose a small resolveFeatureAngle
, which may bring about something like a ‘global refinement’ we don't want. Actually, we can keep staying with a larger resolveFeatureAngle
and at the same time manually assign some edges >> for explicit feature edge refinement to use, then even if the patches are in the same plane, i.e. along a flat surface, we can still get the refinement we want.