diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 1016794140..dfc657fe8f 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1655,6 +1655,9 @@ int main(int argc, char *argv[]) Info<< endl; + // Remove any demand-driven fields ('S', 'V' etc) + mesh.clearOut(); + if (cellRegion.nRegions() == 1) { diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C index b9a7d4277b..1662667d68 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C +++ b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C @@ -53,9 +53,24 @@ dimensionedScalar dimensionedConstant { dictionary& dict = dimensionedConstants(); - const word unitSet(dict.lookup("unitSet")); + // Check that the entries exist. + // Note: should make FatalError robust instead! - dictionary& unitDict(dict.subDict(unitSet + "Coeffs")); + if (!dict.found("unitSet")) + { + std::cerr<< "Cannot find unitSet in dictionary " << dict.name() + << std::endl; + } + + const word unitSetCoeffs(word(dict.lookup("unitSet")) + "Coeffs"); + + if (!dict.found(unitSetCoeffs)) + { + std::cerr<< "Cannot find " << unitSetCoeffs << " in dictionary " + << dict.name() << std::endl; + } + + dictionary& unitDict = dict.subDict(unitSetCoeffs); dictionary& groupDict = unitDict.subDict(group); diff --git a/src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C b/src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C index bde1181c09..4ee04a7cdf 100644 --- a/src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C +++ b/src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C @@ -198,9 +198,7 @@ void Foam::hierarchGeomDecomp::findBinary label high = values.size(); // Safeguards to avoid infinite loop. - label lowPrev = -1; - label midPrev = -1; - label highPrev = -1; + scalar midValuePrev = VGREAT; while (true) { @@ -208,10 +206,10 @@ void Foam::hierarchGeomDecomp::findBinary if (debug) { - Pout<< "low:" << low << " lowValue:" << lowValue + Pout<< " low:" << low << " lowValue:" << lowValue << " high:" << high << " highValue:" << highValue - << " mid:" << mid << " midValue:" << midValue << nl - << "globalSize:" << size << " wantedSize:" << wantedSize + << " mid:" << mid << " midValue:" << midValue << endl + << " globalSize:" << size << " wantedSize:" << wantedSize << " sizeTol:" << sizeTol << endl; } @@ -235,10 +233,7 @@ void Foam::hierarchGeomDecomp::findBinary mid = findLower(values, midValue, low, high); // Safeguard if same as previous. - bool hasNotChanged = - (mid == midPrev) - && (low == lowPrev) - && (high == highPrev); + bool hasNotChanged = (mag(midValue-midValuePrev) < SMALL); if (returnReduce(hasNotChanged, andOp())) { @@ -248,9 +243,7 @@ void Foam::hierarchGeomDecomp::findBinary break; } - midPrev = mid; - lowPrev = low; - highPrev = high; + midValuePrev = midValue; } } @@ -280,9 +273,7 @@ void Foam::hierarchGeomDecomp::findBinary label high = values.size(); // Safeguards to avoid infinite loop. - label lowPrev = -1; - label midPrev = -1; - label highPrev = -1; + scalar midValuePrev = VGREAT; while (true) { @@ -294,10 +285,10 @@ void Foam::hierarchGeomDecomp::findBinary if (debug) { - Pout<< "low:" << low << " lowValue:" << lowValue + Pout<< " low:" << low << " lowValue:" << lowValue << " high:" << high << " highValue:" << highValue - << " mid:" << mid << " midValue:" << midValue << nl - << "globalSize:" << weightedSize + << " mid:" << mid << " midValue:" << midValue << endl + << " globalSize:" << weightedSize << " wantedSize:" << wantedSize << " sizeTol:" << sizeTol << endl; } @@ -322,10 +313,7 @@ void Foam::hierarchGeomDecomp::findBinary mid = findLower(values, midValue, low, high); // Safeguard if same as previous. - bool hasNotChanged = - (mid == midPrev) - && (low == lowPrev) - && (high == highPrev); + bool hasNotChanged = (mag(midValue-midValuePrev) < SMALL); if (returnReduce(hasNotChanged, andOp())) { @@ -335,9 +323,7 @@ void Foam::hierarchGeomDecomp::findBinary break; } - midPrev = mid; - lowPrev = low; - highPrev = high; + midValuePrev = midValue; } } @@ -460,11 +446,11 @@ void Foam::hierarchGeomDecomp::sortComponent if (debug) { Pout<< "For component " << compI << ", bin " << bin - << " copying" << nl + << " copying" << endl << "from " << leftCoord << " at local index " - << leftIndex << nl + << leftIndex << endl << "to " << rightCoord << " localSize:" - << localSize << nl + << localSize << endl << endl; } @@ -643,11 +629,11 @@ void Foam::hierarchGeomDecomp::sortComponent if (debug) { Pout<< "For component " << compI << ", bin " << bin - << " copying" << nl + << " copying" << endl << "from " << leftCoord << " at local index " - << leftIndex << nl + << leftIndex << endl << "to " << rightCoord << " localSize:" - << localSize << nl + << localSize << endl << endl; } @@ -788,7 +774,6 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose pointField rotatedPoints = rotDelta_ & points; - // Calculate tolerance of cell distribution. For large cases finding // distibution to the cell exact would cause too many iterations so allow // some slack. diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index 1a725f0ebf..49b676b4bd 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C @@ -628,7 +628,7 @@ void Foam::addPatchCellLayer::setRefinement DynamicList