ENH: autoLayerDriver: additional printing in checkAndUnmark

This commit is contained in:
mattijs
2011-09-20 13:45:25 +01:00
parent 46616b54ec
commit 6084361ca3
4 changed files with 167 additions and 103 deletions

View File

@ -46,6 +46,7 @@ Description
#include "combineFaces.H"
#include "IOmanip.H"
#include "globalIndex.H"
#include "DynamicField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1990,6 +1991,7 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark
(
const addPatchCellLayer& addLayer,
const dictionary& meshQualityDict,
const bool additionalReporting,
const List<labelPair>& baffles,
const indirectPrimitivePatch& pp,
const fvMesh& newMesh,
@ -2032,6 +2034,12 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark
);
// Check if any of the faces in error uses any face of an added cell
// - if additionalReporting print the few remaining areas for ease of
// finding out where the problems are.
const label nReportMax = 10;
DynamicField<point> disabledFaceCentres(nReportMax);
forAll(addedCells, oldPatchFaceI)
{
// Get the cells (in newMesh labels) per old patch face (in mesh
@ -2052,12 +2060,58 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark
)
)
{
if (additionalReporting && (nChanged < nReportMax))
{
disabledFaceCentres.append
(
pp.faceCentres()[oldPatchFaceI]
);
}
nChanged++;
}
}
}
return returnReduce(nChanged, sumOp<label>());
label nChangedTotal = returnReduce(nChanged, sumOp<label>());
if (additionalReporting)
{
// Limit the number of points to be printed so that
// not too many points are reported when running in parallel
// Not accurate, i.e. not always nReportMax points are written,
// but this estimation avoid some communication here.
// The important thing, however, is that when only a few faces
// are disabled, their coordinates are printed, and this should be
// the case
label nReportLocal =
min
(
max(nChangedTotal / Pstream::nProcs(), 1),
min
(
nChanged,
max(nReportMax / Pstream::nProcs(), 1)
)
);
Pout<< "Checked mesh with layers. Disabled extrusion at " << endl;
for (label i=0; i < nReportLocal; i++)
{
Pout<< " " << disabledFaceCentres[i] << endl;
}
label nReportTotal = returnReduce(nReportLocal, sumOp<label>());
if (nReportTotal < nChangedTotal)
{
Info<< "Suppressed disabled extrusion message for other "
<< nChangedTotal - nReportTotal << " faces." << endl;
}
}
return nChangedTotal;
}
@ -2858,6 +2912,7 @@ void Foam::autoLayerDriver::addLayers
(
addLayer,
meshQualityDict,
layerParams.additionalReporting(),
newMeshBaffles,
pp(),
newMesh,

View File

@ -331,6 +331,7 @@ class autoLayerDriver
(
const addPatchCellLayer& addLayer,
const dictionary& motionDict,
const bool additionalReporting,
const List<labelPair>& baffles,
const indirectPrimitivePatch& pp,
const fvMesh&,

View File

@ -137,98 +137,98 @@ Foam::labelList Foam::layerParameters::readNumLayers
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::layerParameters::layerParameters
(
const PtrList<dictionary>& surfaceDicts,
const refinementSurfaces& refineSurfaces,
const labelList& globalToPatch,
const dictionary& dict,
const polyBoundaryMesh& boundaryMesh
)
:
numLayers_
(
readNumLayers
(
surfaceDicts,
refineSurfaces,
globalToPatch,
boundaryMesh
)
),
expansionRatio_
(
numLayers_.size(),
readScalar(dict.lookup("expansionRatio"))
),
relativeSizes_(false),
finalLayerThickness_
(
numLayers_.size(),
readScalar(dict.lookup("finalLayerRatio"))
),
minThickness_
(
numLayers_.size(),
readScalar(dict.lookup("minThickness"))
),
featureAngle_(readScalar(dict.lookup("featureAngle"))),
concaveAngle_
(
dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
),
nGrow_(readLabel(dict.lookup("nGrow"))),
nSmoothSurfaceNormals_
(
readLabel(dict.lookup("nSmoothSurfaceNormals"))
),
nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
maxFaceThicknessRatio_
(
readScalar(dict.lookup("maxFaceThicknessRatio"))
),
layerTerminationCos_
(
Foam::cos(degToRad(0.5*featureAngle_))
),
maxThicknessToMedialRatio_
(
readScalar(dict.lookup("maxThicknessToMedialRatio"))
),
minMedianAxisAngleCos_
(
Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
),
nBufferCellsNoExtrude_
(
readLabel(dict.lookup("nBufferCellsNoExtrude"))
),
nSnap_(readLabel(dict.lookup("nSnap"))),
nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
nRelaxedIter_(labelMax)
{
if (nGrow_ > 0)
{
WarningIn("layerParameters::layerParameters(..)")
<< "The nGrow parameter effect has changed with respect to 1.6.x."
<< endl
<< "Please set nGrow=0 for 1.6.x behaviour."
<< endl;
}
dict.readIfPresent("nRelaxedIter", nRelaxedIter_);
if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
{
FatalErrorIn("layerParameters::layerParameters(..)")
<< "Layer iterations should be >= 0." << endl
<< "nLayerIter:" << nLayerIter_
<< " nRelaxedIter:" << nRelaxedIter_
<< exit(FatalError);
}
}
//// Construct from dictionary
//Foam::layerParameters::layerParameters
//(
// const PtrList<dictionary>& surfaceDicts,
// const refinementSurfaces& refineSurfaces,
// const labelList& globalToPatch,
// const dictionary& dict,
// const polyBoundaryMesh& boundaryMesh
//)
//:
// numLayers_
// (
// readNumLayers
// (
// surfaceDicts,
// refineSurfaces,
// globalToPatch,
// boundaryMesh
// )
// ),
// expansionRatio_
// (
// numLayers_.size(),
// readScalar(dict.lookup("expansionRatio"))
// ),
// relativeSizes_(false),
// finalLayerThickness_
// (
// numLayers_.size(),
// readScalar(dict.lookup("finalLayerRatio"))
// ),
// minThickness_
// (
// numLayers_.size(),
// readScalar(dict.lookup("minThickness"))
// ),
// featureAngle_(readScalar(dict.lookup("featureAngle"))),
// concaveAngle_
// (
// dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
// ),
// nGrow_(readLabel(dict.lookup("nGrow"))),
// nSmoothSurfaceNormals_
// (
// readLabel(dict.lookup("nSmoothSurfaceNormals"))
// ),
// nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
// nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
// maxFaceThicknessRatio_
// (
// readScalar(dict.lookup("maxFaceThicknessRatio"))
// ),
// layerTerminationCos_
// (
// Foam::cos(degToRad(0.5*featureAngle_))
// ),
// maxThicknessToMedialRatio_
// (
// readScalar(dict.lookup("maxThicknessToMedialRatio"))
// ),
// minMedianAxisAngleCos_
// (
// Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
// ),
// nBufferCellsNoExtrude_
// (
// readLabel(dict.lookup("nBufferCellsNoExtrude"))
// ),
// nSnap_(readLabel(dict.lookup("nSnap"))),
// nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
// nRelaxedIter_(labelMax)
//{
// if (nGrow_ > 0)
// {
// WarningIn("layerParameters::layerParameters(..)")
// << "The nGrow parameter effect has changed with respect to 1.6.x."
// << endl
// << "Please set nGrow=0 for 1.6.x behaviour."
// << endl;
// }
//
// dict.readIfPresent("nRelaxedIter", nRelaxedIter_);
//
// if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
// {
// FatalErrorIn("layerParameters::layerParameters(..)")
// << "Layer iterations should be >= 0." << endl
// << "nLayerIter:" << nLayerIter_
// << " nRelaxedIter:" << nRelaxedIter_
// << exit(FatalError);
// }
//}
// Construct from dictionary
@ -289,7 +289,8 @@ Foam::layerParameters::layerParameters
),
nSnap_(readLabel(dict.lookup("nRelaxIter"))),
nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
nRelaxedIter_(labelMax)
nRelaxedIter_(labelMax),
additionalReporting_(dict.lookupOrDefault("additionalReporting", false))
{
if (nGrow_ > 0)
{

View File

@ -105,6 +105,7 @@ class layerParameters
label nRelaxedIter_;
Switch additionalReporting_;
// Private Member Functions
@ -128,15 +129,15 @@ public:
// Constructors
//- Construct from dictionary - old syntax
layerParameters
(
const PtrList<dictionary>& surfaceDicts,
const refinementSurfaces& refineSurfaces,
const labelList& globalToPatch,
const dictionary& dict,
const polyBoundaryMesh& boundaryMesh
);
////- Construct from dictionary - old syntax
//layerParameters
//(
// const PtrList<dictionary>& surfaceDicts,
// const refinementSurfaces& refineSurfaces,
// const labelList& globalToPatch,
// const dictionary& dict,
// const polyBoundaryMesh& boundaryMesh
//);
//- Construct from dictionary - new syntax
layerParameters(const dictionary& dict, const polyBoundaryMesh&);
@ -259,6 +260,12 @@ public:
return nSnap_;
}
const Switch& additionalReporting() const
{
return additionalReporting_;
}
// Overall
//- Number of overall layer addition iterations