mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
protect against illegal number of layers
This commit is contained in:
@ -2661,10 +2661,22 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
// Find maximum length of a patch name, for a nicer output
|
||||||
|
label maxPatchNameLen = 0;
|
||||||
|
forAll(meshMover.adaptPatchIDs(), i)
|
||||||
|
{
|
||||||
|
label patchI = meshMover.adaptPatchIDs()[i];
|
||||||
|
word patchName = patches[patchI].name();
|
||||||
|
maxPatchNameLen = max(maxPatchNameLen,label(patchName.size()));
|
||||||
|
}
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "patch faces layers avg thickness[m]" << nl
|
<< setf(ios_base::left) << setw(maxPatchNameLen) << "patch"
|
||||||
<< " near-wall overall" << nl
|
<< setw(0) << " faces layers avg thickness[m]" << nl
|
||||||
<< "----- ----- ------ --------- -------" << endl;
|
<< setf(ios_base::left) << setw(maxPatchNameLen) << " "
|
||||||
|
<< setw(0) << " near-wall overall" << nl
|
||||||
|
<< setf(ios_base::left) << setw(maxPatchNameLen) << "-----"
|
||||||
|
<< setw(0) << " ----- ------ --------- -------" << endl;
|
||||||
|
|
||||||
forAll(meshMover.adaptPatchIDs(), i)
|
forAll(meshMover.adaptPatchIDs(), i)
|
||||||
{
|
{
|
||||||
@ -2704,18 +2716,24 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
|
|
||||||
label totNPoints = returnReduce(meshPoints.size(), sumOp<label>());
|
label totNPoints = returnReduce(meshPoints.size(), sumOp<label>());
|
||||||
|
|
||||||
//reduce(maxThickness, maxOp<scalar>());
|
// For empty patches, totNPoints is 0.
|
||||||
//reduce(minThickness, minOp<scalar>());
|
scalar avgThickness = 0;
|
||||||
scalar avgThickness =
|
scalar avgNearWallThickness = 0;
|
||||||
returnReduce(sumThickness, sumOp<scalar>())
|
|
||||||
/ totNPoints;
|
|
||||||
scalar avgNearWallThickness =
|
|
||||||
returnReduce(sumNearWallThickness, sumOp<scalar>())
|
|
||||||
/ totNPoints;
|
|
||||||
|
|
||||||
Info<< setf(ios_base::left) << setw(19) << patches[patchI].name();
|
if (totNPoints > 0)
|
||||||
//Sout.unsetf(ios_base::left);
|
{
|
||||||
Info<< setprecision(3)
|
//reduce(maxThickness, maxOp<scalar>());
|
||||||
|
//reduce(minThickness, minOp<scalar>());
|
||||||
|
avgThickness =
|
||||||
|
returnReduce(sumThickness, sumOp<scalar>())
|
||||||
|
/ totNPoints;
|
||||||
|
avgNearWallThickness =
|
||||||
|
returnReduce(sumNearWallThickness, sumOp<scalar>())
|
||||||
|
/ totNPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< setf(ios_base::left) << setw(maxPatchNameLen)
|
||||||
|
<< patches[patchI].name() << setprecision(3)
|
||||||
<< " " << setw(8)
|
<< " " << setw(8)
|
||||||
<< returnReduce(patches[patchI].size(), sumOp<scalar>())
|
<< returnReduce(patches[patchI].size(), sumOp<scalar>())
|
||||||
<< " " << setw(6) << layerParams.numLayers()[patchI]
|
<< " " << setw(6) << layerParams.numLayers()[patchI]
|
||||||
|
|||||||
Reference in New Issue
Block a user