diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 279808bff1..d991719071 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -40,6 +40,7 @@ Description #include "refinementFeatures.H" #include "shellSurfaces.H" #include "decompositionMethod.H" +#include "noDecomp.H" #include "fvMeshDistribute.H" #include "wallPolyPatch.H" #include "refinementParameters.H" @@ -176,17 +177,27 @@ int main(int argc, char *argv[]) // Read decomposePar dictionary - IOdictionary decomposeDict - ( - IOobject + dictionary decomposeDict; + { + IOobject io ( "decomposeParDict", runTime.system(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE - ) - ); + ); + + if (io.headerOk()) + { + decomposeDict = IOdictionary(io); + } + else + { + decomposeDict.add("method", "none"); + decomposeDict.add("numberOfSubdomains", 1); + } + } // Debug diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C index d23acc6a69..e26fc10988 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.C @@ -191,6 +191,22 @@ int main(int argc, char *argv[]) outputFieldList(vtf, patchIDs[0]); Info<< endl; } + else + { + // No group. + forAll(patchIDs, i) + { + label patchI = patchIDs[i]; + Info<< bm[patchI].type() + << "\t: " << bm[patchI].name() << nl; + outputFieldList(vsf, patchI); + outputFieldList(vvf, patchI); + outputFieldList(vsptf, patchI); + outputFieldList(vsytf, patchI); + outputFieldList(vtf, patchI); + Info<< endl; + } + } } } } diff --git a/applications/utilities/postProcessing/wall/solidWallHeatFlux/createFields.H b/applications/utilities/postProcessing/wall/solidWallHeatFlux/createFields.H index 712dd51050..88adcd8e54 100644 --- a/applications/utilities/postProcessing/wall/solidWallHeatFlux/createFields.H +++ b/applications/utilities/postProcessing/wall/solidWallHeatFlux/createFields.H @@ -3,4 +3,4 @@ autoPtr thermo solidThermo::New(mesh) ); -volScalarField& T = thermo->T(); +const volScalarField& T = thermo->T(); diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C index efc6559d79..e9ecd484c3 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C @@ -110,6 +110,38 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const const labelUList& owner = mesh_.owner(); const labelUList& neighbour = mesh_.neighbour(); + + // Determine number of dimensions and (for 2D) missing dimension + label nDims = 0; + label twoD = -1; + for (direction dir = 0; dir < vector::nComponents; dir++) + { + if (mesh.geometricD()[dir] == 1) + { + nDims++; + } + else + { + twoD = dir; + } + } + + if (nDims == 1) + { + FatalErrorIn + ( + "extendedLeastSquaresVectors::makeLeastSquaresVectors() const" + ) << "Found a mesh with only one geometric dimension : " + << mesh.geometricD() + << exit(FatalError); + } + else if (nDims == 2) + { + Info<< "extendedLeastSquares : detected " << nDims + << " valid directions. Missing direction " << twoD << nl << endl; + } + + const volVectorField& C = mesh.C(); // Set up temporary storage for the dd tensor (before inversion) @@ -122,7 +154,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const vector d = C[nei] - C[own]; - const symmTensor wdd(1.0/magSqr(d[facei])*sqr(d[facei])); + const symmTensor wdd(1.0/magSqr(d)*sqr(d)); dd[own] += wdd; dd[nei] += wdd; @@ -147,6 +179,28 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const } } + + // Check for missing dimensions + // Add the missing eigenvector (such that it does not + // affect the determinant) + if (nDims == 2) + { + forAll(dd, cellI) + { + if (twoD == 0) + { + dd[cellI].xx() = 1; + } + else if (twoD == 1) + { + dd[cellI].yy() = 1; + } + else + { + dd[cellI].zz() = 1; + } + } + } scalarField detdd(det(dd)); Info<< "max(detdd) = " << max(detdd) << nl @@ -170,7 +224,8 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const ( "extendedLeastSquaresVectors::" "makeLeastSquaresVectors() const" - ) << "nAddCells exceeds maxNaddCells" + ) << "nAddCells exceeds maxNaddCells (" + << maxNaddCells << ")" << exit(FatalError); } @@ -188,20 +243,35 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const if (cellj != i) { - if (cellj != -1) + vector dCij = (mesh.C()[cellj] - mesh.C()[i]); + + symmTensor ddij = + dd[i] + (1.0/magSqr(dCij))*sqr(dCij); + + // Add the missing eigenvector (such that it does not + // affect the determinant) + if (nDims == 2) { - vector dCij = (mesh.C()[cellj] - mesh.C()[i]); - - symmTensor ddij = - dd[i] + (1.0/magSqr(dCij))*sqr(dCij); - - scalar detddij = det(ddij); - - if (detddij > maxDetddij) + if (twoD == 0) { - addCell = cellj; - maxDetddij = detddij; + ddij.xx() = 1; } + else if (twoD == 1) + { + ddij.yy() = 1; + } + else + { + ddij.zz() = 1; + } + } + + scalar detddij = det(ddij); + + if (detddij > maxDetddij) + { + addCell = cellj; + maxDetddij = detddij; } } } @@ -213,6 +283,25 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const additionalCells_[nAddCells++][1] = addCell; vector dCij = mesh.C()[addCell] - mesh.C()[i]; dd[i] += (1.0/magSqr(dCij))*sqr(dCij); + + // Add the missing eigenvector (such that it does not + // affect the determinant) + if (nDims == 2) + { + if (twoD == 0) + { + dd[i].xx() = 1; + } + else if (twoD == 1) + { + dd[i].yy() = 1; + } + else + { + dd[i].zz() = 1; + } + } + detdd[i] = det(dd[i]); } } @@ -220,10 +309,16 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const additionalCells_.setSize(nAddCells); - Info<< "max(detdd) = " << max(detdd) << nl - << "min(detdd) = " << min(detdd) << nl - << "average(detdd) = " << average(detdd) << nl - << "nAddCells/nCells = " << scalar(nAddCells)/mesh.nCells() << endl; + reduce(nAddCells, sumOp