Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
a4d50f98
Commit
a4d50f98
authored
Dec 02, 2013
by
mattijs
Browse files
BUG: autoLayerDriver: update local data
parent
1f35db62
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
View file @
a4d50f98
...
...
@@ -55,6 +55,10 @@ Description
#include "fixedValueFvPatchFields.H"
#include "localPointRegion.H"
#include "externalDisplacementMeshMover.H"
#include "medialAxisMeshMover.H"
#include "scalarIOField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace
Foam
...
...
@@ -1378,8 +1382,8 @@ void Foam::autoLayerDriver::syncPatchDisplacement
mesh
,
meshPoints
,
patchDisp
,
minEqOp
<
vector
>
(),
point
::
max
// null value
min
MagSqr
EqOp
<
vector
>
(),
point
::
rootMax
// null value
);
// Unmark if displacement too small
...
...
@@ -1487,7 +1491,7 @@ void Foam::autoLayerDriver::syncPatchDisplacement
// patch point.
void
Foam
::
autoLayerDriver
::
getPatchDisplacement
(
const
motionSmoother
&
meshMover
,
const
indirectPrimitivePatch
&
pp
,
const
scalarField
&
thickness
,
const
scalarField
&
minThickness
,
pointField
&
patchDisp
,
...
...
@@ -1499,7 +1503,6 @@ void Foam::autoLayerDriver::getPatchDisplacement
<<
" according to pointNormal ..."
<<
endl
;
const
fvMesh
&
mesh
=
meshRefiner_
.
mesh
();
const
indirectPrimitivePatch
&
pp
=
meshMover
.
patch
();
const
vectorField
&
faceNormals
=
pp
.
faceNormals
();
const
labelListList
&
pointFaces
=
pp
.
pointFaces
();
const
pointField
&
localPoints
=
pp
.
localPoints
();
...
...
@@ -1594,6 +1597,11 @@ void Foam::autoLayerDriver::getPatchDisplacement
nExtrudeRemove
++
;
}
else
{
// All surrounding points are not extruded. Leave patchDisp
// intact.
}
}
}
...
...
@@ -1720,7 +1728,7 @@ Foam::label Foam::autoLayerDriver::truncateDisplacement
(
const
globalIndex
&
globalFaces
,
const
labelListList
&
edgeGlobalFaces
,
const
motionSmoother
&
meshMover
,
const
indirectPrimitivePatch
&
pp
,
const
scalarField
&
minThickness
,
const
faceSet
&
illegalPatchFaces
,
pointField
&
patchDisp
,
...
...
@@ -1728,8 +1736,7 @@ Foam::label Foam::autoLayerDriver::truncateDisplacement
List
<
extrudeMode
>&
extrudeStatus
)
const
{
const
polyMesh
&
mesh
=
meshMover
.
mesh
();
const
indirectPrimitivePatch
&
pp
=
meshMover
.
patch
();
const
fvMesh
&
mesh
=
meshRefiner_
.
mesh
();
label
nChanged
=
0
;
...
...
@@ -2034,7 +2041,7 @@ Foam::label Foam::autoLayerDriver::truncateDisplacement
// regions where layer mesh terminates.
void
Foam
::
autoLayerDriver
::
setupLayerInfoTruncation
(
const
motionSmoother
&
meshMover
,
const
indirectPrimitivePatch
&
pp
,
const
labelList
&
patchNLayers
,
const
List
<
extrudeMode
>&
extrudeStatus
,
const
label
nBufferCellsNoExtrude
,
...
...
@@ -2044,8 +2051,7 @@ void Foam::autoLayerDriver::setupLayerInfoTruncation
{
Info
<<
nl
<<
"Setting up information for layer truncation ..."
<<
endl
;
const
indirectPrimitivePatch
&
pp
=
meshMover
.
patch
();
const
polyMesh
&
mesh
=
meshMover
.
mesh
();
const
fvMesh
&
mesh
=
meshRefiner_
.
mesh
();
if
(
nBufferCellsNoExtrude
<
0
)
{
...
...
@@ -2917,26 +2923,6 @@ void Foam::autoLayerDriver::addLayers
);
// Construct iterative mesh mover.
Info
<<
"Constructing mesh displacer ..."
<<
endl
;
autoPtr
<
motionSmoother
>
meshMover
(
new
motionSmoother
(
mesh
,
pp
(),
patchIDs
,
makeLayerDisplacementField
(
pointMesh
::
New
(
mesh
),
layerParams
.
numLayers
()
),
motionDict
)
);
// Point-wise extrusion data
// ~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -2961,7 +2947,7 @@ void Foam::autoLayerDriver::addLayers
setNumLayers
(
layerParams
.
numLayers
(),
// per patch the num layers
meshMover
().
adaptPatchIDs
(),
// patches that are being moved
patchIDs
,
// patches that are being moved
pp
,
// indirectpatch for all faces moving
patchDisp
,
...
...
@@ -3059,12 +3045,22 @@ void Foam::autoLayerDriver::addLayers
// Determine (wanted) point-wise overall layer thickness and expansion
// ratio
scalarField
thickness
(
pp
().
nPoints
());
scalarField
minThickness
(
pp
().
nPoints
());
scalarIOField
minThickness
(
IOobject
(
"minThickness"
,
meshRefiner_
.
timeName
(),
mesh
,
IOobject
::
NO_READ
),
pp
().
nPoints
()
);
scalarField
expansionRatio
(
pp
().
nPoints
());
calculateLayerThickness
(
pp
,
meshMover
().
adaptP
atchIDs
()
,
p
atchIDs
,
layerParams
,
cellLevel
,
patchNLayers
,
...
...
@@ -3077,89 +3073,36 @@ void Foam::autoLayerDriver::addLayers
// Calculate wall to medial axis distance for smoothing displacement
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pointScalarField
pointMedialDist
(
IOobject
(
"pointMedialDist"
,
meshRefiner_
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
,
false
),
meshMover
().
pMesh
(),
dimensionedScalar
(
"pointMedialDist"
,
dimLength
,
0
.
0
)
);
pointVectorField
dispVec
// Overall displacement field
pointVectorField
displacement
(
IOobject
makeLayerDisplacementField
(
"dispVec"
,
meshRefiner_
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
,
false
),
meshMover
().
pMesh
(),
dimensionedVector
(
"dispVec"
,
dimLength
,
vector
::
zero
)
pointMesh
::
New
(
mesh
),
layerParams
.
numLayers
()
)
);
pointScalarField
medialRatio
(
IOobject
(
"medialRatio"
,
meshRefiner_
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
,
false
),
meshMover
().
pMesh
(),
dimensionedScalar
(
"medialRatio"
,
dimless
,
0
.
0
)
);
// Allocate run-time selectable mesh mover
autoPtr
<
externalDisplacementMeshMover
>
medialAxisMoverPtr
;
{
// Set up controls for meshMover
dictionary
combinedDict
(
layerParams
.
dict
());
// Add mesh quality constraints
combinedDict
.
merge
(
motionDict
);
// Where to get minThickness from
combinedDict
.
add
(
"minThicknessName"
,
minThickness
.
name
());
pointVectorField
medialVec
(
IOobject
// Take over patchDisp as boundary conditions on displacement
// pointVectorField
medialAxisMoverPtr
=
externalDisplacementMeshMover
::
New
(
"medialVec"
,
meshRefiner_
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
,
false
),
meshMover
().
pMesh
(),
dimensionedVector
(
"medialVec"
,
dimLength
,
vector
::
zero
)
);
// Setup information for medial axis smoothing. Calculates medial axis
// and a smoothed displacement direction.
// - pointMedialDist : distance to medial axis
// - dispVec : normalised direction of nearest displacement
// - medialRatio : ratio of medial distance to wall distance.
// (1 at wall, 0 at medial axis)
medialAxisSmoothingInfo
(
meshMover
,
layerParams
.
nSmoothNormals
(),
layerParams
.
nSmoothSurfaceNormals
(),
layerParams
.
minMedianAxisAngleCos
(),
layerParams
.
slipFeatureAngle
(),
dispVec
,
medialRatio
,
pointMedialDist
,
medialVec
);
layerParams
.
meshShrinker
(),
combinedDict
,
baffles
,
displacement
);
}
// Saved old points
...
...
@@ -3215,7 +3158,7 @@ void Foam::autoLayerDriver::addLayers
// Displacement acc. to pointnormals
getPatchDisplacement
(
meshMover
,
pp
,
thickness
,
minThickness
,
patchDisp
,
...
...
@@ -3229,43 +3172,39 @@ void Foam::autoLayerDriver::addLayers
{
pointField
oldPatchPos
(
pp
().
localPoints
());
//// Laplacian displacement shrinking.
//shrinkMeshDistance
//(
// debug,
// meshMover,
// -patchDisp, // Shrink in opposite direction of addedPoints
// layerParams.nSmoothDisp(),
// layerParams.nSnap()
//);
// Medial axis based shrinking
shrinkMeshMedialDistance
// Take over patchDisp into pointDisplacement field and
// adjust both for multi-patch constraints
motionSmootherAlgo
::
setDisplacement
(
meshMover
(),
meshQualityDict
,
baffles
,
patchIDs
,
pp
,
patchDisp
,
displacement
);
layerParams
.
nSmoothThickness
(),
layerParams
.
nSmoothDisplacement
(),
layerParams
.
maxThicknessToMedialRatio
(),
nAllowableErrors
,
layerParams
.
nSnap
(),
layerParams
.
layerTerminationCos
(),
thickness
,
minThickness
,
// Move mesh
// ~~~~~~~~~
dispVec
,
medialRatio
,
pointMedialDist
,
medialVec
,
// Set up controls for meshMover
dictionary
combinedDict
(
layerParams
.
dict
());
// Add standard quality constraints
combinedDict
.
merge
(
motionDict
);
// Add relaxed constraints (overrides standard ones)
combinedDict
.
merge
(
meshQualityDict
);
// Where to get minThickness from
combinedDict
.
add
(
"minThicknessName"
,
minThickness
.
name
());
extrudeStatus
,
patchDisp
,
patchNLayers
labelList
checkFaces
(
identity
(
mesh
.
nFaces
()));
medialAxisMoverPtr
().
move
(
combinedDict
,
nAllowableErrors
,
checkFaces
);
pp
().
movePoints
(
mesh
.
points
());
// Update patchDisp (since not all might have been honoured)
patchDisp
=
oldPatchPos
-
pp
().
localPoints
();
}
...
...
@@ -3278,7 +3217,7 @@ void Foam::autoLayerDriver::addLayers
(
globalFaces
,
edgeGlobalFaces
,
meshMover
()
,
pp
,
minThickness
,
dummySet
,
patchDisp
,
...
...
@@ -3331,7 +3270,7 @@ void Foam::autoLayerDriver::addLayers
labelList
nPatchFaceLayers
(
pp
().
size
(),
-
1
);
setupLayerInfoTruncation
(
meshMover
()
,
pp
,
patchNLayers
,
extrudeStatus
,
layerParams
.
nBufferCellsNoExtrude
(),
...
...
@@ -3456,7 +3395,7 @@ void Foam::autoLayerDriver::addLayers
<<
endl
;
newMesh
.
write
();
cellSet
addedCellSet
(
newMesh
,
"
addedCells"
,
nAddedCells
);
cellSet
addedCellSet
(
newMesh
,
"
addedCells"
,
nAddedCells
);
forAll
(
cellNLayers
,
cellI
)
{
if
(
cellNLayers
[
cellI
]
>
0
)
...
...
@@ -3521,10 +3460,7 @@ void Foam::autoLayerDriver::addLayers
// Reset mesh points and start again
mesh
.
movePoints
(
oldPoints
);
// Update meshmover for change of mesh geometry
meshMover
().
movePoints
();
meshMover
().
correct
();
pp
().
movePoints
(
mesh
.
points
());
// Grow out region of non-extrusion
for
(
label
i
=
0
;
i
<
layerParams
.
nGrow
();
i
++
)
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
View file @
a4d50f98
...
...
@@ -277,7 +277,7 @@ private:
//- Get nearest point on surface to snap to
void
getPatchDisplacement
(
const
motionSmoother
&
meshMover
,
const
indirectPrimitivePatch
&
pp
,
const
scalarField
&
thickness
,
const
scalarField
&
minThickness
,
pointField
&
patchDisp
,
...
...
@@ -315,7 +315,7 @@ private:
(
const
globalIndex
&
globalFaces
,
const
labelListList
&
edgeGlobalFaces
,
const
motionSmoother
&
meshMover
,
const
indirectPrimitivePatch
&
pp
,
const
scalarField
&
minThickness
,
const
faceSet
&
illegalPatchFaces
,
pointField
&
patchDisp
,
...
...
@@ -331,7 +331,7 @@ private:
// to go into the actual layer addition engine.
void
setupLayerInfoTruncation
(
const
motionSmoother
&
meshMover
,
const
indirectPrimitivePatch
&
pp
,
const
labelList
&
patchNLayers
,
const
List
<
extrudeMode
>&
extrudeStatus
,
const
label
nBufferCellsNoExtrude
,
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
View file @
a4d50f98
...
...
@@ -752,15 +752,15 @@ void Foam::autoLayerDriver::findIsolatedRegions
nPointCounter
++
;
nChanged
++
;
}
}
}
}
}
if
(
returnReduce
(
nChanged
,
sumOp
<
label
>
())
==
0
)
{
break
;
}
}
if
(
returnReduce
(
nChanged
,
sumOp
<
label
>
())
==
0
)
{
break
;
}
}
const
edgeList
&
edges
=
pp
.
edges
();
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C
View file @
a4d50f98
...
...
@@ -28,6 +28,7 @@ License
#include "unitConversion.H"
#include "refinementSurfaces.H"
#include "searchableSurfaces.H"
#include "medialAxisMeshMover.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...
...
@@ -109,6 +110,7 @@ Foam::layerParameters::layerParameters
const
polyBoundaryMesh
&
boundaryMesh
)
:
dict_
(
dict
),
numLayers_
(
boundaryMesh
.
size
(),
-
1
),
relativeSizes_
(
dict
.
lookup
(
"relativeSizes"
)),
layerSpec_
(
ILLEGAL
),
...
...
@@ -163,7 +165,15 @@ Foam::layerParameters::layerParameters
nSnap_
(
readLabel
(
dict
.
lookup
(
"nRelaxIter"
))),
nLayerIter_
(
readLabel
(
dict
.
lookup
(
"nLayerIter"
))),
nRelaxedIter_
(
labelMax
),
additionalReporting_
(
dict
.
lookupOrDefault
(
"additionalReporting"
,
false
))
additionalReporting_
(
dict
.
lookupOrDefault
(
"additionalReporting"
,
false
)),
meshShrinker_
(
dict
.
lookupOrDefault
(
"meshShrinker"
,
medialAxisMeshMover
::
typeName
)
)
{
// Detect layer specification mode
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H
View file @
a4d50f98
...
...
@@ -86,6 +86,9 @@ private:
// Private data
const
dictionary
dict_
;
// Per patch (not region!) information
//- How many layers to add.
...
...
@@ -143,6 +146,8 @@ private:
Switch
additionalReporting_
;
word
meshShrinker_
;
// Private Member Functions
//- Calculate expansion ratio from overall size v.s. thickness of
...
...
@@ -170,6 +175,12 @@ public:
// Member Functions
const
dictionary
&
dict
()
const
{
return
dict_
;
}
// Per patch information
//- How many layers to add.
...
...
@@ -230,112 +241,124 @@ public:
}
scalar
featureAngle
()
const
{
return
featureAngle_
;
}
// Control
//- At non-patched sides allow mesh to slip if extrusion
// direction makes angle larger than slipFeatureAngle.
scalar
slipFeatureAngle
()
const
{
return
slipFeatureAngle_
;
}
//- Number of overall layer addition iterations
label
nLayerIter
()
const
{
return
nLayerIter_
;
}
scalar
concaveAngle
()
const
{
return
concaveAngle_
;
}
//- Number of iterations after which relaxed motion rules
// are to be used.
label
nRelaxedIter
()
const
{
return
nRelaxedIter_
;
}
//- If points get not extruded do nGrow layers of connected faces
// that are not grown. Is used to not do layers at all close to
// features.
label
nGrow
()
const
{
return
nGrow_
;
}
//- Number of smoothing iterations of surface normals
label
nSmoothSurfaceNormals
()
const
{
return
nSmoothSurfaceNormals_
;
}
// Control
//- Number of smoothing iterations of interior mesh movement
// direction
label
nSmoothNormals
()
const
{
return
nSmoothNormals_
;
}
scalar
featureAngle
()
const
{
return
featureAngle_
;
}
//- Stop layer growth on highly warped cells
scalar
maxFaceThicknessRatio
()
const
{
return
maxFaceThicknessRatio_
;
}
scalar
concaveAngle
()
const
{
return
concaveAngle_
;
}
scalar
layerTerminationCos
()
const
{
return
layerTerminationCos_
;
}
//- If points get not extruded do nGrow layers of connected faces
// that are not grown. Is used to not do layers at all close to
// features.
label
nGrow
()
const
{
return
nGrow_
;
}
//- S
mooth internal displacement
label
nSmoothDisplacement
()
const
{
return
nSmoothDisplacement
_
;
}
//- S
top layer growth on highly warped cells
scalar
maxFaceThicknessRatio
()
const
{
return
maxFaceThicknessRatio
_
;
}
//- Smooth layer thickness over surface patche
s
label
n
SmoothThickness
()
const
{
return
n
SmoothThickness
_
;
}
//- Create buffer region for new layer termination
s
label
n
BufferCellsNoExtrude
()
const
{
return
n
BufferCellsNoExtrude
_
;
}
//- Reduce layer growth where ratio thickness to medial
// distance is large
scalar
maxThicknessToMedialRatio
()
const
{
return
maxThicknessToMedialRatio_
;
}
const
Switch
&
additionalReporting
()
const
{
return
additionalReporting_
;
}
//- Angle used to pick up medial axis points