From 86b9ed5348c88bc5862f14cb74c81719000de335 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 15 Jan 2013 10:31:42 +0000 Subject: [PATCH 01/23] BUG: Correcting writing of solidReaction and reaction --- .../Reactions/solidReaction/solidReaction.C | 76 ++++++++++++++++- .../Reactions/solidReaction/solidReaction.H | 9 ++ .../Reactions/solidReaction/solidReactionI.H | 3 +- .../reaction/Reactions/Reaction/Reaction.C | 85 ++++++++----------- .../reaction/Reactions/Reaction/Reaction.H | 12 ++- .../reaction/Reactions/Reaction/ReactionI.H | 4 +- 6 files changed, 134 insertions(+), 55 deletions(-) diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C index ead9b263fc..99bb98acb4 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C +++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C @@ -137,8 +137,82 @@ gasSpecies() const template void Foam::solidReaction::write(Ostream& os) const { - Reaction::write(os); + OStringStream reaction; + os.writeKeyword("reaction") << solidReactionStr(reaction) + << token::END_STATEMENT << nl; } +template +Foam::string Foam::solidReaction::solidReactionStr +( + OStringStream& reaction +) const +{ + this->reactionStrLeft(reaction); + reaction << " + "; + solidReactionStrLeft(reaction); + reaction << " = "; + this->reactionStrRight(reaction); + reaction << " + "; + solidReactionStrRight(reaction); + return reaction.str(); + +} + + +template +void Foam::solidReaction::solidReactionStrLeft +( + OStringStream& reaction +) const +{ + for (label i = 0; i < glhs().size(); ++i) + { + reaction << " + "; + + if (i > 0) + { + reaction << " + "; + } + if (mag(glhs()[i].stoichCoeff - 1) > SMALL) + { + reaction << glhs()[i].stoichCoeff; + } + reaction << gasSpecies()[glhs()[i].index]; + if (mag(glhs()[i].exponent - glhs()[i].stoichCoeff) > SMALL) + { + reaction << "^" << glhs()[i].exponent; + } + } +} + + +template +void Foam::solidReaction::solidReactionStrRight +( + OStringStream& reaction +) const +{ + + for (label i = 0; i < grhs().size(); ++i) + { + reaction << " + "; + + if (i > 0) + { + reaction << " + "; + } + if (mag(grhs()[i].stoichCoeff - 1) > SMALL) + { + reaction << grhs()[i].stoichCoeff; + } + reaction << gasSpecies()[grhs()[i].index]; + if (mag(grhs()[i].exponent - grhs()[i].stoichCoeff) > SMALL) + { + reaction << "^" << grhs()[i].exponent; + } + } +} + // ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H index 1bc4a82243..cc9eb6a7b7 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H +++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H @@ -81,6 +81,15 @@ private: // Private Member Functions + //- Return string representation of reaction + string solidReactionStr(OStringStream&) const; + + //- Return string representation of the left of the reaction + void solidReactionStrLeft(OStringStream&) const; + + //- Return string representation of the right of the reaction + void solidReactionStrRight(OStringStream&) const; + //- Disallow default bitwise assignment void operator=(const solidReaction&); diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H index 534bb66fa7..9bad3ba778 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H +++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H @@ -39,7 +39,8 @@ inline Ostream& operator<< const solidReaction& r ) { - r.write(os); + OStringStream reaction; + os << r.solidReactionStr(reaction)<< token::END_STATEMENT < Foam::label Foam::Reaction::nUnNamedReactions = 0; - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // template -Foam::label Foam::Reaction::getNewReactionID() +void Foam::Reaction::reactionStrLeft +( + OStringStream& reaction +) const { - return nUnNamedReactions++; -} - - -template -Foam::string Foam::Reaction::reactionStr() const -{ - OStringStream reaction; - for (label i = 0; i < lhs_.size(); ++i) { if (i > 0) @@ -62,28 +55,15 @@ Foam::string Foam::Reaction::reactionStr() const reaction << "^" << lhs_[i].exponent; } } +} - for (label i = 0; i < glhs().size(); ++i) - { - reaction << " + "; - - if (i > 0) - { - reaction << " + "; - } - if (mag(glhs()[i].stoichCoeff - 1) > SMALL) - { - reaction << glhs()[i].stoichCoeff; - } - reaction << gasSpecies()[glhs()[i].index]; - if (mag(glhs()[i].exponent - glhs()[i].stoichCoeff) > SMALL) - { - reaction << "^" << glhs()[i].exponent; - } - } - - reaction << " = "; +template +void Foam::Reaction::reactionStrRight +( + OStringStream& reaction +) const +{ for (label i = 0; i < rhs_.size(); ++i) { if (i > 0) @@ -100,26 +80,27 @@ Foam::string Foam::Reaction::reactionStr() const reaction << "^" << rhs_[i].exponent; } } +} - for (label i = 0; i < grhs().size(); ++i) - { - reaction << " + "; - if (i > 0) - { - reaction << " + "; - } - if (mag(grhs()[i].stoichCoeff - 1) > SMALL) - { - reaction << grhs()[i].stoichCoeff; - } - reaction << gasSpecies()[grhs()[i].index]; - if (mag(grhs()[i].exponent - grhs()[i].stoichCoeff) > SMALL) - { - reaction << "^" << grhs()[i].exponent; - } - } +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +template +Foam::label Foam::Reaction::getNewReactionID() +{ + return nUnNamedReactions++; +} + + +template +Foam::string Foam::Reaction::reactionStr +( + OStringStream& reaction +) const +{ + reactionStrLeft(reaction); + reaction << " = "; + reactionStrRight(reaction); return reaction.str(); } @@ -464,7 +445,9 @@ Foam::Reaction::New template void Foam::Reaction::write(Ostream& os) const { - os.writeKeyword("reaction") << reactionStr() << token::END_STATEMENT << nl; + OStringStream reaction; + os.writeKeyword("reaction") << reactionStr(reaction) + << token::END_STATEMENT << nl; } @@ -528,11 +511,13 @@ template const Foam::List::specieCoeffs>& Foam::Reaction::glhs() const { + /* notImplemented ( "inline const List::specieCoeffs>&" "Reaction::glhs()" ); + */ return *reinterpret_cast*>(0); } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H index b0c66fb86f..2679fc1bbb 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H @@ -66,6 +66,16 @@ class Reaction : public ReactionThermo { +protected: + + // Protected member functions + + //- Return string representation of the left of the reaction + void reactionStrLeft(OStringStream& reaction) const; + + //- Return string representation of the right of the reaction + void reactionStrRight(OStringStream& reaction) const; + public: @@ -134,7 +144,7 @@ private: // Private Member Functions //- Return string representation of reaction - string reactionStr() const; + string reactionStr(OStringStream& reaction) const; //- Construct reaction thermo void setThermo(const HashPtrTable& thermoDatabase); diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H index 7e380b4c80..6dece80ba7 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H @@ -67,8 +67,8 @@ Reaction::rhs() const template inline Ostream& operator<<(Ostream& os, const Reaction& r) { - os << r.reactionStr()<< token::END_STATEMENT < Date: Tue, 15 Jan 2013 10:41:18 +0000 Subject: [PATCH 02/23] BUG: Introducing notImplemented in Reaction.C --- .../specie/reaction/Reactions/Reaction/Reaction.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C index fda7552611..2a8a5ca1e1 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C @@ -511,13 +511,11 @@ template const Foam::List::specieCoeffs>& Foam::Reaction::glhs() const { - /* notImplemented ( "inline const List::specieCoeffs>&" "Reaction::glhs()" ); - */ return *reinterpret_cast*>(0); } From b35f0f062089dee54e1c8fd495e61f3d3bc12527 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 15 Jan 2013 12:39:31 +0000 Subject: [PATCH 03/23] STYLE: functionObjectTemplate: modification date --- etc/codeTemplates/dynamicCode/functionObjectTemplate.H | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H index bd07fff034..211c0868ec 100644 --- a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; class fvMesh; @@ -131,7 +132,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; From 868a090243a011484384203f6038db4f4ce3d861 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 16 Jan 2013 17:08:26 +0000 Subject: [PATCH 04/23] BUG: snappyHexMesh: synchronisation when patch edges align with processor edges --- .../autoHexMeshDriver/autoLayerDriver.C | 42 ++++- .../autoHexMeshDriver/autoLayerDriverShrink.C | 110 +++++++++++++- .../algorithms/PointEdgeWave/PointEdgeWave.C | 143 ++++++++++++------ 3 files changed, 245 insertions(+), 50 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index d0e43dbb10..b224ef609d 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -293,6 +293,46 @@ void Foam::autoLayerDriver::handleNonManifolds } } + // 3. Remote check for end of layer across coupled boundaries + { + PackedBoolList isCoupledEdge(mesh.nEdges()); + + const labelList& cpEdges = mesh.globalData().coupledPatchMeshEdges(); + forAll(cpEdges, i) + { + isCoupledEdge[cpEdges[i]] = true; + } + syncTools::syncEdgeList + ( + mesh, + isCoupledEdge, + orEqOp(), + 0 + ); + + forAll(edgeGlobalFaces, edgeI) + { + label meshEdgeI = meshEdges[edgeI]; + + if + ( + pp.edgeFaces()[edgeI].size() == 1 + && edgeGlobalFaces[edgeI].size() == 1 + && isCoupledEdge[meshEdgeI] + ) + { + // Edge of patch but no continuation across processor. + const edge& e = pp.edges()[edgeI]; + //Pout<< "** Stopping extrusion on edge " + // << pp.localPoints()[e[0]] + // << pp.localPoints()[e[1]] << endl; + nonManifoldPoints.insert(pp.meshPoints()[e[0]]); + nonManifoldPoints.insert(pp.meshPoints()[e[1]]); + } + } + } + + label nNonManif = returnReduce(nonManifoldPoints.size(), sumOp