Skip to content
GitLab
Menu
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
98cabc2e
Commit
98cabc2e
authored
Jan 21, 2014
by
mattijs
Browse files
ENH: snappyHexMesh: added debug switch
parent
b3de4399
Changes
8
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
View file @
98cabc2e
...
...
@@ -418,9 +418,9 @@ addLayersControls
// default is 0.
//nSmoothDisplacement 90;
// Optional: do not extrude a
ny
point
where all
surrounding
face
s
//
have at least one point
not extruded. Default is
tru
e.
//detectExtrusionIsland
fals
e;
//
(wip)
Optional: do not extrude a point
if none of the
surrounding
points i
s
// not extruded. Default is
fals
e.
//detectExtrusionIsland
tru
e;
// Mesh shrinking
...
...
@@ -488,7 +488,9 @@ meshQualityControls
//(
// mesh // write intermediate meshes
// intersections // write current mesh intersections as .obj files
// featureSeeds // write information about explicit feature edge refinement
// featureSeeds // write information about explicit feature edge
// // refinement
// attraction // write attraction as .obj files
// layerInfo // write information about layers
//);
//
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
View file @
98cabc2e
...
...
@@ -41,7 +41,7 @@ Description
#include
"mapPolyMesh.H"
#include
"addPatchCellLayer.H"
#include
"mapDistributePolyMesh.H"
#include
"O
F
stream.H"
#include
"O
BJ
stream.H"
#include
"layerParameters.H"
#include
"combineFaces.H"
#include
"IOmanip.H"
...
...
@@ -80,37 +80,25 @@ void Foam::autoLayerDriver::dumpDisplacement
const
List
<
extrudeMode
>&
extrudeStatus
)
{
O
F
stream
dispStr
(
prefix
+
"_disp.obj"
);
O
BJ
stream
dispStr
(
prefix
+
"_disp.obj"
);
Info
<<
"Writing all displacements to "
<<
dispStr
.
name
()
<<
endl
;
label
vertI
=
0
;
forAll
(
patchDisp
,
patchPointI
)
{
const
point
&
pt
=
pp
.
localPoints
()[
patchPointI
];
meshTools
::
writeOBJ
(
dispStr
,
pt
);
vertI
++
;
meshTools
::
writeOBJ
(
dispStr
,
pt
+
patchDisp
[
patchPointI
]);
vertI
++
;
dispStr
<<
"l "
<<
vertI
-
1
<<
' '
<<
vertI
<<
nl
;
dispStr
.
write
(
linePointRef
(
pt
,
pt
+
patchDisp
[
patchPointI
]));
}
O
F
stream
illStr
(
prefix
+
"_illegal.obj"
);
O
BJ
stream
illStr
(
prefix
+
"_illegal.obj"
);
Info
<<
"Writing invalid displacements to "
<<
illStr
.
name
()
<<
endl
;
vertI
=
0
;
forAll
(
patchDisp
,
patchPointI
)
{
if
(
extrudeStatus
[
patchPointI
]
!=
EXTRUDE
)
{
const
point
&
pt
=
pp
.
localPoints
()[
patchPointI
];
meshTools
::
writeOBJ
(
illStr
,
pt
);
vertI
++
;
meshTools
::
writeOBJ
(
illStr
,
pt
+
patchDisp
[
patchPointI
]);
vertI
++
;
illStr
<<
"l "
<<
vertI
-
1
<<
' '
<<
vertI
<<
nl
;
illStr
.
write
(
linePointRef
(
pt
,
pt
+
patchDisp
[
patchPointI
]));
}
}
}
...
...
@@ -441,13 +429,12 @@ void Foam::autoLayerDriver::handleFeatureAngle
point
::
max
// null value
);
label
vertI
=
0
;
autoPtr
<
OFstream
>
str
;
autoPtr
<
OBJstream
>
str
;
if
(
debug
&
meshRefinement
::
MESH
)
{
str
.
reset
(
new
O
F
stream
new
O
BJ
stream
(
mesh
.
time
().
path
()
/
"featureEdges_"
...
...
@@ -497,11 +484,9 @@ void Foam::autoLayerDriver::handleFeatureAngle
if
(
str
.
valid
())
{
meshTools
::
writeOBJ
(
str
(),
pp
.
localPoints
()[
e
[
0
]]);
vertI
++
;
meshTools
::
writeOBJ
(
str
(),
pp
.
localPoints
()[
e
[
1
]]);
vertI
++
;
str
()
<<
"l "
<<
vertI
-
1
<<
' '
<<
vertI
<<
nl
;
const
point
&
p0
=
pp
.
localPoints
()[
e
[
0
]];
const
point
&
p1
=
pp
.
localPoints
()[
e
[
1
]];
str
().
write
(
linePointRef
(
p0
,
p1
));
}
}
}
...
...
@@ -1542,7 +1527,7 @@ void Foam::autoLayerDriver::getPatchDisplacement
if
(
!
meshTools
::
visNormal
(
n
,
faceNormals
,
pointFaces
[
patchPointI
]))
{
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
Pout
<<
"No valid normal for point "
<<
meshPointI
<<
' '
<<
pp
.
points
()[
meshPointI
]
...
...
@@ -1582,7 +1567,7 @@ void Foam::autoLayerDriver::getPatchDisplacement
if
(
nPoints
>
0
)
{
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
Pout
<<
"Displacement at illegal point "
<<
localPoints
[
patchPointI
]
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C
View file @
98cabc2e
...
...
@@ -94,7 +94,7 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine
(
meshRefiner_
.
refineCandidates
(
refineParams
.
keepPoints
()
[
0
],
// For now only use one.
refineParams
.
keepPoints
()
,
refineParams
.
curvature
(),
refineParams
.
planarAngle
(),
...
...
@@ -207,7 +207,7 @@ Foam::label Foam::autoRefineDriver::surfaceOnlyRefine
(
meshRefiner_
.
refineCandidates
(
refineParams
.
keepPoints
()
[
0
]
,
refineParams
.
keepPoints
(),
refineParams
.
curvature
(),
refineParams
.
planarAngle
(),
...
...
@@ -341,7 +341,7 @@ Foam::label Foam::autoRefineDriver::gapOnlyRefine
(
meshRefiner_
.
refineCandidates
(
refineParams
.
keepPoints
()
[
0
]
,
refineParams
.
keepPoints
(),
refineParams
.
curvature
(),
refineParams
.
planarAngle
(),
...
...
@@ -753,7 +753,7 @@ Foam::label Foam::autoRefineDriver::shellRefine
(
meshRefiner_
.
refineCandidates
(
refineParams
.
keepPoints
()
[
0
]
,
refineParams
.
keepPoints
(),
refineParams
.
curvature
(),
refineParams
.
planarAngle
(),
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
View file @
98cabc2e
...
...
@@ -1279,7 +1279,7 @@ void Foam::autoSnapDriver::detectNearSurfaces
autoPtr
<
OBJstream
>
gapStr
;
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
gapStr
.
reset
(
...
...
@@ -3089,7 +3089,7 @@ void Foam::autoSnapDriver::doSnap
meshMover
.
setDisplacement
(
disp
);
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
dumpMove
(
...
...
@@ -3120,13 +3120,6 @@ void Foam::autoSnapDriver::doSnap
<<
" surfaces but the"
<<
" resulting mesh will not satisfy your quality"
<<
" constraints"
<<
nl
<<
endl
;
//Info<< "Did not succesfully snap mesh. Giving up."
// << nl << endl;
//
//// Use current mesh as base mesh
//meshMover.correct();
//
//break;
}
if
(
debug
&
meshRefinement
::
MESH
)
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C
View file @
98cabc2e
...
...
@@ -422,7 +422,7 @@ void Foam::autoSnapDriver::calcNearestFace
^
faceSurfaceNormal
[
faceI
];
}
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
dumpMove
(
...
...
@@ -1037,7 +1037,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
{
autoPtr
<
OBJstream
>
feStr
;
autoPtr
<
OBJstream
>
fpStr
;
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
feStr
.
reset
(
...
...
@@ -1331,7 +1331,7 @@ void Foam::autoSnapDriver::releasePointsNextToMultiPatch
)
const
{
autoPtr
<
OBJstream
>
multiPatchStr
;
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
multiPatchStr
.
reset
(
...
...
@@ -1809,7 +1809,7 @@ void Foam::autoSnapDriver::determineFeatures
autoPtr
<
OBJstream
>
missedEdgeStr
;
autoPtr
<
OBJstream
>
featurePointStr
;
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
featureEdgeStr
.
reset
(
...
...
@@ -2263,7 +2263,7 @@ void Foam::autoSnapDriver::determineBaffleFeatures
autoPtr
<
OBJstream
>
baffleEdgeStr
;
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
baffleEdgeStr
.
reset
(
...
...
@@ -2865,7 +2865,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
// Dump
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
OBJstream
featureEdgeStr
(
...
...
@@ -2962,7 +2962,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
);
}
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
dumpMove
(
...
...
@@ -3380,7 +3380,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
// Re-add normal component
tangPatchDisp
+=
(
pointNormals
&
patchDisp
)
*
pointNormals
;
if
(
debug
&
meshRefinement
::
OBJINTERSE
CTION
S
)
if
(
debug
&
meshRefinement
::
ATTRA
CTION
)
{
dumpMove
(
...
...
src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
View file @
98cabc2e
...
...
@@ -67,13 +67,14 @@ namespace Foam
const
char
*
Foam
::
NamedEnum
<
Foam
::
meshRefinement
::
IOdebugType
,
4
5
>::
names
[]
=
{
"mesh"
,
//"scalarLevels",
"intersections"
,
"featureSeeds"
,
"attraction"
,
"layerInfo"
};
...
...
@@ -102,7 +103,7 @@ namespace Foam
}
const
Foam
::
NamedEnum
<
Foam
::
meshRefinement
::
IOdebugType
,
4
>
const
Foam
::
NamedEnum
<
Foam
::
meshRefinement
::
IOdebugType
,
5
>
Foam
::
meshRefinement
::
IOdebugTypeNames
;
const
Foam
::
NamedEnum
<
Foam
::
meshRefinement
::
IOoutputType
,
1
>
...
...
src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H
View file @
98cabc2e
...
...
@@ -92,15 +92,17 @@ public:
//IOSCALARLEVELS,
IOOBJINTERSECTIONS
,
IOFEATURESEEDS
,
IOATTRACTION
,
IOLAYERINFO
};
static
const
NamedEnum
<
IOdebugType
,
4
>
IOdebugTypeNames
;
static
const
NamedEnum
<
IOdebugType
,
5
>
IOdebugTypeNames
;
enum
debugType
{
MESH
=
1
<<
IOMESH
,
//SCALARLEVELS = 1<<IOSCALARLEVELS,
OBJINTERSECTIONS
=
1
<<
IOOBJINTERSECTIONS
,
FEATURESEEDS
=
1
<<
IOFEATURESEEDS
,
ATTRACTION
=
1
<<
IOATTRACTION
,
LAYERINFO
=
1
<<
IOLAYERINFO
};
...
...
@@ -256,7 +258,7 @@ private:
// (or -1 if not passed through). Uses tracking.
void
markFeatureCellLevel
(
const
point
&
keepPoint
,
const
point
Field
&
keepPoint
s
,
labelList
&
maxFeatureLevel
)
const
;
...
...
@@ -264,7 +266,7 @@ private:
// features.
label
markFeatureRefinement
(
const
point
&
keepPoint
,
const
point
Field
&
keepPoint
s
,
const
label
nAllowRefine
,
labelList
&
refineCell
,
...
...
@@ -779,7 +781,7 @@ public:
//- Calculate list of cells to refine.
labelList
refineCandidates
(
const
point
&
keepPoint
,
const
point
Field
&
keepPoint
s
,
const
scalar
curvature
,
const
scalar
planarAngle
,
...
...
@@ -914,7 +916,7 @@ public:
//- Select coupled faces that are not collocated
void
selectSeparatedCoupledFaces
(
boolList
&
)
const
;
//- Find region
cell
is in. Uses optional perturbation to re-test.
//- Find region
point
is in. Uses optional perturbation to re-test.
static
label
findRegion
(
const
polyMesh
&
,
...
...
@@ -1018,6 +1020,8 @@ public:
const
labelHashSet
&
set
)
const
;
//- Merge edges, maintain mesh quality. Return global number
// of edges merged
label
mergeEdgesUndo
(
const
scalar
minCos
,
...
...
src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
View file @
98cabc2e
...
...
@@ -313,7 +313,7 @@ bool Foam::meshRefinement::markForRefine
void
Foam
::
meshRefinement
::
markFeatureCellLevel
(
const
point
&
keepPoint
,
const
point
Field
&
keepPoint
s
,
labelList
&
maxFeatureLevel
)
const
{
...
...
@@ -345,106 +345,111 @@ void Foam::meshRefinement::markFeatureCellLevel
// what to seed. Do this on only the processor that
// holds the keepPoint.
label
cellI
=
-
1
;
label
tetFaceI
=
-
1
;
label
tetPtI
=
-
1
;
forAll
(
keepPoints
,
i
)
{
const
point
&
keepPoint
=
keepPoints
[
i
]
;
mesh_
.
findCellFacePt
(
keepPoint
,
cellI
,
tetFaceI
,
tetPtI
);
label
cellI
=
-
1
;
label
tetFaceI
=
-
1
;
label
tetPtI
=
-
1
;
if
(
cellI
!=
-
1
)
{
// I am the processor that holds the keepPoint
mesh_
.
findCellFacePt
(
keepPoint
,
cellI
,
tetFaceI
,
tetPtI
);
forAll
(
features_
,
featI
)
if
(
cellI
!=
-
1
)
{
const
edgeMesh
&
featureMesh
=
features_
[
featI
];
const
label
featureLevel
=
features_
.
levels
()[
featI
][
0
];
const
labelListList
&
pointEdges
=
featureMesh
.
pointEdges
();
// I am the processor that holds the keepPoint
// Find regions on edgeMesh
labelList
edgeRegion
;
label
nRegions
=
featureMesh
.
regions
(
edgeRegion
);
forAll
(
features_
,
featI
)
{
const
edgeMesh
&
featureMesh
=
features_
[
featI
];
const
label
featureLevel
=
features_
.
levels
()[
featI
][
0
];
const
labelListList
&
pointEdges
=
featureMesh
.
pointEdges
();
// Find regions on edgeMesh
labelList
edgeRegion
;
label
nRegions
=
featureMesh
.
regions
(
edgeRegion
);
PackedBoolList
regionVisited
(
nRegions
);
PackedBoolList
regionVisited
(
nRegions
);
// 1. Seed all 'knots' in edgeMesh
// 1. Seed all 'knots' in edgeMesh
forAll
(
pointEdges
,
pointI
)
{
if
(
pointEdges
[
pointI
].
size
()
!=
2
)
forAll
(
pointEdges
,
pointI
)
{
if
(
debug
&
meshRefinement
::
FEATURESEEDS
)
if
(
pointEdges
[
pointI
].
size
()
!=
2
)
{
Pout
<<
"Adding particle from point:"
<<
pointI
<<
" coord:"
<<
featureMesh
.
points
()[
pointI
]
<<
" since number of emanating edges:"
<<
pointEdges
[
pointI
].
size
()
<<
endl
;
}
if
(
debug
&
meshRefinement
::
FEATURESEEDS
)
{
Pout
<<
"Adding particle from point:"
<<
pointI
<<
" coord:"
<<
featureMesh
.
points
()[
pointI
]
<<
" since number of emanating edges:"
<<
pointEdges
[
pointI
].
size
()
<<
endl
;
}
// Non-manifold point. Create particle.
startPointCloud
.
addParticle
(
new
trackedParticle
// Non-manifold point. Create particle.
startPointCloud
.
addParticle
(
mesh_
,
keepPoint
,
cellI
,
tetFaceI
,
tetPtI
,
featureMesh
.
points
()[
pointI
],
// endpos
featureLevel
,
// level
featI
,
// featureMesh
pointI
// end point
)
);
new
trackedParticle
(
mesh_
,
keepPoint
,
cellI
,
tetFaceI
,
tetPtI
,
featureMesh
.
points
()[
pointI
],
// endpos
featureLevel
,
// level
featI
,
// featureMesh
pointI
// end point
)
);
// Mark
if
(
pointEdges
[
pointI
].
size
()
>
0
)
{
label
e0
=
pointEdges
[
pointI
][
0
];
label
regionI
=
edgeRegion
[
e0
];
regionVisited
[
regionI
]
=
1u
;
// Mark
if
(
pointEdges
[
pointI
].
size
()
>
0
)
{
label
e0
=
pointEdges
[
pointI
][
0
];
label
regionI
=
edgeRegion
[
e0
];
regionVisited
[
regionI
]
=
1u
;
}
}
}
}
// 2. Any regions that have not been visited at all? These can
// only be circular regions!
forAll
(
featureMesh
.
edges
(),
edgeI
)
{
if
(
regionVisited
.
set
(
edgeRegion
[
edgeI
],
1u
))
// 2. Any regions that have not been visited at all? These can
// only be circular regions!
forAll
(
featureMesh
.
edges
(),
edgeI
)
{
const
edge
&
e
=
featureMesh
.
edges
()[
edgeI
];
label
pointI
=
e
.
start
();
if
(
debug
&
meshRefinement
::
FEATURESEEDS
)
if
(
regionVisited
.
set
(
edgeRegion
[
edgeI
],
1u
))
{
Pout
<<
"Adding particle from point:"
<<
pointI
<<
" coord:"
<<
featureMesh
.
points
()[
pointI
]
<<
" on circular region:"
<<
edgeRegion
[
edgeI
]
<<
endl
;
}
const
edge
&
e
=
featureMesh
.
edges
()[
edgeI
];
label
pointI
=
e
.
start
();
if
(
debug
&
meshRefinement
::
FEATURESEEDS
)
{
Pout
<<
"Adding particle from point:"
<<
pointI
<<
" coord:"
<<
featureMesh
.
points
()[
pointI
]
<<
" on circular region:"
<<
edgeRegion
[
edgeI
]
<<
endl
;
}
// Non-manifold point. Create particle.
startPointCloud
.
addParticle
(
new
trackedParticle
// Non-manifold point. Create particle.
startPointCloud
.
addParticle
(
mesh_
,
keepPoint
,
cellI
,
tetFaceI
,
tetPtI
,
featureMesh
.
points
()[
pointI
],
// endpos
featureLevel
,
// level
featI
,
// featureMesh
pointI
// end point
)
);
new
trackedParticle
(
mesh_
,
keepPoint
,
cellI
,
tetFaceI
,
tetPtI
,
featureMesh
.
points
()[
pointI
],
// endpos
featureLevel
,
// level
featI
,
// featureMesh
pointI
// end point
)
);
}
}
}
}
...
...
@@ -628,7 +633,7 @@ void Foam::meshRefinement::markFeatureCellLevel
// Calculates list of cells to refine based on intersection with feature edge.
Foam
::
label
Foam
::
meshRefinement
::
markFeatureRefinement
(
const
point
&
keepPoint
,
const
point
Field
&
keepPoint
s
,
const
label
nAllowRefine
,
labelList
&
refineCell
,
...
...
@@ -637,7 +642,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
{
// Largest refinement level of any feature passed through
labelList
maxFeatureLevel
;
markFeatureCellLevel
(
keepPoint
,
maxFeatureLevel
);
markFeatureCellLevel
(
keepPoint
s
,
maxFeatureLevel
);
// See which cells to refine. maxFeatureLevel will hold highest level
// of any feature edge that passed through.
...
...
@@ -2009,7 +2014,7 @@ Foam::label Foam::meshRefinement::markProximityRefinement
// hitting overall limit maxGlobalCells.
Foam
::
labelList
Foam
::
meshRefinement
::
refineCandidates
(
const
point
&
keepPoint
,
const
point
Field
&
keepPoint
s
,
const
scalar
curvature
,
const
scalar
planarAngle
,
...
...
@@ -2077,7 +2082,7 @@ Foam::labelList Foam::meshRefinement::refineCandidates
{
label
nFeatures
=
markFeatureRefinement
(
keepPoint
,
keepPoint
s
,
nAllowRefine
,
refineCell
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment