From de46ee40da035613ef28faea8be641b4628d4567 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Oct 2012 15:17:52 +0000 Subject: [PATCH 01/24] ENH: Enable moving wall velocity BC to be used for non-moving mesh cases --- .../movingWallVelocityFvPatchVectorField.C | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index cd94de26ca..11f811e443 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -105,33 +105,39 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs() return; } - const fvPatch& p = patch(); - const polyPatch& pp = p.patch(); const fvMesh& mesh = dimensionedInternalField().mesh(); - const pointField& oldPoints = mesh.oldPoints(); - vectorField oldFc(pp.size()); - - forAll(oldFc, i) + if (mesh.changing()) { - oldFc[i] = pp[i].centre(oldPoints); + const fvPatch& p = patch(); + const polyPatch& pp = p.patch(); + const pointField& oldPoints = mesh.oldPoints(); + + vectorField oldFc(pp.size()); + + forAll(oldFc, i) + { + oldFc[i] = pp[i].centre(oldPoints); + } + + const scalar deltaT = mesh.time().deltaTValue(); + + const vectorField Up((pp.faceCentres() - oldFc)/deltaT); + + const volVectorField& U = db().lookupObject(UName_); + scalarField phip + ( + p.patchField(fvc::meshPhi(U)) + ); + + const vectorField n(p.nf()); + const scalarField& magSf = p.magSf(); + tmp Un = phip/(magSf + VSMALL); + + + vectorField::operator=(Up + n*(Un - (n & Up))); } - const vectorField Up((pp.faceCentres() - oldFc)/mesh.time().deltaTValue()); - - const volVectorField& U = db().lookupObject(UName_); - scalarField phip - ( - p.patchField(fvc::meshPhi(U)) - ); - - const vectorField n(p.nf()); - const scalarField& magSf = p.magSf(); - tmp Un = phip/(magSf + VSMALL); - - - vectorField::operator=(Up + n*(Un - (n & Up))); - fixedValueFvPatchVectorField::updateCoeffs(); } From afcd601a5cb8ca6d4bb8651374fab43bffd92735 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Oct 2012 15:49:29 +0000 Subject: [PATCH 02/24] ENH: Removed unused code --- .../general/porosityModel/porosityModel/porosityModelList.C | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C index 14ab39d964..9cccc1f7f4 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C @@ -26,12 +26,6 @@ License #include "porosityModelList.H" #include "volFields.H" -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -/* -void Foam::porosityModelList::XXX() -{} -*/ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::porosityModelList::porosityModelList From 41d98c2dfadabe06d573933257015f2b70b55b45 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Oct 2012 16:49:30 +0000 Subject: [PATCH 03/24] ENH: Updated MRF functionality --- src/finiteVolume/Make/files | 3 +- .../cfdTools/general/MRF/IOMRFZoneList.C | 90 ++++++++++ .../cfdTools/general/MRF/IOMRFZoneList.H | 96 ++++++++++ .../cfdTools/general/MRF/MRFZone.C | 129 ++++++++------ .../cfdTools/general/MRF/MRFZone.H | 140 ++++++++------- .../cfdTools/general/MRF/MRFZoneI.H | 38 ++++ .../general/MRF/{MRFZones.C => MRFZoneList.C} | 166 ++++++++++++------ .../general/MRF/{MRFZones.H => MRFZoneList.H} | 74 +++++--- 8 files changed, 534 insertions(+), 202 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C create mode 100644 src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H create mode 100644 src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H rename src/finiteVolume/cfdTools/general/MRF/{MRFZones.C => MRFZoneList.C} (50%) rename src/finiteVolume/cfdTools/general/MRF/{MRFZones.H => MRFZoneList.H} (72%) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index eee3fd6894..0d510f9019 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -379,7 +379,8 @@ $(porosity)/fixedCoeff/fixedCoeff.C MRF = $(general)/MRF $(MRF)/MRFZone.C -$(MRF)/MRFZones.C +$(MRF)/MRFZoneList.C +$(MRF)/IOMRFZoneList.C SRF = $(general)/SRF $(SRF)/SRFModel/SRFModel/SRFModel.C diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C new file mode 100644 index 0000000000..c5ad7fc104 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "IOMRFZoneList.H" +#include "fvMesh.H" +#include "Time.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::IOobject Foam::IOMRFZoneList::createIOobject +( + const fvMesh& mesh +) const +{ + IOobject io + ( + "MRFProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (io.headerOk()) + { + Info<< "Creating MRF zone list from " << io.name() << endl; + + io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + return io; + } + else + { + Info<< "No MRF models present" << nl << endl; + + io.readOpt() = IOobject::NO_READ; + return io; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::IOMRFZoneList::IOMRFZoneList +( + const fvMesh& mesh +) +: + IOdictionary(createIOobject(mesh)), + MRFZoneList(mesh, *this) +{} + + +bool Foam::IOMRFZoneList::read() +{ + if (regIOobject::read()) + { + MRFZoneList::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // + diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H new file mode 100644 index 0000000000..4ac60263fd --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::IOMRFZoneList + +Description + List of MRF zones with IO functionality + +SourceFiles + IOMRFZoneList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IOMRFZoneList_H +#define IOMRFZoneList_H + +#include "IOdictionary.H" +#include "MRFZoneList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IOMRFZoneList Declaration +\*---------------------------------------------------------------------------*/ + +class IOMRFZoneList +: + public IOdictionary, + public MRFZoneList +{ +private: + + // Private Member Functions + + //- Create IO object if dictionary is present + IOobject createIOobject(const fvMesh& mesh) const; + + //- Disallow default bitwise copy construct + IOMRFZoneList(const IOMRFZoneList&); + + //- Disallow default bitwise assignment + void operator=(const IOMRFZoneList&); + + +public: + + // Constructors + + //- Construct from mesh + IOMRFZoneList(const fvMesh& mesh); + + + //- Destructor + virtual ~IOMRFZoneList() + {} + + + // Member Functions + + //- Read dictionary + virtual bool read(); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 1aa6bdd0cd..0bf1abb34a 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -32,7 +32,6 @@ License #include "faceSet.H" #include "geometricOneField.H" - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(Foam::MRFZone, 0); @@ -144,7 +143,7 @@ void Foam::MRFZone::setMRFFaces() forAll(pp, patchFacei) { - label faceI = pp.start()+patchFacei; + label faceI = pp.start() + patchFacei; if (faceType[faceI] == 1) { @@ -173,7 +172,7 @@ void Foam::MRFZone::setMRFFaces() forAll(pp, patchFacei) { - label faceI = pp.start()+patchFacei; + label faceI = pp.start() + patchFacei; if (faceType[faceI] == 1) { @@ -228,64 +227,71 @@ void Foam::MRFZone::setMRFFaces() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is) +Foam::MRFZone::MRFZone +( + const word& name, + const fvMesh& mesh, + const dictionary& dict +) : mesh_(mesh), - name_(is), - dict_(is), - cellZoneID_(mesh_.cellZones().findZoneID(name_)), + name_(name), + coeffs_(dict), + active_(readBool(coeffs_.lookup("active"))), + cellZoneName_(coeffs_.lookup("cellZone")), + cellZoneID_(mesh_.cellZones().findZoneID(cellZoneName_)), excludedPatchNames_ ( - dict_.lookupOrDefault("nonRotatingPatches", wordList(0)) + coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0)) ), - origin_(dict_.lookup("origin")), - axis_(dict_.lookup("axis")), - omega_(DataEntry::New("omega", dict_)) + origin_(coeffs_.lookup("origin")), + axis_(coeffs_.lookup("axis")), + omega_(DataEntry::New("omega", coeffs_)) { - if (dict_.found("patches")) + if (!active_) { - WarningIn("MRFZone(const fvMesh&, Istream&)") - << "Ignoring entry 'patches'\n" - << " By default all patches within the rotating region rotate.\n" - << " Optionally supply excluded patches " - << "using 'nonRotatingPatches'." - << endl; + cellZoneID_ = -1; } - - const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - - axis_ = axis_/mag(axis_); - - excludedPatchLabels_.setSize(excludedPatchNames_.size()); - - forAll(excludedPatchNames_, i) + else { - excludedPatchLabels_[i] = patches.findPatchID(excludedPatchNames_[i]); + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - if (excludedPatchLabels_[i] == -1) + axis_ = axis_/mag(axis_); + + excludedPatchLabels_.setSize(excludedPatchNames_.size()); + + forAll(excludedPatchNames_, i) + { + excludedPatchLabels_[i] = + patches.findPatchID(excludedPatchNames_[i]); + + if (excludedPatchLabels_[i] == -1) + { + FatalErrorIn + ( + "MRFZone(const word&, const fvMesh&, const dictionary&)" + ) + << "cannot find MRF patch " << excludedPatchNames_[i] + << exit(FatalError); + } + } + + bool cellZoneFound = (cellZoneID_ != -1); + + reduce(cellZoneFound, orOp()); + + if (!cellZoneFound) { FatalErrorIn ( - "Foam::MRFZone::MRFZone(const fvMesh&, Istream&)" - ) << "cannot find MRF patch " << excludedPatchNames_[i] + "MRFZone(const word&, const fvMesh&, const dictionary&)" + ) + << "cannot find MRF cellZone " << cellZoneName_ << exit(FatalError); } + + setMRFFaces(); } - - bool cellZoneFound = (cellZoneID_ != -1); - - reduce(cellZoneFound, orOp()); - - if (!cellZoneFound) - { - FatalErrorIn - ( - "Foam::MRFZone::MRFZone(const fvMesh&, Istream&)" - ) << "cannot find MRF cellZone " << name_ - << exit(FatalError); - } - - setMRFFaces(); } @@ -497,24 +503,37 @@ void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const } -Foam::Ostream& Foam::operator<<(Ostream& os, const MRFZone& MRF) +void Foam::MRFZone::writeData(Ostream& os) const { - os << indent << nl; - os.write(MRF.name_) << nl; + os << nl; + os.write(name_) << nl; os << token::BEGIN_BLOCK << incrIndent << nl; - os.writeKeyword("origin") << MRF.origin_ << token::END_STATEMENT << nl; - os.writeKeyword("axis") << MRF.axis_ << token::END_STATEMENT << nl; - MRF.omega_->writeData(os); + os.writeKeyword("active") << active_ << token::END_STATEMENT << nl; + os.writeKeyword("cellZone") << cellZoneName_ << token::END_STATEMENT << nl; + os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl; + os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl; + omega_->writeData(os); - if (MRF.excludedPatchNames_.size()) + if (excludedPatchNames_.size()) { - os.writeKeyword("nonRotatingPatches") << MRF.excludedPatchNames_ + os.writeKeyword("nonRotatingPatches") << excludedPatchNames_ << token::END_STATEMENT << nl; } os << decrIndent << token::END_BLOCK << nl; - - return os; } + +bool Foam::MRFZone::read(const dictionary& dict) +{ + coeffs_ = dict; + + active_ = readBool(coeffs_.lookup("active")); + coeffs_.lookup("cellZone") >> cellZoneName_; + cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); + + return true; +} + + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index 46fb94c39a..2ac842ae15 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -67,12 +67,22 @@ class MRFZone { // Private data + //- Reference to the mesh database const fvMesh& mesh_; + //- Name of the MRF region model const word name_; - const dictionary dict_; + //- Coefficients dictionary + dictionary coeffs_; + //- MRF region active flag + bool active_; + + //- Name of cell zone + word cellZoneName_; + + //- Cell zone ID label cellZoneID_; const wordList excludedPatchNames_; @@ -133,8 +143,8 @@ public: // Constructors - //- Construct from fvMesh and Istream - MRFZone(const fvMesh& mesh, Istream& is); + //- Construct from fvMesh + MRFZone(const word& name, const fvMesh& mesh, const dictionary& dict); //- Return clone autoPtr clone() const @@ -143,79 +153,73 @@ public: return autoPtr(NULL); } - //- Return a pointer to a new MRFZone created on freestore - // from Istream - class iNew - { - const fvMesh& mesh_; - - public: - - iNew(const fvMesh& mesh) - : - mesh_(mesh) - {} - - autoPtr operator()(Istream& is) const - { - return autoPtr(new MRFZone(mesh_, is)); - } - }; - // Member Functions - //- Update the mesh corresponding to given map - void updateMesh(const mapPolyMesh& mpm) - { - // Only updates face addressing - setMRFFaces(); - } + // Access - //- Add the Coriolis force contribution to the acceleration field - void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; + //- Return const access to the porosity model name + inline const word& name() const; - //- Add the Coriolis force contribution to the momentum equation - void addCoriolis(fvVectorMatrix& UEqn) const; - - //- Add the Coriolis force contribution to the momentum equation - void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const; - - //- Make the given absolute velocity relative within the MRF region - void relativeVelocity(volVectorField& U) const; - - //- Make the given relative velocity absolute within the MRF region - void absoluteVelocity(volVectorField& U) const; - - //- Make the given absolute flux relative within the MRF region - void relativeFlux(surfaceScalarField& phi) const; - - //- Make the given absolute mass-flux relative within the MRF region - void relativeFlux - ( - const surfaceScalarField& rho, - surfaceScalarField& phi - ) const; - - //- Make the given relative flux absolute within the MRF region - void absoluteFlux(surfaceScalarField& phi) const; - - //- Make the given relative mass-flux absolute within the MRF region - void absoluteFlux - ( - const surfaceScalarField& rho, - surfaceScalarField& phi - ) const; - - //- Correct the boundary velocity for the roation of the MRF region - void correctBoundaryVelocity(volVectorField& U) const; + //- Return const access to the porosity active flag + inline bool active() const; - // IOstream operator + // Evaluation - friend Ostream& operator<<(Ostream& os, const MRFZone& MRF); + //- Update the mesh corresponding to given map + void updateMesh(const mapPolyMesh& mpm) + { + // Only updates face addressing + setMRFFaces(); + } + + //- Add the Coriolis force contribution to the acceleration field + void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; + + //- Add the Coriolis force contribution to the momentum equation + void addCoriolis(fvVectorMatrix& UEqn) const; + + //- Add the Coriolis force contribution to the momentum equation + void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const; + + //- Make the given absolute velocity relative within the MRF region + void relativeVelocity(volVectorField& U) const; + + //- Make the given relative velocity absolute within the MRF region + void absoluteVelocity(volVectorField& U) const; + + //- Make the given absolute flux relative within the MRF region + void relativeFlux(surfaceScalarField& phi) const; + + //- Make the given absolute mass-flux relative within the MRF region + void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Make the given relative flux absolute within the MRF region + void absoluteFlux(surfaceScalarField& phi) const; + + //- Make the given relative mass-flux absolute within the MRF region + void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Correct the boundary velocity for the roation of the MRF region + void correctBoundaryVelocity(volVectorField& U) const; + // I-O + + //- Write + void writeData(Ostream& os) const; + + //- Read MRF dictionary + bool read(const dictionary& dict); }; @@ -231,6 +235,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "MRFZoneI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H b/src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H new file mode 100644 index 0000000000..705d11d0af --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +inline const Foam::word& Foam::MRFZone::name() const +{ + return name_; +} + + +inline bool Foam::MRFZone::active() const +{ + return active_; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C similarity index 50% rename from src/finiteVolume/cfdTools/general/MRF/MRFZones.C rename to src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C index fa35898f0e..e1d2a1f11e 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,59 +23,109 @@ License \*---------------------------------------------------------------------------*/ -#include "MRFZones.H" -#include "Time.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTemplateTypeNameAndDebug(IOPtrList, 0); -} +#include "MRFZoneList.H" +#include "volFields.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::MRFZones::MRFZones(const fvMesh& mesh) +Foam::MRFZoneList::MRFZoneList +( + const fvMesh& mesh, + const dictionary& dict +) : - IOPtrList - ( - IOobject - ( - "MRFZones", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ), - MRFZone::iNew(mesh) - ), + PtrList(), mesh_(mesh) { - if - ( - Pstream::parRun() - && - ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster - ) - ) - { - WarningIn("MRFZones(const fvMesh&)") - << "The MRFZones are not run time modifiable\n" - << " using 'timeStampMaster' or 'inotifyMaster'\n" - << " for the entry fileModificationChecking\n" - << " in the etc/controlDict.\n" - << " Use 'timeStamp' instead." - << endl; - } + reset(dict); + + active(); } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::MRFZoneList::~MRFZoneList() +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::MRFZones::addCoriolis +bool Foam::MRFZoneList::active() const +{ + bool a = false; + forAll(*this, i) + { + a = a || this->operator[](i).active(); + } + + if (!a) + { + Info<< " No MRF zones active" << endl; + } + + return a; +} + + +void Foam::MRFZoneList::reset(const dictionary& dict) +{ + label count = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + count++; + } + } + + this->setSize(count); + label i = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + const word& name = iter().keyword(); + const dictionary& modelDict = iter().dict(); + + Info<< " creating MRF zone: " << name << endl; + + this->set + ( + i++, + new MRFZone(name, mesh_, modelDict) + ); + } + } +} + + +bool Foam::MRFZoneList::read(const dictionary& dict) +{ + bool allOk = true; + forAll(*this, i) + { + MRFZone& pm = this->operator[](i); + bool ok = pm.read(dict.subDict(pm.name())); + allOk = (allOk && ok); + } + return allOk; +} + + +bool Foam::MRFZoneList::writeData(Ostream& os) const +{ + forAll(*this, i) + { + os << nl; + this->operator[](i).writeData(os); + } + + return os.good(); +} + + +void Foam::MRFZoneList::addCoriolis ( const volVectorField& U, volVectorField& ddtU @@ -88,7 +138,7 @@ void Foam::MRFZones::addCoriolis } -void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const +void Foam::MRFZoneList::addCoriolis(fvVectorMatrix& UEqn) const { forAll(*this, i) { @@ -97,7 +147,7 @@ void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const } -void Foam::MRFZones::addCoriolis +void Foam::MRFZoneList::addCoriolis ( const volScalarField& rho, fvVectorMatrix& UEqn @@ -110,7 +160,7 @@ void Foam::MRFZones::addCoriolis } -void Foam::MRFZones::relativeVelocity(volVectorField& U) const +void Foam::MRFZoneList::relativeVelocity(volVectorField& U) const { forAll(*this, i) { @@ -119,7 +169,7 @@ void Foam::MRFZones::relativeVelocity(volVectorField& U) const } -void Foam::MRFZones::absoluteVelocity(volVectorField& U) const +void Foam::MRFZoneList::absoluteVelocity(volVectorField& U) const { forAll(*this, i) { @@ -128,7 +178,7 @@ void Foam::MRFZones::absoluteVelocity(volVectorField& U) const } -void Foam::MRFZones::relativeFlux(surfaceScalarField& phi) const +void Foam::MRFZoneList::relativeFlux(surfaceScalarField& phi) const { forAll(*this, i) { @@ -137,7 +187,7 @@ void Foam::MRFZones::relativeFlux(surfaceScalarField& phi) const } -void Foam::MRFZones::relativeFlux +void Foam::MRFZoneList::relativeFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -150,7 +200,7 @@ void Foam::MRFZones::relativeFlux } -void Foam::MRFZones::absoluteFlux(surfaceScalarField& phi) const +void Foam::MRFZoneList::absoluteFlux(surfaceScalarField& phi) const { forAll(*this, i) { @@ -159,7 +209,7 @@ void Foam::MRFZones::absoluteFlux(surfaceScalarField& phi) const } -void Foam::MRFZones::absoluteFlux +void Foam::MRFZoneList::absoluteFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -172,7 +222,7 @@ void Foam::MRFZones::absoluteFlux } -void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const +void Foam::MRFZoneList::correctBoundaryVelocity(volVectorField& U) const { forAll(*this, i) { @@ -181,10 +231,16 @@ void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const } -bool Foam::MRFZones::readData(Istream& is) +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const MRFZoneList& models +) { - PtrList::read(is, MRFZone::iNew(mesh_)); - return is.good(); + models.writeData(os); + return os; } diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H similarity index 72% rename from src/finiteVolume/cfdTools/general/MRF/MRFZones.H rename to src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H index f5b43bce29..e956f6e0e0 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,61 +22,77 @@ License along with OpenFOAM. If not, see . Class - Foam::MRFZones + Foam::MRFZoneList Description - Container class for a set of MRFZones with the MRFZone member functions - implemented to loop over the functions for each MRFZone. + List container for MRF zomes SourceFiles - MRFZones.C + MRFZoneList.C \*---------------------------------------------------------------------------*/ -#ifndef MRFZones_H -#define MRFZones_H +#ifndef MRFZoneList_H +#define MRFZoneList_H +#include "fvMesh.H" +#include "dictionary.H" +#include "fvMatricesFwd.H" #include "MRFZone.H" -#include "IOPtrList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward declaration of friend functions and operators +class MRFZoneList; +Ostream& operator<<(Ostream& os, const MRFZoneList& models); + /*---------------------------------------------------------------------------*\ - Class MRFZones Declaration + Class MRFZoneList Declaration \*---------------------------------------------------------------------------*/ -class MRFZones +class MRFZoneList : - public IOPtrList + PtrList { - // Private data - - //- Reference to mesh - const fvMesh& mesh_; - +private: // Private Member Functions //- Disallow default bitwise copy construct - MRFZones(const MRFZones&); + MRFZoneList(const MRFZoneList&); //- Disallow default bitwise assignment - void operator=(const MRFZones&); + void operator=(const MRFZoneList&); + + +protected: + + // Protected data + + //- Reference to the mesh database + const fvMesh& mesh_; public: - // Constructors + //- Constructor + MRFZoneList(const fvMesh& mesh, const dictionary& dict); - //- Construct from fvMesh - MRFZones(const fvMesh& mesh); + //- Destructor + ~MRFZoneList(); // Member Functions + //- Return active status + bool active() const; + + //- Reset the source list + void reset(const dictionary& dict); + //- Add the Coriolis force contribution to the acceleration field void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; @@ -116,14 +132,22 @@ public: void correctBoundaryVelocity(volVectorField& U) const; - // I-O + // I-O - //- Read from Istream - virtual bool readData(Istream&); + //- Read dictionary + bool read(const dictionary& dict); + //- Write data to Ostream + bool writeData(Ostream& os) const; + + //- Ostream operator + friend Ostream& operator<< + ( + Ostream& os, + const MRFZoneList& models + ); }; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam From 6bc9714f1ff234d0522a0a3c5023bd371557c997 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Oct 2012 16:57:58 +0000 Subject: [PATCH 04/24] ENH: Updated MRF solvers --- .../rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C | 2 +- .../rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H | 2 +- .../rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C | 2 +- .../rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H | 2 +- .../rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C | 2 +- .../incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C | 4 ++-- .../compressibleTwoPhaseEulerFoam.C | 2 +- .../multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H | 2 +- .../solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C | 2 +- .../multiphase/interFoam/MRFInterFoam/createMRFZones.H | 2 +- .../solvers/multiphase/multiphaseEulerFoam/createMRFZones.H | 2 +- .../multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C | 4 ++-- .../MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C | 2 +- .../solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H | 2 +- .../solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C index 82ba5cbac1..18a32a1791 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C @@ -37,7 +37,7 @@ Description #include "fvCFD.H" #include "psiThermo.H" #include "turbulenceModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "fvcSmooth.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H index d2522b8c75..f6c7e4dddf 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); IOporosityModelList pZones(mesh); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index ac5dc1eadc..0975b0de2b 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -37,7 +37,7 @@ Description #include "psiThermo.H" #include "turbulenceModel.H" #include "bound.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "pimpleControl.H" diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H index 4eb2cb193c..614460f82b 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); IOporosityModelList pZones(mesh); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C index b552cadfce..e906c56f80 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C @@ -34,7 +34,7 @@ Description #include "fvCFD.H" #include "rhoThermo.H" #include "RASModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "IObasicSourceList.H" #include "IOporosityModelList.H" #include "simpleControl.H" diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C index 0916d852ef..7c78107c53 100644 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C @@ -33,7 +33,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "simpleControl.H" #include "IObasicSourceList.H" @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); simpleControl simple(mesh); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C index c736f8194d..855a862b6b 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C @@ -46,7 +46,7 @@ Description #include "pimpleControl.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H index 4d5c2bab72..7b875a20e0 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U1); mrfZones.correctBoundaryVelocity(U2); mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index 5cbbc0b3ab..b9db6b25ec 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C @@ -42,7 +42,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H b/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H index 161446a8e6..dba2f7ae62 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H @@ -1,2 +1,2 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H index 326c934eaf..f78d168a6d 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); forAllIter(PtrDictionary, fluid.phases(), iter) { diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C index c1d3126352..b509b53562 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,7 @@ Description #include "singlePhaseTransportModel.H" #include "LESModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C index 0179b98e68..1f4b4cdb01 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C @@ -35,7 +35,7 @@ Description #include "fvCFD.H" #include "multiphaseMixture.H" #include "turbulenceModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H index 4d5c2bab72..7b875a20e0 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U1); mrfZones.correctBoundaryVelocity(U2); mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 178032db6f..67e4174a3b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C @@ -46,7 +46,7 @@ Description #include "kineticTheoryModel.H" #include "pimpleControl.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 286971f65e89d1b1057026f1aea8c83fa95ba114 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Oct 2012 17:11:08 +0000 Subject: [PATCH 05/24] ENH: Added MRF functionality to buoyantSimpleFoam --- applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H | 2 ++ .../solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C | 2 ++ .../solvers/heatTransfer/buoyantSimpleFoam/createZones.H | 3 +++ applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H | 2 ++ 4 files changed, 9 insertions(+) create mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/createZones.H diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H index ca28910aaf..e1593c3691 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H @@ -8,6 +8,8 @@ UEqn().relax(); + mrfZones.addCoriolis(rho, UEqn()); + if (simple.momentumPredictor()) { solve diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index 4a9387c188..fc47fc90a1 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -34,6 +34,7 @@ Description #include "RASModel.H" #include "fixedGradientFvPatchFields.H" #include "simpleControl.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,6 +45,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createZones.H" #include "initContinuityErrs.H" simpleControl simple(mesh); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createZones.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createZones.H new file mode 100644 index 0000000000..08480c68d2 --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createZones.H @@ -0,0 +1,3 @@ + IOMRFZoneList mrfZones(mesh); + mrfZones.correctBoundaryVelocity(U); + diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index f63e12f363..66ae75b650 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -17,6 +17,8 @@ fvc::interpolate(rho)*(fvc::interpolate(HbyA) & mesh.Sf()) ); + mrfZones.relativeFlux(fvc::interpolate(rho), phiHbyA); + bool closedVolume = adjustPhi(phiHbyA, U, p_rgh); phiHbyA += phig; From dec670d2f36727f1e84e4e176af75bb0e83b5c52 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Oct 2012 08:22:11 +0000 Subject: [PATCH 06/24] ENH: Updated MRF tutorials --- .../constant/{MRFZones => MRFProperties} | 5 ++- .../mixerVessel2D/constant/MRFProperties} | 23 +++++++------- .../constant/MRFProperties} | 4 +-- .../constant/MRFProperties} | 5 ++- .../mixerVesselAMI2D/constant/MRFProperties} | 24 +++++++------- .../mixerVessel2D/constant/MRFProperties | 31 +++++++++++++++++++ .../mixerVessel2D/constant/MRFProperties | 31 +++++++++++++++++++ .../mixerVessel2D/constant/MRFZones | 31 ------------------- .../bubbleColumn/constant/MRFProperties} | 5 ++- .../fluidisedBed/constant/MRFProperties | 20 ++++++++++++ .../fluidisedBed/constant/MRFZones | 20 ------------ .../mixerVessel2D/constant/MRFProperties} | 24 +++++++------- .../mixerVessel2D/constant/MRFZones | 31 ------------------- .../bubbleColumn/constant/MRFProperties | 20 ++++++++++++ .../bubbleColumn/constant/MRFZones | 20 ------------ .../damBreak4phase/constant/MRFProperties | 20 ++++++++++++ .../damBreak4phase/constant/MRFZones | 20 ------------ .../damBreak4phaseFine/constant/MRFProperties | 20 ++++++++++++ .../damBreak4phaseFine/constant/MRFZones | 20 ------------ .../mixerVessel2D/constant/MRFProperties} | 24 +++++++------- .../mixerVessel2D/constant/MRFZones | 31 ------------------- .../bed/constant/MRFProperties | 20 ++++++++++++ .../twoPhaseEulerFoam/bed/constant/MRFZones | 20 ------------ .../bed2/constant/MRFProperties | 20 ++++++++++++ .../twoPhaseEulerFoam/bed2/constant/MRFZones | 20 ------------ .../bubbleColumn/constant/MRFProperties | 20 ++++++++++++ .../bubbleColumn/constant/MRFZones | 20 ------------ .../mixerVessel2D/constant/MRFProperties | 31 +++++++++++++++++++ .../mixerVessel2D/constant/MRFZones | 31 ------------------- 29 files changed, 288 insertions(+), 323 deletions(-) rename tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/{MRFZones => MRFProperties} (95%) rename tutorials/{incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones => compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties} (78%) rename tutorials/{multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones => compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFProperties} (95%) rename tutorials/compressible/rhoPorousMRFSimpleFoam/{angledDuctExplicitFixedCoeff/constant/MRFZones => angledDuctImplicit/constant/MRFProperties} (95%) rename tutorials/{compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones => incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties} (76%) create mode 100644 tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties create mode 100644 tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties delete mode 100644 tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones rename tutorials/{compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones => multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties} (95%) create mode 100644 tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties delete mode 100644 tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones rename tutorials/{incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones => multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties} (76%) delete mode 100644 tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones create mode 100644 tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties delete mode 100644 tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones create mode 100644 tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties delete mode 100644 tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones create mode 100644 tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties delete mode 100644 tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones rename tutorials/multiphase/{MRFInterFoam/mixerVessel2D/constant/MRFZones => multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties} (76%) delete mode 100644 tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones create mode 100644 tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties delete mode 100644 tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones create mode 100644 tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties delete mode 100644 tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones create mode 100644 tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties delete mode 100644 tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones create mode 100644 tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties delete mode 100644 tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFZones b/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFProperties similarity index 95% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFZones rename to tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFProperties index de81c73439..fd749d0396 100644 --- a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFZones +++ b/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFProperties @@ -11,11 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0 -() +// none // ************************************************************************* // diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties similarity index 78% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones rename to tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties index 87c1c43c6e..3782a377cd 100644 --- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties @@ -11,21 +11,20 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; - origin (0 0 0); - axis (0 0 1); - omega 104.72; - } -) + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 1047.2; +} // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFProperties similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones rename to tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFProperties index 0034a58c22..fd749d0396 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFProperties @@ -11,10 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0() +// none // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFProperties similarity index 95% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones rename to tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFProperties index de81c73439..fd749d0396 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFProperties @@ -11,11 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0 -() +// none // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties similarity index 76% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones rename to tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties index 7c255d51db..623823d3ab 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones +++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; - origin (0 0 0); - axis (0 0 1); - omega constant 1047.2; - } -) + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 104.72; +} // ************************************************************************* // diff --git a/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties b/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties new file mode 100644 index 0000000000..956389e755 --- /dev/null +++ b/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 6.2831853; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties new file mode 100644 index 0000000000..956389e755 --- /dev/null +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 6.2831853; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index ec52208dc0..0000000000 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 6.2831853; - } -) - -// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties similarity index 95% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties index de81c73439..fd749d0396 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties @@ -11,11 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0 -() +// none // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties similarity index 76% rename from tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties index d1c9dd95d9..8712458a97 100644 --- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; - origin (0 0 0); - axis (0 0 1); - omega constant 104.72; - } -) + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 10.472; +} // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index 7dd518ca65..0000000000 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 10.472; - } -) - -// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties similarity index 76% rename from tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFZones rename to tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties index ec52208dc0..8712458a97 100644 --- a/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFZones +++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; - origin (0 0 0); - axis (0 0 1); - omega constant 6.2831853; - } -) + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 10.472; +} // ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index 7dd518ca65..0000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 10.472; - } -) - -// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties new file mode 100644 index 0000000000..fd749d0396 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones deleted file mode 100644 index 0034a58c22..0000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties new file mode 100644 index 0000000000..8712458a97 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 10.472; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index 7dd518ca65..0000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 10.472; - } -) - -// ************************************************************************* // From 33d6015686afae21c77f280b7a862af80991e347 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Oct 2012 08:25:44 +0000 Subject: [PATCH 07/24] ENH: Updated IOMRFZoneList header documentation --- .../cfdTools/general/MRF/IOMRFZoneList.H | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H index 4ac60263fd..09b6591313 100644 --- a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H @@ -25,7 +25,24 @@ Class Foam::IOMRFZoneList Description - List of MRF zones with IO functionality + List of MRF zones with IO functionality. MRF zones are specified by a list + of dictionary entries, e.g. + + \verbatim + zone1 + { + cellZone rotor1; + active yes; + ... + } + + zone2 + { + cellZone rotor2; + active yes; + ... + } + \endverbatim SourceFiles IOMRFZoneList.C From 915822cba7fce1a41b0f25aacfcb5c62080597fc Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Oct 2012 08:47:58 +0000 Subject: [PATCH 08/24] ENH: Updated header file comment --- .../interRegionHeatTransferModel.H | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H index 9a521f459d..ae843d9ab9 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H +++ b/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H @@ -27,7 +27,6 @@ Class Description Base class for inter region heat exchange. The derived classes must provide the heat transfer coefficient (htc) - NOTE: mapToMap does to work in paralell \*---------------------------------------------------------------------------*/ @@ -44,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interRegionHeatTransferModel Declaration + Class interRegionHeatTransferModel Declaration \*---------------------------------------------------------------------------*/ class interRegionHeatTransferModel From 6155c52228c40984da29563e4ba9b77676df839c Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Oct 2012 10:25:28 +0000 Subject: [PATCH 09/24] ENH: removed unnecessary #include headers --- src/finiteVolume/cfdTools/general/MRF/MRFZone.C | 1 - src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C | 1 - 2 files changed, 2 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 0bf1abb34a..d56bf6421a 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -28,7 +28,6 @@ License #include "volFields.H" #include "surfaceFields.H" #include "fvMatrices.H" -#include "syncTools.H" #include "faceSet.H" #include "geometricOneField.H" diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C index f15aef2647..872bf53a82 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C @@ -27,7 +27,6 @@ License #include "fvMesh.H" #include "volFields.H" #include "surfaceFields.H" -#include "geometricOneField.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // From 5e1b02e753d7b9492d11c4378c6716b88f281ae7 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Oct 2012 10:28:21 +0000 Subject: [PATCH 10/24] STYLE: Updated comment documentation --- src/finiteVolume/cfdTools/general/MRF/MRFZone.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index 2ac842ae15..a2129b9c59 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -70,7 +70,7 @@ class MRFZone //- Reference to the mesh database const fvMesh& mesh_; - //- Name of the MRF region model + //- Name of the MRF region const word name_; //- Coefficients dictionary @@ -158,10 +158,10 @@ public: // Access - //- Return const access to the porosity model name + //- Return const access to the MRF region name inline const word& name() const; - //- Return const access to the porosity active flag + //- Return const access to the MRF active flag inline bool active() const; From 143450b480aa57e2640d2bb93abea4f8012c1687 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Oct 2012 12:27:06 +0000 Subject: [PATCH 11/24] ENH: Re-added missing tutorial files --- .../mixerVessel2D/constant/MRFProperties | 28 ++++++++++++++ .../constant/porosityProperties | 38 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFProperties create mode 100644 tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFProperties b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFProperties new file mode 100644 index 0000000000..3089e7d826 --- /dev/null +++ b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFProperties @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +zone1 +{ + cellZone rotor; + active yes; + origin (0 0 0); + axis (0 0 1); + omega 104.72; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties new file mode 100644 index 0000000000..650f01268c --- /dev/null +++ b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object porosityProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +porosity1 +{ + type DarcyForchheimer; + active yes; + cellZone porosity; + + DarcyForchheimerCoeffs + { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + + coordinateSystem + { + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } + } +} + + +// ************************************************************************* // From 0763bc2312fa9aa26cced162e0797278c42969f8 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 15:36:39 +0000 Subject: [PATCH 12/24] ENH: Added new v2f incompressible RAS model --- .../incompressible/RAS/v2f/v2f.C | 459 ++++++++++++++++++ .../incompressible/RAS/v2f/v2f.H | 284 +++++++++++ 2 files changed, 743 insertions(+) create mode 100644 src/turbulenceModels/incompressible/RAS/v2f/v2f.C create mode 100644 src/turbulenceModels/incompressible/RAS/v2f/v2f.H diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C new file mode 100644 index 0000000000..51807e9b98 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C @@ -0,0 +1,459 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "v2f.H" +#include "fixedValueFvPatchField.H" +#include "zeroGradientFvPatchField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +wordList v2f::RBoundaryTypes() const +{ + const volScalarField::GeometricBoundaryField& bf(k_.boundaryField()); + + wordList bTypes + ( + bf.size(), + zeroGradientFvPatchField::typeName + ); + + forAll(bf, patchI) + { + if (bf[patchI].fixesValue()) + { + bTypes[patchI] = fixedValueFvPatchField::typeName; + } + } + + return bTypes; +} + + +tmp v2f::davidsonCorrectNut +( + const tmp& value +) const +{ + return min(CmuKEps_*sqr(k_)/epsilon_, value); +} + + +tmp v2f::Ts() const +{ + return max(k_/epsilon_, 6.0*sqrt(nu()/epsilon_)); +} + + +tmp v2f::Ls() const +{ + return CL_*max(pow(k_, 1.5)/epsilon_, Ceta_*pow025(pow3(nu())/epsilon_)); +} + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(v2f, 0); +addToRunTimeSelectionTable(RASModel, v2f, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2f::v2f +( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport, + const word& turbulenceModelName, + const word& modelName +) +: + RASModel(modelName, U, phi, transport, turbulenceModelName), + + Cmu_ + ( + dimensioned::lookupOrAddToDict + ( + "Cmu", + coeffDict_, + 0.22 + ) + ), + CmuKEps_ + ( + dimensioned::lookupOrAddToDict + ( + "CmuKEps", + coeffDict_, + 0.09 + ) + ), + C1_ + ( + dimensioned::lookupOrAddToDict + ( + "C1", + coeffDict_, + 1.4 + ) + ), + C2_ + ( + dimensioned::lookupOrAddToDict + ( + "C2", + coeffDict_, + 0.3 + ) + ), + CL_ + ( + dimensioned::lookupOrAddToDict + ( + "CL", + coeffDict_, + 0.23 + ) + ), + Ceta_ + ( + dimensioned::lookupOrAddToDict + ( + "Ceta", + coeffDict_, + 70.0 + ) + ), + Ceps2_ + ( + dimensioned::lookupOrAddToDict + ( + "Ceps1", + coeffDict_, + 1.9 + ) + ), + sigmaK_ + ( + dimensioned::lookupOrAddToDict + ( + "sigmaK", + coeffDict_, + 1.0 + ) + ), + sigmaEps_ + ( + dimensioned::lookupOrAddToDict + ( + "sigmaEps", + coeffDict_, + 1.3 + ) + ), + + k_ + ( + IOobject + ( + "k", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + epsilon_ + ( + IOobject + ( + "epsilon", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2_ + ( + IOobject + ( + "v2", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + f_ + ( + IOobject + ( + "f", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2Min_(dimensionedScalar("v2Min", v2_.dimensions(), SMALL)), + fMin_(dimensionedScalar("fMin", f_.dimensions(), 0.0)) +{ + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + bound(v2_, v2Min_); + bound(f_, fMin_); + + nut_ = davidsonCorrectNut(Cmu_*v2_*Ts()); + nut_.correctBoundaryConditions(); + + printCoeffs(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp v2f::R() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), + RBoundaryTypes() + ) + ); +} + + +tmp v2f::devReff() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -nuEff()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp v2f::divDevReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(nuEff(), U) + - fvc::div(nuEff()*dev(T(fvc::grad(U)))) + ); +} + + +tmp v2f::divDevRhoReff +( + const volScalarField& rho, + volVectorField& U +) const +{ + volScalarField muEff("muEff", rho*nuEff()); + + return + ( + - fvm::laplacian(muEff, U) + - fvc::div(muEff*dev(T(fvc::grad(U)))) + ); +} + + +bool v2f::read() +{ + if (RASModel::read()) + { + Cmu_.readIfPresent(coeffDict()); + CmuKEps_.readIfPresent(coeffDict()); + C1_.readIfPresent(coeffDict()); + C2_.readIfPresent(coeffDict()); + CL_.readIfPresent(coeffDict()); + Ceta_.readIfPresent(coeffDict()); + Ceps2_.readIfPresent(coeffDict()); + sigmaK_.readIfPresent(coeffDict()); + sigmaEps_.readIfPresent(coeffDict()); + + return true; + } + else + { + return false; + } +} + + +void v2f::correct() +{ + RASModel::correct(); + + if (!turbulence_) + { + return; + } + + // use N=6 so that f=0 at walls + const dimensionedScalar N("N", dimless, 6.0); + + const volTensorField gradU(fvc::grad(U_)); + const volScalarField S2(2*magSqr(dev(symm(gradU)))); + + const volScalarField G("RASModel.G", nut_*S2); + const volScalarField T(Ts()); + const volScalarField L2("v2f.L2", sqr(Ls())); + const volScalarField alpha + ( + "v2f::alpha", + 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) + ); + + + tmp Ceps1 = 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), 100.0)); + + // Update epsilon (and possibly G) at the wall + epsilon_.boundaryField().updateCoeffs(); + + // Dissipation equation + tmp epsEqn + ( + fvm::ddt(epsilon_) + + fvm::div(phi_, epsilon_) + - fvm::laplacian(DepsilonEff(), epsilon_) + == + Ceps1*G/T + - fvm::Sp(Ceps2_/T, epsilon_) + ); + + epsEqn().relax(); + + epsEqn().boundaryManipulate(epsilon_.boundaryField()); + + solve(epsEqn); + bound(epsilon_, epsilonMin_); + + + // Turbulent kinetic energy equation + tmp kEqn + ( + fvm::ddt(k_) + + fvm::div(phi_, k_) + - fvm::laplacian(DkEff(), k_) + == + G + - fvm::Sp(epsilon_/k_, k_) + ); + + kEqn().relax(); + solve(kEqn); + bound(k_, kMin_); + + + // Relaxation function equation + tmp fEqn + ( + - fvm::laplacian(f_) + == + - fvm::Sp(1.0/L2, f_) + - 1.0/L2/k_*(alpha - C2_*G) + ); + + fEqn().relax(); + solve(fEqn); + bound(f_, fMin_); + + + // Turbulence stress normal to streamlines equation + tmp v2Eqn + ( + fvm::ddt(v2_) + + fvm::div(phi_, v2_) + - fvm::laplacian(DkEff(), v2_) + == + min(k_*f_, -alpha + C2_*G) + - fvm::Sp(N*epsilon_/k_, v2_) + ); + + v2Eqn().relax(); + solve(v2Eqn); + bound(v2_, v2Min_); + + + // Re-calculate viscosity + nut_ = davidsonCorrectNut(Cmu_*v2_*T); + nut_.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.H b/src/turbulenceModels/incompressible/RAS/v2f/v2f.H new file mode 100644 index 0000000000..0aff2182b9 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.H @@ -0,0 +1,284 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::incompressible::RASModels::v2f + +Group + grpIcoRASTurbulence + +Description + Lien and Kalitzin's v2-f turbulence model for incompressible flows, with + a limit imposed on the turbulent viscosity given by Davidson et al. + + The model solves for turbulence k and epsilon, with additional equations + for the turbulence stress normal to streamlines, v2, and elliptic damping + function, f. The variant implemented employs N=6, such that f=0 on walls. + + Wall boundary conditions are: + + k = kLowReWallFunction + epsilon = epsilonLowReWallFunction + v2 = v2WalLFunction + f = fWallFunction + + These are applicable to both low- and high-Reynolds number flows. + + Inlet values can be approximated by: + + v2 = 2/3 k + f = zero-gradient + + + References: + + Lien F-S, Kalitzin G, 2001. Computations of transonic flow with the v2-f + turbulence model. Int. J. Heat Fluid Flow 22, pp 53-61 + + Davidson L, Nielsen P, Sveningsson A, 2003. Modifications of the v2-f + model for computing the flow in a 3D wall jet. Turbulence, Heat and Mass + Transfer 4, pp 577-584 + + The default model coefficients are given as: + \verbatim + v2fCoeffs + { + Cmu 0.22; + CmuKEps 0.09; + C1 1.4; + C2 0.3; + CL 0.23; + Ceta 70; + Ceps2 1.9; + sigmaEps 1.3; + sigmaK 1; + } + \endverbatim + +Note + If the kLowReWallFunction is employed, a velocity variant of the turbulent + viscosity wall function should be used, e.g. nutUWallFunction. Turbulence + k variants (nutk...) for this case will not behave correctly. + +SeeAlso + Foam::kEpsilon + Foam::kLowReWallFunctionFvPatchScalarField + Foam::epsilonLowReWallFunctionFvPatchScalarField + Foam::v2WallFunctionFvPatchScalarField + Foam::fWallFunctionFvPatchScalarField + +SourceFiles + v2f.C + +\*---------------------------------------------------------------------------*/ + +#ifndef v2f_H +#define v2f_H + +#include "RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2f Declaration +\*---------------------------------------------------------------------------*/ + +class v2f +: + public RASModel +{ + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar Cmu_; + dimensionedScalar CmuKEps_; + dimensionedScalar C1_; + dimensionedScalar C2_; + dimensionedScalar CL_; + dimensionedScalar Ceta_; + dimensionedScalar Ceps2_; + dimensionedScalar sigmaK_; + dimensionedScalar sigmaEps_; + + + // Fields + + //- Turbulence kinetic energy + volScalarField k_; + + //- Turbulence dissipation + volScalarField epsilon_; + + //- Turbulence stress normal to streamlines + volScalarField v2_; + + //- Damping function + volScalarField f_; + + //- Turbulence viscosity + volScalarField nut_; + + + // Bounding values + + dimensionedScalar v2Min_; + dimensionedScalar fMin_; + + + // Protected Member Functions + + //- Return boundary type names for the R field + wordList RBoundaryTypes() const; + + //- Apply Davidson correction to nut + tmp davidsonCorrectNut + ( + const tmp& value + ) const; + + //- Return time scale, Ts + tmp Ts() const; + + //- Return length scale, Ls + tmp Ls() const; + + +public: + + //- Runtime type information + TypeName("v2f"); + + // Constructors + + //- Construct from components + v2f + ( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport, + const word& turbulenceModelName = turbulenceModel::typeName, + const word& modelName = typeName + ); + + + //- Destructor + virtual ~v2f() + {} + + + // Member Functions + + //- Return the turbulence viscosity + virtual tmp nut() const + { + return nut_; + } + + //- Return the effective diffusivity for k + tmp DkEff() const + { + return tmp + ( + new volScalarField("DkEff", nut_/sigmaK_ + nu()) + ); + } + + //- Return the effective diffusivity for epsilon + tmp DepsilonEff() const + { + return tmp + ( + new volScalarField("DepsilonEff", nut_/sigmaEps_ + nu()) + ); + } + + //- Return the turbulence kinetic energy + virtual tmp k() const + { + return k_; + } + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp epsilon() const + { + return epsilon_; + } + + //- Return turbulence stress normal to streamlines + virtual tmp v2() const + { + return v2_; + } + + //- Return the damping function + virtual tmp f() const + { + return f_; + } + + //- Return the Reynolds stress tensor + virtual tmp R() const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp devReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevReff(volVectorField& U) const; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff + ( + const volScalarField& rho, + volVectorField& U + ) const; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 291bf721755f2170f63d99dd658e73586702e613 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 15:57:08 +0000 Subject: [PATCH 13/24] ENH: Added new incompressible epsilon low-Re wall function --- ...silonLowReWallFunctionFvPatchScalarField.C | 206 ++++++++++++++++++ ...silonLowReWallFunctionFvPatchScalarField.H | 191 ++++++++++++++++ 2 files changed, 397 insertions(+) create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..1a67d2329f --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "epsilonLowReWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + yPlusLam_(ptf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF, dict), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf, iF), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + + volScalarField& G = + const_cast(db().lookupObject(GName_)); + + DimensionedField& epsilon = + const_cast&> + ( + dimensionedInternalField() + ); + + const tmp tk = rasModel.k(); + const volScalarField& k = tk(); + + const tmp tnu = rasModel.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const tmp tnut = rasModel.nut(); + const volScalarField& nut = tnut(); + const scalarField& nutw = nut.boundaryField()[patchI]; + + const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const scalarField magGradUw(mag(Uw.snGrad())); + + const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu75 = pow(Cmu_, 0.75); + + // Set epsilon and G + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*sqrt(k[faceCellI])*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]); + } + else + { + epsilon[faceCellI] = 2.0*Cmu25*pow(k[faceCellI], 1.5)/y[faceI]; + } + + G[faceCellI] = + (nutw[faceI] + nuw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[faceCellI]) + /(kappa_*y[faceI]); + } + + fixedInternalValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + epsilonLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..9191a584b4 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::incompressible::RASModels::epsilonLowReWallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence dissipation wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The condition can be applied to wall boundaries, whereby it inserts near + wall epsilon values directly into the epsilon equation to act as a + constraint. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type epsilonLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::epsilonWallFunctionFvPatchScalarField + +SourceFiles + epsilonLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef epsilonLowReWallFunctionFvPatchScalarField_H +#define epsilonLowReWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class epsilonLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class epsilonLowReWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField +{ + +protected: + + // Protected data + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("epsilonLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // epsilonLowReWallFunctionFvPatchScalarField + // onto a new patch + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 44ca03d30ffe80616a52d84b3c6c9e3976d00a1d Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 15:57:19 +0000 Subject: [PATCH 14/24] ENH: Added new incompressible k low-Re wall function --- .../kLowReWallFunctionFvPatchScalarField.C | 255 ++++++++++++++++++ .../kLowReWallFunctionFvPatchScalarField.H | 210 +++++++++++++++ 2 files changed, 465 insertions(+) create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..a7da31f471 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,255 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "kLowReWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("kLowReWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar kLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + Ceps2_(1.9), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + Ceps2_(ptf.Ceps2_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + Cmu_(dict.lookupOrDefault("Cmu", 0.09)), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + E_(dict.lookupOrDefault("E", 9.8)), + Ceps2_(dict.lookupOrDefault("Ceps2", 1.9)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf +) +: + fixedValueFvPatchField(kwfpsf), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(kwfpsf, iF), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + + const tmp tk = rasModel.k(); + const volScalarField& k = tk(); + + const tmp tnu = rasModel.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& kw = *this; + + // Set k wall values + forAll(kw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Ck = -0.416; + scalar Bk = 8.366; + kw[faceI] = Ck/kappa_*log(yPlus) + Bk; + } + else + { + scalar C = 11.0; + scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C)); + kw[faceI] = 2400.0/sqr(Ceps2_)*Cf; + } + + kw[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void kLowReWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField::evaluate(commsType); +} + + +void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + os.writeKeyword("Ceps2") << Ceps2_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + kLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..72c077d33e --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::incompressible::RASModels::kLowReWallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence kinetic energy wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + Ceps2 | model coefficient | no | 1.9 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type kLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + kLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kLowReWallFunctionFvPatchScalarField_H +#define kLowReWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class kLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class kLowReWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Ceps2 coefficient + scalar Ceps2_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("kLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given kLowReWallFunctionFvPatchScalarField + // onto a new patch + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new kLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new kLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 200f7a6f4166c8edd8cd82cb8db61e3e10113119 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 15:57:28 +0000 Subject: [PATCH 15/24] ENH: Added new incompressible f low-Re wall function --- .../fWallFunctionFvPatchScalarField.C | 256 ++++++++++++++++++ .../fWallFunctionFvPatchScalarField.H | 206 ++++++++++++++ 2 files changed, 462 insertions(+) create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..2fae43e161 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -0,0 +1,256 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "v2f.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("fWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar fWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + Cmu_(dict.lookupOrDefault("Cmu", 0.09)), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + E_(dict.lookupOrDefault("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const v2f& v2fModel = refCast(rasModel); + + const scalarField& y = v2fModel.y()[patchI]; + + const tmp tk = v2fModel.k(); + const volScalarField& k = tk(); + + const tmp tepsilon = v2fModel.epsilon(); + const volScalarField& epsilon = tepsilon(); + + const tmp tv2 = v2fModel.v2(); + const volScalarField& v2 = tv2(); + + const tmp tnu = v2fModel.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& f = *this; + + // Set f wall values + forAll(f, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + scalar N = 6.0; + scalar v2c = v2[faceCellI]; + scalar epsc = epsilon[faceCellI]; + scalar kc = k[faceCellI]; + + f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL); + f[faceI] /= sqr(uTau) + ROOTVSMALL; + } + else + { + f[faceI] = 0.0; + } + } + + fixedValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void fWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField::evaluate(commsType); +} + + +void fWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + fWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..771da70dfa --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::incompressible::RASModels::fWallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence damping function, f, wall + function condition for low- and high Reynolds number, turbulent flow cases + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + fWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fWallFunctionFvPatchScalarField_H +#define fWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class fWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class fWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("fWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given fWallFunctionFvPatchScalarField + // onto a new patch + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new fWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new fWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 1b519d29e47fa719c50735c58208fb126e77da5c Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 15:57:39 +0000 Subject: [PATCH 16/24] ENH: Added new incompressible v2 low-Re wall function --- .../v2WallFunctionFvPatchScalarField.C | 246 ++++++++++++++++++ .../v2WallFunctionFvPatchScalarField.H | 208 +++++++++++++++ 2 files changed, 454 insertions(+) create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..d896d4d08b --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -0,0 +1,246 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "v2WallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar v2WallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + Cmu_(dict.lookupOrDefault("Cmu", 0.09)), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + E_(dict.lookupOrDefault("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + + const tmp tk = rasModel.k(); + const volScalarField& k = tk(); + + const tmp tnu = rasModel.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& v2 = *this; + + // Set v2 wall values + forAll(v2, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Cv2 = 0.193; + scalar Bv2 = -0.94; + v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2; + } + else + { + scalar Cv2 = 0.193; + v2[faceI] = Cv2*pow4(yPlus); + } + + v2[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void v2WallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField::evaluate(commsType); +} + + +void v2WallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + v2WallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..68bb2daaa0 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::incompressible::RASModels::v2WallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence stress normal to streamlines + wall function condition for low- and high-Reynolds number, turbulent flow + cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type v2WallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + v2WallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef v2WallFunctionFvPatchScalarField_H +#define v2WallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2WallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class v2WallFunctionFvPatchScalarField +: + public fixedValueFvPatchField +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("v2WallFunction"); + + + // Constructors + + //- Construct from patch and internal field + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given v2WallFunctionFvPatchScalarField + // onto a new patch + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new v2WallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new v2WallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 6e33e79a9441c2a6cbf7b88ce914a57ef36dd4f3 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 15:58:22 +0000 Subject: [PATCH 17/24] ENH: Added new wall incompressible RAS models to Make/files --- src/turbulenceModels/incompressible/RAS/Make/files | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index ce75d38346..9ad68d8c76 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -17,6 +17,7 @@ NonlinearKEShih/NonlinearKEShih.C LienLeschzinerLowRe/LienLeschzinerLowRe.C LamBremhorstKE/LamBremhorstKE.C kkLOmega/kkLOmega.C +v2f/v2f.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions @@ -36,16 +37,23 @@ $(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarFiel epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C + +fWallFunctions = $(wallFunctions)/fWallFunctions +$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C omegaWallFunctions = $(wallFunctions)/omegaWallFunctions $(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C +$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C kappatWallFunctions = $(wallFunctions)/kappatWallFunctions $(kappatWallFunctions)/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C +v2WallFunctions = $(wallFunctions)/v2WallFunctions +$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C /* Patch fields */ derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C From 302a997cb0061022a595fc3a4bb8804e6ac2a861 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 16:19:33 +0000 Subject: [PATCH 18/24] ENH: tutorial file updates --- .../boundaryFoam/boundaryWallFunctionsProfile/0/epsilon | 4 ++-- .../boundaryFoam/boundaryWallFunctionsProfile/0/k | 4 ++-- .../boundaryFoam/boundaryWallFunctionsProfile/0/nut | 4 ++-- .../boundaryFoam/boundaryWallFunctionsProfile/0/nut.k | 4 ++-- .../boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding | 4 ++-- .../boundaryFoam/boundaryWallFunctionsProfile/0/omega | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon index d2d9900782..ac692bb7f2 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon @@ -24,12 +24,12 @@ boundaryField lowerWall { type epsilonWallFunction; - value uniform 1e-08; + value $internalField; } upperWall { type epsilonWallFunction; - value uniform 1e-08; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k index 5f80226cc8..1c9826aebd 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k @@ -24,12 +24,12 @@ boundaryField lowerWall { type kqRWallFunction; - internalField uniform 0.1; + value $internalField; } upperWall { type kqRWallFunction; - internalField uniform 0.1; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut index ecdb3d2733..c9cc1c5b79 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut @@ -24,12 +24,12 @@ boundaryField lowerWall { type nutkWallFunction; - value uniform 0; + value $internalField; } upperWall { type nutkWallFunction; - value uniform 0; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k index c353c0b7f2..7d7ba9f720 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k @@ -24,12 +24,12 @@ boundaryField lowerWall { type nutkWallFunction; - value uniform 0; + value $internalField; } upperWall { type nutkWallFunction; - value uniform 0; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding index b3d810e965..4b988ac9ab 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding @@ -24,12 +24,12 @@ boundaryField lowerWall { type nutUSpaldingWallFunction; - value uniform 0; + value $internalField; } upperWall { type nutUSpaldingWallFunction; - value uniform 0; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega index 45a6d6abad..8cc512ab34 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega @@ -24,12 +24,12 @@ boundaryField lowerWall { type omegaWallFunction; - value uniform 1111.11; + value $internalField; } upperWall { type omegaWallFunction; - value uniform 1111.11; + value $internalField; } front { From fe1f8615af3d379aa8b6627eca575e47b56cf15a Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 17:28:47 +0000 Subject: [PATCH 19/24] ENH: Added compressible variant of v2f RAS model and associated wall functions --- .../compressible/RAS/Make/files | 9 + ...silonLowReWallFunctionFvPatchScalarField.C | 208 ++++++++ ...silonLowReWallFunctionFvPatchScalarField.H | 191 +++++++ .../fWallFunctionFvPatchScalarField.C | 258 +++++++++ .../fWallFunctionFvPatchScalarField.H | 206 ++++++++ .../kLowReWallFunctionFvPatchScalarField.C | 257 +++++++++ .../kLowReWallFunctionFvPatchScalarField.H | 210 ++++++++ .../v2WallFunctionFvPatchScalarField.C | 248 +++++++++ .../v2WallFunctionFvPatchScalarField.H | 208 ++++++++ .../compressible/RAS/v2f/v2f.C | 490 ++++++++++++++++++ .../compressible/RAS/v2f/v2f.H | 288 ++++++++++ 11 files changed, 2573 insertions(+) create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/compressible/RAS/v2f/v2f.C create mode 100644 src/turbulenceModels/compressible/RAS/v2f/v2f.H diff --git a/src/turbulenceModels/compressible/RAS/Make/files b/src/turbulenceModels/compressible/RAS/Make/files index 524f89b653..e107b6793d 100644 --- a/src/turbulenceModels/compressible/RAS/Make/files +++ b/src/turbulenceModels/compressible/RAS/Make/files @@ -9,6 +9,7 @@ LaunderGibsonRSTM/LaunderGibsonRSTM.C realizableKE/realizableKE.C SpalartAllmaras/SpalartAllmaras.C kOmegaSST/kOmegaSST.C +v2f/v2f.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions @@ -30,12 +31,20 @@ $(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField. epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C + +fWallFunctions = $(wallFunctions)/fWallFunctions +$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C omegaWallFunctions = $(wallFunctions)/omegaWallFunctions $(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C +$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C + +v2WallFunctions = $(wallFunctions)/v2WallFunctions +$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C /* Patch fields */ derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..c9d824287d --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "epsilonLowReWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + yPlusLam_(ptf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF, dict), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf, iF), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + + volScalarField& G = + const_cast(db().lookupObject(GName_)); + + DimensionedField& epsilon = + const_cast&> + ( + dimensionedInternalField() + ); + + const tmp tk = rasModel.k(); + const volScalarField& k = tk(); + + const tmp tmu = rasModel.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const tmp tmut = rasModel.mut(); + const volScalarField& mut = tmut(); + const scalarField& mutw = mut.boundaryField()[patchI]; + + const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + + const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const scalarField magGradUw(mag(Uw.snGrad())); + + const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu75 = pow(Cmu_, 0.75); + + // Set epsilon and G + forAll(mutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*sqrt(k[faceCellI])*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]); + } + else + { + epsilon[faceCellI] = 2.0*Cmu25*pow(k[faceCellI], 1.5)/y[faceI]; + } + + G[faceCellI] = + (mutw[faceI] + muw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[faceCellI]) + /(kappa_*y[faceI]); + } + + fixedInternalValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + epsilonLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..825adbf2c5 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::iompressible::RASModels::epsilonLowReWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence dissipation wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The condition can be applied to wall boundaries, whereby it inserts near + wall epsilon values directly into the epsilon equation to act as a + constraint. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type epsilonLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::epsilonWallFunctionFvPatchScalarField + +SourceFiles + epsilonLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef epsilonLowReWallFunctionFvPatchScalarField_H +#define epsilonLowReWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class epsilonLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class epsilonLowReWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField +{ + +protected: + + // Protected data + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::epsilonLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // epsilonLowReWallFunctionFvPatchScalarField + // onto a new patch + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..07ea00c1b0 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -0,0 +1,258 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "v2f.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("fWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar fWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + Cmu_(dict.lookupOrDefault("Cmu", 0.09)), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + E_(dict.lookupOrDefault("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const v2f& v2fModel = refCast(rasModel); + + const scalarField& y = v2fModel.y()[patchI]; + + const tmp tk = v2fModel.k(); + const volScalarField& k = tk(); + + const tmp tepsilon = v2fModel.epsilon(); + const volScalarField& epsilon = tepsilon(); + + const tmp tv2 = v2fModel.v2(); + const volScalarField& v2 = tv2(); + + const tmp tmu = v2fModel.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const scalarField& rhow = v2fModel.rho().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& f = *this; + + // Set f wall values + forAll(f, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + scalar N = 6.0; + scalar v2c = v2[faceCellI]; + scalar epsc = epsilon[faceCellI]; + scalar kc = k[faceCellI]; + + f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL); + f[faceI] /= sqr(uTau) + ROOTVSMALL; + } + else + { + f[faceI] = 0.0; + } + } + + fixedValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void fWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField::evaluate(commsType); +} + + +void fWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + fWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..b78613eeba --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::compressible::RASModels::fWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence damping function, f, wall + function condition for low- and high Reynolds number, turbulent flow cases + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + fWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fWallFunctionFvPatchScalarField_H +#define fWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class fWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class fWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::fWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given fWallFunctionFvPatchScalarField + // onto a new patch + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new fWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new fWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..5f10ea4f22 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,257 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "kLowReWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("kLowReWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar kLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + Ceps2_(1.9), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + Ceps2_(ptf.Ceps2_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + Cmu_(dict.lookupOrDefault("Cmu", 0.09)), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + E_(dict.lookupOrDefault("E", 9.8)), + Ceps2_(dict.lookupOrDefault("Ceps2", 1.9)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf +) +: + fixedValueFvPatchField(kwfpsf), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(kwfpsf, iF), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + + const tmp tk = rasModel.k(); + const volScalarField& k = tk(); + + const tmp tmu = rasModel.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& kw = *this; + + // Set k wall values + forAll(kw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Ck = -0.416; + scalar Bk = 8.366; + kw[faceI] = Ck/kappa_*log(yPlus) + Bk; + } + else + { + scalar C = 11.0; + scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C)); + kw[faceI] = 2400.0/sqr(Ceps2_)*Cf; + } + + kw[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void kLowReWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField::evaluate(commsType); +} + + +void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + os.writeKeyword("Ceps2") << Ceps2_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + kLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..d70f288653 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::compressible::RASModels::kLowReWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence kinetic energy wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + Ceps2 | model coefficient | no | 1.9 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type kLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + kLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kLowReWallFunctionFvPatchScalarField_H +#define kLowReWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class kLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class kLowReWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Ceps2 coefficient + scalar Ceps2_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::kLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given kLowReWallFunctionFvPatchScalarField + // onto a new patch + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new kLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new kLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..f7c8643bae --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -0,0 +1,248 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "v2WallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar v2WallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + Cmu_(dict.lookupOrDefault("Cmu", 0.09)), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + E_(dict.lookupOrDefault("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + + const tmp tk = rasModel.k(); + const volScalarField& k = tk(); + + const tmp tmu = rasModel.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& v2 = *this; + + // Set v2 wall values + forAll(v2, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Cv2 = 0.193; + scalar Bv2 = -0.94; + v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2; + } + else + { + scalar Cv2 = 0.193; + v2[faceI] = Cv2*pow4(yPlus); + } + + v2[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void v2WallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField::evaluate(commsType); +} + + +void v2WallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + v2WallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..bfedbbddf5 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::compressible::RASModels::v2WallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence stress normal to streamlines + wall function condition for low- and high-Reynolds number, turbulent flow + cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type v2WallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + v2WallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef v2WallFunctionFvPatchScalarField_H +#define v2WallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2WallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class v2WallFunctionFvPatchScalarField +: + public fixedValueFvPatchField +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::v2WallFunction"); + + + // Constructors + + //- Construct from patch and internal field + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given v2WallFunctionFvPatchScalarField + // onto a new patch + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new v2WallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new v2WallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.C b/src/turbulenceModels/compressible/RAS/v2f/v2f.C new file mode 100644 index 0000000000..fa5c19503e --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.C @@ -0,0 +1,490 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "v2f.H" +#include "fixedValueFvPatchField.H" +#include "zeroGradientFvPatchField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(v2f, 0); +addToRunTimeSelectionTable(RASModel, v2f, dictionary); + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +wordList v2f::RBoundaryTypes() const +{ + const volScalarField::GeometricBoundaryField& bf(k_.boundaryField()); + + wordList bTypes + ( + bf.size(), + zeroGradientFvPatchField::typeName + ); + + forAll(bf, patchI) + { + if (bf[patchI].fixesValue()) + { + bTypes[patchI] = fixedValueFvPatchField::typeName; + } + } + + return bTypes; +} + + +tmp v2f::davidsonCorrectNut +( + const tmp& value +) const +{ + return min(CmuKEps_*sqr(k_)/epsilon_, value); +} + + +tmp v2f::Ts() const +{ + return max(k_/epsilon_, 6.0*sqrt(mu()/rho_/epsilon_)); +} + + +tmp v2f::Ls() const +{ + return + CL_*max(pow(k_, 1.5)/epsilon_, Ceta_*pow025(pow3(mu()/rho_)/epsilon_)); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2f::v2f +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const fluidThermo& thermophysicalModel, + const word& turbulenceModelName, + const word& modelName +) +: + RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName), + + Cmu_ + ( + dimensioned::lookupOrAddToDict + ( + "Cmu", + coeffDict_, + 0.22 + ) + ), + CmuKEps_ + ( + dimensioned::lookupOrAddToDict + ( + "CmuKEps", + coeffDict_, + 0.09 + ) + ), + C1_ + ( + dimensioned::lookupOrAddToDict + ( + "C1", + coeffDict_, + 1.4 + ) + ), + C2_ + ( + dimensioned::lookupOrAddToDict + ( + "C2", + coeffDict_, + 0.3 + ) + ), + CL_ + ( + dimensioned::lookupOrAddToDict + ( + "CL", + coeffDict_, + 0.23 + ) + ), + Ceta_ + ( + dimensioned::lookupOrAddToDict + ( + "Ceta", + coeffDict_, + 70.0 + ) + ), + Ceps2_ + ( + dimensioned::lookupOrAddToDict + ( + "Ceps2", + coeffDict_, + 1.9 + ) + ), + Ceps3_ + ( + dimensioned::lookupOrAddToDict + ( + "Ceps3", + coeffDict_, + -0.33 + ) + ), + sigmaK_ + ( + dimensioned::lookupOrAddToDict + ( + "sigmaK", + coeffDict_, + 1.0 + ) + ), + sigmaEps_ + ( + dimensioned::lookupOrAddToDict + ( + "sigmaEps", + coeffDict_, + 1.3 + ) + ), + Prt_ + ( + dimensioned::lookupOrAddToDict + ( + "Prt", + coeffDict_, + 1.0 + ) + ), + + k_ + ( + IOobject + ( + "k", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + epsilon_ + ( + IOobject + ( + "epsilon", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2_ + ( + IOobject + ( + "v2", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + f_ + ( + IOobject + ( + "f", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + mut_ + ( + IOobject + ( + "mut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + alphat_ + ( + IOobject + ( + "alphat", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2Min_(dimensionedScalar("v2Min", v2_.dimensions(), SMALL)), + fMin_(dimensionedScalar("fMin", f_.dimensions(), 0.0)) +{ + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + bound(v2_, v2Min_); + bound(f_, fMin_); + + mut_ = rho_*davidsonCorrectNut(Cmu_*v2_*Ts()); + mut_.correctBoundaryConditions(); + + alphat_ = mut_/Prt_; + alphat_.correctBoundaryConditions(); + + printCoeffs(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp v2f::R() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))), + RBoundaryTypes() + ) + ); +} + + +tmp v2f::devRhoReff() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -muEff()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp v2f::divDevRhoReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(muEff(), U) + - fvc::div(muEff()*dev2(T(fvc::grad(U)))) + ); +} + + +bool v2f::read() +{ + if (RASModel::read()) + { + Cmu_.readIfPresent(coeffDict()); + CmuKEps_.readIfPresent(coeffDict()); + C1_.readIfPresent(coeffDict()); + C2_.readIfPresent(coeffDict()); + CL_.readIfPresent(coeffDict()); + Ceta_.readIfPresent(coeffDict()); + Ceps2_.readIfPresent(coeffDict()); + sigmaK_.readIfPresent(coeffDict()); + sigmaEps_.readIfPresent(coeffDict()); + + return true; + } + else + { + return false; + } +} + + +void v2f::correct() +{ + if (!turbulence_) + { + // Re-calculate viscosity + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; + mut_.correctBoundaryConditions(); + + // Re-calculate thermal diffusivity + alphat_ = mut_/Prt_; + alphat_.correctBoundaryConditions(); + + return; + } + + RASModel::correct(); + + volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_))); + + if (mesh_.moving()) + { + divU += fvc::div(mesh_.phi()); + } + + // use N=6 so that f=0 at walls + const dimensionedScalar N("N", dimless, 6.0); + + const volTensorField gradU(fvc::grad(U_)); + const volScalarField S2(2*magSqr(dev(symm(gradU)))); + + const volScalarField G("RASModel.G", mut_*S2); + const volScalarField T(Ts()); + const volScalarField L2("v2f.L2", sqr(Ls())); + const volScalarField alpha + ( + "v2f::alpha", + 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) + ); + + tmp Ceps1 = 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), 100.0)); + + // Update epsilon (and possibly G) at the wall + epsilon_.boundaryField().updateCoeffs(); + + // Dissipation equation + tmp epsEqn + ( + fvm::ddt(rho_, epsilon_) + + fvm::div(phi_, epsilon_) + - fvm::laplacian(DepsilonEff(), epsilon_) + == + Ceps1()*G/T + - fvm::SuSp(((2.0/3.0)*Ceps1 + Ceps3_)*rho_*divU, epsilon_) + - fvm::Sp(Ceps2_*rho_/T, epsilon_) + ); + + epsEqn().relax(); + + epsEqn().boundaryManipulate(epsilon_.boundaryField()); + + solve(epsEqn); + bound(epsilon_, epsilonMin_); + + // Turbulent kinetic energy equation + tmp kEqn + ( + fvm::ddt(rho_, k_) + + fvm::div(phi_, k_) + - fvm::laplacian(DkEff(), k_) + == + G + - fvm::SuSp((2.0/3.0)*rho_*divU, k_) + - fvm::Sp(rho_*epsilon_/k_, k_) + ); + + kEqn().relax(); + solve(kEqn); + bound(k_, kMin_); + + // Relaxation function equation + tmp fEqn + ( + - fvm::laplacian(rho_, f_) + == + - fvm::Sp(rho_/L2, f_) + - 1.0/L2/k_*(rho_*alpha - C2_*G) + ); + + fEqn().relax(); + solve(fEqn); + bound(f_, fMin_); + + // Turbulence stress normal to streamlines equation + tmp v2Eqn + ( + fvm::ddt(rho_, v2_) + + fvm::div(phi_, v2_) + - fvm::laplacian(DkEff(), v2_) + == + min(rho_*k_*f_, -rho_*alpha + C2_*G) + - fvm::Sp(rho_*N*epsilon_/k_, v2_) + ); + + v2Eqn().relax(); + solve(v2Eqn); + bound(v2_, v2Min_); + + // Re-calculate viscosity + mut_ = rho_*davidsonCorrectNut(Cmu_*v2_*T); + mut_.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.H b/src/turbulenceModels/compressible/RAS/v2f/v2f.H new file mode 100644 index 0000000000..5b68a605d9 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.H @@ -0,0 +1,288 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::compressible::RASModels::v2f + +Group + grpCmpRASTurbulence + +Description + Lien and Kalitzin's v2-f turbulence model for incompressible flows, with + a limit imposed on the turbulent viscosity given by Davidson et al. + + The model solves for turbulence k and epsilon, with additional equations + for the turbulence stress normal to streamlines, v2, and elliptic damping + function, f. The variant implemented employs N=6, such that f=0 on walls. + + Wall boundary conditions are: + + k = kLowReWallFunction + epsilon = epsilonLowReWallFunction + v2 = v2WalLFunction + f = fWallFunction + + These are applicable to both low- and high-Reynolds number flows. + + Inlet values can be approximated by: + + v2 = 2/3 k + f = zero-gradient + + + References: + + Lien F-S, Kalitzin G, 2001. Computations of transonic flow with the v2-f + turbulence model. Int. J. Heat Fluid Flow 22, pp 53-61 + + Davidson L, Nielsen P, Sveningsson A, 2003. Modifications of the v2-f + model for computing the flow in a 3D wall jet. Turbulence, Heat and Mass + Transfer 4, pp 577-584 + + The default model coefficients are given as: + \verbatim + v2fCoeffs + { + Cmu 0.22; + CmuKEps 0.09; + C1 1.4; + C2 0.3; + CL 0.23; + Ceta 70; + Ceps2 1.9; + sigmaEps 1.3; + sigmaK 1; + } + \endverbatim + +Note + If the kLowReWallFunction is employed, a velocity variant of the turbulent + viscosity wall function should be used, e.g. nutUWallFunction. Turbulence + k variants (nutk...) for this case will not behave correctly. + +SeeAlso + Foam::kEpsilon + Foam::kLowReWallFunctionFvPatchScalarField + Foam::epsilonLowReWallFunctionFvPatchScalarField + Foam::v2WallFunctionFvPatchScalarField + Foam::fWallFunctionFvPatchScalarField + +SourceFiles + v2f.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressiblev2f_H +#define compressiblev2f_H + +#include "RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2f Declaration +\*---------------------------------------------------------------------------*/ + +class v2f +: + public RASModel +{ + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar Cmu_; + dimensionedScalar CmuKEps_; + dimensionedScalar C1_; + dimensionedScalar C2_; + dimensionedScalar CL_; + dimensionedScalar Ceta_; + dimensionedScalar Ceps2_; + dimensionedScalar Ceps3_; + dimensionedScalar sigmaK_; + dimensionedScalar sigmaEps_; + dimensionedScalar Prt_; + + // Fields + + //- Turbulence kinetic energy + volScalarField k_; + + //- Turbulence dissipation + volScalarField epsilon_; + + //- Turbulence stress normal to streamlines + volScalarField v2_; + + //- Damping function + volScalarField f_; + + //- Turbulence viscosity + volScalarField mut_; + + //- Turbulence thermal diffusivity + volScalarField alphat_; + + + // Bounding values + + dimensionedScalar v2Min_; + dimensionedScalar fMin_; + + + // Protected Member Functions + + //- Return boundary type names for the R field + wordList RBoundaryTypes() const; + + //- Apply Davidson correction to nut + tmp davidsonCorrectNut + ( + const tmp& value + ) const; + + //- Return time scale, Ts + tmp Ts() const; + + //- Return length scale, Ls + tmp Ls() const; + + +public: + + //- Runtime type information + TypeName("v2f"); + + // Constructors + + //- Construct from components + v2f + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const fluidThermo& thermophysicalModel, + const word& turbulenceModelName = turbulenceModel::typeName, + const word& modelName = typeName + ); + + + //- Destructor + virtual ~v2f() + {} + + + // Member Functions + + //- Return the effective diffusivity for k + tmp DkEff() const + { + return tmp + ( + new volScalarField("DkEff", mut_/sigmaK_ + mu()) + ); + } + + //- Return the effective diffusivity for epsilon + tmp DepsilonEff() const + { + return tmp + ( + new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu()) + ); + } + + //- Return the turbulence viscosity + virtual tmp mut() const + { + return mut_; + } + + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const + { + return alphat_; + } + + //- Return the turbulence kinetic energy + virtual tmp k() const + { + return k_; + } + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp epsilon() const + { + return epsilon_; + } + + //- Return turbulence stress normal to streamlines + virtual tmp v2() const + { + return v2_; + } + + //- Return the damping function + virtual tmp f() const + { + return f_; + } + + //- Return the Reynolds stress tensor + virtual tmp R() const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff(volVectorField& U) const; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From e8a129487b52fb1c453f079b433883065c41b441 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 17:29:11 +0000 Subject: [PATCH 20/24] ENH: Updated incompressible v2f RAS model --- src/turbulenceModels/incompressible/RAS/v2f/v2f.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C index 51807e9b98..d7304617ac 100644 --- a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C @@ -37,6 +37,11 @@ namespace incompressible namespace RASModels { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(v2f, 0); +addToRunTimeSelectionTable(RASModel, v2f, dictionary); + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // wordList v2f::RBoundaryTypes() const @@ -82,11 +87,6 @@ tmp v2f::Ls() const } -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(v2f, 0); -addToRunTimeSelectionTable(RASModel, v2f, dictionary); - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // v2f::v2f @@ -158,7 +158,7 @@ v2f::v2f ( dimensioned::lookupOrAddToDict ( - "Ceps1", + "Ceps2", coeffDict_, 1.9 ) From f5ae1a6a600577cafdaae66570f8dad78b4cab90 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 2 Nov 2012 17:35:24 +0000 Subject: [PATCH 21/24] STYLE: limit code to 80 chars --- src/finiteVolume/cfdTools/general/MRF/MRFZone.H | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index a2129b9c59..74160cf39b 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -175,13 +175,21 @@ public: } //- Add the Coriolis force contribution to the acceleration field - void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; + void addCoriolis + ( + const volVectorField& U, + volVectorField& ddtU + ) const; //- Add the Coriolis force contribution to the momentum equation void addCoriolis(fvVectorMatrix& UEqn) const; //- Add the Coriolis force contribution to the momentum equation - void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const; + void addCoriolis + ( + const volScalarField& rho, + fvVectorMatrix& UEqn + ) const; //- Make the given absolute velocity relative within the MRF region void relativeVelocity(volVectorField& U) const; From 55913bf964747a90bffa2415021d6d52c69fa9af Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 5 Nov 2012 09:12:22 +0000 Subject: [PATCH 22/24] ENH: Added optional offset to timeVaryingMapped BC --- .../timeVaryingMappedFixedValueFvPatchField.C | 33 ++++++++++++------- .../timeVaryingMappedFixedValueFvPatchField.H | 4 +++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 2d31d3802f..fbfc5eb96a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -52,7 +52,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offSet_() {} @@ -77,7 +78,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offSet_() {} @@ -101,7 +103,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offSet_(DataEntry::New("offSet", dict)) { dict.readIfPresent("fieldTableName", fieldTableName_); @@ -134,7 +137,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offSet_(ptf.offSet_().clone().ptr()) {} @@ -158,7 +162,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offSet_(ptf.offSet_().clone().ptr()) {} @@ -276,7 +281,7 @@ void timeVaryingMappedFixedValueFvPatchField::checkTable() { FatalErrorIn ( - "timeVaryingMappedFixedValueFvPatchField::checkTable" + "timeVaryingMappedFixedValueFvPatchField::checkTable()" ) << "Cannot find starting sampling values for current time " << this->db().time().value() << nl << "Have sampling values for times " @@ -366,6 +371,7 @@ void timeVaryingMappedFixedValueFvPatchField::checkTable() /sampleTimes_[endSampleTime_].name() << endl; } + // Reread values and interpolate AverageIOField vals ( @@ -392,7 +398,6 @@ void timeVaryingMappedFixedValueFvPatchField::checkTable() template void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() { - if (this->updated()) { return; @@ -423,7 +428,7 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() scalar start = sampleTimes_[startSampleTime_].value(); scalar end = sampleTimes_[endSampleTime_].value(); - scalar s = (this->db().time().value()-start)/(end-start); + scalar s = (this->db().time().value() - start)/(end - start); if (debug) { @@ -434,8 +439,8 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() << " with weight:" << s << endl; } - this->operator==((1-s)*startSampledValues_ + s*endSampledValues_); - wantedAverage = (1-s)*startAverage_ + s*endAverage_; + this->operator==((1 - s)*startSampledValues_ + s*endSampledValues_); + wantedAverage = (1 - s)*startAverage_ + s*endAverage_; } // Enforce average. Either by scaling (if scaling factor > 0.5) or by @@ -465,7 +470,7 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() Pout<< "updateCoeffs :" << " offsetting with:" << offset << endl; } - this->operator==(fld+offset); + this->operator==(fld + offset); } else { @@ -480,6 +485,10 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() } } + // apply offset to mapped values + const scalar t = this->db().time().timeOutputValue(); + this->operator==(*this + offSet_->value(t)); + if (debug) { Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) @@ -503,6 +512,8 @@ void timeVaryingMappedFixedValueFvPatchField::write(Ostream& os) const << token::END_STATEMENT << nl; } + offSet_->writeData(os); + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H index 61228fe07c..01e61301eb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H @@ -80,6 +80,7 @@ SourceFiles #include "FixedList.H" #include "instantList.H" #include "pointToPointPlanarInterpolation.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,6 +131,9 @@ class timeVaryingMappedFixedValueFvPatchField //- If setAverage: end average value Type endAverage_; + //- Time varying offset values to interpolated data + autoPtr > offSet_; + public: From 9ef3301748308889abc317334f462daec43a6b17 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 5 Nov 2012 15:17:02 +0000 Subject: [PATCH 23/24] Thermodynamics: Added phaseName option to the constructors and selectors of all thermo packages --- src/fieldSources/Make/options | 2 +- .../basic/basicThermo/basicThermo.C | 167 +++++++++++++----- .../basic/basicThermo/basicThermo.H | 72 ++++++-- .../basic/basicThermo/basicThermoTemplates.C | 12 +- .../energyJump/energyJumpFvPatchScalarField.C | 4 +- .../energyJumpAMIFvPatchScalarField.C | 4 +- .../fixedEnergyFvPatchScalarField.C | 7 +- .../gradientEnergyFvPatchScalarField.C | 4 +- .../mixedEnergyFvPatchScalarField.C | 6 +- .../wallHeatTransferFvPatchScalarField.C | 6 +- .../basic/fluidThermo/fluidThermo.C | 18 +- .../basic/fluidThermo/fluidThermo.H | 27 ++- .../basic/heThermo/heThermo.C | 17 +- .../basic/heThermo/heThermo.H | 15 +- .../basic/psiThermo/hePsiThermo.C | 8 +- .../basic/psiThermo/hePsiThermo.H | 8 +- .../basic/psiThermo/psiThermo.C | 13 +- .../basic/psiThermo/psiThermo.H | 18 +- .../basic/rhoThermo/heRhoThermo.C | 8 +- .../basic/rhoThermo/heRhoThermo.H | 8 +- .../basic/rhoThermo/rhoThermo.C | 30 ++-- .../basic/rhoThermo/rhoThermo.H | 27 ++- .../psiReactionThermo/psiReactionThermo.C | 13 +- .../psiReactionThermo/psiReactionThermo.H | 18 +- .../psiuReactionThermo/heheuPsiThermo.C | 5 +- .../psiuReactionThermo/heheuPsiThermo.H | 8 +- .../psiuReactionThermo/psiuReactionThermo.C | 13 +- .../psiuReactionThermo/psiuReactionThermo.H | 18 +- .../rhoReactionThermo/rhoReactionThermo.C | 13 +- .../rhoReactionThermo/rhoReactionThermo.H | 18 +- .../solidReactionThermo/solidReactionThermo.C | 23 ++- .../solidReactionThermo/solidReactionThermo.H | 35 ++-- .../solidThermo/solidThermo/heSolidThermo.C | 17 +- .../solidThermo/solidThermo/heSolidThermo.H | 17 +- .../solidThermo/solidThermo/solidThermo.C | 23 ++- .../solidThermo/solidThermo/solidThermo.H | 38 ++-- .../compressible/turbulenceModel/Make/options | 1 - .../squareBend/system/fvSchemes | 1 - 38 files changed, 515 insertions(+), 227 deletions(-) diff --git a/src/fieldSources/Make/options b/src/fieldSources/Make/options index 5927956469..a98e673d25 100644 --- a/src/fieldSources/Make/options +++ b/src/fieldSources/Make/options @@ -13,5 +13,5 @@ LIB_LIBS = \ -lfiniteVolume \ -lsampling \ -lmeshTools \ - -lsolidThermo \ + /*-lsolidThermo*/ \ -lcompressibleTurbulenceModel diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index f1ac31e459..84e30e31a4 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -34,16 +34,56 @@ namespace Foam defineRunTimeSelectionTable(basicThermo, fvMesh); } +const Foam::word Foam::basicThermo::dictName("thermophysicalProperties"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::basicThermo::basicThermo(const fvMesh& mesh) +Foam::volScalarField& Foam::basicThermo::lookupOrConstruct +( + const fvMesh& mesh, + const char* name +) const +{ + if (!mesh.objectRegistry::foundObject(name)) + { + volScalarField* fPtr + ( + new volScalarField + ( + IOobject + ( + name, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + + // Transfer ownership of this object to the objectRegistry + fPtr->store(fPtr); + } + + return const_cast + ( + mesh.objectRegistry::lookupObject(name) + ); +} + + +Foam::basicThermo::basicThermo +( + const fvMesh& mesh, + const word& phaseName +) : IOdictionary ( IOobject ( - "thermophysicalProperties", + phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, @@ -51,24 +91,15 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh) ) ), - p_ - ( - IOobject - ( - "p", - mesh.time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ), + phaseName_(phaseName), + + p_(lookupOrConstruct(mesh, "p")), T_ ( IOobject ( - "T", + phasePropertyName("T"), mesh.time().timeName(), mesh, IOobject::MUST_READ, @@ -81,7 +112,7 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh) ( IOobject ( - "alpha", + phasePropertyName("alpha"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -98,14 +129,15 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh) Foam::basicThermo::basicThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : IOdictionary ( IOobject ( - "thermophysicalProperties", + phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::NO_READ, @@ -114,24 +146,15 @@ Foam::basicThermo::basicThermo dict ), - p_ - ( - IOobject - ( - "p", - mesh.time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ), + phaseName_(phaseName), + + p_(lookupOrConstruct(mesh, "p")), T_ ( IOobject ( - "T", + phasePropertyName("T"), mesh.time().timeName(), mesh, IOobject::MUST_READ, @@ -144,7 +167,7 @@ Foam::basicThermo::basicThermo ( IOobject ( - "alpha", + phasePropertyName("alpha"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -160,10 +183,11 @@ Foam::basicThermo::basicThermo Foam::autoPtr Foam::basicThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return New(mesh); + return New(mesh, phaseName); } @@ -175,16 +199,52 @@ Foam::basicThermo::~basicThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::basicThermo& Foam::basicThermo::lookupThermo +( + const fvPatchScalarField& pf +) +{ + if (pf.db().foundObject(dictName)) + { + return pf.db().lookupObject(dictName); + } + else + { + HashTable thermos = + pf.db().lookupClass(); + + for + ( + HashTable::iterator iter = thermos.begin(); + iter != thermos.end(); + ++iter + ) + { + if + ( + &(iter()->he().dimensionedInternalField()) + == &(pf.dimensionedInternalField()) + ) + { + return *iter(); + } + } + } + + return pf.db().lookupObject(dictName); +} + + void Foam::basicThermo::validate ( const word& app, const word& a ) const { - if (!(he().name() == a)) + if (!(he().name() == phasePropertyName(a))) { FatalErrorIn(app) - << "Supported energy type is " << a + << "Supported energy type is " << phasePropertyName(a) << ", thermodynamics package provides " << he().name() << exit(FatalError); } @@ -197,10 +257,17 @@ void Foam::basicThermo::validate const word& b ) const { - if (!(he().name() == a || he().name() == b)) + if + ( + !( + he().name() == phasePropertyName(a) + || he().name() == phasePropertyName(b) + ) + ) { FatalErrorIn(app) - << "Supported energy types are " << a << " and " << b + << "Supported energy types are " << phasePropertyName(a) + << " and " << phasePropertyName(b) << ", thermodynamics package provides " << he().name() << exit(FatalError); } @@ -217,14 +284,16 @@ void Foam::basicThermo::validate if ( !( - he().name() == a - || he().name() == b - || he().name() == c + he().name() == phasePropertyName(a) + || he().name() == phasePropertyName(b) + || he().name() == phasePropertyName(c) ) ) { FatalErrorIn(app) - << "Supported energy types are " << a << ", " << b << " and " << c + << "Supported energy types are " << phasePropertyName(a) + << ", " << phasePropertyName(b) + << " and " << phasePropertyName(c) << ", thermodynamics package provides " << he().name() << exit(FatalError); } @@ -242,16 +311,18 @@ void Foam::basicThermo::validate if ( !( - he().name() == a - || he().name() == b - || he().name() == c - || he().name() == d + he().name() == phasePropertyName(a) + || he().name() == phasePropertyName(b) + || he().name() == phasePropertyName(c) + || he().name() == phasePropertyName(d) ) ) { FatalErrorIn(app) - << "Supported energy types are " << a << ", " << b - << ", " << c << " and " << d + << "Supported energy types are " << phasePropertyName(a) + << ", " << phasePropertyName(b) + << ", " << phasePropertyName(c) + << " and " << phasePropertyName(d) << ", thermodynamics package provides " << he().name() << exit(FatalError); } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 2064444ff2..659b6f35ca 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -59,10 +59,14 @@ protected: // Protected data + //- Phase-name + const word& phaseName_; + + // Fields //- Pressure [Pa] - volScalarField p_; + volScalarField& p_; //- Temperature [K] volScalarField T_; @@ -76,6 +80,12 @@ protected: //- Construct as copy (not implemented) basicThermo(const basicThermo&); + volScalarField& lookupOrConstruct + ( + const fvMesh& mesh, + const char* name + ) const; + public: @@ -89,18 +99,27 @@ public: autoPtr, basicThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - basicThermo(const fvMesh&); + //- Construct from mesh and phase name + basicThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh - basicThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + basicThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); // Selectors @@ -115,14 +134,27 @@ public: //- Generic New for each of the related thermodynamics packages template - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Generic New for each of the related thermodynamics packages template - static autoPtr New(const fvMesh&, const dictionary&); + static autoPtr New + ( + const fvMesh&, + const dictionary&, + const word& phaseName=word::null + ); //- Specialisation of the Generic New for basicThermo - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor @@ -131,6 +163,24 @@ public: // Member functions + static const word dictName; + + static word phasePropertyName + ( + const word& name, + const word& phaseName + ) + { + return name + phaseName; + } + + word phasePropertyName(const word& name) const + { + return basicThermo::phasePropertyName(name, phaseName_); + } + + static const basicThermo& lookupThermo(const fvPatchScalarField& pf); + //- Check that the thermodynamics package is consistent // with energy forms supported by the application void validate @@ -356,7 +406,7 @@ public: ) const = 0; - //- Read thermophysicalProperties dictionary + //- Read thermophysical properties dictionary virtual bool read(); }; diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C index e22b4f33c7..4521750996 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C @@ -136,14 +136,15 @@ typename Table::iterator Foam::basicThermo::lookupThermo template Foam::autoPtr Foam::basicThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { IOdictionary thermoDict ( IOobject ( - "thermophysicalProperties", + phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, @@ -159,7 +160,7 @@ Foam::autoPtr Foam::basicThermo::New Thermo::fvMeshConstructorTablePtr_ ); - return autoPtr(cstrIter()(mesh)); + return autoPtr(cstrIter()(mesh, phaseName)); } @@ -167,7 +168,8 @@ template Foam::autoPtr Foam::basicThermo::New ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) { typename Thermo::dictionaryConstructorTable::iterator cstrIter = @@ -177,7 +179,7 @@ Foam::autoPtr Foam::basicThermo::New Thermo::dictionaryConstructorTablePtr_ ); - return autoPtr(cstrIter()(mesh, dict)); + return autoPtr(cstrIter()(mesh, dict, phaseName)); } diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C index 71a097f55f..9e5578b886 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C @@ -101,9 +101,7 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs() if (this->cyclicPatch().owner()) { - const basicThermo& thermo = - db().lookupObject("thermophysicalProperties"); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); label patchID = patch().index(); const scalarField& pp = thermo.p().boundaryField()[patchID]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C index 81a992b9ab..7f6a09c181 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C @@ -101,9 +101,7 @@ void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs() if (this->cyclicAMIPatch().owner()) { - const basicThermo& thermo = - db().lookupObject("thermophysicalProperties"); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); label patchID = patch().index(); const scalarField& pp = thermo.p().boundaryField()[patchID]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C index 3dd72e1e68..0be59a2285 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C @@ -97,12 +97,7 @@ void Foam::fixedEnergyFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = db().lookupObject - ( - "thermophysicalProperties" - ); - - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C index 5f0e009d13..5a173ec12d 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C @@ -97,9 +97,7 @@ void Foam::gradientEnergyFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = - db().lookupObject("thermophysicalProperties"); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C index af83cfd20e..4d8d66874f 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C @@ -102,11 +102,7 @@ void Foam::mixedEnergyFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = db().lookupObject - ( - "thermophysicalProperties" - ); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C index 681f1c36a1..da9ff9b2bb 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C @@ -149,11 +149,7 @@ void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = db().lookupObject - ( - "thermophysicalProperties" - ); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C index 4aef741b50..f330c6ae81 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C @@ -36,16 +36,21 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fluidThermo::fluidThermo(const fvMesh& mesh) +Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const word& phaseName) : - basicThermo(mesh) + basicThermo(mesh, phaseName) {} -Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const dictionary& dict) +Foam::fluidThermo::fluidThermo +( + const fvMesh& mesh, + const dictionary& dict, + const word& phaseName +) : - basicThermo(mesh, dict) + basicThermo(mesh, dict, phaseName) {} @@ -53,10 +58,11 @@ Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const dictionary& dict) Foam::autoPtr Foam::fluidThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H index 21de4808ff..d8612d7db5 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H @@ -63,21 +63,34 @@ public: autoPtr, fluidThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - fluidThermo(const fvMesh&); + //- Construct from mesh and phase name + fluidThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh - fluidThermo(const fvMesh&, const dictionary&); + //- Construct from mesh and phase name + fluidThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Selector - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index f3902a033d..bba8da1514 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -128,16 +128,20 @@ void Foam::heThermo::init() template -Foam::heThermo::heThermo(const fvMesh& mesh) +Foam::heThermo::heThermo +( + const fvMesh& mesh, + const word& phaseName +) : - BasicThermo(mesh), + BasicThermo(mesh, phaseName), MixtureType(*this, mesh), he_ ( IOobject ( - MixtureType::thermoType::heName(), + BasicThermo::phasePropertyName(MixtureType::thermoType::heName()), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -156,17 +160,18 @@ template Foam::heThermo::heThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : - BasicThermo(mesh, dict), + BasicThermo(mesh, dict, phaseName), MixtureType(*this, mesh), he_ ( IOobject ( - MixtureType::thermoType::heName(), + BasicThermo::phasePropertyName(MixtureType::thermoType::heName()), mesh.time().timeName(), mesh, IOobject::NO_READ, diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index c6416878e1..2c894eee43 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -89,10 +89,19 @@ public: // Constructors //- Construct from mesh - heThermo(const fvMesh&); + heThermo + ( + const fvMesh&, + const word& phaseName + ); //- Construct from mesh and dictionary - heThermo(const fvMesh&, const dictionary&); + heThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Destructor @@ -284,7 +293,7 @@ public: ) const; - //- Read thermophysicalProperties dictionary + //- Read thermophysical properties dictionary virtual bool read(); }; diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C index 06c9b47697..970fc82fe3 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C @@ -102,9 +102,13 @@ void Foam::hePsiThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::hePsiThermo::hePsiThermo(const fvMesh& mesh) +Foam::hePsiThermo::hePsiThermo +( + const fvMesh& mesh, + const word& phaseName +) : - heThermo(mesh) + heThermo(mesh, phaseName) { calculate(); diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H index a701a854c2..41aa6da1c8 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H @@ -68,8 +68,12 @@ public: // Constructors - //- Construct from mesh - hePsiThermo(const fvMesh&); + //- Construct from mesh and phase name + hePsiThermo + ( + const fvMesh&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index 30949d16d7..fd4bc962c9 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -36,15 +36,15 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::psiThermo::psiThermo(const fvMesh& mesh) +Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName) : - fluidThermo(mesh), + fluidThermo(mesh, phaseName), psi_ ( IOobject ( - "psi", + phasePropertyName("psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -58,7 +58,7 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh) ( IOobject ( - "mu", + phasePropertyName("mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -74,10 +74,11 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh) Foam::autoPtr Foam::psiThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index 84a9dff0b4..7ac2973a5b 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -81,19 +81,27 @@ public: autoPtr, psiThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - psiThermo(const fvMesh&); + //- Construct from mesh and phase name + psiThermo + ( + const fvMesh&, + const word& phaseName + ); //- Selector - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh& mesh, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C index 0284f76454..ec7aad7e72 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C @@ -107,9 +107,13 @@ void Foam::heRhoThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::heRhoThermo::heRhoThermo(const fvMesh& mesh) +Foam::heRhoThermo::heRhoThermo +( + const fvMesh& mesh, + const word& phaseName +) : - heThermo(mesh) + heThermo(mesh, phaseName) { calculate(); } diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H index 9722526fc6..287041dbf8 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H @@ -69,8 +69,12 @@ public: // Constructors - //- Construct from mesh - heRhoThermo(const fvMesh&); + //- Construct from mesh and phase name + heRhoThermo + ( + const fvMesh&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index d5e572f615..4aa7835cac 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -36,14 +36,14 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::rhoThermo::rhoThermo(const fvMesh& mesh) +Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName) : - fluidThermo(mesh), + fluidThermo(mesh, phaseName), rho_ ( IOobject ( - "rhoThermo", + phasePropertyName("rhoThermo"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -57,7 +57,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) ( IOobject ( - "psi", + phasePropertyName("psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -71,7 +71,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) ( IOobject ( - "mu", + phasePropertyName("mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -83,14 +83,19 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) {} -Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) +Foam::rhoThermo::rhoThermo +( + const fvMesh& mesh, + const dictionary& dict, + const word& phaseName +) : - fluidThermo(mesh, dict), + fluidThermo(mesh, dict, phaseName), rho_ ( IOobject ( - "rhoThermo", + phasePropertyName("rhoThermo"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -104,7 +109,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) ( IOobject ( - "psi", + phasePropertyName("psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -118,7 +123,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) ( IOobject ( - "mu", + phasePropertyName("mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -134,10 +139,11 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) Foam::autoPtr Foam::rhoThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index cc477d35eb..4202267e2b 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -85,22 +85,35 @@ public: autoPtr, rhoThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - rhoThermo(const fvMesh&); + //- Construct from mesh and phase name + rhoThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh - rhoThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + rhoThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Selector - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C index c0afb6a513..afacba2ebf 100644 --- a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C @@ -36,9 +36,13 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::psiReactionThermo::psiReactionThermo(const fvMesh& mesh) +Foam::psiReactionThermo::psiReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - psiThermo(mesh) + psiThermo(mesh, phaseName) {} @@ -46,10 +50,11 @@ Foam::psiReactionThermo::psiReactionThermo(const fvMesh& mesh) Foam::autoPtr Foam::psiReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } diff --git a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H index 8add518a8b..79af428518 100644 --- a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H @@ -66,21 +66,29 @@ public: autoPtr, psiReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from dictionary and mesh - psiReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + psiReactionThermo + ( + const fvMesh&, + const word& phaseName + ); // Selectors //- Standard selection based on fvMesh - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C index 8a2daccfe6..cc6950b80a 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C @@ -121,10 +121,11 @@ void Foam::heheuPsiThermo::calculate() template Foam::heheuPsiThermo::heheuPsiThermo ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) : - heThermo(mesh), + heThermo(mesh, phaseName), Tu_ ( IOobject diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H index 2a9645df0e..4c52e775ed 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H @@ -76,8 +76,12 @@ public: // Constructors - //- Construct from mesh - heheuPsiThermo(const fvMesh&); + //- Construct from mesh and phase name + heheuPsiThermo + ( + const fvMesh&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C index b5f824c376..45e6b01bac 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C @@ -100,9 +100,13 @@ void psiuReactionThermo::heuBoundaryCorrection(volScalarField& heu) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -psiuReactionThermo::psiuReactionThermo(const fvMesh& mesh) +psiuReactionThermo::psiuReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - psiReactionThermo(mesh) + psiReactionThermo(mesh, phaseName) {} @@ -110,10 +114,11 @@ psiuReactionThermo::psiuReactionThermo(const fvMesh& mesh) Foam::autoPtr Foam::psiuReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H index f27e3662c0..0a0b3bcfa4 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H @@ -73,20 +73,28 @@ public: autoPtr, psiuReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from dictionary and mesh - psiuReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + psiuReactionThermo + ( + const fvMesh&, + const word& phaseName + ); // Selectors - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C index ef056e4267..12e34e90b7 100644 --- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C @@ -36,9 +36,13 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::rhoReactionThermo::rhoReactionThermo(const fvMesh& mesh) +Foam::rhoReactionThermo::rhoReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - rhoThermo(mesh) + rhoThermo(mesh, phaseName) {} @@ -46,10 +50,11 @@ Foam::rhoReactionThermo::rhoReactionThermo(const fvMesh& mesh) Foam::autoPtr Foam::rhoReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H index 227d6382da..346b0d8580 100644 --- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H @@ -66,21 +66,29 @@ public: autoPtr, rhoReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from dictionary and mesh - rhoReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + rhoReactionThermo + ( + const fvMesh&, + const word& phaseName + ); // Selectors //- Standard selection based on fvMesh - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C index 77184b166b..5bf7cd7786 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C @@ -38,19 +38,24 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidReactionThermo::solidReactionThermo(const fvMesh& mesh) +Foam::solidReactionThermo::solidReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - solidThermo(mesh) + solidThermo(mesh, phaseName) {} Foam::solidReactionThermo::solidReactionThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : - solidThermo(mesh, dict) + solidThermo(mesh, dict, phaseName) {} @@ -58,20 +63,22 @@ Foam::solidReactionThermo::solidReactionThermo Foam::autoPtr Foam::solidReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } Foam::autoPtr Foam::solidReactionThermo::New ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) { - return basicThermo::New(mesh, dict); + return basicThermo::New(mesh, dict, phaseName); } diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H index e9112602e1..1a3c041dff 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H @@ -67,8 +67,8 @@ public: autoPtr, solidReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Declare run-time constructor selection tables @@ -77,31 +77,46 @@ public: autoPtr, solidReactionThermo, dictionary, - (const fvMesh& mesh, const dictionary& dict), - (mesh, dict) + (const fvMesh& mesh, const dictionary& dict, const word& phaseName), + (mesh, dict, phaseName) ); // Constructors - //- Construct from mesh - solidReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + solidReactionThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from dictionary and mesh - solidReactionThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + solidReactionThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); // Selectors //- Standard selection based on fvMesh - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Standard selection based on fvMesh amd dictionary static autoPtr New ( const fvMesh&, - const dictionary& + const dictionary&, + const word& phaseName=word::null ); + //- Destructor virtual ~solidReactionThermo(); diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C index 55f9bc1999..65f07073f6 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C @@ -124,9 +124,13 @@ void Foam::heSolidThermo::calculate() template Foam::heSolidThermo:: -heSolidThermo(const fvMesh& mesh) +heSolidThermo +( + const fvMesh& mesh, + const word& phaseName +) : - heThermo(mesh) + heThermo(mesh, phaseName) { calculate(); } @@ -134,9 +138,14 @@ heSolidThermo(const fvMesh& mesh) template Foam::heSolidThermo:: -heSolidThermo(const fvMesh& mesh, const dictionary& dict) +heSolidThermo +( + const fvMesh& mesh, + const dictionary& dict, + const word& phaseName +) : - heThermo(mesh, dict) + heThermo(mesh, dict, phaseName) { calculate(); } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H index ee1f9aa010..8d13ea6e28 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H @@ -68,11 +68,20 @@ public: // Constructors - //- Construct from mesh - heSolidThermo(const fvMesh&); + //- Construct from mesh and phase name + heSolidThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh and dictionary - heSolidThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + heSolidThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C index faf4ea6155..102414e3fb 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C @@ -39,9 +39,13 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidThermo::solidThermo(const fvMesh& mesh) +Foam::solidThermo::solidThermo +( + const fvMesh& mesh, + const word& phaseName +) : - basicThermo(mesh), + basicThermo(mesh, phaseName), rho_ ( IOobject @@ -61,10 +65,11 @@ Foam::solidThermo::solidThermo(const fvMesh& mesh) Foam::solidThermo::solidThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : - basicThermo(mesh, dict), + basicThermo(mesh, dict, phaseName), rho_ ( IOobject @@ -85,20 +90,22 @@ Foam::solidThermo::solidThermo Foam::autoPtr Foam::solidThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New(mesh); + return basicThermo::New(mesh, phaseName); } Foam::autoPtr Foam::solidThermo::New ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) { - return basicThermo::New(mesh, dict); + return basicThermo::New(mesh, dict, phaseName); } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index a7fbf5c067..893a9673ea 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -78,8 +78,8 @@ public: autoPtr, solidThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Declare run-time constructor selection tables @@ -88,26 +88,44 @@ public: autoPtr, solidThermo, dictionary, - (const fvMesh& mesh, const dictionary& dict), - (mesh, dict) + (const fvMesh& mesh, const dictionary& dict, const word& phaseName), + (mesh, dict, phaseName) ); // Constructors - //- Construct from mesh - solidThermo(const fvMesh&); + //- Construct from mesh and phase name + solidThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh and dict - solidThermo(const fvMesh&, const dictionary& dict); + //- Construct from mesh, dictionary and phase name + solidThermo + ( + const fvMesh&, + const dictionary& dict, + const word& phaseName + ); //- Return a pointer to a new solidThermo created from // the solidThermophysicalProperties dictionary - static autoPtr New(const fvMesh&); + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Return a pointer to a new solidThermo created from // local dictionary - static autoPtr New(const fvMesh&, const dictionary&); + static autoPtr New + ( + const fvMesh&, + const dictionary&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/options b/src/turbulenceModels/compressible/turbulenceModel/Make/options index a3d25da57a..9b024f163d 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/Make/options +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/options @@ -15,4 +15,3 @@ LIB_LIBS = \ -lmeshTools \ -lsolidSpecie \ -lradiationModels - diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes b/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes index 0cab2f77d3..5a12a4e1da 100644 --- a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes +++ b/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes @@ -48,7 +48,6 @@ laplacianSchemes interpolationSchemes { default linear; - UD upwind phid; } snGradSchemes From 701f5680c8ba74785b98be3df9703778192cb7b3 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 5 Nov 2012 15:31:30 +0000 Subject: [PATCH 24/24] buoyantSimpleRadiationFoam: Added MRF zones --- .../buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C index d02853591e..38f3a7c647 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C @@ -36,6 +36,7 @@ Description #include "fixedGradientFvPatchFields.H" #include "radiationModel.H" #include "simpleControl.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +47,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createZones.H" #include "createRadiationModel.H" #include "initContinuityErrs.H"