From aaf2b3973b53f11591add4ece91c604cadb0398d Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Jul 2012 09:58:56 +0100 Subject: [PATCH 01/12] STYLE: manualDecomp: corrected message --- .../decompositionMethods/manualDecomp/manualDecomp.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parallel/decompose/decompositionMethods/manualDecomp/manualDecomp.H b/src/parallel/decompose/decompositionMethods/manualDecomp/manualDecomp.H index 28a1d4c539..cd2ba9b430 100644 --- a/src/parallel/decompose/decompositionMethods/manualDecomp/manualDecomp.H +++ b/src/parallel/decompose/decompositionMethods/manualDecomp/manualDecomp.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,7 +111,7 @@ public: notImplemented ( "decompose(const labelListList&, const pointField&" - ", const scalarField)" + ", const scalarField&)" ); return labelList(0); } From 82ec0dbe6b0d3f6bb5a2099a17250d9ce6950953 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Jul 2012 10:00:31 +0100 Subject: [PATCH 02/12] ENH: decompositionMethods: added none method --- .../decompose/decompositionMethods/Make/files | 1 + .../decompositionMethods/noDecomp/noDecomp.C | 53 +++++++ .../decompositionMethods/noDecomp/noDecomp.H | 134 ++++++++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.C create mode 100644 src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.H diff --git a/src/parallel/decompose/decompositionMethods/Make/files b/src/parallel/decompose/decompositionMethods/Make/files index b21f2c70bd..5e54b366af 100644 --- a/src/parallel/decompose/decompositionMethods/Make/files +++ b/src/parallel/decompose/decompositionMethods/Make/files @@ -6,5 +6,6 @@ manualDecomp/manualDecomp.C multiLevelDecomp/multiLevelDecomp.C structuredDecomp/topoDistanceData.C structuredDecomp/structuredDecomp.C +noDecomp/noDecomp.C LIB = $(FOAM_LIBBIN)/libdecompositionMethods diff --git a/src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.C b/src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.C new file mode 100644 index 0000000000..e62e588b9e --- /dev/null +++ b/src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "noDecomp.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeName(noDecomp); + + addNamedToRunTimeSelectionTable + ( + decompositionMethod, + noDecomp, + dictionary, + none + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::noDecomp::noDecomp(const dictionary& decompositionDict) +: + decompositionMethod(decompositionDict) +{} + + +// ************************************************************************* // diff --git a/src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.H b/src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.H new file mode 100644 index 0000000000..13368c9970 --- /dev/null +++ b/src/parallel/decompose/decompositionMethods/noDecomp/noDecomp.H @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::noDecomp + +Description + Dummy decomposition method + +SourceFiles + noDecomp.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noDecomp_H +#define noDecomp_H + +#include "decompositionMethod.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class noDecomp Declaration +\*---------------------------------------------------------------------------*/ + +class noDecomp +: + public decompositionMethod +{ + + // Private Member Functions + + //- Disallow default bitwise copy construct and assignment + void operator=(const noDecomp&); + noDecomp(const noDecomp&); + + +public: + + //- Runtime type information + TypeName("noDecomp"); + + + // Constructors + + //- Construct given the decomposition dictionary + noDecomp(const dictionary& decompositionDict); + + //- Destructor + virtual ~noDecomp() + {} + + + // Member Functions + + //- manual decompose does not care about proc boundaries - is all + // up to the user. + virtual bool parallelAware() const + { + return false; + } + + //- Return for every coordinate the wanted processor number. Use the + // mesh connectivity (if needed) + virtual labelList decompose + ( + const polyMesh& mesh, + const pointField& cc, + const scalarField& cWeights + ) + { + notImplemented + ( + "decompose(const polyMesh&, const pointField&" + ", const scalarField&)" + ); + return labelList(0); + } + + //- Return for every coordinate the wanted processor number. Explicitly + // provided connectivity - does not use mesh_. + // The connectivity is equal to mesh.cellCells() except for + // - in parallel the cell numbers are global cell numbers (starting + // from 0 at processor0 and then incrementing all through the + // processors) + // - the connections are across coupled patches + virtual labelList decompose + ( + const labelListList& globalCellCells, + const pointField& cc, + const scalarField& cWeights + ) + { + notImplemented + ( + "decompose(const labelListList&, const pointField&" + ", const scalarField&)" + ); + return labelList(0); + } + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 33656b39691a96f9032c2596ad96a2c2c2edfced Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Jul 2012 10:01:25 +0100 Subject: [PATCH 03/12] ENH: snappyHexMesh: run without decomposeParDict --- .../generation/snappyHexMesh/snappyHexMesh.C | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) 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 From f64b5a1b77185f436ba9298e135afd0a41a2f1a1 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 4 Jul 2012 14:22:08 +0100 Subject: [PATCH 04/12] BUG: Re-arrenging the solidThermo interface --- .../reactingOneDim/reactingOneDim.C | 4 +- .../thermoBaffle2D/thermoBaffle2D.C | 2 +- .../basic/basicThermo/basicThermo.C | 55 ----------- .../basic/rhoThermo/rhoThermo/rhoThermo.C | 19 ++++ .../basic/rhoThermo/rhoThermo/rhoThermo.H | 3 + .../heSolidThermo/heSolidThermo.H | 3 - .../solidThermo/solidThermo.C | 78 +--------------- .../solidThermo/solidThermo.H | 92 +------------------ 8 files changed, 29 insertions(+), 227 deletions(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index e19084dd3d..65143f5d27 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -349,7 +349,7 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) pyrolysisModel(modelType, mesh), solidChemistry_(solidChemistryModel::New(regionMesh())), solidThermo_(solidChemistry_->solid()), - rho_(solidThermo_.rhos()), + rho_(solidThermo_.rho()), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), primaryRadFluxName_(coeffs().lookupOrDefault("radFluxName", "Qr")), @@ -449,7 +449,7 @@ reactingOneDim::reactingOneDim pyrolysisModel(modelType, mesh, dict), solidChemistry_(solidChemistryModel::New(regionMesh())), solidThermo_(solidChemistry_->solid()), - rho_(solidThermo_.rhos()), + rho_(solidThermo_.rho()), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), primaryRadFluxName_(dict.lookupOrDefault("radFluxName", "Qr")), diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C index a0495d2d06..97faec40cb 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C @@ -359,7 +359,7 @@ void thermoBaffle2D::info() const ( mag(regionMesh().Sf().boundaryField()[patchI]) * ph.snGrad() - * thermo_->alpha(patchI) + * thermo_->alpha().boundaryField()[patchI] ) << endl; } } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index aa90283d51..1390c214a2 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -40,62 +40,7 @@ namespace Foam defineTypeNameAndDebug(basicThermo, 0); defineRunTimeSelectionTable(basicThermo, fvMesh); } -/* -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::wordList Foam::basicThermo::heBoundaryTypes() -{ - const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField(); - - wordList hbt = tbf.types(); - - forAll(tbf, patchi) - { - if (isA(tbf[patchi])) - { - hbt[patchi] = fixedEnergyFvPatchScalarField::typeName; - } - else if - ( - isA(tbf[patchi]) - || isA(tbf[patchi]) - ) - { - hbt[patchi] = gradientEnergyFvPatchScalarField::typeName; - } - else if(isA(tbf[patchi])) - { - hbt[patchi] = mixedEnergyFvPatchScalarField::typeName; - } - else if (isA(tbf[patchi])) - { - hbt[patchi] = energyJumpFvPatchScalarField::typeName; - } - } - - return hbt; -} - - -void Foam::basicThermo::heBoundaryCorrection(volScalarField& h) -{ - volScalarField::GeometricBoundaryField& hbf = h.boundaryField(); - - forAll(hbf, patchi) - { - if (isA(hbf[patchi])) - { - refCast(hbf[patchi]).gradient() - = hbf[patchi].fvPatchField::snGrad(); - } - else if (isA(hbf[patchi])) - { - refCast(hbf[patchi]).refGrad() - = hbf[patchi].fvPatchField::snGrad(); - } - } -} -*/ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C index 8cafa9454c..33c7905fee 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C @@ -55,6 +55,25 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) {} +Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dicy) +: + basicThermo(mesh, dict), + rho_ + ( + IOobject + ( + "rhoThermo", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimDensity + ) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::rhoThermo::~rhoThermo() diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H index 098e2ec0f1..77a4c4fd12 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.H @@ -90,6 +90,9 @@ public: //- Construct from mesh rhoThermo(const fvMesh&); + //- Construct from mesh + rhoThermo(const fvMesh&, const dictionary&); + //- Selector static autoPtr New(const fvMesh&); diff --git a/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H index fac27226ff..88a8d8aab6 100644 --- a/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/heSolidThermo/heSolidThermo.H @@ -89,9 +89,6 @@ public: // Derived thermal properties - //- Isotropic thermal conductivity [W/m/K] - //virtual tmp kappa() const; - //- Anisotropic thermal conductivity [W/m/K] virtual tmp Kappa() const; diff --git a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C index 24220ee9bb..7a791b59cc 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C @@ -42,20 +42,7 @@ namespace Foam Foam::solidThermo::solidThermo(const fvMesh& mesh) : - basicThermo(mesh), - rho_ - ( - IOobject - ( - "rho", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimMass/dimVolume - ) + rhoThermo(mesh) {} @@ -65,20 +52,7 @@ Foam::solidThermo::solidThermo const dictionary& dict ) : - basicThermo(mesh, dict), - rho_ - ( - IOobject - ( - "rho", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimMass/dimVolume - ) + rhoThermo(mesh, dict) {} @@ -90,54 +64,6 @@ Foam::solidThermo::~solidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::volScalarField& Foam::solidThermo::T() -{ - return this->T_; -} - - -const Foam::volScalarField& Foam::solidThermo::T() const -{ - return this->T_; -} - - -const Foam::volScalarField& Foam::solidThermo::rhos() const -{ - return rho_; -} - - -Foam::volScalarField& Foam::solidThermo::rhos() -{ - return rho_; -} - - -const Foam::volScalarField& Foam::solidThermo::p() const -{ - return this->p_; -} - - -Foam::volScalarField& Foam::solidThermo::p() -{ - return this->p_; -} - - -const Foam::volScalarField& Foam::solidThermo::alpha() const -{ - return this->alpha_; -} - - -Foam::tmp Foam::solidThermo::rho() const -{ - return tmp(rho_); -} - - bool Foam::solidThermo::read() { return regIOobject::read(); diff --git a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H index 79741f466f..08b9f82ab4 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.H @@ -41,7 +41,7 @@ SourceFiles #include "IOdictionary.H" #include "autoPtr.H" #include "basicSolidMixture.H" -#include "basicThermo.H" +#include "rhoThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,18 +54,9 @@ namespace Foam class solidThermo : - public basicThermo + public rhoThermo { -protected: - - - // Fields - - //- Density [kg/m3] - volScalarField rho_; - - public: //- Runtime type information @@ -116,50 +107,9 @@ public: // Member functions - //- Update properties - virtual void correct() = 0; - - - // Access to thermodynamic state variables - - //- Constant access to temperature [K] - virtual const volScalarField& T() const; - - //- Non constant access to temperature [K] - virtual volScalarField& T(); - - //- Solid density [kg/m3] - virtual const volScalarField& rhos() const; - - //- Non-const access for solid density [kg/m3] - virtual volScalarField& rhos(); - - - //- Constant access to p [Pa] - virtual const volScalarField& p() const; - - //- Non-constant access to p [Pa] - virtual volScalarField& p(); - - - // Access to transport state variables - - //- Thermal diffusivity for enthalpy of mixture [kg/m/s] - virtual const volScalarField& alpha() const; - // Derived thermal properties - //- Enthalpy/Internal energy [J/kg] - virtual const volScalarField& he() const = 0; - - //- Enthalpy/Internal energy [J/kg] - // Non-const access allowed for transport equations - virtual volScalarField& he() = 0; - - //- Thermal conductivity [W/m/K] - virtual tmp kappa() const = 0; - //- Thermal conductivity [W/m/K] virtual tmp Kappa() const = 0; @@ -172,50 +122,12 @@ public: //- Emissivity coefficient [1/m] virtual tmp emissivity() const = 0; - //- Specific heat capacity [J/kg/K] - virtual tmp Cp() const = 0; - - //- Heat of formation [J/kg] - virtual tmp hc() const = 0; - - //- Density [kg/m^3] - virtual tmp rho() const; - // Per patch calculation - //- Enthalpy/Internal energy [J/kg] - virtual tmp he - ( - const scalarField& p, - const scalarField& T, - const label patchi - ) const = 0; - - - //- Specific heat capacity [J/kg/K)] - virtual tmp Cp - ( - const scalarField& p, - const scalarField& T, - const label patchI - ) const = 0; - - - //- Isotropic thermal conductivity [W//m/K] - virtual tmp kappa - ( - const label patchI - ) const = 0; //- Anisotropic thermal conductivity [W/m/K] virtual tmp Kappa - ( - const label patchI - ) const = 0; - - //- Thermal diffusivity for enthalpy of mixture [kg/m/s] - virtual tmp alpha ( const label patchI ) const = 0; From 0607d6a9aa3037534a1bd822e24fe2fe969162f0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 4 Jul 2012 16:06:29 +0100 Subject: [PATCH 05/12] BUG: patchSummary: no output if no patch groups --- .../miscellaneous/patchSummary/patchSummary.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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; + } + } } } } From cc9fbe7393338c12bdd06357b85c451f2fdd9638 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Jul 2012 12:16:19 +0100 Subject: [PATCH 06/12] ENH: FaceCellWave: check on supplied sizes --- .../algorithms/MeshWave/FaceCellWave.C | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.C b/src/meshTools/algorithms/MeshWave/FaceCellWave.C index 2177382a38..27218a474a 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWave.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -814,7 +814,27 @@ Foam::FaceCellWave::FaceCellWave nEvals_(0), nUnvisitedCells_(mesh_.nCells()), nUnvisitedFaces_(mesh_.nFaces()) -{} +{ + if + ( + allFaceInfo.size() != mesh_.nFaces() + || allCellInfo.size() != mesh_.nCells() + ) + { + FatalErrorIn + ( + "FaceCellWave::FaceCellWave" + "(const polyMesh&, const labelList&, const List," + " UList&, UList&, const label maxIter)" + ) << "face and cell storage not the size of mesh faces, cells:" + << endl + << " allFaceInfo :" << allFaceInfo.size() << endl + << " mesh_.nFaces():" << mesh_.nFaces() << endl + << " allCellInfo :" << allCellInfo.size() << endl + << " mesh_.nCells():" << mesh_.nCells() + << exit(FatalError); + } +} // Iterate, propagating changedFacesInfo across mesh, until no change (or @@ -850,6 +870,26 @@ Foam::FaceCellWave::FaceCellWave nUnvisitedCells_(mesh_.nCells()), nUnvisitedFaces_(mesh_.nFaces()) { + if + ( + allFaceInfo.size() != mesh_.nFaces() + || allCellInfo.size() != mesh_.nCells() + ) + { + FatalErrorIn + ( + "FaceCellWave::FaceCellWave" + "(const polyMesh&, const labelList&, const List," + " UList&, UList&, const label maxIter)" + ) << "face and cell storage not the size of mesh faces, cells:" + << endl + << " allFaceInfo :" << allFaceInfo.size() << endl + << " mesh_.nFaces():" << mesh_.nFaces() << endl + << " allCellInfo :" << allCellInfo.size() << endl + << " mesh_.nCells():" << mesh_.nCells() + << exit(FatalError); + } + // Copy initial changed faces data setFaceInfo(changedFaces, changedFacesInfo); From 2e2c8d32d54d54e74033bf36ed0b164659b91fab Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Jul 2012 12:23:42 +0100 Subject: [PATCH 07/12] BUG: rhoThermo.C: misspelled argument --- src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C index 33c7905fee..75b6f1f363 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo/rhoThermo.C @@ -55,7 +55,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) {} -Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dicy) +Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) : basicThermo(mesh, dict), rho_ From 15188397e87253bedfb6943a9d9d6e32341a903f Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Jul 2012 12:26:51 +0100 Subject: [PATCH 08/12] BUG: createFields: non-const ref to T --- .../postProcessing/wall/solidWallHeatFlux/createFields.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); From 3e26473b5db93981dfa7683efa1822f0518da686 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 6 Jul 2012 11:57:46 +0100 Subject: [PATCH 09/12] STYLE: solidThermo: indenting --- .../basicSolidThermo/solidReactionThermo/solidReactionThermo.C | 2 ++ .../basicSolidThermo/solidThermo/solidThermo.C | 1 + 2 files changed, 3 insertions(+) diff --git a/src/thermophysicalModels/basicSolidThermo/solidReactionThermo/solidReactionThermo.C b/src/thermophysicalModels/basicSolidThermo/solidReactionThermo/solidReactionThermo.C index 6cf0fef12b..00f75ac7cc 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidReactionThermo/solidReactionThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidReactionThermo/solidReactionThermo.C @@ -35,6 +35,7 @@ namespace Foam defineRunTimeSelectionTable(solidReactionThermo, dictionary); } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::solidReactionThermo::solidReactionThermo(const fvMesh& mesh) @@ -52,6 +53,7 @@ Foam::solidReactionThermo::solidReactionThermo solidThermo(mesh, dict) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::solidReactionThermo::~solidReactionThermo() diff --git a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C index 7a791b59cc..d1e6af4e2b 100644 --- a/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/solidThermo/solidThermo.C @@ -69,4 +69,5 @@ bool Foam::solidThermo::read() return regIOobject::read(); } + // ************************************************************************* // From c380d6d423e1153f250395502d9469ce7a337dc3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 6 Jul 2012 12:03:47 +0100 Subject: [PATCH 10/12] BUG: extendedLeastSquares: incorrect indexing. Added 2D detection. --- .../extendedLeastSquaresVectors.C | 136 +++++++++++++++--- 1 file changed, 114 insertions(+), 22 deletions(-) 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