From adcb7646f013e3383f1ec6d223bc06669d18ede1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 23 Oct 2009 08:31:59 +0200 Subject: [PATCH 01/21] unitConversion - don't pull in the entire constant::mathematical namespace - also, minor doxygen fixup --- src/OpenFOAM/global/unitConversion/unitConversion.H | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/global/unitConversion/unitConversion.H b/src/OpenFOAM/global/unitConversion/unitConversion.H index 0ab93f1a50..73d80dd57e 100644 --- a/src/OpenFOAM/global/unitConversion/unitConversion.H +++ b/src/OpenFOAM/global/unitConversion/unitConversion.H @@ -22,7 +22,7 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Namespace +InNamespace Foam Description @@ -35,8 +35,6 @@ Description #include "mathematicalConstants.H" -using namespace Foam::constant::mathematical; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -47,13 +45,13 @@ namespace Foam //- Conversion from degrees to radians inline scalar degToRad(const scalar& deg) { - return (deg*pi/180.0); + return (deg * constant::mathematical::pi/180.0); } //- Conversion from radians to degrees inline scalar radToDeg(const scalar& rad) { - return (rad*180.0/pi); + return (rad * 180.0/constant::mathematical::pi); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From e12acd7010b34a3df8c4ecd6f21775d48f2814a2 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 23 Oct 2009 17:36:09 +0100 Subject: [PATCH 02/21] very minor cosmetics --- .../PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index d763866a49..3927ad7740 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -161,7 +161,7 @@ void Foam::LiquidEvaporation::calculate // vapour diffusivity [m2/s] scalar Dab = liquids_->properties()[lid].D(pc, Ts); - // Saturation pressure for species i [pa] + // saturation pressure for species i [pa] // - carrier phase pressure assumed equal to the liquid vapour pressure // close to the surface // NOTE: if pSat > pc then particle is superheated From 7bce90d19e9bfcde2f56b2747ce22313ae5667e0 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 23 Oct 2009 17:54:15 +0100 Subject: [PATCH 03/21] re-vamped patch interaction - generalised into reflect, stick and escape --- src/lagrangian/intermediate/Make/files | 1 + .../KinematicParcel/KinematicParcel.C | 8 +- .../LocalInteraction/LocalInteraction.C | 94 +++++++++-- .../LocalInteraction/LocalInteraction.H | 75 +-------- .../LocalInteraction/patchInteractionData.C | 89 ++++++++++ .../LocalInteraction/patchInteractionData.H | 157 ++++++++++++++++++ .../PatchInteractionModel.C | 70 ++++++++ .../PatchInteractionModel.H | 26 +++ .../PatchInteractionModel/Rebound/Rebound.C | 3 + .../PatchInteractionModel/Rebound/Rebound.H | 1 + .../StandardWallInteraction.C | 101 +++++++++-- .../StandardWallInteraction.H | 31 +++- .../constant/coalCloud1Properties | 5 +- .../constant/limestoneCloud1Properties | 5 +- .../filter/constant/reactingCloud1Properties | 9 +- .../constant/reactingCloud1Properties | 3 +- .../constant/kinematicCloud1Properties | 3 +- .../constant/thermoCloud1Properties | 3 +- 18 files changed, 562 insertions(+), 122 deletions(-) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.H diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 270bc40e2e..6695181469 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -47,6 +47,7 @@ $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C /* bolt-on models */ submodels/addOns/radiation/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C +submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C /* data entries */ diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 1ae536e4db..8c020d3739 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -286,7 +286,13 @@ bool Foam::KinematicParcel::hitPatch ParcelType& p = static_cast(*this); td.cloud().postProcessing().postPatch(p, patchI); - return td.cloud().patchInteraction().correct(pp, this->face(), U_); + return td.cloud().patchInteraction().correct + ( + pp, + this->face(), + td.keepParticle, + U_ + ); } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index ffe1f09631..3beaa8abaf 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -26,7 +26,7 @@ License #include "LocalInteraction.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template Foam::label Foam::LocalInteraction::applyToPatch @@ -46,7 +46,7 @@ Foam::label Foam::LocalInteraction::applyToPatch } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // template Foam::LocalInteraction::LocalInteraction @@ -62,6 +62,7 @@ Foam::LocalInteraction::LocalInteraction const polyMesh& mesh = cloud.mesh(); const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); + // check that user patches are valid region patches forAll(patchData_, patchI) { const word& patchName = patchData_[patchI].patchName(); @@ -70,7 +71,7 @@ Foam::LocalInteraction::LocalInteraction { FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)") << "Patch " << patchName << " not found. Available patches " - << "are: " << bMesh.names() << exit(FatalError); + << "are: " << bMesh.names() << nl << exit(FatalError); } } @@ -95,6 +96,26 @@ Foam::LocalInteraction::LocalInteraction << "interaction. Please specify data for patches:" << nl << badWalls << nl << exit(FatalError); } + + // check that interactions are valid/specified + forAll(patchData_, patchI) + { + const word& interactionTypeName = + patchData_[patchI].interactionTypeName(); + const typename PatchInteractionModel::interactionType& it = + this->wordToInteractionType(interactionTypeName); + + if (it == PatchInteractionModel::itOther) + { + const word& patchName = patchData_[patchI].patchName(); + FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)") + << "Unknown patch interaction type " + << interactionTypeName << " for patch " << patchName + << ". Valid selections are:" + << this->PatchInteractionModel::interactionTypeNames_ + << nl << exit(FatalError); + } + } } @@ -105,7 +126,7 @@ Foam::LocalInteraction::~LocalInteraction() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // template bool Foam::LocalInteraction::active() const @@ -119,6 +140,7 @@ bool Foam::LocalInteraction::correct ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const { @@ -126,18 +148,64 @@ bool Foam::LocalInteraction::correct if (patchI >= 0) { - vector nw = pp.faceAreas()[pp.whichFace(faceId)]; - nw /= mag(nw); + typename PatchInteractionModel::interactionType it = + this->wordToInteractionType + ( + patchData_[patchI].interactionTypeName() + ); - scalar Un = U & nw; - vector Ut = U - Un*nw; - - if (Un > 0) + switch (it) { - U -= (1.0 + patchData_[patchI].e())*Un*nw; - } + case PatchInteractionModel::itEscape: + { + keepParticle = false; + U = vector::zero; + break; + } + case PatchInteractionModel::itStick: + { + keepParticle = true; + U = vector::zero; + break; + } + case PatchInteractionModel::itRebound: + { + keepParticle = true; - U -= patchData_[patchI].mu()*Ut; + vector nw = pp.faceAreas()[pp.whichFace(faceId)]; + nw /= mag(nw); + + scalar Un = U & nw; + vector Ut = U - Un*nw; + + if (Un > 0) + { + U -= (1.0 + patchData_[patchI].e())*Un*nw; + } + + U -= patchData_[patchI].mu()*Ut; + + break; + } + default: + { + FatalErrorIn + ( + "bool LocalInteraction::correct" + "(" + "const polyPatch&, " + "const label, " + "bool&, " + "vector&" + ") const" + ) << "Unknown interaction type " + << patchData_[patchI].interactionTypeName() + << "(" << it << ") for patch " + << patchData_[patchI].patchName() + << ". Valid selections are:" << this->interactionTypeNames_ + << endl << abort(FatalError); + } + } return true; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H index 49d36e9c6d..902c4316e5 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H @@ -34,7 +34,7 @@ Description #define LocalInteraction_H #include "PatchInteractionModel.H" -#include "dictionaryEntry.H" +#include "patchInteractionData.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,78 +49,6 @@ class LocalInteraction : public PatchInteractionModel { - class patchInteractionData - { - // Private data - - //- Patch name - word patchName_; - - //- Elasticity coefficient - scalar e_; - - //- Restitution coefficient - scalar mu_; - - - public: - - //- Construct null - patchInteractionData() - : - patchName_("unknownPatch"), - e_(0.0), - mu_(0.0) - {} - - //- Construct from dictionary - patchInteractionData(const dictionary& dict); - - // Member functions - - // Access - - //- Return const access to the patch name - const word& patchName() const - { - return patchName_; - } - - //- Return const access to the elasticity coefficient - scalar e() const - { - return e_; - } - - //- Return const access to the restitution coefficient - scalar mu() const - { - return mu_; - } - - - // I-O - - //- Istream operator - friend Istream& operator>>(Istream& is, patchInteractionData& pid) - { - is.check - ( - "Istream& operator>>" - "(Istream&, patchInteractionData&)" - ); - - const dictionaryEntry entry(dictionary::null, is); - - pid.patchName_ = entry.keyword(); - entry.lookup("e") >> pid.e_; - entry.lookup("mu") >> pid.mu_; - - return is; - } - }; - - // Private data //- List of participating patches @@ -164,6 +92,7 @@ public: ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C new file mode 100644 index 0000000000..f5569fa94d --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "patchInteractionData.H" +#include "dictionaryEntry.H" +#include "PatchInteractionModel.H" + +// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // + +Foam::patchInteractionData::patchInteractionData() +: + interactionTypeName_("unknownInteractionTypeName"), + patchName_("unknownPatch"), + e_(0.0), + mu_(0.0) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const Foam::word& Foam::patchInteractionData::interactionTypeName() const +{ + return interactionTypeName_; +} + + +const Foam::word& Foam::patchInteractionData::patchName() const +{ + return patchName_; +} + + +Foam::scalar Foam::patchInteractionData::e() const +{ + return e_; +} + + +Foam::scalar Foam::patchInteractionData::mu() const +{ + return mu_; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>> +( + Istream& is, + patchInteractionData& pid +) +{ + is.check("Istream& operator>>(Istream&, patchInteractionData&)"); + + const dictionaryEntry entry(dictionary::null, is); + + pid.patchName_ = entry.keyword(); + entry.lookup("type") >> pid.interactionTypeName_; + pid.e_ = entry.lookupOrDefault("e", 1.0); + pid.mu_ = entry.lookupOrDefault("mu", 0.0); + + return is; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.H new file mode 100644 index 0000000000..d53bb3dcf6 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::patchInteractionData + +Description + Helper class for the LocalInteraction patch interaction model + +\*---------------------------------------------------------------------------*/ + +#ifndef patchInteractionData_H +#define patchInteractionData_H + +#include "Istream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class patchInteractionData Declaration +\*---------------------------------------------------------------------------*/ + +// Forward declaration of classes +class patchInteractionData; + +// Forward declaration of friend functions +Istream& operator>> +( + Istream& is, + patchInteractionData& pid +); + + +class patchInteractionData +{ + // Private data + + //- Interaction type name + word interactionTypeName_; + + //- Patch name + word patchName_; + + //- Elasticity coefficient + scalar e_; + + //- Restitution coefficient + scalar mu_; + + +public: + + // Constructor + + //- Construct null + patchInteractionData(); + + + // Member functions + + // Access + + //- Return const access to the interaction type name + const word& interactionTypeName() const; + + //- Return const access to the patch name + const word& patchName() const; + + //- Return const access to the elasticity coefficient + scalar e() const; + + //- Return const access to the restitution coefficient + scalar mu() const; + + + // I-O + + //- Istream operator + friend Istream& operator>> + ( + Istream& is, + patchInteractionData& pid + ); +/* { + is.check + ( + "Istream& operator>>" + "(Istream&, patchInteractionData&)" + ); + + const dictionaryEntry entry(dictionary::null, is); + + pid.patchName_ = entry.keyword(); + entry.lookup("type") >> pid.interactionTypeName_; + pid.e_ = entry.lookupOrDefault("e", 1.0); + pid.mu_ = entry.lookupOrDefault("mu", 0.0); + + if + ( + PatchInteractionModel::wordToInteractionType + ( + pid.interactionTypeName_ + ) + == PatchInteractionModel::itOther) + { + FatalErrorIn + ( + "friend Istream& operator>>" + "(" + "Istream&, " + "patchInteractionData&" + ")" + ) << "Unknown patch interaction type " + << pid.interactionTypeName_ + << ". Valid selections are:" + << PatchInteractionModel:: + interactionTypeNames_ + << endl << abort(FatalError); + } + + return is; + } +*/}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C index 117e6005c8..873d5fb346 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C @@ -26,6 +26,76 @@ License #include "PatchInteractionModel.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +Foam::wordList Foam::PatchInteractionModel::interactionTypeNames_ +( + IStringStream + ( + "(rebound stick escape)" + )() +); + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::word Foam::PatchInteractionModel::interactionTypeToWord +( + const interactionType& itEnum +) +{ + switch (itEnum) + { + case itRebound: + { + return "rebound"; + break; + } + case itStick: + { + return "stick"; + break; + } + case itEscape: + { + return "escape"; + break; + } + default: + { + return "other"; + } + } +} + + +template +typename Foam::PatchInteractionModel::interactionType +Foam::PatchInteractionModel::wordToInteractionType +( + const word& itWord +) +{ + if (itWord == "rebound") + { + return itRebound; + } + else if (itWord == "stick") + { + return itStick; + } + else if (itWord == "escape") + { + return itEscape; + } + else + { + return itOther; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H index 986d30d3a1..cf9eb2b05c 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H @@ -40,6 +40,7 @@ SourceFiles #include "IOdictionary.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" +#include "polyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,6 +54,24 @@ namespace Foam template class PatchInteractionModel { +public: + + // Public enumerations + + // Interaction types + enum interactionType + { + itRebound, + itStick, + itEscape, + itOther + }; + + static wordList interactionTypeNames_; + + +private: + // Private data //- The cloud dictionary @@ -121,6 +140,12 @@ public: // Member Functions + //- Convert interaction result to word + static word interactionTypeToWord(const interactionType& itEnum); + + //- Convert word to interaction result + static interactionType wordToInteractionType(const word& itWord); + //- Flag to indicate whether model activates patch interaction model virtual bool active() const = 0; @@ -130,6 +155,7 @@ public: ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const = 0; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C index e5cfdd3540..44d8915497 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C @@ -61,9 +61,12 @@ bool Foam::Rebound::correct ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const { + keepParticle = true; + vector nw = pp.faceAreas()[pp.whichFace(faceId)]; nw /= mag(nw); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H index 7e3126996f..3980ff9c4d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H @@ -82,6 +82,7 @@ public: ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C index f87c0dd08b..fcf8f04a2f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C @@ -36,9 +36,45 @@ Foam::StandardWallInteraction::StandardWallInteraction ) : PatchInteractionModel(dict, cloud, typeName), - e_(dimensionedScalar(this->coeffDict().lookup("e")).value()), - mu_(dimensionedScalar(this->coeffDict().lookup("mu")).value()) -{} + interactionType_ + ( + this->wordToInteractionType(this->coeffDict().lookup("type")) + ), + e_(0.0), + mu_(0.0) +{ + switch (interactionType_) + { + case PatchInteractionModel::itOther: + { + word interactionTypeName(this->coeffDict().lookup("type")); + + FatalErrorIn + ( + "StandardWallInteraction::StandardWallInteraction" + "(" + "const dictionary&, " + "CloudType& cloud" + ")" + ) << "Unknown interaction result type " + << interactionTypeName + << ". Valid selections are:" << this->interactionTypeNames_ + << endl << exit(FatalError); + + break; + } + case PatchInteractionModel::itRebound: + { + e_ = this->coeffDict().lookupOrDefault("e", 1.0); + mu_ = this->coeffDict().lookupOrDefault("mu", 0.0); + break; + } + default: + { + // do nothing + } + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -62,23 +98,62 @@ bool Foam::StandardWallInteraction::correct ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const { if (isA(pp)) { - vector nw = pp.faceAreas()[pp.whichFace(faceId)]; - nw /= mag(nw); - - scalar Un = U & nw; - vector Ut = U - Un*nw; - - if (Un > 0) + switch (interactionType_) { - U -= (1.0 + e_)*Un*nw; - } + case PatchInteractionModel::itEscape: + { + keepParticle = false; + U = vector::zero; + break; + } + case PatchInteractionModel::itStick: + { + keepParticle = true; + U = vector::zero; + break; + } + case PatchInteractionModel::itRebound: + { + keepParticle = true; - U -= mu_*Ut; + vector nw = pp.faceAreas()[pp.whichFace(faceId)]; + nw /= mag(nw); + + scalar Un = U & nw; + vector Ut = U - Un*nw; + + if (Un > 0) + { + U -= (1.0 + e_)*Un*nw; + } + + U -= mu_*Ut; + + break; + } + default: + { + FatalErrorIn + ( + "bool StandardWallInteraction::correct" + "(" + "const polyPatch&, " + "const label, " + "bool&, " + "vector&" + ") const" + ) << "Unknown interaction type " + << this->interactionTypeToWord(interactionType_) + << "(" << interactionType_ << ")" << endl + << abort(FatalError); + } + } return true; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H index 3e2175e469..ab1f198bdc 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H @@ -26,7 +26,19 @@ Class Foam::StandardWallInteraction Description - Wall interaction based on restitution and elasticity coefficients + Wall interaction model. Three choices: + - rebound - optionally specify elasticity and resitution coefficients + - stick - particles assigined zero velocity + - escape - remove particle from the domain + + Example usage: + + StandardWallInteractionCoeffs + { + type rebound; // stick, escape + e 1; // optional - elasticity coeff + mu 0; // optional - restitution coeff + } \*---------------------------------------------------------------------------*/ @@ -40,7 +52,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class StandardWallInteraction Declaration + Class StandardWallInteraction Declaration \*---------------------------------------------------------------------------*/ template @@ -48,13 +60,19 @@ class StandardWallInteraction : public PatchInteractionModel { - // Private data +protected: - //- Elasticity - const scalar e_; + // Protected data + + //- Interaction type + typename PatchInteractionModel::interactionType + interactionType_; + + //- Elasticity coefficient + scalar e_; //- Restitution coefficient - const scalar mu_; + scalar mu_; public: @@ -84,6 +102,7 @@ public: ( const polyPatch& pp, const label faceId, + bool& keepParticle, vector& U ) const; }; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index f270546201..ef11516391 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -107,8 +107,9 @@ ManualInjectionCoeffs StandardWallInteractionCoeffs { - e e [ 0 0 0 0 0 ] 1; - mu mu [ 0 0 0 0 0 ] 0; + type rebound; + e 1; + mu 0; } RanzMarshallCoeffs diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index a17be1e36f..f4cf89a700 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -92,8 +92,9 @@ ManualInjectionCoeffs StandardWallInteractionCoeffs { - e e [ 0 0 0 0 0 ] 1; - mu mu [ 0 0 0 0 0 ] 0; + type rebound; + e 1; + mu 0; } RanzMarshallCoeffs diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties index 5c99dbf554..b1b89e17eb 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties @@ -110,8 +110,7 @@ ReactingLookupTableInjectionCoeffs StandardWallInteractionCoeffs { - e e [ 0 0 0 0 0 ] 1; - mu mu [ 0 0 0 0 0 ] 0; + type rebound; } LocalInteractionCoeffs @@ -120,13 +119,11 @@ LocalInteractionCoeffs ( walls { - e 1; - mu 0; + type rebound; } cycLeft { - e 1; - mu 0; + type rebound; } ); } diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties index 95f4df9ceb..97619b95a7 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties @@ -99,8 +99,7 @@ ManualInjectionCoeffs StandardWallInteractionCoeffs { - e e [ 0 0 0 0 0 ] 1; - mu mu [ 0 0 0 0 0 ] 0; + type rebound; } RanzMarshallCoeffs diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties index f88d7e1090..469aaa10f6 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties @@ -104,8 +104,7 @@ ConeInjectionCoeffs StandardWallInteractionCoeffs { - e e [ 0 0 0 0 0 ] 1; - mu mu [ 0 0 0 0 0 ] 0; + type rebound; } diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties index 67823f6aab..59402e4ea3 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties @@ -92,8 +92,7 @@ ManualInjectionCoeffs StandardWallInteractionCoeffs { - e e [ 0 0 0 0 0 ] 1; - mu mu [ 0 0 0 0 0 ] 0; + type rebound; } RanzMarshallCoeffs From 2b7dee2c8be417ee1df57cd8530d3b1e1bac49bc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 26 Oct 2009 13:14:40 +0100 Subject: [PATCH 04/21] add applications/test/BSpline - it fails! --- applications/test/BSpline/BSplineTest.C | 68 ++++++++++++++++++++++++ applications/test/BSpline/Make/files | 3 ++ applications/test/BSpline/Make/options | 5 ++ applications/test/BSpline/test-splines | 69 +++++++++++++++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 applications/test/BSpline/BSplineTest.C create mode 100644 applications/test/BSpline/Make/files create mode 100644 applications/test/BSpline/Make/options create mode 100644 applications/test/BSpline/test-splines diff --git a/applications/test/BSpline/BSplineTest.C b/applications/test/BSpline/BSplineTest.C new file mode 100644 index 0000000000..cb858d5560 --- /dev/null +++ b/applications/test/BSpline/BSplineTest.C @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ +#include "argList.H" + +#include "simpleMatrix.H" +#include "vector.H" +#include "IFstream.H" +#include "BSpline.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::noParallel(); + argList::validArgs.insert("file .. fileN"); + + argList args(argc, argv, false, true); + + forAll(args.additionalArgs(), argI) + { + const string& srcFile = args.additionalArgs()[argI]; + Info<< nl << "reading " << srcFile << nl; + IFstream ifs(srcFile); + + List splinePointFields(ifs); + + forAll(splinePointFields, splineI) + { + Info<<"convert " << splinePointFields[splineI] << " to bspline" << endl; + + BSpline spl(splinePointFields[splineI], vector::zero, vector::zero); + + Info<< "1/2 = " << spl.position(0.5) << endl; + } + } + + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/BSpline/Make/files b/applications/test/BSpline/Make/files new file mode 100644 index 0000000000..be66810067 --- /dev/null +++ b/applications/test/BSpline/Make/files @@ -0,0 +1,3 @@ +BSplineTest.C + +EXE = $(FOAM_USER_APPBIN)/BSplineTest diff --git a/applications/test/BSpline/Make/options b/applications/test/BSpline/Make/options new file mode 100644 index 0000000000..1a366abf0d --- /dev/null +++ b/applications/test/BSpline/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/mesh/blockMesh/lnInclude + +EXE_LIBS = -lblockMesh diff --git a/applications/test/BSpline/test-splines b/applications/test/BSpline/test-splines new file mode 100644 index 0000000000..f5c3a46ae4 --- /dev/null +++ b/applications/test/BSpline/test-splines @@ -0,0 +1,69 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +( + // Upper body longitudinal splines. + ( + (-0.22685 -0.01125166 0) // 7 + (-0.21685 -0.01340204 0) + (-0.20685 -0.01529684 0) + (-0.19685 -0.01694748 0) + (-0.18685 -0.01836538 0) + (-0.17685 -0.01956197 0) + (-0.16685 -0.02054868 0) + (-0.15685 -0.02133693 0) + (-0.14685 -0.02193816 0) + (-0.13685 -0.02236377 0) + (-0.12685 -0.02262521 0) + (-0.11685 -0.02273389 0) // 2 + ) + + ( + (-0.22685 0 0.01125166) // 8 + (-0.21685 0 0.01340204) + (-0.20685 0 0.01529684) + (-0.19685 0 0.01694748) + (-0.18685 0 0.01836538) + (-0.17685 0 0.01956197) + (-0.16685 0 0.02054868) + (-0.15685 0 0.02133693) + (-0.14685 0 0.02193816) + (-0.13685 0 0.02236377) + (-0.12685 0 0.02262521) + (-0.11685 0 0.02273389) // 3 + ) + + ( + (-0.22685 0.01125166 0) // 9 + (-0.21685 0.01340204 0) + (-0.20685 0.01529684 0) + (-0.19685 0.01694748 0) + (-0.18685 0.01836538 0) + (-0.17685 0.01956197 0) + (-0.16685 0.02054868 0) + (-0.15685 0.02133693 0) + (-0.14685 0.02193816 0) + (-0.13685 0.02236377 0) + (-0.12685 0.02262521 0) + (-0.11685 0.02273389 0) // 4 + ) + + ( + (-0.22685 0 -0.01125166) // 6 + (-0.21685 0 -0.01340204) + (-0.20685 0 -0.01529684) + (-0.19685 0 -0.01694748) + (-0.18685 0 -0.01836538) + (-0.17685 0 -0.01956197) + (-0.16685 0 -0.02054868) + (-0.15685 0 -0.02133693) + (-0.14685 0 -0.02193816) + (-0.13685 0 -0.02236377) + (-0.12685 0 -0.02262521) + (-0.11685 0 -0.02273389) // 1 + ) +); From 514914207ae1dcefef15f3a999741cd2be3c7488 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 26 Oct 2009 13:50:10 +0100 Subject: [PATCH 05/21] BSpline bugfix: initialize simpleMatrix with 0.0 - why doesn't simpleMatrix always do this? --- src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C | 8 ++++++++ src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H | 3 +++ src/mesh/blockMesh/curvedEdges/BSpline.C | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C index ecc094a840..abc0c0ba03 100644 --- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C +++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C @@ -36,6 +36,14 @@ Foam::simpleMatrix::simpleMatrix(const label mSize) {} +template +Foam::simpleMatrix::simpleMatrix(const label mSize, const scalar& t) +: + scalarSquareMatrix(mSize, mSize, t), + source_(mSize, pTraits::zero) +{} + + template Foam::simpleMatrix::simpleMatrix ( diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H index fd875281cc..b854355003 100644 --- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H +++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H @@ -77,6 +77,9 @@ public: //- Construct given size simpleMatrix(const label); + //- Construct given size and initial value + simpleMatrix(const label, const scalar&); + //- Construct from components simpleMatrix(const scalarSquareMatrix&, const Field&); diff --git a/src/mesh/blockMesh/curvedEdges/BSpline.C b/src/mesh/blockMesh/curvedEdges/BSpline.C index 56e829eda5..8932651647 100644 --- a/src/mesh/blockMesh/curvedEdges/BSpline.C +++ b/src/mesh/blockMesh/curvedEdges/BSpline.C @@ -48,7 +48,8 @@ Foam::pointField Foam::BSpline::findKnots register scalar oneSixth = 1.0/6.0; register scalar twoThird = 2.0/3.0; - simpleMatrix M(newnKnots); + simpleMatrix M(newnKnots, pTraits::zero); + // set up the matrix From 79efd0a546b5cfbd1f6fba0156890cb8de070a9a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 26 Oct 2009 13:59:50 +0100 Subject: [PATCH 06/21] BSpline code cleanup --- src/mesh/blockMesh/curvedEdges/BSpline.C | 49 +++++++++++------------- src/mesh/blockMesh/curvedEdges/BSpline.H | 11 ++---- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/mesh/blockMesh/curvedEdges/BSpline.C b/src/mesh/blockMesh/curvedEdges/BSpline.C index 8932651647..4e53399719 100644 --- a/src/mesh/blockMesh/curvedEdges/BSpline.C +++ b/src/mesh/blockMesh/curvedEdges/BSpline.C @@ -38,75 +38,70 @@ Foam::pointField Foam::BSpline::findKnots const vector& sndend ) { - label newnKnots(allknots.size() + 2); - label NKnots(allknots.size()); - pointField newknots(newnKnots); + const label NKnots = allknots.size(); // set up 1/6 and 2/3 which are the matrix elements throughout most // of the matrix - register scalar oneSixth = 1.0/6.0; - register scalar twoThird = 2.0/3.0; - - simpleMatrix M(newnKnots, pTraits::zero); + register const scalar oneSixth = 1.0/6.0; + register const scalar twoThird = 2.0/3.0; + simpleMatrix M(NKnots+2, pTraits::zero); // set up the matrix - M[0][0] = -0.5*scalar(NKnots - 1); M[0][2] = 0.5*scalar(NKnots - 1); - for (register label i=1; i Date: Mon, 26 Oct 2009 14:01:39 +0000 Subject: [PATCH 07/21] Added support for the caching of gradients. This is controlled by providing a list of the fields to be cached in the "cache" sub-dictionary of fvSolution. Debug information about the caching is printed when the solution::debug switch is on. There are still a couple of issues to do with the naming of gradients used in corrected snGrads and limited interpolation schemes that need to be resolved but these are no different to previously and hence not urgent. --- src/OpenFOAM/matrices/solution/solution.C | 2 +- src/finiteVolume/Make/files | 1 + .../convectionScheme/convectionScheme.H | 2 +- .../gaussConvectionScheme.C | 6 +- .../gaussConvectionScheme.H | 2 +- .../multivariateGaussConvectionScheme.C | 4 +- .../multivariateGaussConvectionScheme.H | 2 +- .../EulerD2dt2Scheme/EulerD2dt2Scheme.C | 10 +- .../EulerD2dt2Scheme/EulerD2dt2Scheme.H | 6 +- .../d2dt2Schemes/d2dt2Scheme/d2dt2Scheme.H | 6 +- .../steadyStateD2dt2Scheme.C | 8 +- .../steadyStateD2dt2Scheme.H | 6 +- .../CoEulerDdtScheme/CoEulerDdtScheme.C | 22 +-- .../CoEulerDdtScheme/CoEulerDdtScheme.H | 6 +- .../CrankNicholsonDdtScheme.C | 6 +- .../CrankNicholsonDdtScheme.H | 8 +- .../EulerDdtScheme/EulerDdtScheme.C | 6 +- .../EulerDdtScheme/EulerDdtScheme.H | 6 +- .../ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C | 16 +- .../ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.H | 6 +- .../backwardDdtScheme/backwardDdtScheme.C | 6 +- .../backwardDdtScheme/backwardDdtScheme.H | 6 +- .../boundedBackwardDdtScheme.C | 8 +- .../boundedBackwardDdtScheme.H | 6 +- .../boundedBackwardDdtSchemes.C | 2 +- .../ddtSchemes/ddtScheme/ddtScheme.H | 6 +- .../steadyStateDdtScheme.C | 8 +- .../steadyStateDdtScheme.H | 6 +- src/finiteVolume/finiteVolume/fvc/fvcGrad.C | 4 +- src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C | 9 +- src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H | 6 +- src/finiteVolume/finiteVolume/fvm/fvmDdt.C | 8 +- src/finiteVolume/finiteVolume/fvm/fvmDdt.H | 8 +- src/finiteVolume/finiteVolume/fvm/fvmDiv.C | 11 +- src/finiteVolume/finiteVolume/fvm/fvmDiv.H | 8 +- .../finiteVolume/fvm/fvmLaplacian.C | 36 ++-- .../finiteVolume/fvm/fvmLaplacian.H | 32 ++-- src/finiteVolume/finiteVolume/fvm/fvmSup.C | 26 +-- src/finiteVolume/finiteVolume/fvm/fvmSup.H | 26 +-- .../extendedLeastSquaresGrad.C | 37 ++-- .../extendedLeastSquaresGrad.H | 9 +- .../gradSchemes/fourthGrad/fourthGrad.C | 37 ++-- .../gradSchemes/fourthGrad/fourthGrad.H | 9 +- .../gradSchemes/gaussGrad/gaussGrad.C | 53 ++---- .../gradSchemes/gaussGrad/gaussGrad.H | 22 +-- .../gradSchemes/gaussGrad/gaussGrads.C | 2 - .../gradSchemes/gradScheme/gradScheme.C | 174 +++++++++++++++--- .../gradSchemes/gradScheme/gradScheme.H | 48 ++++- .../leastSquaresGrad/leastSquaresGrad.C | 37 ++-- .../leastSquaresGrad/leastSquaresGrad.H | 9 +- .../cellLimitedGrad/cellLimitedGrad.H | 72 +++++++- .../cellLimitedGrad/cellLimitedGrads.C | 77 ++------ .../cellMDLimitedGrad/cellMDLimitedGrad.H | 27 ++- .../cellMDLimitedGrad/cellMDLimitedGrads.C | 33 ++-- .../faceLimitedGrad/faceLimitedGrad.H | 54 +++++- .../faceLimitedGrad/faceLimitedGrads.C | 55 ++---- .../faceMDLimitedGrad/faceMDLimitedGrad.H | 27 ++- .../faceMDLimitedGrad/faceMDLimitedGrads.C | 37 ++-- .../gaussLaplacianScheme.C | 8 +- .../gaussLaplacianScheme.H | 6 +- .../gaussLaplacianSchemes.C | 4 +- .../laplacianScheme/laplacianScheme.C | 2 +- .../laplacianScheme/laplacianScheme.H | 4 +- .../correctedSnGrad/correctedSnGrad.C | 55 +++--- .../correctedSnGrad/correctedSnGrad.H | 26 ++- .../correctedSnGrad/correctedSnGrads.C | 26 ++- .../fvMatrices/fvMatrix/fvMatrix.C | 19 +- .../fvMatrices/fvMatrix/fvMatrix.H | 18 +- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 17 +- .../fvScalarMatrix/fvScalarMatrix.C | 24 ++- .../LimitedScheme/LimitedScheme.C | 8 +- .../linearUpwind/linearUpwind.C | 25 ++- .../linearUpwind/linearUpwind.H | 8 +- .../linearUpwind/linearUpwindV.C | 19 +- .../linearUpwind/linearUpwindV.H | 8 +- 75 files changed, 859 insertions(+), 590 deletions(-) diff --git a/src/OpenFOAM/matrices/solution/solution.C b/src/OpenFOAM/matrices/solution/solution.C index c63dceec4e..b17130dfe6 100644 --- a/src/OpenFOAM/matrices/solution/solution.C +++ b/src/OpenFOAM/matrices/solution/solution.C @@ -152,7 +152,7 @@ bool Foam::solution::cache(const word& name) const { if (debug) { - Info<< "Find cache entry for " << name << endl; + Info<< "Cache: find entry for " << name << endl; } return cache_.found(name); diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 7ecbf878a6..c387ac994d 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -285,6 +285,7 @@ $(divSchemes)/gaussDivScheme/gaussDivSchemes.C gradSchemes = finiteVolume/gradSchemes $(gradSchemes)/gradScheme/gradSchemes.C $(gradSchemes)/gaussGrad/gaussGrads.C + $(gradSchemes)/leastSquaresGrad/leastSquaresVectors.C $(gradSchemes)/leastSquaresGrad/leastSquaresGrads.C $(gradSchemes)/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H index c1e46a9e10..25dcbeb130 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H +++ b/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H @@ -177,7 +177,7 @@ public: virtual tmp > fvmDiv ( const surfaceScalarField&, - GeometricField& + const GeometricField& ) const = 0; virtual tmp > fvcDiv diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C index a219d80281..e2077d75ef 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C @@ -69,7 +69,7 @@ tmp > gaussConvectionScheme::fvmDiv ( const surfaceScalarField& faceFlux, - GeometricField& vf + const GeometricField& vf ) const { tmp tweights = tinterpScheme_().weights(vf); @@ -89,9 +89,9 @@ gaussConvectionScheme::fvmDiv fvm.upper() = fvm.lower() + faceFlux.internalField(); fvm.negSumDiag(); - forAll(fvm.psi().boundaryField(), patchI) + forAll(vf.boundaryField(), patchI) { - const fvPatchField& psf = fvm.psi().boundaryField()[patchI]; + const fvPatchField& psf = vf.boundaryField()[patchI]; const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI]; const fvsPatchScalarField& pw = weights.boundaryField()[patchI]; diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H index 7a4e5da155..8202f270dc 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H @@ -124,7 +124,7 @@ public: tmp > fvmDiv ( const surfaceScalarField&, - GeometricField& + const GeometricField& ) const; tmp > fvcDiv diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.C b/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.C index d147d461ee..61cbba5ceb 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.C +++ b/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "multivariateGaussConvectionScheme.H" @@ -81,7 +79,7 @@ tmp > multivariateGaussConvectionScheme::fvmDiv ( const surfaceScalarField& faceFlux, - GeometricField& vf + const GeometricField& vf ) const { return gaussConvectionScheme diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.H index b8ccb25ed5..419628ddfa 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.H +++ b/src/finiteVolume/finiteVolume/convectionSchemes/multivariateGaussConvectionScheme/multivariateGaussConvectionScheme.H @@ -114,7 +114,7 @@ public: tmp > fvmDiv ( const surfaceScalarField&, - GeometricField& + const GeometricField& ) const; tmp > fvcDiv diff --git a/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.C b/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.C index 9a7ad2d0d3..4a9cca164a 100644 --- a/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.C +++ b/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "EulerD2dt2Scheme.H" @@ -181,7 +181,7 @@ EulerD2dt2Scheme::fvcD2dt2 coefft *(rho.boundaryField() + rho.oldTime().boundaryField()) *vf.boundaryField() - + - ( coefft *( @@ -232,7 +232,7 @@ template tmp > EulerD2dt2Scheme::fvmD2dt2 ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -292,7 +292,7 @@ tmp > EulerD2dt2Scheme::fvmD2dt2 ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -353,7 +353,7 @@ tmp > EulerD2dt2Scheme::fvmD2dt2 ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm diff --git a/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.H b/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.H index bca75562ed..0823f225dc 100644 --- a/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.H +++ b/src/finiteVolume/finiteVolume/d2dt2Schemes/EulerD2dt2Scheme/EulerD2dt2Scheme.H @@ -109,19 +109,19 @@ public: tmp > fvmD2dt2 ( - GeometricField& + const GeometricField& ); tmp > fvmD2dt2 ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmD2dt2 ( const volScalarField&, - GeometricField& + const GeometricField& ); }; diff --git a/src/finiteVolume/finiteVolume/d2dt2Schemes/d2dt2Scheme/d2dt2Scheme.H b/src/finiteVolume/finiteVolume/d2dt2Schemes/d2dt2Scheme/d2dt2Scheme.H index 9e5668ecf3..452373b501 100644 --- a/src/finiteVolume/finiteVolume/d2dt2Schemes/d2dt2Scheme/d2dt2Scheme.H +++ b/src/finiteVolume/finiteVolume/d2dt2Schemes/d2dt2Scheme/d2dt2Scheme.H @@ -153,19 +153,19 @@ public: virtual tmp > fvmD2dt2 ( - GeometricField& + const GeometricField& ) = 0; virtual tmp > fvmD2dt2 ( const dimensionedScalar&, - GeometricField& + const GeometricField& ) = 0; virtual tmp > fvmD2dt2 ( const volScalarField&, - GeometricField& + const GeometricField& ) = 0; }; diff --git a/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.C b/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.C index 121df11087..9d810c401c 100644 --- a/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.C +++ b/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "steadyStateD2dt2Scheme.H" @@ -107,7 +107,7 @@ template tmp > steadyStateD2dt2Scheme::fvmD2dt2 ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -128,7 +128,7 @@ tmp > steadyStateD2dt2Scheme::fvmD2dt2 ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -149,7 +149,7 @@ tmp > steadyStateD2dt2Scheme::fvmD2dt2 ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm diff --git a/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.H b/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.H index 004fb22a5e..9b9327ceee 100644 --- a/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.H +++ b/src/finiteVolume/finiteVolume/d2dt2Schemes/steadyStateD2dt2Scheme/steadyStateD2dt2Scheme.H @@ -108,19 +108,19 @@ public: tmp > fvmD2dt2 ( - GeometricField& + const GeometricField& ); tmp > fvmD2dt2 ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmD2dt2 ( const volScalarField&, - GeometricField& + const GeometricField& ); }; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C index 6928e20a2e..a63a644427 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "CoEulerDdtScheme.H" @@ -69,10 +69,10 @@ tmp CoEulerDdtScheme::CorDeltaT() const forAll(owner, faceI) { - corDeltaT[owner[faceI]] = + corDeltaT[owner[faceI]] = max(corDeltaT[owner[faceI]], cofrDeltaT[faceI]); - corDeltaT[neighbour[faceI]] = + corDeltaT[neighbour[faceI]] = max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]); } @@ -127,7 +127,7 @@ tmp CoEulerDdtScheme::CofrDeltaT() const const volScalarField& rho = static_cast(mesh()) .lookupObject(rhoName_).oldTime(); - + surfaceScalarField Co ( mesh().surfaceInterpolation::deltaCoeffs() @@ -369,7 +369,7 @@ template tmp > CoEulerDdtScheme::fvmDdt ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -386,7 +386,7 @@ CoEulerDdtScheme::fvmDdt scalarField rDeltaT = CorDeltaT()().internalField(); fvm.diag() = rDeltaT*mesh().V(); - + if (mesh().moving()) { fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0(); @@ -405,7 +405,7 @@ tmp > CoEulerDdtScheme::fvmDdt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -421,7 +421,7 @@ CoEulerDdtScheme::fvmDdt scalarField rDeltaT = CorDeltaT()().internalField(); fvm.diag() = rDeltaT*rho.value()*mesh().V(); - + if (mesh().moving()) { fvm.source() = rDeltaT @@ -442,7 +442,7 @@ tmp > CoEulerDdtScheme::fvmDdt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -588,7 +588,7 @@ CoEulerDdtScheme::fvcDdtPhiCorr ) ); } - else if + else if ( U.dimensions() == dimVelocity && phi.dimensions() == dimDensity*dimVelocity*dimArea @@ -617,7 +617,7 @@ CoEulerDdtScheme::fvcDdtPhiCorr ) ); } - else if + else if ( U.dimensions() == dimDensity*dimVelocity && phi.dimensions() == dimDensity*dimVelocity*dimArea diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H index f2b54169ed..65cd320d2d 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H @@ -142,19 +142,19 @@ public: tmp > fvmDdt ( - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ); typedef typename ddtScheme::fluxFieldType fluxFieldType; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C index 027f0a2b30..172bea60aa 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C @@ -625,7 +625,7 @@ template tmp > CrankNicholsonDdtScheme::fvmDdt ( - GeometricField& vf + const GeometricField& vf ) { DDt0Field >& ddt0 = @@ -709,7 +709,7 @@ tmp > CrankNicholsonDdtScheme::fvmDdt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { DDt0Field >& ddt0 = @@ -791,7 +791,7 @@ tmp > CrankNicholsonDdtScheme::fvmDdt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { DDt0Field >& ddt0 = diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H index 87ca9a086d..d3177f6a95 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H @@ -90,7 +90,7 @@ class CrankNicholsonDdtScheme //- Return the start-time index label startTimeIndex() const; - + //- Cast to the underlying GeoField GeoField& operator()(); @@ -213,19 +213,19 @@ public: tmp > fvmDdt ( - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ); typedef typename ddtScheme::fluxFieldType fluxFieldType; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C index e7749610a7..091663aa6e 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C @@ -262,7 +262,7 @@ template tmp > EulerDdtScheme::fvmDdt ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -298,7 +298,7 @@ tmp > EulerDdtScheme::fvmDdt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -335,7 +335,7 @@ tmp > EulerDdtScheme::fvmDdt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.H index b06ef32761..3d38050955 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.H @@ -120,19 +120,19 @@ public: tmp > fvmDdt ( - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ); typedef typename ddtScheme::fluxFieldType fluxFieldType; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C index a06e30e725..4906f63567 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "SLTSDdtScheme.H" @@ -369,7 +369,7 @@ template tmp > SLTSDdtScheme::fvmDdt ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -388,7 +388,7 @@ SLTSDdtScheme::fvmDdt Info<< "max/min rDeltaT " << max(rDeltaT) << " " << min(rDeltaT) << endl; fvm.diag() = rDeltaT*mesh().V(); - + if (mesh().moving()) { fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0(); @@ -407,7 +407,7 @@ tmp > SLTSDdtScheme::fvmDdt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -423,7 +423,7 @@ SLTSDdtScheme::fvmDdt scalarField rDeltaT = SLrDeltaT()().internalField(); fvm.diag() = rDeltaT*rho.value()*mesh().V(); - + if (mesh().moving()) { fvm.source() = rDeltaT @@ -444,7 +444,7 @@ tmp > SLTSDdtScheme::fvmDdt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -590,7 +590,7 @@ SLTSDdtScheme::fvcDdtPhiCorr ) ); } - else if + else if ( U.dimensions() == dimVelocity && phi.dimensions() == dimDensity*dimVelocity*dimArea @@ -619,7 +619,7 @@ SLTSDdtScheme::fvcDdtPhiCorr ) ); } - else if + else if ( U.dimensions() == dimDensity*dimVelocity && phi.dimensions() == dimDensity*dimVelocity*dimArea diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.H index 850f358299..f300297e6c 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.H @@ -143,19 +143,19 @@ public: tmp > fvmDdt ( - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ); typedef typename ddtScheme::fluxFieldType fluxFieldType; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C index 8a121b2d44..f172594abe 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C @@ -361,7 +361,7 @@ template tmp > backwardDdtScheme::fvmDdt ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -413,7 +413,7 @@ tmp > backwardDdtScheme::fvmDdt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -464,7 +464,7 @@ tmp > backwardDdtScheme::fvmDdt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.H index 374d05031a..7aceb79c89 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.H @@ -131,19 +131,19 @@ public: tmp > fvmDdt ( - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ); typedef typename ddtScheme::fluxFieldType fluxFieldType; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C index c8ef5c7259..214f1373df 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "boundedBackwardDdtScheme.H" @@ -413,7 +413,7 @@ boundedBackwardDdtScheme::fvcDdt tmp boundedBackwardDdtScheme::fvmDdt ( - volScalarField& vf + const volScalarField& vf ) { tmp tfvm @@ -484,7 +484,7 @@ tmp boundedBackwardDdtScheme::fvmDdt ( const dimensionedScalar& rho, - volScalarField& vf + const volScalarField& vf ) { tmp tfvm @@ -554,7 +554,7 @@ tmp boundedBackwardDdtScheme::fvmDdt ( const volScalarField& rho, - volScalarField& vf + const volScalarField& vf ) { tmp tfvm diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H index 7bff042a75..f1b4121f6e 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H @@ -142,19 +142,19 @@ public: tmp fvmDdt ( - volScalarField& + const volScalarField& ); tmp fvmDdt ( const dimensionedScalar&, - volScalarField& + const volScalarField& ); tmp fvmDdt ( const volScalarField&, - volScalarField& + const volScalarField& ); tmp fvcDdtPhiCorr diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C index 666cb2be3b..67a1d1f69c 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "boundedBackwardDdtScheme.H" diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.H index 31f8fa090d..e454e9409a 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.H @@ -164,19 +164,19 @@ public: virtual tmp > fvmDdt ( - GeometricField& + const GeometricField& ) = 0; virtual tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ) = 0; virtual tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ) = 0; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C index 7bd7b6f8a8..3b5736adb8 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "steadyStateDdtScheme.H" @@ -162,7 +162,7 @@ template tmp > steadyStateDdtScheme::fvmDdt ( - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -183,7 +183,7 @@ tmp > steadyStateDdtScheme::fvmDdt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm @@ -204,7 +204,7 @@ tmp > steadyStateDdtScheme::fvmDdt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.H index 54208441b4..0af9bb66db 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.H @@ -119,19 +119,19 @@ public: tmp > fvmDdt ( - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); tmp > fvmDdt ( const volScalarField&, - GeometricField& + const GeometricField& ); typedef typename ddtScheme::fluxFieldType fluxFieldType; diff --git a/src/finiteVolume/finiteVolume/fvc/fvcGrad.C b/src/finiteVolume/finiteVolume/fvc/fvcGrad.C index 9d61a45e40..9f5c2bd98f 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcGrad.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcGrad.C @@ -54,7 +54,7 @@ grad const GeometricField& ssf ) { - return fv::gaussGrad::grad(ssf); + return fv::gaussGrad::gradf(ssf, "grad(" + ssf.name() + ')'); } @@ -99,7 +99,7 @@ grad ( vf.mesh(), vf.mesh().gradScheme(name) - )().grad(vf); + )().grad(vf, name); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C index 4df081cd07..81f37cd099 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - - \*---------------------------------------------------------------------------*/ #include "volFields.H" @@ -48,7 +45,7 @@ template tmp > d2dt2 ( - GeometricField& vf + const GeometricField& vf ) { return fv::d2dt2Scheme::New @@ -64,7 +61,7 @@ tmp > d2dt2 ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { return fv::d2dt2Scheme::New @@ -80,7 +77,7 @@ tmp > d2dt2 ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { return fv::d2dt2Scheme::New diff --git a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H index b322391ade..3d7e2a716b 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H @@ -54,20 +54,20 @@ namespace fvm tmp > d2dt2 ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); template tmp > d2dt2 ( - GeometricField& + const GeometricField& ); template tmp > d2dt2 ( const volScalarField&, - GeometricField& + const GeometricField& ); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDdt.C b/src/finiteVolume/finiteVolume/fvm/fvmDdt.C index c2e3e976af..d7610206d0 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDdt.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmDdt.C @@ -45,7 +45,7 @@ template tmp > ddt ( - GeometricField& vf + const GeometricField& vf ) { return fv::ddtScheme::New @@ -61,7 +61,7 @@ tmp > ddt ( const oneField&, - GeometricField& vf + const GeometricField& vf ) { return ddt(vf); @@ -73,7 +73,7 @@ tmp > ddt ( const dimensionedScalar& rho, - GeometricField& vf + const GeometricField& vf ) { return fv::ddtScheme::New @@ -89,7 +89,7 @@ tmp > ddt ( const volScalarField& rho, - GeometricField& vf + const GeometricField& vf ) { return fv::ddtScheme::New diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDdt.H b/src/finiteVolume/finiteVolume/fvm/fvmDdt.H index 5472f91f37..2b8124e559 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDdt.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmDdt.H @@ -54,28 +54,28 @@ namespace fvm template tmp > ddt ( - GeometricField& + const GeometricField& ); template tmp > ddt ( const oneField&, - GeometricField& + const GeometricField& ); template tmp > ddt ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); template tmp > ddt ( const volScalarField&, - GeometricField& + const GeometricField& ); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDiv.C b/src/finiteVolume/finiteVolume/fvm/fvmDiv.C index 25af21ef2a..2cc8d0e31f 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDiv.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmDiv.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - - \*---------------------------------------------------------------------------*/ #include "fvmDiv.H" @@ -49,7 +46,7 @@ tmp > div ( const surfaceScalarField& flux, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -66,7 +63,7 @@ tmp > div ( const tmp& tflux, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -81,7 +78,7 @@ tmp > div ( const surfaceScalarField& flux, - GeometricField& vf + const GeometricField& vf ) { return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')'); @@ -92,7 +89,7 @@ tmp > div ( const tmp& tflux, - GeometricField& vf + const GeometricField& vf ) { tmp > Div(fvm::div(tflux(), vf)); diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDiv.H b/src/finiteVolume/finiteVolume/fvm/fvmDiv.H index c15fc72dec..9e45a883da 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDiv.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmDiv.H @@ -56,7 +56,7 @@ namespace fvm tmp > div ( const surfaceScalarField&, - GeometricField&, + const GeometricField&, const word& name ); @@ -64,7 +64,7 @@ namespace fvm tmp > div ( const tmp&, - GeometricField&, + const GeometricField&, const word& name ); @@ -73,14 +73,14 @@ namespace fvm tmp > div ( const surfaceScalarField&, - GeometricField& + const GeometricField& ); template tmp > div ( const tmp&, - GeometricField& + const GeometricField& ); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C index 4a60eadd3d..501456da3c 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C @@ -45,7 +45,7 @@ template tmp > laplacian ( - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -70,7 +70,7 @@ template tmp > laplacian ( - GeometricField& vf + const GeometricField& vf ) { surfaceScalarField Gamma @@ -100,7 +100,7 @@ tmp > laplacian ( const zeroField&, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -116,7 +116,7 @@ tmp > laplacian ( const zeroField&, - GeometricField& vf + const GeometricField& vf ) { return tmp > @@ -131,7 +131,7 @@ tmp > laplacian ( const oneField&, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -144,7 +144,7 @@ tmp > laplacian ( const oneField&, - GeometricField& vf + const GeometricField& vf ) { return fvm::laplacian(vf); @@ -156,11 +156,11 @@ tmp > laplacian ( const dimensioned& gamma, - GeometricField& vf, + const GeometricField& vf, const word& name ) { - GeometricField Gamma + const GeometricField Gamma ( IOobject ( @@ -182,10 +182,10 @@ tmp > laplacian ( const dimensioned& gamma, - GeometricField& vf + const GeometricField& vf ) { - GeometricField Gamma + const GeometricField Gamma ( IOobject ( @@ -209,7 +209,7 @@ tmp > laplacian ( const GeometricField& gamma, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -226,7 +226,7 @@ tmp > laplacian ( const tmp >& tgamma, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -241,7 +241,7 @@ tmp > laplacian ( const GeometricField& gamma, - GeometricField& vf + const GeometricField& vf ) { return fvm::laplacian @@ -258,7 +258,7 @@ tmp > laplacian ( const tmp >& tgamma, - GeometricField& vf + const GeometricField& vf ) { tmp > Laplacian(fvm::laplacian(tgamma(), vf)); @@ -274,7 +274,7 @@ tmp > laplacian ( const GeometricField& gamma, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -291,7 +291,7 @@ tmp > laplacian ( const tmp >& tgamma, - GeometricField& vf, + const GeometricField& vf, const word& name ) { @@ -306,7 +306,7 @@ tmp > laplacian ( const GeometricField& gamma, - GeometricField& vf + const GeometricField& vf ) { return fvm::laplacian @@ -323,7 +323,7 @@ tmp > laplacian ( const tmp >& tGamma, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm(fvm::laplacian(tGamma(), vf)); diff --git a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H index cc06ec5008..c41774361f 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H @@ -55,14 +55,14 @@ namespace fvm template tmp > laplacian ( - GeometricField&, + const GeometricField&, const word& ); template tmp > laplacian ( - GeometricField& + const GeometricField& ); @@ -70,7 +70,7 @@ namespace fvm tmp > laplacian ( const zeroField&, - GeometricField&, + const GeometricField&, const word& ); @@ -78,7 +78,7 @@ namespace fvm tmp > laplacian ( const zeroField&, - GeometricField& + const GeometricField& ); @@ -86,7 +86,7 @@ namespace fvm tmp > laplacian ( const oneField&, - GeometricField&, + const GeometricField&, const word& ); @@ -94,7 +94,7 @@ namespace fvm tmp > laplacian ( const oneField&, - GeometricField& + const GeometricField& ); @@ -102,7 +102,7 @@ namespace fvm tmp > laplacian ( const dimensioned&, - GeometricField&, + const GeometricField&, const word& ); @@ -110,7 +110,7 @@ namespace fvm tmp > laplacian ( const dimensioned&, - GeometricField& + const GeometricField& ); @@ -118,7 +118,7 @@ namespace fvm tmp > laplacian ( const GeometricField&, - GeometricField&, + const GeometricField&, const word& ); @@ -126,7 +126,7 @@ namespace fvm tmp > laplacian ( const GeometricField&, - GeometricField& + const GeometricField& ); @@ -134,7 +134,7 @@ namespace fvm tmp > laplacian ( const tmp >&, - GeometricField&, + const GeometricField&, const word& ); @@ -142,7 +142,7 @@ namespace fvm tmp > laplacian ( const tmp >&, - GeometricField& + const GeometricField& ); @@ -150,7 +150,7 @@ namespace fvm tmp > laplacian ( const GeometricField&, - GeometricField&, + const GeometricField&, const word& ); @@ -158,7 +158,7 @@ namespace fvm tmp > laplacian ( const tmp >&, - GeometricField&, + const GeometricField&, const word& ); @@ -166,14 +166,14 @@ namespace fvm tmp > laplacian ( const GeometricField&, - GeometricField& + const GeometricField& ); template tmp > laplacian ( const tmp >&, - GeometricField& + const GeometricField& ); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmSup.C b/src/finiteVolume/finiteVolume/fvm/fvmSup.C index 67c18d3c59..99e2d14746 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmSup.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmSup.C @@ -35,7 +35,7 @@ Foam::tmp > Foam::fvm::Su ( const DimensionedField& su, - GeometricField& vf + const GeometricField& vf ) { const fvMesh& mesh = vf.mesh(); @@ -60,7 +60,7 @@ Foam::tmp > Foam::fvm::Su ( const tmp >& tsu, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm = fvm::Su(tsu(), vf); @@ -73,7 +73,7 @@ Foam::tmp > Foam::fvm::Su ( const tmp >& tsu, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm = fvm::Su(tsu(), vf); @@ -86,7 +86,7 @@ Foam::zeroField Foam::fvm::Su ( const zeroField&, - GeometricField& vf + const GeometricField& vf ) { return zeroField(); @@ -98,7 +98,7 @@ Foam::tmp > Foam::fvm::Sp ( const DimensionedField& sp, - GeometricField& vf + const GeometricField& vf ) { const fvMesh& mesh = vf.mesh(); @@ -123,7 +123,7 @@ Foam::tmp > Foam::fvm::Sp ( const tmp >& tsp, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm = fvm::Sp(tsp(), vf); @@ -136,7 +136,7 @@ Foam::tmp > Foam::fvm::Sp ( const tmp& tsp, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm = fvm::Sp(tsp(), vf); @@ -150,7 +150,7 @@ Foam::tmp > Foam::fvm::Sp ( const dimensionedScalar& sp, - GeometricField& vf + const GeometricField& vf ) { const fvMesh& mesh = vf.mesh(); @@ -175,7 +175,7 @@ Foam::zeroField Foam::fvm::Sp ( const zeroField&, - GeometricField& + const GeometricField& ) { return zeroField(); @@ -187,7 +187,7 @@ Foam::tmp > Foam::fvm::SuSp ( const DimensionedField& susp, - GeometricField& vf + const GeometricField& vf ) { const fvMesh& mesh = vf.mesh(); @@ -215,7 +215,7 @@ Foam::tmp > Foam::fvm::SuSp ( const tmp >& tsusp, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm = fvm::SuSp(tsusp(), vf); @@ -228,7 +228,7 @@ Foam::tmp > Foam::fvm::SuSp ( const tmp& tsusp, - GeometricField& vf + const GeometricField& vf ) { tmp > tfvm = fvm::SuSp(tsusp(), vf); @@ -241,7 +241,7 @@ Foam::zeroField Foam::fvm::SuSp ( const zeroField&, - GeometricField& vf + const GeometricField& vf ) { return zeroField(); diff --git a/src/finiteVolume/finiteVolume/fvm/fvmSup.H b/src/finiteVolume/finiteVolume/fvm/fvmSup.H index 425a57c6e3..a5662c1733 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmSup.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmSup.H @@ -56,28 +56,28 @@ namespace fvm tmp > Su ( const DimensionedField&, - GeometricField& + const GeometricField& ); template tmp > Su ( const tmp >&, - GeometricField& + const GeometricField& ); template tmp > Su ( const tmp >&, - GeometricField& + const GeometricField& ); template zeroField Su ( const zeroField&, - GeometricField& + const GeometricField& ); @@ -87,21 +87,21 @@ namespace fvm tmp > Sp ( const DimensionedField&, - GeometricField& + const GeometricField& ); template tmp > Sp ( const tmp >&, - GeometricField& + const GeometricField& ); template tmp > Sp ( const tmp&, - GeometricField& + const GeometricField& ); @@ -109,7 +109,7 @@ namespace fvm tmp > Sp ( const dimensionedScalar&, - GeometricField& + const GeometricField& ); @@ -117,7 +117,7 @@ namespace fvm zeroField Sp ( const zeroField&, - GeometricField& + const GeometricField& ); @@ -127,28 +127,28 @@ namespace fvm tmp > SuSp ( const DimensionedField&, - GeometricField& + const GeometricField& ); template tmp > SuSp ( const tmp >&, - GeometricField& + const GeometricField& ); template tmp > SuSp ( const tmp&, - GeometricField& + const GeometricField& ); template zeroField SuSp ( const zeroField&, - GeometricField& + const GeometricField& ); } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C index 24b7e8bae0..797e0f5b77 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "extendedLeastSquaresGrad.H" @@ -35,27 +35,20 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - template -tmp +Foam::tmp < - GeometricField + Foam::GeometricField < - typename outerProduct::type, fvPatchField, volMesh + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh > > -extendedLeastSquaresGrad::grad +Foam::fv::extendedLeastSquaresGrad::calcGrad ( - const GeometricField& vsf + const GeometricField& vsf, + const word& name ) const { typedef typename outerProduct::type GradType; @@ -68,7 +61,7 @@ extendedLeastSquaresGrad::grad ( IOobject ( - "grad("+vsf.name()+')', + name, vsf.instance(), mesh, IOobject::NO_READ, @@ -120,7 +113,7 @@ extendedLeastSquaresGrad::grad if (vsf.boundaryField()[patchi].coupled()) { - Field neiVsf = + Field neiVsf = vsf.boundaryField()[patchi].patchNeighbourField(); forAll(neiVsf, patchFaceI) @@ -162,12 +155,4 @@ extendedLeastSquaresGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H index e8da1ca92f..40003aa703 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H @@ -102,13 +102,16 @@ public: // Member Functions - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C index f8a4992bd1..c72525e881 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "fourthGrad.H" @@ -35,27 +35,20 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - template -tmp +Foam::tmp < - GeometricField + Foam::GeometricField < - typename outerProduct::type, fvPatchField, volMesh + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh > > -fourthGrad::grad +Foam::fv::fourthGrad::calcGrad ( - const GeometricField& vsf + const GeometricField& vsf, + const word& name ) const { // The fourth-order gradient is calculated in two passes. First, @@ -80,7 +73,7 @@ fourthGrad::grad ( IOobject ( - "grad("+vsf.name()+')', + name, vsf.instance(), mesh, IOobject::NO_READ, @@ -130,7 +123,7 @@ fourthGrad::grad const scalarField& lambdap = lambda.boundaryField()[patchi]; // Build the d-vectors - vectorField pd = + vectorField pd = mesh.Sf().boundaryField()[patchi] /( mesh.magSf().boundaryField()[patchi] @@ -171,12 +164,4 @@ fourthGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H index 72e2d3b5ad..1698269b3e 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H @@ -83,13 +83,16 @@ public: // Member Functions - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C index 57dc262370..b8e06f4c55 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "gaussGrad.H" @@ -29,27 +29,20 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - template -tmp +Foam::tmp < - GeometricField + Foam::GeometricField < - typename outerProduct::type, fvPatchField, volMesh + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh > > -gaussGrad::grad +Foam::fv::gaussGrad::gradf ( - const GeometricField& ssf + const GeometricField& ssf, + const word& name ) { typedef typename outerProduct::type GradType; @@ -62,7 +55,7 @@ gaussGrad::grad ( IOobject ( - "grad("+ssf.name()+')', + name, ssf.instance(), mesh, IOobject::NO_READ, @@ -119,27 +112,29 @@ gaussGrad::grad template -tmp +Foam::tmp < - GeometricField + Foam::GeometricField < - typename outerProduct::type, fvPatchField, volMesh + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh > > -gaussGrad::grad +Foam::fv::gaussGrad::calcGrad ( - const GeometricField& vsf + const GeometricField& vsf, + const word& name ) const { typedef typename outerProduct::type GradType; tmp > tgGrad ( - grad(tinterpScheme_().interpolate(vsf)) + gradf(tinterpScheme_().interpolate(vsf), name) ); GeometricField& gGrad = tgGrad(); - gGrad.rename("grad(" + vsf.name() + ')'); correctBoundaryConditions(vsf, gGrad); return tgGrad; @@ -147,7 +142,7 @@ gaussGrad::grad template -void gaussGrad::correctBoundaryConditions +void Foam::fv::gaussGrad::correctBoundaryConditions ( const GeometricField& vsf, GeometricField @@ -174,12 +169,4 @@ void gaussGrad::correctBoundaryConditions } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H index 8ddfe1bf7c..4b03d582f0 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H @@ -89,7 +89,7 @@ public: tinterpScheme_(new linear(mesh)) {} - //- Construct from Istream + //- Construct from mesh and Istream gaussGrad(const fvMesh& mesh, Istream& is) : gradScheme(mesh), @@ -116,31 +116,31 @@ public: // Member Functions - //- Return the gradient of the given field + //- Return the gradient of the given field // calculated using Gauss' theorem on the given surface field static tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > gradf ( - const GeometricField& + const GeometricField&, + const word& name ); - - //- Return the gradient of the given field calculated - // using Gauss' theorem on the interpolated field - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; - //- Correct the boundary values of the gradient using the patchField // snGrad functions static void correctBoundaryConditions diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrads.C index 3aa827351e..2e98e7df2c 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrads.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "fvMesh.H" diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C index 6d7cc56560..f3e2799beb 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C @@ -22,28 +22,16 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Abstract base class for finite volume calculus gradient schemes. - \*---------------------------------------------------------------------------*/ #include "fv.H" -#include "HashTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ +#include "objectRegistry.H" +#include "solution.H" // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // template -tmp > gradScheme::New +Foam::tmp > Foam::fv::gradScheme::New ( const fvMesh& mesh, Istream& schemeData @@ -51,7 +39,8 @@ tmp > gradScheme::New { if (fv::debug) { - Info<< "gradScheme::New(Istream& schemeData) : " + Info<< "gradScheme::New" + "(const fvMesh& mesh, Istream& schemeData) : " "constructing gradScheme" << endl; } @@ -60,7 +49,8 @@ tmp > gradScheme::New { FatalIOErrorIn ( - "gradScheme::New(Istream& schemeData)", + "gradScheme::New" + "(const fvMesh& mesh, Istream& schemeData)", schemeData ) << "Grad scheme not specified" << endl << endl << "Valid grad schemes are :" << endl @@ -77,7 +67,8 @@ tmp > gradScheme::New { FatalIOErrorIn ( - "gradScheme::New(Istream& schemeData)", + "gradScheme::New" + "(const fvMesh& mesh, Istream& schemeData)", schemeData ) << "unknown grad scheme " << schemeName << endl << endl << "Valid grad schemes are :" << endl @@ -92,16 +83,153 @@ tmp > gradScheme::New // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -gradScheme::~gradScheme() +Foam::fv::gradScheme::~gradScheme() {} - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace fv +namespace Foam +{ + template + inline void cachePrintMessage + ( + const char* message, + const word& name, + const GeometricField& vf + ) + { + if (solution::debug) + { + Info<< "Cache: " << message << token::SPACE << name + << ", " << vf.name() << " event No. " << vf.eventNo() + << endl; + } + } +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh + > +> +Foam::fv::gradScheme::grad +( + const GeometricField& vsf, + const word& name +) const +{ + typedef typename outerProduct::type GradType; + typedef GeometricField GradFieldType; + + if (!this->mesh().changing() && this->mesh().cache(name)) + { + if (!mesh().objectRegistry::foundObject(name)) + { + cachePrintMessage("Caching", name, vsf); + tmp tgGrad = calcGrad(vsf, name); + regIOobject::store(tgGrad.ptr()); + } + + cachePrintMessage("Retreiving", name, vsf); + GradFieldType& gGrad = const_cast + ( + mesh().objectRegistry::lookupObject(name) + ); + + if (gGrad.upToDate(vsf)) + { + return gGrad; + } + else + { + cachePrintMessage("Deleting", name, vsf); + gGrad.release(); + delete &gGrad; + + cachePrintMessage("Recalculating", name, vsf); + tmp tgGrad = calcGrad(vsf, name); + + cachePrintMessage("Storing", name, vsf); + regIOobject::store(tgGrad.ptr()); + GradFieldType& gGrad = const_cast + ( + mesh().objectRegistry::lookupObject(name) + ); + + return gGrad; + } + } + else + { + if (mesh().objectRegistry::foundObject(name)) + { + cachePrintMessage("Retreiving", name, vsf); + + GradFieldType& gGrad = const_cast + ( + mesh().objectRegistry::lookupObject(name) + ); + + if (gGrad.ownedByRegistry()) + { + cachePrintMessage("Deleting", name, vsf); + gGrad.release(); + delete &gGrad; + } + } + + cachePrintMessage("Calculating", name, vsf); + return calcGrad(vsf, name); + } +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh + > +> +Foam::fv::gradScheme::grad +( + const GeometricField& vsf +) const +{ + return grad(vsf, "grad(" + vsf.name() + ')'); +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh + > +> +Foam::fv::gradScheme::grad +( + const tmp >& tvsf +) const +{ + typedef typename outerProduct::type GradType; + typedef GeometricField GradFieldType; + + tmp tgrad = grad(tvsf()); + tvsf.clear(); + return tgrad; +} -} // End namespace Foam // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H index e338c3dd9e..f1d3fa2262 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H @@ -114,9 +114,8 @@ public: ); - // Destructor - - virtual ~gradScheme(); + //- Destructor + virtual ~gradScheme(); // Member Functions @@ -127,15 +126,54 @@ public: return mesh_; } - //- Calculate and return the grad of the given field + //- Calculate and return the grad of the given field. + // Used by grad either to recalculate the cached gradient when it is + // out of date with respect to the field or when it is not cached. virtual tmp + < + GeometricField + ::type, fvPatchField, volMesh> + > calcGrad + ( + const GeometricField&, + const word& name + ) const = 0; + + //- Calculate and return the grad of the given field + // which may have been cached + tmp + < + GeometricField + ::type, fvPatchField, volMesh> + > grad + ( + const GeometricField&, + const word& name + ) const; + + //- Calculate and return the grad of the given field + // with the default name + // which may have been cached + tmp < GeometricField ::type, fvPatchField, volMesh> > grad ( const GeometricField& - ) const = 0; + ) const; + + //- Calculate and return the grad of the given field + // with the default name + // which may have been cached + tmp + < + GeometricField + ::type, fvPatchField, volMesh> + > grad + ( + const tmp >& + ) const; }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C index 2ccdcebfdd..581962315b 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "leastSquaresGrad.H" @@ -35,27 +35,20 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - template -tmp +Foam::tmp < - GeometricField + Foam::GeometricField < - typename outerProduct::type, fvPatchField, volMesh + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh > > -leastSquaresGrad::grad +Foam::fv::leastSquaresGrad::calcGrad ( - const GeometricField& vsf + const GeometricField& vsf, + const word& name ) const { typedef typename outerProduct::type GradType; @@ -68,7 +61,7 @@ leastSquaresGrad::grad ( IOobject ( - "grad("+vsf.name()+')', + name, vsf.instance(), mesh, IOobject::NO_READ, @@ -116,7 +109,7 @@ leastSquaresGrad::grad if (vsf.boundaryField()[patchi].coupled()) { - Field neiVsf = + Field neiVsf = vsf.boundaryField()[patchi].patchNeighbourField(); forAll(neiVsf, patchFaceI) @@ -147,12 +140,4 @@ leastSquaresGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H index 90606b83be..efb15a2465 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H @@ -89,13 +89,16 @@ public: // Member Functions - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H index 4599902885..22083de571 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H @@ -117,18 +117,82 @@ public: const Type& extrapolate ); - - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; }; +// * * * * * * * * * * * * Inline Member Function * * * * * * * * * * * * * // + +template<> +inline void cellLimitedGrad::limitFace +( + scalar& limiter, + const scalar& maxDelta, + const scalar& minDelta, + const scalar& extrapolate +) +{ + if (extrapolate > maxDelta + VSMALL) + { + limiter = min(limiter, maxDelta/extrapolate); + } + else if (extrapolate < minDelta - VSMALL) + { + limiter = min(limiter, minDelta/extrapolate); + } +} + + +template +inline void cellLimitedGrad::limitFace +( + Type& limiter, + const Type& maxDelta, + const Type& minDelta, + const Type& extrapolate +) +{ + for(direction cmpt=0; cmpt::limitFace + ( + limiter.component(cmpt), + maxDelta.component(cmpt), + minDelta.component(cmpt), + extrapolate.component(cmpt) + ); + } +} + + +// * * * * * * * * Template Member Function Specialisations * * * * * * * * // + +template<> +tmp cellLimitedGrad::calcGrad +( + const volScalarField& vsf, + const word& name +) const; + + +template<> +tmp cellLimitedGrad::calcGrad +( + const volVectorField& vsf, + const word& name +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C index c4f0bf524a..fbc2b8fba5 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C @@ -36,70 +36,25 @@ License namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - namespace fv { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFvGradScheme(cellLimitedGrad) + makeFvGradScheme(cellLimitedGrad) +} +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<> -inline void cellLimitedGrad::limitFace +Foam::tmp +Foam::fv::cellLimitedGrad::calcGrad ( - scalar& limiter, - const scalar& maxDelta, - const scalar& minDelta, - const scalar& extrapolate -) -{ - if (extrapolate > maxDelta + VSMALL) - { - limiter = min(limiter, maxDelta/extrapolate); - } - else if (extrapolate < minDelta - VSMALL) - { - limiter = min(limiter, minDelta/extrapolate); - } -} - -template -inline void cellLimitedGrad::limitFace -( - Type& limiter, - const Type& maxDelta, - const Type& minDelta, - const Type& extrapolate -) -{ - for(direction cmpt=0; cmpt::limitFace - ( - limiter.component(cmpt), - maxDelta.component(cmpt), - minDelta.component(cmpt), - extrapolate.component(cmpt) - ); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template<> -tmp cellLimitedGrad::grad -( - const volScalarField& vsf + const volScalarField& vsf, + const word& name ) const { const fvMesh& mesh = vsf.mesh(); - tmp tGrad = basicGradScheme_().grad(vsf); + tmp tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { @@ -244,14 +199,16 @@ tmp cellLimitedGrad::grad template<> -tmp cellLimitedGrad::grad +Foam::tmp +Foam::fv::cellLimitedGrad::calcGrad ( - const volVectorField& vsf + const volVectorField& vsf, + const word& name ) const { const fvMesh& mesh = vsf.mesh(); - tmp tGrad = basicGradScheme_().grad(vsf); + tmp tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { @@ -402,12 +359,4 @@ tmp cellLimitedGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrad.H index 05953638b2..d9b389d0f5 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrad.H @@ -117,13 +117,16 @@ public: const vector& dcf ); - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; }; @@ -178,6 +181,24 @@ inline void cellMDLimitedGrad::limitFace } +// * * * * * * * * Template Member Function Specialisations * * * * * * * * // + +template<> +tmp cellMDLimitedGrad::calcGrad +( + const volScalarField& vsf, + const word& name +) const; + + +template<> +tmp cellMDLimitedGrad::calcGrad +( + const volVectorField& vsf, + const word& name +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C index 5a35033428..fffc74e97a 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C @@ -36,27 +36,26 @@ License namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - namespace fv { + makeFvGradScheme(cellMDLimitedGrad) +} +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFvGradScheme(cellMDLimitedGrad) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<> -tmp cellMDLimitedGrad::grad +Foam::tmp +Foam::fv::cellMDLimitedGrad::calcGrad ( - const volScalarField& vsf + const volScalarField& vsf, + const word& name ) const { const fvMesh& mesh = vsf.mesh(); - tmp tGrad = basicGradScheme_().grad(vsf); + tmp tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { @@ -190,14 +189,16 @@ tmp cellMDLimitedGrad::grad template<> -tmp cellMDLimitedGrad::grad +Foam::tmp +Foam::fv::cellMDLimitedGrad::calcGrad ( - const volVectorField& vsf + const volVectorField& vsf, + const word& name ) const { const fvMesh& mesh = vsf.mesh(); - tmp tGrad = basicGradScheme_().grad(vsf); + tmp tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { @@ -329,12 +330,4 @@ tmp cellMDLimitedGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrad.H index 8af5298f42..96393c771e 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrad.H @@ -118,17 +118,63 @@ public: // Member Functions - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& - ) const; + const GeometricField& vsf, + const word& name + ) const + { + return grad(vsf); + } }; +// * * * * * * * * * * * * Inline Member Function * * * * * * * * * * * * * // + +template +inline void faceLimitedGrad::limitFace +( + scalar& limiter, + const scalar maxDelta, + const scalar minDelta, + const scalar extrapolate +) const +{ + if (extrapolate > maxDelta + VSMALL) + { + limiter = min(limiter, maxDelta/extrapolate); + } + else if (extrapolate < minDelta - VSMALL) + { + limiter = min(limiter, minDelta/extrapolate); + } +} + + +// * * * * * * * * Template Member Function Specialisations * * * * * * * * // + +template<> +tmp faceLimitedGrad::calcGrad +( + const volScalarField& vsf, + const word& name +) const; + + +template<> +tmp faceLimitedGrad::calcGrad +( + const volVectorField& vsf, + const word& name +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C index afaf398fbc..83c065fa54 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "faceLimitedGrad.H" @@ -36,49 +36,26 @@ License namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - namespace fv { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFvGradScheme(faceLimitedGrad) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -inline void faceLimitedGrad::limitFace -( - scalar& limiter, - const scalar maxDelta, - const scalar minDelta, - const scalar extrapolate -) const -{ - if (extrapolate > maxDelta + VSMALL) - { - limiter = min(limiter, maxDelta/extrapolate); - } - else if (extrapolate < minDelta - VSMALL) - { - limiter = min(limiter, minDelta/extrapolate); - } + makeFvGradScheme(faceLimitedGrad) +} } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<> -tmp faceLimitedGrad::grad +Foam::tmp +Foam::fv::faceLimitedGrad::calcGrad ( - const volScalarField& vsf + const volScalarField& vsf, + const word& name ) const { const fvMesh& mesh = vsf.mesh(); - tmp tGrad = basicGradScheme_().grad(vsf); + tmp tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { @@ -205,14 +182,16 @@ tmp faceLimitedGrad::grad template<> -tmp faceLimitedGrad::grad +Foam::tmp +Foam::fv::faceLimitedGrad::calcGrad ( - const volVectorField& vvf + const volVectorField& vvf, + const word& name ) const { const fvMesh& mesh = vvf.mesh(); - tmp tGrad = basicGradScheme_().grad(vvf); + tmp tGrad = basicGradScheme_().calcGrad(vvf, name); if (k_ < SMALL) { @@ -363,12 +342,4 @@ tmp faceLimitedGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrad.H index f9c826452a..20177019d7 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrad.H @@ -118,17 +118,38 @@ public: // Member Functions - tmp + //- Return the gradient of the given field to the gradScheme::grad + // for optional caching + virtual tmp < GeometricField ::type, fvPatchField, volMesh> - > grad + > calcGrad ( - const GeometricField& + const GeometricField& vsf, + const word& name ) const; }; +// * * * * * * * * Template Member Function Specialisations * * * * * * * * // + +template<> +tmp faceMDLimitedGrad::calcGrad +( + const volScalarField& vsf, + const word& name +) const; + + +template<> +tmp faceMDLimitedGrad::calcGrad +( + const volVectorField& vsf, + const word& name +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C index 27124c4673..87ddd25096 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "faceMDLimitedGrad.H" @@ -37,28 +37,25 @@ License namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - namespace fv { + makeFvGradScheme(faceMDLimitedGrad) +} +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFvGradScheme(faceMDLimitedGrad) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// FaceLimited scalar gradient template<> -tmp faceMDLimitedGrad::grad +Foam::tmp +Foam::fv::faceMDLimitedGrad::calcGrad ( - const volScalarField& vsf + const volScalarField& vsf, + const word& name ) const { const fvMesh& mesh = vsf.mesh(); - tmp tGrad = basicGradScheme_().grad(vsf); + tmp tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { @@ -189,14 +186,16 @@ tmp faceMDLimitedGrad::grad template<> -tmp faceMDLimitedGrad::grad +Foam::tmp +Foam::fv::faceMDLimitedGrad::calcGrad ( - const volVectorField& vvf + const volVectorField& vvf, + const word& name ) const { const fvMesh& mesh = vvf.mesh(); - tmp tGrad = basicGradScheme_().grad(vvf); + tmp tGrad = basicGradScheme_().calcGrad(vvf, name); if (k_ < SMALL) { @@ -327,12 +326,4 @@ tmp faceMDLimitedGrad::grad } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C index 1df55b7e17..b58c2bd41d 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C @@ -47,7 +47,7 @@ tmp > gaussLaplacianScheme::fvmLaplacianUncorrected ( const surfaceScalarField& gammaMagSf, - GeometricField& vf + const GeometricField& vf ) { tmp tdeltaCoeffs = @@ -67,9 +67,9 @@ gaussLaplacianScheme::fvmLaplacianUncorrected fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.internalField(); fvm.negSumDiag(); - forAll(fvm.psi().boundaryField(), patchI) + forAll(vf.boundaryField(), patchI) { - const fvPatchField& psf = fvm.psi().boundaryField()[patchI]; + const fvPatchField& psf = vf.boundaryField()[patchI]; const fvsPatchScalarField& patchGamma = gammaMagSf.boundaryField()[patchI]; @@ -149,7 +149,7 @@ tmp > gaussLaplacianScheme::fvmLaplacian ( const GeometricField& gamma, - GeometricField& vf + const GeometricField& vf ) { const fvMesh& mesh = this->mesh(); diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H index a6c3138833..12b33ae0e4 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H @@ -62,7 +62,7 @@ class gaussLaplacianScheme tmp > fvmLaplacianUncorrected ( const surfaceScalarField& gammaMagSf, - GeometricField& + const GeometricField& ); tmp > gammaSnGradCorr @@ -126,7 +126,7 @@ public: tmp > fvmLaplacian ( const GeometricField&, - GeometricField& + const GeometricField& ); tmp > fvcLaplacian @@ -146,7 +146,7 @@ template<> \ tmp > gaussLaplacianScheme::fvmLaplacian \ ( \ const GeometricField&, \ - GeometricField& \ + const GeometricField& \ ); \ \ template<> \ diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C index 5dab5ceef0..782f14ea4a 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C @@ -21,7 +21,7 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + \*---------------------------------------------------------------------------*/ #include "gaussLaplacianScheme.H" @@ -44,7 +44,7 @@ Foam::tmp > \ Foam::fv::gaussLaplacianScheme::fvmLaplacian \ ( \ const GeometricField& gamma, \ - GeometricField& vf \ + const GeometricField& vf \ ) \ { \ const fvMesh& mesh = this->mesh(); \ diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C index eb14f253ad..78ce0bc2c6 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C @@ -102,7 +102,7 @@ tmp > laplacianScheme::fvmLaplacian ( const GeometricField& gamma, - GeometricField& vf + const GeometricField& vf ) { return fvmLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf); diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H index b36d87df9e..4bbe44ed9a 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H @@ -173,13 +173,13 @@ public: virtual tmp > fvmLaplacian ( const GeometricField&, - GeometricField& + const GeometricField& ) = 0; virtual tmp > fvmLaplacian ( const GeometricField&, - GeometricField& + const GeometricField& ); virtual tmp > fvcLaplacian diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C index 0168bd626a..631d6a9c2f 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Simple central-difference snGrad scheme with non-orthogonal correction. - \*---------------------------------------------------------------------------*/ #include "correctedSnGrad.H" @@ -34,28 +31,44 @@ Description #include "fvcGrad.H" #include "gaussGrad.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -correctedSnGrad::~correctedSnGrad() +Foam::fv::correctedSnGrad::~correctedSnGrad() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -tmp > -correctedSnGrad::correction +Foam::tmp > +Foam::fv::correctedSnGrad::fullGradCorrection +( + const GeometricField& vf +) const +{ + const fvMesh& mesh = this->mesh(); + + // construct GeometricField + tmp > tssf = + mesh.correctionVectors() + & linear::type>(mesh).interpolate + ( + gradScheme::New + ( + mesh, + mesh.gradScheme(vf.name()) + )().grad(vf, "grad(" + vf.name() + ')') + ); + tssf().rename("snGradCorr(" + vf.name() + ')'); + + return tssf; +} + + +template +Foam::tmp > +Foam::fv::correctedSnGrad::correction ( const GeometricField& vf ) const @@ -89,7 +102,7 @@ correctedSnGrad::correction mesh.correctionVectors() & linear < - typename + typename outerProduct::cmptType>::type >(mesh).interpolate ( @@ -108,12 +121,4 @@ correctedSnGrad::correction } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H index 2358867066..3eaa42bfdf 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H @@ -108,12 +108,36 @@ public: } //- Return the explicit correction to the correctedSnGrad - // for the given field + // for the given field using the gradient of the field + tmp > + fullGradCorrection + ( + const GeometricField& + ) const; + + //- Return the explicit correction to the correctedSnGrad + // for the given field using the gradients of the field components virtual tmp > correction(const GeometricField&) const; }; +// * * * * * * * * Template Member Function Specialisations * * * * * * * * // + +template<> +tmp correctedSnGrad::correction +( + const volScalarField& vsf +) const; + + +template<> +tmp correctedSnGrad::correction +( + const volVectorField& vvf +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrads.C index b416a806fa..8377ba7ef4 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrads.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrads.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Simple central-difference snGrad scheme with non-orthogonal correction. - \*---------------------------------------------------------------------------*/ #include "correctedSnGrad.H" @@ -40,4 +37,27 @@ namespace fv } } + +template<> +Foam::tmp +Foam::fv::correctedSnGrad::correction +( + const volScalarField& vsf +) const +{ + return fullGradCorrection(vsf); +} + + +template<> +Foam::tmp +Foam::fv::correctedSnGrad::correction +( + const volVectorField& vvf +) const +{ + return fullGradCorrection(vvf); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 1e49de4683..74b4282638 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -183,7 +183,7 @@ void Foam::fvMatrix::addBoundarySource template Foam::fvMatrix::fvMatrix ( - GeometricField& psi, + const GeometricField& psi, const dimensionSet& ds ) : @@ -227,7 +227,13 @@ Foam::fvMatrix::fvMatrix ); } - psi_.boundaryField().updateCoeffs(); + // Update the boundary coefficients of psi without changing it's event No. + GeometricField& psiRef = + const_cast&>(psi_); + + label currentStatePsi = psiRef.eventNo(); + psiRef.boundaryField().updateCoeffs(); + psiRef.eventNo() = currentStatePsi; } @@ -322,7 +328,7 @@ Foam::fvMatrix::fvMatrix(const tmp >& tfvm) template Foam::fvMatrix::fvMatrix ( - GeometricField& psi, + const GeometricField& psi, Istream& is ) : @@ -404,12 +410,17 @@ void Foam::fvMatrix::setValues const unallocLabelList& nei = mesh.neighbour(); scalarField& Diag = diag(); + Field& psi = + const_cast + < + GeometricField& + >(psi_).internalField(); forAll(cellLabels, i) { label celli = cellLabels[i]; - psi_[celli] = values[i]; + psi[celli] = values[i]; source_[celli] = values[i]*Diag[celli]; if (symmetric() || asymmetric()) diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H index 4fbc2430d7..8569862e13 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H @@ -117,8 +117,9 @@ public: // Private data - // Reference to GeometricField - GeometricField& psi_; + //- Const reference to GeometricField + // Converted into a non-const reference at the point of solution. + const GeometricField& psi_; //- Dimension set dimensionSet dimensions_; @@ -237,7 +238,7 @@ public: //- Construct given a field to solve for fvMatrix ( - GeometricField&, + const GeometricField&, const dimensionSet& ); @@ -245,12 +246,12 @@ public: fvMatrix(const fvMatrix&); //- Construct as copy of tmp > deleting argument -# ifdef ConstructFromTmp + #ifdef ConstructFromTmp fvMatrix(const tmp >&); -# endif + #endif //- Construct from Istream given field to solve for - fvMatrix(GeometricField&, Istream&); + fvMatrix(const GeometricField&, Istream&); // Destructor @@ -267,11 +268,6 @@ public: return psi_; } - GeometricField& psi() - { - return psi_; - } - const dimensionSet& dimensions() const { return dimensions_; diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 21f3738a02..c56899bd62 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -63,10 +63,13 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve << endl; } + GeometricField& psi = + const_cast&>(psi_); + lduMatrix::solverPerformance solverPerfVec ( "fvMatrix::solve", - psi_.name() + psi.name() ); scalarField saveDiag = diag(); @@ -82,7 +85,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve ( pow ( - psi_.mesh().solutionD(), + psi.mesh().solutionD(), pTraits, Type::rank>::type>::zero ) ); @@ -93,7 +96,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve // copy field and source - scalarField psiCmpt = psi_.internalField().component(cmpt); + scalarField psiCmpt = psi.internalField().component(cmpt); addBoundaryDiag(diag(), cmpt); scalarField sourceCmpt = source.component(cmpt); @@ -109,7 +112,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve ); lduInterfaceFieldPtrsList interfaces = - psi_.boundaryField().interfaces(); + psi.boundaryField().interfaces(); // Use the initMatrixInterfaces and updateMatrixInterfaces to correct // bouCoeffsCmpt for the explicit part of the coupled boundary @@ -137,7 +140,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve // Solver call solverPerf = lduMatrix::solver::New ( - psi_.name() + pTraits::componentNames[cmpt], + psi.name() + pTraits::componentNames[cmpt], *this, bouCoeffsCmpt, intCoeffsCmpt, @@ -156,11 +159,11 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve solverPerfVec = solverPerf; } - psi_.internalField().replace(cmpt, psiCmpt); + psi.internalField().replace(cmpt, psiCmpt); diag() = saveDiag; } - psi_.correctBoundaryConditions(); + psi.correctBoundaryConditions(); return solverPerfVec; } diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index 35e5c3ac35..5ea0ba6a17 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -99,6 +99,10 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::fvSolver::solve const dictionary& solverControls ) { + GeometricField& psi = + const_cast&> + (fvMat_.psi()); + scalarField saveDiag = fvMat_.diag(); fvMat_.addBoundaryDiag(fvMat_.diag(), 0); @@ -108,14 +112,17 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::fvSolver::solve // assign new solver controls solver_->read(solverControls); - lduMatrix::solverPerformance solverPerf = - solver_->solve(fvMat_.psi().internalField(), totalSource); + lduMatrix::solverPerformance solverPerf = solver_->solve + ( + psi.internalField(), + totalSource + ); solverPerf.print(); fvMat_.diag() = saveDiag; - fvMat_.psi().correctBoundaryConditions(); + psi.correctBoundaryConditions(); return solverPerf; } @@ -134,6 +141,9 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve << endl; } + GeometricField& psi = + const_cast&>(psi_); + scalarField saveDiag = diag(); addBoundaryDiag(diag(), 0); @@ -143,19 +153,19 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve // Solver call lduMatrix::solverPerformance solverPerf = lduMatrix::solver::New ( - psi_.name(), + psi.name(), *this, boundaryCoeffs_, internalCoeffs_, - psi_.boundaryField().interfaces(), + psi.boundaryField().interfaces(), solverControls - )->solve(psi_.internalField(), totalSource); + )->solve(psi.internalField(), totalSource); solverPerf.print(); diag() = saveDiag; - psi_.correctBoundaryConditions(); + psi.correctBoundaryConditions(); return solverPerf; } diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C index 1465c2648e..ff2ecdbdc3 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C @@ -66,8 +66,10 @@ tmp LimitedScheme::limiter const GeometricField& lPhi = tlPhi(); - GeometricField - gradc(fvc::grad(lPhi)); + tmp > + tgradc(fvc::grad(lPhi)); + const GeometricField& + gradc = tgradc(); const surfaceScalarField& CDweights = mesh.surfaceInterpolation::weights(); @@ -116,7 +118,7 @@ tmp LimitedScheme::limiter gradc.boundaryField()[patchi].patchNeighbourField(); // Build the d-vectors - vectorField pd = + vectorField pd = mesh.Sf().boundaryField()[patchi] /( mesh.magSf().boundaryField()[patchi] diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.C index 4cda19451b..104cbdd29b 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.C @@ -67,9 +67,22 @@ Foam::linearUpwind::correction const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); - GeometricField - ::type, fvPatchField, volMesh> - gradVf = gradScheme_().grad(vf); + tmp + < + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + > + > tgradVf = gradScheme_().grad(vf, gradSchemeName_); + + const GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& gradVf = tgradVf(); forAll(faceFlux, facei) { @@ -95,7 +108,7 @@ Foam::linearUpwind::correction if (pSfCorr.coupled()) { - const unallocLabelList& pOwner = + const unallocLabelList& pOwner = mesh.boundary()[patchi].faceCells(); const vectorField& pCf = Cf.boundaryField()[patchi]; @@ -106,7 +119,7 @@ Foam::linearUpwind::correction gradVf.boundaryField()[patchi].patchNeighbourField(); // Build the d-vectors - vectorField pd = + vectorField pd = mesh.Sf().boundaryField()[patchi] /( mesh.magSf().boundaryField()[patchi] @@ -129,7 +142,7 @@ Foam::linearUpwind::correction } else { - pSfCorr[facei] = + pSfCorr[facei] = (pCf[facei] - pd[facei] - C[own]) & pGradVfNei[facei]; } } diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.H b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.H index 2b51590f85..e5e278a7e9 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwind.H @@ -56,6 +56,7 @@ class linearUpwind { // Private Data + word gradSchemeName_; tmp > gradScheme_; @@ -84,6 +85,7 @@ public: ) : upwind(mesh, faceFlux), + gradSchemeName_("grad"), gradScheme_ ( new fv::gaussGrad(mesh) @@ -100,12 +102,13 @@ public: ) : upwind(mesh, schemeData), + gradSchemeName_(schemeData), gradScheme_ ( fv::gradScheme::New ( mesh, - schemeData + mesh.gradScheme(gradSchemeName_) ) ) {} @@ -119,12 +122,13 @@ public: ) : upwind(mesh, faceFlux, schemeData), + gradSchemeName_(schemeData), gradScheme_ ( fv::gradScheme::New ( mesh, - schemeData + mesh.gradScheme(gradSchemeName_) ) ) {} diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.C index 80a137b396..c4b52f4da0 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.C @@ -74,9 +74,22 @@ Foam::linearUpwindV::correction const vectorField& C = mesh.C(); const vectorField& Cf = mesh.Cf(); - GeometricField - ::type, fvPatchField, volMesh> - gradVf = gradScheme_().grad(vf); + tmp + < + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + > + > tgradVf = gradScheme_().grad(vf, gradSchemeName_); + + const GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& gradVf = tgradVf(); forAll(faceFlux, facei) { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.H b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.H index 7f8c9de742..9d477610a7 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/linearUpwind/linearUpwindV.H @@ -56,6 +56,7 @@ class linearUpwindV { // Private Data + word gradSchemeName_; tmp > gradScheme_; @@ -84,6 +85,7 @@ public: ) : upwind(mesh, faceFlux), + gradSchemeName_("grad"), gradScheme_ ( new fv::gaussGrad(mesh) @@ -100,12 +102,13 @@ public: ) : upwind(mesh, schemeData), + gradSchemeName_(schemeData), gradScheme_ ( fv::gradScheme::New ( mesh, - schemeData + mesh.gradScheme(gradSchemeName_) ) ) {} @@ -119,12 +122,13 @@ public: ) : upwind(mesh, faceFlux, schemeData), + gradSchemeName_(schemeData), gradScheme_ ( fv::gradScheme::New ( mesh, - schemeData + mesh.gradScheme(gradSchemeName_) ) ) {} From b7cf30bdb44cb01e37b7360d38ce6599f7420adc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 26 Oct 2009 15:40:55 +0100 Subject: [PATCH 08/21] simpleMatrix initialize with coefficients with 0.0 - the element of least surprise --- .../matrices/simpleMatrix/simpleMatrix.C | 2 +- .../matrices/simpleMatrix/simpleMatrix.H | 8 +++-- src/mesh/blockMesh/curvedEdges/BSpline.C | 10 +++--- src/mesh/blockMesh/curvedEdges/arcEdge.C | 2 +- .../blockMesh/curvedEdges/polySplineEdge.C | 27 +++++++--------- src/mesh/blockMesh/curvedEdges/spline.C | 32 ++++++++++--------- src/mesh/blockMesh/curvedEdges/spline.H | 3 +- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C index abc0c0ba03..416f06c1bf 100644 --- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C +++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C @@ -31,7 +31,7 @@ License template Foam::simpleMatrix::simpleMatrix(const label mSize) : - scalarSquareMatrix(mSize), + scalarSquareMatrix(mSize, mSize, pTraits::zero), source_(mSize, pTraits::zero) {} diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H index b854355003..e203972ffe 100644 --- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H +++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H @@ -26,7 +26,7 @@ Class Foam::simpleMatrix Description - Foam::simpleMatrix + A simple square matrix solver with scalar coefficients. SourceFiles simpleMatrix.C @@ -74,10 +74,10 @@ public: // Constructors - //- Construct given size + //- Construct given size, initializing matrix coefficients to zero simpleMatrix(const label); - //- Construct given size and initial value + //- Construct given size, and initial value for matrix coefficients simpleMatrix(const label, const scalar&); //- Construct from components @@ -94,11 +94,13 @@ public: // Access + //- Return access to the source Field& source() { return source_; } + //- Return const-access to the source const Field& source() const { return source_; diff --git a/src/mesh/blockMesh/curvedEdges/BSpline.C b/src/mesh/blockMesh/curvedEdges/BSpline.C index 4e53399719..5aaf693c29 100644 --- a/src/mesh/blockMesh/curvedEdges/BSpline.C +++ b/src/mesh/blockMesh/curvedEdges/BSpline.C @@ -46,7 +46,7 @@ Foam::pointField Foam::BSpline::findKnots register const scalar oneSixth = 1.0/6.0; register const scalar twoThird = 2.0/3.0; - simpleMatrix M(NKnots+2, pTraits::zero); + simpleMatrix M(NKnots+2); // set up the matrix M[0][0] = -0.5*scalar(NKnots - 1); @@ -68,9 +68,9 @@ Foam::pointField Foam::BSpline::findKnots M.source()[i] = allknots[i-1]; } + // set the gradients at the ends: - // set the gradients at the two ends - if (mag(fstend)<1e-8) + if (mag(fstend) < 1e-8) { // default : forward differences on the end knots M.source()[0] = allknots[1] - allknots[0]; @@ -78,7 +78,7 @@ Foam::pointField Foam::BSpline::findKnots } else { - // set to the gradient vector provided + // use the gradient vector provided M.source()[0] = fstend/mag(fstend); } @@ -90,7 +90,7 @@ Foam::pointField Foam::BSpline::findKnots } else { - // set to the gradient vector provided + // use the gradient vector provided M.source()[NKnots+1] = sndend/mag(sndend); } diff --git a/src/mesh/blockMesh/curvedEdges/arcEdge.C b/src/mesh/blockMesh/curvedEdges/arcEdge.C index bb7b3b7a8c..afb62a8f8b 100644 --- a/src/mesh/blockMesh/curvedEdges/arcEdge.C +++ b/src/mesh/blockMesh/curvedEdges/arcEdge.C @@ -75,7 +75,7 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle() angle_ = radToDeg(acos(tmp)); // check if the vectors define an exterior or an interior arcEdge - if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) + if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) { angle_ = 360.0 - angle_; } diff --git a/src/mesh/blockMesh/curvedEdges/polySplineEdge.C b/src/mesh/blockMesh/curvedEdges/polySplineEdge.C index 841f6f986a..866689d8cf 100644 --- a/src/mesh/blockMesh/curvedEdges/polySplineEdge.C +++ b/src/mesh/blockMesh/curvedEdges/polySplineEdge.C @@ -68,18 +68,22 @@ Foam::pointField Foam::polySplineEdge::intervening const vector& sndend ) { - BSpline spl(knotlist(points_, start_, end_, otherknots), fstend, sndend); + BSpline spl + ( + knotlist(points_, start_, end_, otherknots), + fstend, + sndend + ); - label nSize(nsize(otherknots.size(), nBetweenKnots)); + const label nSize(nsize(otherknots.size(), nBetweenKnots)); - pointField ans(nSize); - - label N = spl.nKnots(); - scalar init = 1.0/(N - 1); - scalar interval = (N - scalar(3))/N; + const label NKnots = spl.nKnots(); + const scalar init = 1.0/(NKnots - 1); + scalar interval = (NKnots - scalar(3.0))/NKnots; interval /= otherknots.size() + 1; interval /= nBetweenKnots + 1; + pointField ans(nSize); ans[0] = points_[start_]; register scalar index(init); @@ -135,17 +139,8 @@ Foam::polySplineEdge::polySplineEdge vector fstend(is); vector sndend(is); - controlPoints_.setSize(nsize(otherKnots_.size(), nInterKnots)); - // why does this need to be here (to avoid a crash)? - // 'intervening' uses BSpline to solve the new points - // it seems to be going badly there - distances_.setSize(controlPoints_.size()); - controlPoints_ = intervening(otherKnots_, nInterKnots, fstend, sndend); calcDistances(); - - // Info<< "polyLine[" << start_ << " " << end_ - // << "] controlPoints " << controlPoints_ << endl; } diff --git a/src/mesh/blockMesh/curvedEdges/spline.C b/src/mesh/blockMesh/curvedEdges/spline.C index 871c7f7db4..67b8c79559 100644 --- a/src/mesh/blockMesh/curvedEdges/spline.C +++ b/src/mesh/blockMesh/curvedEdges/spline.C @@ -26,17 +26,9 @@ License #include "spline.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -Foam::spline::spline(const pointField& knotPoints) -: - knots_(knotPoints) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::spline::B(const scalar& tau) const +Foam::scalar Foam::spline::B(const scalar& tau) { if (tau <= -2.0 || tau >= 2.0) { @@ -44,7 +36,7 @@ Foam::scalar Foam::spline::B(const scalar& tau) const } else if (tau <= -1.0) { - return pow((2.0 + tau),3.0)/6.0; + return pow((2.0 + tau), 3.0)/6.0; } else if (tau <= 0.0) { @@ -56,7 +48,7 @@ Foam::scalar Foam::spline::B(const scalar& tau) const } else if (tau <= 2.0) { - return pow((2.0 - tau),3.0)/6.0; + return pow((2.0 - tau), 3.0)/6.0; } else { @@ -70,13 +62,23 @@ Foam::scalar Foam::spline::B(const scalar& tau) const } -Foam::vector Foam::spline::position(const scalar mu1) const +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::spline::spline(const pointField& knotPoints) +: + knots_(knotPoints) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::vector Foam::spline::position(const scalar mu) const { vector loc(vector::zero); - for (register label i=0; i Date: Mon, 26 Oct 2009 18:54:10 +0000 Subject: [PATCH 09/21] adding tabulated U wall function BC and utility to generate tables --- .../preProcessing/wallFunctionTable/Allwclean | 5 + .../preProcessing/wallFunctionTable/Allwmake | 5 + .../wallFunctionTable/Make/files | 3 + .../wallFunctionTable/Make/options | 8 + .../tabulatedWallFunction/Make/files | 7 + .../tabulatedWallFunction/Make/options | 9 + .../SpaldingsLaw/SpaldingsLaw.C | 197 ++++++++++++++ .../SpaldingsLaw/SpaldingsLaw.H | 140 ++++++++++ .../tabulatedWallFunction/general/general.C | 254 ++++++++++++++++++ .../tabulatedWallFunction/general/general.H | 172 ++++++++++++ .../newTabulatedWallFunction.C | 71 +++++ .../tabulatedWallFunction.C | 88 ++++++ .../tabulatedWallFunction.H | 147 ++++++++++ .../tabulatedWallFunctionI.H | 45 ++++ .../wallFunctionTable/wallFunctionDict | 39 +++ .../wallFunctionTable/wallFunctionTableApp.C | 68 +++++ src/OpenFOAM/Make/files | 1 + .../uniformInterpolationTable.C | 225 ++++++++++++++++ .../uniformInterpolationTable.H | 218 +++++++++++++++ .../uniformInterpolationTableI.H | 87 ++++++ .../incompressible/RAS/Make/files | 1 + ...UTabulatedWallFunctionFvPatchScalarField.C | 215 +++++++++++++++ ...UTabulatedWallFunctionFvPatchScalarField.H | 177 ++++++++++++ 23 files changed, 2182 insertions(+) create mode 100755 applications/utilities/preProcessing/wallFunctionTable/Allwclean create mode 100755 applications/utilities/preProcessing/wallFunctionTable/Allwmake create mode 100644 applications/utilities/preProcessing/wallFunctionTable/Make/files create mode 100644 applications/utilities/preProcessing/wallFunctionTable/Make/options create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/files create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/options create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.C create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.H create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/newTabulatedWallFunction.C create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.H create mode 100644 applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunctionI.H create mode 100644 applications/utilities/preProcessing/wallFunctionTable/wallFunctionDict create mode 100644 applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C create mode 100644 src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C create mode 100644 src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.H create mode 100644 src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTableI.H create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H diff --git a/applications/utilities/preProcessing/wallFunctionTable/Allwclean b/applications/utilities/preProcessing/wallFunctionTable/Allwclean new file mode 100755 index 0000000000..bf93e1c06b --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/Allwclean @@ -0,0 +1,5 @@ +#!/bin/sh + +wclean libso tabulatedWallFunction +wclean + diff --git a/applications/utilities/preProcessing/wallFunctionTable/Allwmake b/applications/utilities/preProcessing/wallFunctionTable/Allwmake new file mode 100755 index 0000000000..57795a542f --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/Allwmake @@ -0,0 +1,5 @@ +#!/bin/sh + +wmake libso tabulatedWallFunction +wmake + diff --git a/applications/utilities/preProcessing/wallFunctionTable/Make/files b/applications/utilities/preProcessing/wallFunctionTable/Make/files new file mode 100644 index 0000000000..49a6c94aa1 --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/Make/files @@ -0,0 +1,3 @@ +wallFunctionTableApp.C + +EXE = $(FOAM_APPBIN)/wallFunctionTable diff --git a/applications/utilities/preProcessing/wallFunctionTable/Make/options b/applications/utilities/preProcessing/wallFunctionTable/Make/options new file mode 100644 index 0000000000..6c78939e7c --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/Make/options @@ -0,0 +1,8 @@ +EXE_INC = \ + -I./tabulatedWallFunction/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -ltabulatedWallFunctions \ + -lfiniteVolume diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/files b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/files new file mode 100644 index 0000000000..77c9217ded --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/files @@ -0,0 +1,7 @@ +tabulatedWallFunction/tabulatedWallFunction.C +tabulatedWallFunction/newTabulatedWallFunction.C + +SpaldingsLaw/SpaldingsLaw.C +general/general.C + +LIB = $(FOAM_LIBBIN)/libtabulatedWallFunctions diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/options b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/options new file mode 100644 index 0000000000..cc5bf25a93 --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/Make/options @@ -0,0 +1,9 @@ + +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \ + -I$(LIB_SRC)/transportModels + +LIB_LIBS = \ + -lfiniteVolume diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.C new file mode 100644 index 0000000000..2138000f6e --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.C @@ -0,0 +1,197 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "SpaldingsLaw.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace tabulatedWallFunctions + { + defineTypeNameAndDebug(SpaldingsLaw, 0); + addToRunTimeSelectionTable + ( + tabulatedWallFunction, + SpaldingsLaw, + dictionary + ); + } +} + +const Foam::label Foam::tabulatedWallFunctions::SpaldingsLaw::maxIters_ = 1000; + +const Foam::scalar + Foam::tabulatedWallFunctions::SpaldingsLaw::tolerance_ = 1e-4; + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::tabulatedWallFunctions::SpaldingsLaw::invertFunction() +{ + // Initialise u+ and R + scalar Re = 0.0; + scalar uPlus = 1; + + // Populate the table + for (label i=0; i 0) + { + uPlus = invertedTable_[i-1]; + } + + // Newton iterations to determine u+ + label iter = 0; + scalar error = GREAT; + do + { + scalar kUPlus = min(kappa_*uPlus, 50); + scalar A = + E_*sqr(uPlus) + + uPlus + *(exp(kUPlus) - pow3(kUPlus)/6 - 0.5*sqr(kUPlus) - kUPlus - 1); + + scalar f = - Re + A/E_; + + scalar df = + ( + 2*E_*uPlus + + exp(kUPlus)*(kUPlus + 1) + - 2/3*pow3(kUPlus) + - 1.5*sqr(kUPlus) + - 2*kUPlus + - 1 + )/E_; + + scalar uPlusNew = uPlus - f/(df + ROOTVSMALL); + error = mag((uPlus - uPlusNew)/uPlusNew); + uPlus = uPlusNew; + } while (error > tolerance_ && ++iter < maxIters_); + + if (iter == maxIters_) + { + WarningIn("SpaldingsLaw::invertFunction()") + << "Newton iterations not converged:" << nl + << " iters = " << iter << ", error = " << error << endl; + } + + // Set new values - constrain u+ >= 0 + invertedTable_[i] = max(0, uPlus); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::tabulatedWallFunctions::SpaldingsLaw::SpaldingsLaw +( + const dictionary& dict, + const polyMesh& mesh +) +: + tabulatedWallFunction(dict, mesh, typeName), + kappa_(readScalar(coeffDict_.lookup("kappa"))), + E_(readScalar(coeffDict_.lookup("E"))) +{ + invertFunction(); + + if (debug) + { + writeData(Info); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::tabulatedWallFunctions::SpaldingsLaw::~SpaldingsLaw() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalar Foam::tabulatedWallFunctions::SpaldingsLaw::yPlus +( + const scalar uPlus +) const +{ + scalar kUPlus = min(kappa_*uPlus, 50); + + return + uPlus + + 1/E_*(exp(kUPlus) - pow3(kUPlus)/6 - 0.5*sqr(kUPlus) - kUPlus - 1); +} + + +Foam::scalar Foam::tabulatedWallFunctions::SpaldingsLaw::Re +( + const scalar uPlus +) const +{ + return uPlus*yPlus(uPlus); +} + + +void Foam::tabulatedWallFunctions::SpaldingsLaw::writeData(Ostream& os) const +{ + if (invertedTable_.log10()) + { + os << "log10(Re), y+, u+:" << endl; + forAll(invertedTable_, i) + { + scalar uPlus = invertedTable_[i]; + scalar Re = ::log10(this->Re(uPlus)); + scalar yPlus = this->yPlus(uPlus); + os << Re << ", " << yPlus << ", " << uPlus << endl; + } + } + else + { + os << "Re, y+, u+:" << endl; + forAll(invertedTable_, i) + { + scalar uPlus = invertedTable_[i]; + scalar Re = this->Re(uPlus); + scalar yPlus = this->yPlus(uPlus); + os << Re << ", " << yPlus << ", " << uPlus << endl; + } + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.H b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.H new file mode 100644 index 0000000000..07853ef5eb --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/SpaldingsLaw/SpaldingsLaw.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::tabulatedWallFunctions::SpaldingsLaw + +Description + Computes U+ as a function of Reynolds number by inverting Spaldings law. + + Example dictionary specification: + + tabulatedWallFunction SpaldingsLaw; + + // Output table info + tableName uPlusWallFunctionData; // Output table name + log10 yes; // Rey interpreted as log10(Rey) + dx 0.2; // Interval log10(Rey) + x0 -3; // Minimum log10(Rey) + xMax 7; // Maximum log10(Rey) + + SpaldingsLawCoeffs + { + kappa 0.41; // Von Karman constant + E 9.8; // Law-of-the-wall E coefficient + } + + +SourceFiles + SpaldingsLaw.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SpaldingsLaw_H +#define SpaldingsLaw_H + +#include "tabulatedWallFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace tabulatedWallFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class SpaldingsLaw Declaration +\*---------------------------------------------------------------------------*/ + +class SpaldingsLaw +: + public tabulatedWallFunction +{ +protected: + + // Protected data + + //- Von Karman constant + scalar kappa_; + + //- Law-of-the-wall E coefficient + scalar E_; + + + // Newton iteration solution properties + + //- Maximum number of iterations + static const label maxIters_; + + //- Tolerance + static const scalar tolerance_; + + + // Protected member functions + + //- Invert the function + virtual void invertFunction(); + + +public: + + //- Run-time type information + TypeName("SpaldingsLaw"); + + + // Constructors + SpaldingsLaw(const dictionary& dict, const polyMesh& mesh); + + //- Destructor + virtual ~SpaldingsLaw(); + + + // Member Functions + + // Access + + //- Return y+ as a function of u+ + virtual scalar yPlus(const scalar uPlus) const; + + //- Return Reynolds number as a function of u+ + virtual scalar Re(const scalar uPlus) const; + + + // I-O + + //- Write to Ostream + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace tabulatedWallFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C new file mode 100644 index 0000000000..76792dc2f8 --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C @@ -0,0 +1,254 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "general.H" +#include "addToRunTimeSelectionTable.H" +#include "Tuple2.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace tabulatedWallFunctions + { + defineTypeNameAndDebug(general, 0); + addToRunTimeSelectionTable + ( + tabulatedWallFunction, + general, + dictionary + ); + } +} + +template<> +const char* +Foam::NamedEnum:: + names[] = + { + "linear" + }; + +const +Foam::NamedEnum + Foam::tabulatedWallFunctions::general::interpolationTypeNames_; + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::tabulatedWallFunctions::general::invertTable() +{ + scalarList Rey(uPlus_.size(), 0.0); + + // Calculate Reynolds number + forAll(uPlus_, i) + { + Rey[i] = yPlus_[i]*uPlus_[i]; + if (invertedTable_.log10()) + { + Rey[i] = ::log10(max(ROOTVSMALL, Rey[i])); + } + } + + // Populate the U+ vs Re table + forAll(invertedTable_, i) + { + scalar Re = i*invertedTable_.dx() + invertedTable_.x0(); + invertedTable_[i] = max(0, interpolate(Re, Rey, uPlus_)); + } +} + + +Foam::scalar Foam::tabulatedWallFunctions::general::interpolate +( + const scalar xi, + const scalarList& x, + const scalarList& fx +) const +{ + switch (interpType_) + { + case itLinear: + { + if (xi < x[0]) + { + return fx[0]; + } + else if (xi > x[x.size()-1]) + { + return fx[x.size()-1]; + } + else + { + label i2 = 0; + while (x[i2] < xi) + { + i2++; + } + label i1 = i2 - 1; + + return (xi - x[i1])/(x[i2] - x[i1])*(fx[i2] - fx[i1]) + fx[i1]; + } + + break; + } + default: + { + FatalErrorIn + ( + "tabulatedWallFunctions::general::interpolate" + "(" + "const scalar, " + "const scalarList&, " + "const scalarList&" + ")" + ) << "Unknown interpolation method" << nl + << abort(FatalError); + } + } + + return 0.0; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::tabulatedWallFunctions::general::general +( + const dictionary& dict, + const polyMesh& mesh +) +: + tabulatedWallFunction(dict, mesh, typeName), + interpType_(interpolationTypeNames_[coeffDict_.lookup("interpType")]), + yPlus_(), + uPlus_(), + log10YPlus_(coeffDict_.lookup("log10YPlus")), + log10UPlus_(coeffDict_.lookup("log10UPlus")) +{ + List > inputTable = coeffDict_.lookup("inputTable"); + if (inputTable.size() < 2) + { + FatalErrorIn + ( + "tabulatedWallFunctions::general::general" + "(" + "const dictionary&, " + "const polyMesh&" + ")" + ) << "Input table must have at least 2 values" << nl + << exit(FatalError); + } + + yPlus_.setSize(inputTable.size()); + uPlus_.setSize(inputTable.size()); + + forAll(inputTable, i) + { + if (log10YPlus_) + { + yPlus_[i] = pow(10, inputTable[i].first()); + } + else + { + yPlus_[i] = inputTable[i].first(); + } + + if (log10UPlus_) + { + uPlus_[i] = pow(10, inputTable[i].second()); + } + else + { + uPlus_[i] = inputTable[i].second(); + } + } + + invertTable(); + + if (debug) + { + writeData(Info); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::tabulatedWallFunctions::general::~general() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalar Foam::tabulatedWallFunctions::general::yPlus +( + const scalar uPlus +) const +{ + return interpolate(uPlus, uPlus_, yPlus_); +} + + +Foam::scalar Foam::tabulatedWallFunctions::general::Re +( + const scalar uPlus +) const +{ + return uPlus*yPlus(uPlus); +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +void Foam::tabulatedWallFunctions::general::writeData(Ostream& os) const +{ + if (invertedTable_.log10()) + { + os << "log10(Re), y+, u+:" << endl; + forAll(invertedTable_, i) + { + scalar uPlus = invertedTable_[i]; + scalar Re = ::log10(this->Re(uPlus)); + scalar yPlus = this->yPlus(uPlus); + os << Re << ", " << yPlus << ", " << uPlus << endl; + } + } + else + { + os << "Re, y+, u+:" << endl; + forAll(invertedTable_, i) + { + scalar uPlus = invertedTable_[i]; + scalar Re = this->Re(uPlus); + scalar yPlus = this->yPlus(uPlus); + os << Re << ", " << yPlus << ", " << uPlus << endl; + } + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H new file mode 100644 index 0000000000..032d2d6cc1 --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::tabulatedWallFunctions::general + +Description + Computes U+ as a function of Reynolds number by inverting table of + y+ vs U+ + + Example dictionary specification: + + tabulatedWallFunction general; + + // Output table info + tableName uPlusWallFunctionData; // Output table name + log10 yes; // Re interpreted as log10(Rey) + dx 0.2; // Interval log10(Rey) + x0 -3; // Minimum log10(Rey) + xMax 7; // Maximum log10(Rey) + + generalCoeffs + { + interpType linear; // Interpolation method + log10YPlus true; // y+ values defined as log10(y+) + log10UPlus true; // U+ values defined as log10(y+) + inputTable + ( + (yPlusValue0 uPlusValue0) + ... + (yPlusValueN uPlusValueN) + ); + + } + + +SourceFiles + general.C + +\*---------------------------------------------------------------------------*/ + +#ifndef general_H +#define general_H + +#include "tabulatedWallFunction.H" +#include "NamedEnum.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace tabulatedWallFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class general Declaration +\*---------------------------------------------------------------------------*/ + +class general +: + public tabulatedWallFunction +{ +public: + + // Public data types + + //- Enumeration listing available interpolation types + enum interpolationType + { + itLinear + }; + + static const NamedEnum interpolationTypeNames_; + + +protected: + + // Protected data + + //- Type of interpolation to apply when inverting the data set + interpolationType interpType_; + + //- Input y+ values + List yPlus_; + + //- Input U+ values + List uPlus_; + + //- Are y+ values entered as log10(y+)? + Switch log10YPlus_; + + //- Are U+ values entered as log10(U+)? + Switch log10UPlus_; + + + // Protected member functions + + //- Invert the table + virtual void invertTable(); + + //- Interpolate + virtual scalar interpolate + ( + const scalar xi, + const scalarList& x, + const scalarList& fx + ) const; + + +public: + + //- Run-time type information + TypeName("general"); + + + // Constructors + general(const dictionary& dict, const polyMesh& mesh); + + //- Destructor + virtual ~general(); + + + // Member Functions + + // Access + + //- Return y+ as a function of u+ + virtual scalar yPlus(const scalar uPlus) const; + + //- Return Reynolds number as a function of u+ + virtual scalar Re(const scalar uPlus) const; + + + // I-O + + //- Write to Ostream + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace tabulatedWallFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/newTabulatedWallFunction.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/newTabulatedWallFunction.C new file mode 100644 index 0000000000..af10c17567 --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/newTabulatedWallFunction.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "tabulatedWallFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace tabulatedWallFunctions +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +autoPtr tabulatedWallFunction::New +( + const dictionary& dict, + const polyMesh& mesh +) +{ + word twfTypeName = dict.lookup("tabulatedWallFunction"); + + Info<< "Selecting tabulatedWallFunction " << twfTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(twfTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "tabulatedWallFunction::New(const dictionary&, const polyMesh&)" + ) << "Unknown tabulatedWallFunction type " << twfTypeName + << nl << nl << "Valid tabulatedWallFunction types are:" << nl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict, mesh)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace tabulatedWallFunctions +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C new file mode 100644 index 0000000000..4c0087a87b --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C @@ -0,0 +1,88 @@ + +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "tabulatedWallFunction.H" +#include "Time.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace tabulatedWallFunctions + { + defineTypeNameAndDebug(tabulatedWallFunction, 0); + defineRunTimeSelectionTable(tabulatedWallFunction, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::tabulatedWallFunctions::tabulatedWallFunction::tabulatedWallFunction +( + const dictionary& dict, + const polyMesh& mesh, + const word& name +) +: + dict_(dict), + mesh_(mesh), + coeffDict_(dict.subDict(name + "Coeffs")), + invertedTableName_(dict.lookup("invertedTableName")), + invertedTable_(invertedTableName_, mesh_, dict, true) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::tabulatedWallFunctions::tabulatedWallFunction::~tabulatedWallFunction() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::tabulatedWallFunctions::tabulatedWallFunction::write() +{ + if (invertedTable_.log10()) + { + invertedTable_.note() = + "U+ as a function of log10(Re) computed using " + type(); + } + else + { + invertedTable_.note() = + "U+ as a function of Re computed using " + type(); + } + + Info<< "Writing inverted table to\n " << invertedTable_.objectPath() + << endl; + + invertedTable_.write(); +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.H b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.H new file mode 100644 index 0000000000..afa382407c --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::tabulatedWallFunctions::tabulatedWallFunction + +Description + Base class for models that generate tabulated wall function data. + +SourceFiles + tabulatedWallFunction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef tabulatedWallFunction_H +#define tabulatedWallFunction_H + +#include "dictionary.H" +#include "polyMesh.H" +#include "runTimeSelectionTables.H" +#include "Switch.H" +#include "uniformInterpolationTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace tabulatedWallFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class tabulatedWallFunction Declaration +\*---------------------------------------------------------------------------*/ + +class tabulatedWallFunction +{ +protected: + + // Proteced data + + //- Main dictionary + const dictionary dict_; + + //- Reference to the mesh database + const polyMesh& mesh_; + + //- Coefficients dictionary + const dictionary coeffDict_; + + //- Name of inverted table + word invertedTableName_; + + //- Inverted table + uniformInterpolationTable invertedTable_; + + +public: + + //- Run-time type information + TypeName("tabulatedWallFunction"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + tabulatedWallFunction, + dictionary, + ( + const dictionary& dict, + const polyMesh& mesh + ), + (dict, mesh) + ); + + //- Constructor + tabulatedWallFunction + ( + const dictionary& dict, + const polyMesh& mesh, + const word& name + ); + + //- Destructor + virtual ~tabulatedWallFunction(); + + + //- Selector + static autoPtr New + ( + const dictionary& dict, + const polyMesh& mesh + ); + + + // Member Functions + + // Access + + //- Return the inverted table name + inline const word& invertedTableName() const; + + //- Return the inverted table + inline const uniformInterpolationTable& invertedTable() const; + + + // I-O + + //- Write + virtual void write(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace tabulatedWallFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "tabulatedWallFunctionI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunctionI.H b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunctionI.H new file mode 100644 index 0000000000..4fbe48d3fe --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunctionI.H @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "tabulatedWallFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::word& +Foam::tabulatedWallFunctions::tabulatedWallFunction::invertedTableName() const +{ + return invertedTableName_; +} + + +inline const Foam::uniformInterpolationTable& +Foam::tabulatedWallFunctions::tabulatedWallFunction::invertedTable() const +{ + return invertedTable_; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/wallFunctionDict b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionDict new file mode 100644 index 0000000000..85cd0ba5aa --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionDict @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object wallFunctionDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +tabulatedWallFunction SpaldingsLaw; + +invertedTableName uPlusWallFunctionData; + +dx 0.2; + +x0 -3; + +xMax 7; + +log10 yes; + +bound yes; + +SpaldingsLawCoeffs +{ + kappa 0.41; + E 9.8; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C new file mode 100644 index 0000000000..a729a771c9 --- /dev/null +++ b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + wallFunctionTable + +Description + Generates a table suitable for use by tabulated wall functions + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "tabulatedWallFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + + IOdictionary dict + ( + IOobject + ( + "wallFunctionDict", + runTime.constant(), + mesh, + IOobject::MUST_READ + ) + ); + + autoPtr + twf(tabulatedWallFunctions::tabulatedWallFunction::New(dict, mesh)); + +// twf->writeData(Info); + + twf->write(); + + Info << "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 2823c2a9ec..dc5fc33491 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -509,6 +509,7 @@ meshes/preservePatchTypes/preservePatchTypes.C interpolations = interpolations interpolation = $(interpolations)/interpolation $(interpolations)/patchToPatchInterpolation/PatchToPatchInterpolationName.C +$(interpolations)/uniformInterpolationTable/uniformInterpolationTable.C algorithms/MeshWave/MeshWaveName.C algorithms/MeshWave/FaceCellWaveName.C diff --git a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C new file mode 100644 index 0000000000..33cbc5e917 --- /dev/null +++ b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C @@ -0,0 +1,225 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "uniformInterpolationTable.H" +#include "Time.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(uniformInterpolationTable, 0); +} + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::uniformInterpolationTable::checkTable() const +{ + if (size() < 2) + { + FatalErrorIn("uniformInterpolationTable::checkTable()") + << "Table " << name() << ": must have at least 2 values." << nl + << "Table size = " << size() << nl + << " min, interval width = " << x0_ << ", " << dx_ << nl + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::uniformInterpolationTable::uniformInterpolationTable +( + const IOobject& io, + bool readFields +) +: + IOobject(io), + List(2, 0.0), + x0_(0.0), + dx_(1.0), + log10_(false), + bound_(false) +{ + if (readFields) + { + IOdictionary dict(io); + + dict.lookup("data") >> *this; + dict.lookup("x0") >> x0_; + dict.lookup("dx") >> dx_; + dict.lookup("log10") >> log10_; + dict.lookup("bound") >> bound_; + } + + checkTable(); +} + + +Foam::uniformInterpolationTable::uniformInterpolationTable +( + const word& tableName, + const objectRegistry& db, + const dictionary& dict, + const bool initialiseOnly +) +: + IOobject + ( + tableName, + db.time().constant(), + db, + IOobject::NO_READ, + IOobject::NO_WRITE, + false // if used in BCs, could be used by multiple patches + ), + List(2, 0.0), + x0_(readScalar(dict.lookup("x0"))), + dx_(readScalar(dict.lookup("dx"))), + log10_(dict.lookup("log10")), + bound_(dict.lookup("bound")) +{ + if (initialiseOnly) + { + scalar xMax = readScalar(dict.lookup("xMax")); + label nIntervals = static_cast