snappyHexMesh enable patch refinement for refinementRegions similar to refinementSurfaces
Functionality to add/problem to solve
Add the possibility to set refinementRegions for individual patches of a geometry. This is already possible in refinementSurfaces so workload for implementation should be feasable.
Target audience
In CFD, we often have to define boundary layer regions close to the surface of a geometry. Especially for WMLES the thickness may vary greatly for individual parts of the surface, thus individual patch addressing by setting distance refinemed is very benificial in comparison to only being able to address the whole geometry. I believe that this change should not be tough to implement but is a nice QoL addition from which all fellow SHM-users can benefit. Many users may find this especially useful if they have a geometry with several individual elements. One example may be a profile with multiple elements, where one may want to set distance refinement individually for each of the elements based on there flow importance.
Detailed explanation
In order to refine individual patches of a geometry from a geometry file, I currently have to extract the patch as an additional geometry file and include it as another refinement region to use it for shell refinement.
This works well with surface-only geometry together with distance refinement, so why should it not be possible to directly apply region refinement from geometry patches as well? It is possible for refinementSurfaces but why not for refinementRegions?
As I am working with a geometry with several dozen surfaces to be individually refined, this creates many unnecessary and essentially duplicate files from the main geometry.
Here a simplified excerption of the code that I have to do at the moment to achieve surface distance refinement:
"CRMHL_WB_09222022_NoDomain_BLT_1.obj.gz"
{
type triSurfaceMesh;
regions
{
ww_wing_SS_01 { name ww_wing_SS_01; }
ww_wing_SS_02 { name ww_wing_SS_02; }
}
name Airplane_Body;
}
"CRMHL_WB_09222022_NoDomain_BLT_1_ww_wing_SS_01.obj.gz" { type triSurfaceMesh; }
"CRMHL_WB_09222022_NoDomain_BLT_1_ww_wing_SS_02.obj.gz" { type triSurfaceMesh; }
refinementSurfaces
{
Airplane_Body
{
level ($resMin $resMin);
regions
{
ww_wing_SS_01 { level ($LSS01 #eval{$LSS01} ); }
ww_wing_SS_02 { level ($LSS02 #eval{$LSS02} ); }
}
}
}
refinementRegions
{
Airplane_Body
{
mode distance;
levels ((10 #eval{$resMin - 3}) (20 #eval{$resMin - 5}));
}
CRMHL_WB_09222022_NoDomain_BLT_1_ww_wing_SS_01.obj.gz { mode distance; levels (( 320e-3 #eval{$LSS01})); }
CRMHL_WB_09222022_NoDomain_BLT_1_ww_wing_SS_02.obj.gz { mode distance; levels (( 160e-3 #eval{$LSS02})); }
}
What I would like to be able to do is the following, where I only have to reference the patch name in the refinement regions:
"CRMHL_WB_09222022_NoDomain_BLT_1.obj.gz"
{
type triSurfaceMesh;
regions
{
ww_wing_SS_01 { name ww_wing_SS_01; }
ww_wing_SS_02 { name ww_wing_SS_02; }
}
name Airplane_Body;
}
refinementSurfaces
{
Airplane_Body
{
level ($resMin $resMin);
regions
{
ww_wing_SS_01 { level ($LSS01 #eval{$LSS01} ); }
ww_wing_SS_02 { level ($LSS02 #eval{$LSS02} ); }
}
}
}
refinementRegions
{
Airplane_Body
{
mode distance;
levels ((10 #eval{$resMin - 3}) (20 #eval{$resMin - 5}));
regions
{
ww_wing_SS_01 { mode distance; levels (( 320e-3 #eval{$LSS01})); }
ww_wing_SS_02 { mode distance; levels (( 160e-3 #eval{$LSS02})); }
}
}
}
Possible changes in source code
I had a short look at the source code. This change probably needs to be implemented in shellSurfaces.C around line 748-786 by extending the region loop. This probably can be made similar to how it is done in refinementSurfaces.C, where we also define a level for the whole geometry as well as each individual region / patch. However, I am not experienced enough / do not have enough time to take a deeper look at this.
Previous work
This was already mentioned in issue #1005 but nothing happend in 4 years so I am reopening it.