Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
76f2d62b
Commit
76f2d62b
authored
Jul 07, 2008
by
Mattijs Janssens
Browse files
mesh driver rewrite; initial distributed surfaces
parent
b7bb04e8
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
src/autoMesh/Make/files
View file @
76f2d62b
autoHexMesh = autoHexMesh
autoHexMeshDriver = $(autoHexMesh)/autoHexMeshDriver
$(autoHexMeshDriver)/autoHexMeshDriver.C
$(autoHexMeshDriver)/autoHexMeshDriverLayers.C
$(autoHexMeshDriver)/autoHexMeshDriverShrink.C
$(autoHexMeshDriver)/autoHexMeshDriverSnap.C
$(autoHexMeshDriver)/layerParameters/layerParameters.C
$(autoHexMeshDriver)/refinementParameters/refinementParameters.C
$(autoHexMeshDriver)/snapParameters/snapParameters.C
$(autoHexMeshDriver)/pointData/pointData.C
$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriver.C
$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriverLayers.C
$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriverShrink.C
$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriverSnap.C
$(autoHexMesh)/autoHexMeshDriver/pointData/pointData.C
$(autoHexMesh)/meshRefinement/meshRefinementBaffles.C
$(autoHexMesh)/meshRefinement/meshRefinement.C
$(autoHexMesh)/meshRefinement/meshRefinementMerge.C
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C
$(autoHexMesh)/shellSurfaces/shellSurfaces.C
$(autoHexMesh)/trackedParticle/trackedParticle.C
$(autoHexMesh)/trackedParticle/trackedParticleCloud.C
...
...
src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C
View file @
76f2d62b
This diff is collapsed.
Click to expand it.
src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H
View file @
76f2d62b
...
...
@@ -49,8 +49,9 @@ SourceFiles
#include
"wallPoint.H"
#include
"indirectPrimitivePatch.H"
#include
"featureEdgeMesh.H"
#include
"searchableSurface.H"
#include
"searchableSurface
s
.H"
#include
"refinementSurfaces.H"
#include
"shellSurfaces.H"
#include
"meshRefinement.H"
#include
"decompositionMethod.H"
#include
"fvMeshDistribute.H"
...
...
@@ -70,6 +71,9 @@ class pointData;
class
faceSet
;
class
addPatchCellLayer
;
class
mapDistributePolyMesh
;
class
snapParameters
;
class
layerParameters
;
class
refinementParameters
;
/*---------------------------------------------------------------------------*\
Class autoHexMeshDriver Declaration
...
...
@@ -79,15 +83,13 @@ class autoHexMeshDriver
{
// Static data members
//- Default angle for faces to be convcave
static
const
scalar
defaultConcaveAngle
;
//- Extrusion controls
enum
extrudeMode
{
NOEXTRUDE
,
/*!< Do not extrude. No layers added. */
EXTRUDE
,
/*!< Extrude */
EXTRUDEREMOVE
/*!< Extrude but afterwards remove added faces locally */
EXTRUDEREMOVE
/*!< Extrude but afterwards remove added */
/*!< faces locally */
};
...
...
@@ -141,42 +143,24 @@ class autoHexMeshDriver
//- Debug level
const
label
debug_
;
//- Total number of cells
const
label
maxGlobalCells_
;
//- Per processor max number of cells
const
label
maxLocalCells_
;
//- When to stop refining
const
label
minRefineCells_
;
//- Curvature
const
scalar
curvature_
;
//- Number of layers between different refinement levels
const
label
nBufferLayers_
;
//- Areas to keep
const
pointField
keepPoints_
;
//- Merge distance
const
scalar
mergeDist_
;
// Refinement only
//- Explicit features
PtrList
<
featureEdgeMesh
>
featureMeshes_
;
//- Per feature the refinement level
labelList
featureLevels_
;
//- Explicit features
PtrList
<
featureEdgeMesh
>
featureMeshes_
;
//- Per feature the refinement level
labelList
featureLevels_
;
//- All surface based geometry
autoPtr
<
searchableSurfaces
>
allGeometryPtr_
;
//- Shells
PtrList
<
searchableSurface
>
shells_
;
//- Per shell the refinement level
labelList
shellLevels_
;
//- Per shell whether to refine inside or outside
boolList
shellRefineInside_
;
//- Shells (geometry for inside/outside refinement)
autoPtr
<
shellSurfaces
>
shellsPtr_
;
//- Surfaces
with refinement levels built-in
//- Surfaces
(geometry for intersection based refinement)
autoPtr
<
refinementSurfaces
>
surfacesPtr_
;
//- Per refinement surface region the patch
...
...
@@ -200,10 +184,6 @@ class autoHexMeshDriver
//- Calculate merge distance. Check against writing tolerance.
scalar
getMergeDistance
(
const
scalar
mergeTol
)
const
;
// Return per keeppoint -1 or the local cell label the point is in.
// Guaranteed to be only on one processor.
labelList
findCells
(
const
pointField
&
)
const
;
static
void
orientOutside
(
PtrList
<
searchableSurface
>&
);
//- Read feature edges
...
...
@@ -371,6 +351,7 @@ class autoHexMeshDriver
// layers per surface.
void
setNumLayers
(
const
labelList
&
patchToNLayers
,
const
labelList
&
patchIDs
,
const
indirectPrimitivePatch
&
pp
,
pointField
&
patchDisp
,
...
...
@@ -390,17 +371,22 @@ class autoHexMeshDriver
//- Calculate pointwise wanted and minimum thickness.
// thickness: wanted thickness
// minthickness: when to give up and not extrude
// Gets per patch parameters and determine pp pointwise
// parameters.
void
calculateLayerThickness
(
const
scalar
expansionRatio
,
const
scalar
finalLayerRatio
,
const
scalar
relMinThickness
,
const
indirectPrimitivePatch
&
pp
,
const
labelList
&
patchIDs
,
const
scalarField
&
patchExpansionRatio
,
const
scalarField
&
patchFinalLayerRatio
,
const
scalarField
&
patchRelMinThickness
,
const
labelList
&
cellLevel
,
const
labelList
&
patchNLayers
,
const
scalar
edge0Len
,
scalarField
&
thickness
,
scalarField
&
minThickness
scalarField
&
minThickness
,
scalarField
&
expansionRatio
)
const
;
...
...
@@ -638,13 +624,13 @@ public:
// Constructors
//- Construct from dictionary and mesh to modify
autoHexMeshDriver
(
fvMesh
&
mesh
,
const
dictionary
&
meshDict
,
const
dictionary
&
decomposeDict
);
//
//- Construct from dictionary and mesh to modify
//
autoHexMeshDriver
//
(
//
fvMesh& mesh,
//
const dictionary& meshDict,
//
const dictionary& decomposeDict
//
);
//- Alternative constructor from top-level controldictionary and
// refinement specific dictionary
...
...
@@ -652,6 +638,7 @@ public:
(
fvMesh
&
mesh
,
const
dictionary
&
controlDict
,
const
dictionary
&
geometryDict
,
const
dictionary
&
refineDict
,
const
dictionary
&
decomposeDict
);
...
...
@@ -677,6 +664,12 @@ public:
return
surfacesPtr_
();
}
//- Surfaces to volume refinement on
const
shellSurfaces
&
shells
()
const
{
return
shellsPtr_
();
}
//- Per refinementsurface, per region the patch
const
labelList
&
globalToPatch
()
const
{
...
...
@@ -689,32 +682,53 @@ public:
//- Refine around explicit feature edges
label
featureEdgeRefine
(
const
refinementParameters
&
refineParams
,
const
PtrList
<
dictionary
>&
featDicts
,
const
label
maxIter
,
const
label
minRefine
);
//- Refine at surface intersections
label
surfaceOnlyRefine
(
const
label
maxIter
);
label
surfaceOnlyRefine
(
const
refinementParameters
&
refineParams
,
const
label
maxIter
);
//- Remove cells not reachable from keep points
void
removeInsideCells
(
const
label
nBufferLayers
);
void
removeInsideCells
(
const
refinementParameters
&
refineParams
,
const
label
nBufferLayers
);
//- Refine volume regions (interior of shells)
label
shellRefine
(
const
label
maxIter
);
label
shellRefine
(
const
refinementParameters
&
refineParams
,
const
label
maxIter
);
//- Introduce baffles; remove unreachable mesh parts
// handleSnapProblems : whether to remove free floating cells
void
baffleAndSplitMesh
(
const
bool
handleSnapProblems
);
void
baffleAndSplitMesh
(
const
refinementParameters
&
refineParams
,
const
bool
handleSnapProblems
);
//- Move cells to zones
void
zonify
();
void
zonify
(
const
refinementParameters
&
);
//- Split and recombine baffles to get rid of single face baffles.
void
splitAndMergeBaffles
(
const
bool
handleSnapProblems
);
void
splitAndMergeBaffles
(
const
refinementParameters
&
refineParams
,
const
bool
handleSnapProblems
);
//- Merge multiple boundary faces on single cell
void
mergePatchFaces
();
void
mergePatchFaces
(
const
refinementParameters
&
);
//- Redecompose according to cell count
// keepZoneFaces : find all faceZones from zoned surfaces and keep
...
...
@@ -742,7 +756,7 @@ public:
//- Calculate edge length per patch point.
scalarField
calcSnapDistance
(
const
dictionary
&
snapDict
,
const
snapParameters
&
snapParams
,
const
indirectPrimitivePatch
&
)
const
;
...
...
@@ -753,12 +767,19 @@ public:
// of surface points (on castellated mesh) w.r.t. surface.
void
preSmoothPatch
(
const
dictionary
&
snapDict
,
const
snapParameters
&
snapParams
,
const
label
nInitErrors
,
const
List
<
labelPair
>&
baffles
,
motionSmoother
&
)
const
;
//- Get points both on patch and facezone.
labelList
getZoneSurfacePoints
(
const
indirectPrimitivePatch
&
,
const
word
&
zoneName
)
const
;
//- Per patch point calculate point on nearest surface. Set as
// boundary conditions of motionSmoother displacement field. Return
// displacement of patch points.
...
...
@@ -771,7 +792,7 @@ public:
//- Smooth the displacement field to the internal.
void
smoothDisplacement
(
const
dictionary
&
snapDict
,
const
snapParameters
&
snapParams
,
motionSmoother
&
)
const
;
...
...
@@ -779,7 +800,7 @@ public:
// locally relax the displacement.
void
scaleMesh
(
const
dictionary
&
snapDict
,
const
snapParameters
&
snapParams
,
const
label
nInitErrors
,
const
List
<
labelPair
>&
baffles
,
motionSmoother
&
...
...
@@ -791,7 +812,7 @@ public:
//- Merge patch faces on same cell.
void
mergePatchFacesUndo
(
const
dictionary
&
shrinkDict
,
const
layerParameters
&
layerParams
,
const
dictionary
&
motionDict
);
...
...
@@ -801,7 +822,7 @@ public:
//- Add cell layers
void
addLayers
(
const
dictionary
&
shrinkDict
,
const
layerParameters
&
layerParams
,
const
dictionary
&
motionDict
,
const
label
nAllowableErrors
,
motionSmoother
&
...
...
src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriverLayers.C
View file @
76f2d62b
...
...
@@ -27,7 +27,6 @@ Description
\*----------------------------------------------------------------------------*/
#include
"ListOps.H"
#include
"autoHexMeshDriver.H"
#include
"fvMesh.H"
#include
"Time.H"
...
...
@@ -43,11 +42,8 @@ Description
#include
"mapPolyMesh.H"
#include
"addPatchCellLayer.H"
#include
"mapDistributePolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const
Foam
::
scalar
Foam
::
autoHexMeshDriver
::
defaultConcaveAngle
=
90
;
#include
"OFstream.H"
#include
"layerParameters.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
...
...
@@ -1191,6 +1187,7 @@ void Foam::autoHexMeshDriver::handleWarpedFaces
// No extrusion on faces with differing number of layers for points
void
Foam
::
autoHexMeshDriver
::
setNumLayers
(
const
labelList
&
patchToNLayers
,
const
labelList
&
patchIDs
,
const
indirectPrimitivePatch
&
pp
,
pointField
&
patchDisp
,
...
...
@@ -1201,18 +1198,6 @@ void Foam::autoHexMeshDriver::setNumLayers
Info
<<
nl
<<
"Handling points with inconsistent layer specification ..."
<<
endl
;
const
labelList
&
nSurfLayers
=
surfaces
().
numLayers
();
// Build map from patch to layers
Map
<
label
>
patchToNLayers
(
nSurfLayers
.
size
());
forAll
(
nSurfLayers
,
region
)
{
if
(
globalToPatch_
[
region
]
!=
-
1
)
{
patchToNLayers
.
insert
(
globalToPatch_
[
region
],
nSurfLayers
[
region
]);
}
}
// Get for every point (really only nessecary on patch external points)
// the max and min of any patch faces using it.
labelList
maxLayers
(
patchNLayers
.
size
(),
labelMin
);
...
...
@@ -1257,7 +1242,7 @@ void Foam::autoHexMeshDriver::setNumLayers
// Unmark any point with different min and max
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
label
nConflicts
=
0
;
//
label nConflicts = 0;
forAll
(
maxLayers
,
i
)
{
...
...
@@ -1294,11 +1279,11 @@ void Foam::autoHexMeshDriver::setNumLayers
}
}
reduce
(
nConflicts
,
sumOp
<
label
>
());
Info
<<
"Set displacement to zero for "
<<
nConflicts
<<
" points due to points being on multiple regions"
<<
" with inconsistent nLayers specification."
<<
endl
;
//
reduce(nConflicts, sumOp<label>());
//
//
Info<< "Set displacement to zero for " << nConflicts
//
<< " points due to points being on multiple regions"
//
<< " with inconsistent nLayers specification." << endl;
}
...
...
@@ -1369,60 +1354,138 @@ void Foam::autoHexMeshDriver::growNoExtrusion
}
// Calculate pointwise wanted and minimum thickness.
// thickness: wanted thickness per point
void
Foam
::
autoHexMeshDriver
::
calculateLayerThickness
(
const
scalar
expansionRatio
,
const
scalar
finalLayerRatio
,
const
scalar
relMinThickness
,
const
indirectPrimitivePatch
&
pp
,
const
labelList
&
patchIDs
,
const
scalarField
&
patchExpansionRatio
,
const
scalarField
&
patchFinalLayerRatio
,
const
scalarField
&
patchRelMinThickness
,
const
labelList
&
cellLevel
,
const
labelList
&
patchNLayers
,
const
scalar
edge0Len
,
scalarField
&
thickness
,
scalarField
&
minThickness
scalarField
&
minThickness
,
scalarField
&
expansionRatio
)
const
{
if
(
relMinThickness
<
0
||
relMinThickness
>
2
)
const
polyBoundaryMesh
&
patches
=
mesh_
.
boundaryMesh
();
if
(
min
(
patchRelMinThickness
)
<
0
||
max
(
patchRelMinThickness
)
>
2
)
{
FatalErrorIn
(
"calculateLayerThickness(..)"
)
<<
"Thickness should be factor of local undistorted cell size."
<<
" Valid values are [0..2]."
<<
nl
<<
" minThickness:"
<<
r
elMinThickness
<<
" minThickness:"
<<
patchR
elMinThickness
<<
exit
(
FatalError
);
}
thickness
.
setSize
(
pp
.
nPoints
());
minThickness
.
setSize
(
pp
.
nPoints
());
// Per point the max cell level of connected cells
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList
maxPointLevel
(
pp
.
nPoints
(),
labelMin
);
forAll
(
pp
,
i
)
{
label
ownLevel
=
cellLevel
[
mesh_
.
faceOwner
()[
pp
.
addressing
()[
i
]]];
forAll
(
pp
,
i
)
{
label
ownLevel
=
cellLevel
[
mesh_
.
faceOwner
()[
pp
.
addressing
()[
i
]]];
const
face
&
f
=
pp
.
localFaces
()[
i
];
const
face
&
f
=
pp
.
localFaces
()[
i
];
forAll
(
f
,
fp
)
forAll
(
f
,
fp
)
{
maxPointLevel
[
f
[
fp
]]
=
max
(
maxPointLevel
[
f
[
fp
]],
ownLevel
);
}
}
syncTools
::
syncPointList
(
mesh_
,
pp
.
meshPoints
(),
maxPointLevel
,
maxEqOp
<
label
>
(),
labelMin
,
// null value
false
// no separation
);
}
// Rework patch-wise layer parameters into minimum per point
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
expansionRatio
.
setSize
(
pp
.
nPoints
());
expansionRatio
=
GREAT
;
scalarField
finalLayerRatio
(
pp
.
nPoints
(),
GREAT
);
scalarField
relMinThickness
(
pp
.
nPoints
(),
GREAT
);
{
forAll
(
patchIDs
,
i
)
{
maxPointLevel
[
f
[
fp
]]
=
max
(
maxPointLevel
[
f
[
fp
]],
ownLevel
);
label
patchI
=
patchIDs
[
i
];
const
labelList
&
meshPoints
=
patches
[
patchI
].
meshPoints
();
forAll
(
meshPoints
,
patchPointI
)
{
label
ppPointI
=
pp
.
meshPointMap
()[
meshPoints
[
patchPointI
]];
expansionRatio
[
ppPointI
]
=
min
(
expansionRatio
[
ppPointI
],
patchExpansionRatio
[
patchI
]
);
finalLayerRatio
[
ppPointI
]
=
min
(
finalLayerRatio
[
ppPointI
],
patchFinalLayerRatio
[
patchI
]
);
relMinThickness
[
ppPointI
]
=
min
(
relMinThickness
[
ppPointI
],
patchRelMinThickness
[
patchI
]
);
}
}
syncTools
::
syncPointList
(
mesh_
,
pp
.
meshPoints
(),
expansionRatio
,
minEqOp
<
scalar
>
(),
GREAT
,
// null value
false
// no separation
);
syncTools
::
syncPointList
(
mesh_
,
pp
.
meshPoints
(),
finalLayerRatio
,
minEqOp
<
scalar
>
(),
GREAT
,
// null value
false
// no separation
);
syncTools
::
syncPointList
(
mesh_
,
pp
.
meshPoints
(),
relMinThickness
,
minEqOp
<
scalar
>
(),
GREAT
,
// null value
false
// no separation
);
}
syncTools
::
syncPointList
(
mesh_
,
pp
.
meshPoints
(),
maxPointLevel
,
maxEqOp
<
label
>
(),
labelMin
,
// null value
false
// no separation
);
// Per mesh point the expansion parameters
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thickness
.
setSize
(
pp
.
nPoints
());
minThickness
.
setSize
(
pp
.
nPoints
());
forAll
(
maxPointLevel
,
pointI
)
{
// Find undistorted edge size for this level.
...
...
@@ -1430,19 +1493,24 @@ void Foam::autoHexMeshDriver::calculateLayerThickness
// Calculate layer thickness based on expansion ratio
// and final layer height
if
(
expansionRatio
==
1
)
if
(
expansionRatio
[
pointI
]
==
1
)
{
thickness
[
pointI
]
=
finalLayerRatio
*
patchNLayers
[
pointI
]
*
edgeLen
;
minThickness
[
pointI
]
=
relMinThickness
*
edgeLen
;
thickness
[
pointI
]
=
finalLayerRatio
[
pointI
]
*
patchNLayers
[
pointI
]
*
edgeLen
;
minThickness
[
pointI
]
=
relMinThickness
[
pointI
]
*
edgeLen
;
}
else
{
scalar
invExpansion
=
1
.
0
/
expansionRatio
;
scalar
invExpansion
=
1
.
0
/
expansionRatio
[
pointI
]
;
label
nLay
=
patchNLayers
[
pointI
];
thickness
[
pointI
]
=
finalLayerRatio
*
edgeLen
*
(
1
.
0
-
pow
(
invExpansion
,
nLay
))
/
(
1
.
0
-
invExpansion
);
minThickness
[
pointI
]
=
relMinThickness
*
edgeLen
;
thickness
[
pointI
]
=
finalLayerRatio
[
pointI
]
*
edgeLen
*
(
1
.
0
-
pow
(
invExpansion
,
nLay
))
/
(
1
.
0
-
invExpansion
);
minThickness
[
pointI
]
=
relMinThickness
[
pointI
]
*
edgeLen
;
}
}
...
...
@@ -2309,31 +2377,34 @@ void Foam::autoHexMeshDriver::getLayerCellsFaces
void
Foam
::
autoHexMeshDriver
::
mergePatchFacesUndo
(
const
dictionary
&
shrinkDict
,
const
layerParameters
&
layerParams
,