diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index 0db3d8f472a50e68db593260f2467673a9c59bc1..01bd647b8acb1a2e2c0d80295169e7a71125532f 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -2525,7 +2525,10 @@ Foam::labelBits Foam::dynamicIndexedOctree<Type>::findNode template <class Type> -Foam::label Foam::dynamicIndexedOctree<Type>::findInside(const point& sample) const +Foam::label Foam::dynamicIndexedOctree<Type>::findInside +( + const point& sample +) const { labelBits index = findNode(0, sample); @@ -2873,7 +2876,8 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex if (newContent.size() == 0) { // Set to empty. - nodes_[nodIndex].subNodes_[octant] = emptyPlusOctant(octant); + nodes_[nodIndex].subNodes_[octant] + = emptyPlusOctant(octant); } contentList.transfer(newContent); @@ -3002,7 +3006,8 @@ bool Foam::dynamicIndexedOctree<Type>::write(Ostream& os) const template <class Type> -Foam::Ostream& Foam::operator<<(Ostream& os, const dynamicIndexedOctree<Type>& t) +Foam::Ostream& +Foam::operator<<(Ostream& os, const dynamicIndexedOctree<Type>& t) { os << t.bb() << token::SPACE << t.nodes() << endl; diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H index 9afcb3e08cba4d19a1cecebdeebf09c6f7f01a17..225e995419f5ac4d5dd19c0fba38185b7265f8ed 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -150,8 +150,8 @@ public: { notImplemented ( - "dynamicTreeDataPoint::intersects(const label, const point&," - "const point&, point&)" + "dynamicTreeDataPoint::intersects + "(const label, const point&, const point&, point&)" ); return false; } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H index c95406350b3b461546266e6cad4ee0badb3dffb4..a506deed354d2a42263c4478ef6462f1fa5bdc8b 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -139,17 +139,28 @@ public: // Member Functions - //- Return Table value - virtual Type value(const scalar x) const - { - return TableBase<Type>::value(x); - } + // Manipulation - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const - { - return TableBase<Type>::integrate(x1, x2); - } + //- Convert time + virtual void convertTimeBase(const Time& t) + { + TableBase<Type>::convertTimeBase(t); + } + + + // Evaluation + + //- Return Table value + virtual Type value(const scalar x) const + { + return TableBase<Type>::value(x); + } + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase<Type>::integrate(x1, x2); + } // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C index cb46155840ae876ae7aab31ae5061e82eaefb508..3b972949bb1f4eef395a7c5202668b0cfaa9c264 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.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 @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "DataEntry.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // @@ -59,6 +60,13 @@ const Foam::word& Foam::DataEntry<Type>::name() const } +template<class Type> +void Foam::DataEntry<Type>::convertTimeBase(const Time&) +{ + // do nothing +} + + template<class Type> Type Foam::DataEntry<Type>::value(const scalar x) const { diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H index 5b3e7831016a61333bdc38ddfd09cd69eb25d454..6ab51b98d335379d67fc4b83d2dca445eb9d6845 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,7 @@ SourceFiles namespace Foam { +class Time; template<class Type> class DataEntry; @@ -133,6 +134,12 @@ public: const word& name() const; + // Manipulation + + //- Convert time + virtual void convertTimeBase(const Time& t); + + // Evaluation //- Return value as a function of (scalar) independent variable diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H index c1ba2121e8903cfd99292919c740b19e3c79bc6d..3f19ec38f27b1e2d781a54d475dd6823e393d9db 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,17 +106,28 @@ public: // Member Functions - //- Return Table value - virtual Type value(const scalar x) const - { - return TableBase<Type>::value(x); - } + // Manipulation - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const - { - return TableBase<Type>::integrate(x1, x2); - } + //- Convert time + virtual void convertTimeBase(const Time& t) + { + TableBase<Type>::convertTimeBase(t); + } + + + // Evaluation + + //- Return Table value + virtual Type value(const scalar x) const + { + return TableBase<Type>::value(x); + } + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase<Type>::integrate(x1, x2); + } // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C index 165b542ad8c9e290a2f1869d4d77f0123e12a5ec..cadc9c53a5aec7d592954c4f4ba80eecb8d4ea46 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.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 @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "TableBase.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -296,6 +297,17 @@ bool Foam::TableBase<Type>::checkMaxBounds } +template<class Type> +void Foam::TableBase<Type>::convertTimeBase(const Time& t) +{ + forAll(table_, i) + { + scalar value = table_[i].first(); + table_[i].first() = t.userTimeToTime(value); + } +} + + template<class Type> Type Foam::TableBase<Type>::value(const scalar x) const { diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H index f4d20028bcc0616cecb5d26ed9b2dab7d992cf60..50ee3b955a39214572896d410018b0e09b9dcf1f 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,9 @@ public: //- Check maximum table bounds bool checkMaxBounds(const scalar x, scalar& xDash) const; + //- Convert time + virtual void convertTimeBase(const Time& t); + //- Return Table value virtual Type value(const scalar x) const; diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H index 60106598b1e9d6d1aeec05a86e4add24ecaa9da3..5c31c5cf68d3c4cf8c731e90a5f794dd13bfc144 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,17 +122,28 @@ public: // Member Functions - //- Return TableFile value - virtual Type value(const scalar x) const - { - return TableBase<Type>::value(x); - } + // Manipulation - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const - { - return TableBase<Type>::integrate(x1, x2); - } + //- Convert time + virtual void convertTimeBase(const Time& t) + { + TableBase<Type>::convertTimeBase(t); + } + + + // Evaluation + + //- Return TableFile value + virtual Type value(const scalar x) const + { + return TableBase<Type>::value(x); + } + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase<Type>::integrate(x1, x2); + } // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C index 10111c8680091544e209557e29b1d7267e577027..34c595f8acf5919638501f42ce87abe6977f6607 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.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 @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "polynomial.H" +#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -89,6 +90,16 @@ Foam::polynomial::~polynomial() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::polynomial::convertTimeBase(const Time& t) +{ + forAll(coeffs_, i) + { + scalar value = coeffs_[i].first(); + coeffs_[i].first() = t.userTimeToTime(value); + } +} + + Foam::scalar Foam::polynomial::value(const scalar x) const { scalar y = 0.0; diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H index 37a45b33162f4e0b7ceeda9e621152b601dfcc20..2ed38a9f32221e9f91ee6dba3ca7522455278877 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,11 +112,19 @@ public: // Member Functions - //- Return polynomial value - scalar value(const scalar x) const; + // Manipulation - //- Integrate between two (scalar) values - scalar integrate(const scalar x1, const scalar x2) const; + //- Convert time + virtual void convertTimeBase(const Time& t); + + + // Evaluation + + //- Return polynomial value + scalar value(const scalar x) const; + + //- Integrate between two (scalar) values + scalar integrate(const scalar x1, const scalar x2) const; // I/O diff --git a/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C new file mode 100644 index 0000000000000000000000000000000000000000..b5e74a78c0bdcedcaa283210ab2c909ce7dfafb8 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "TimeDataEntry.H" + +// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::TimeDataEntry<Type>::TimeDataEntry +( + const Time& t, + const word& name, + const dictionary& dict +) +: + time_(t), + name_(name), + entry_(DataEntry<Type>::New(name, dict)) +{ + entry_->convertTimeBase(t); +} + + +template<class Type> +Foam::TimeDataEntry<Type>::TimeDataEntry(const Time& t, const word& name) +: + time_(t), + name_(name), + entry_(NULL) +{} + + +template<class Type> +Foam::TimeDataEntry<Type>::TimeDataEntry +( + const TimeDataEntry<Type>& tde +) +: + time_(tde.time_), + name_(tde.name_), + entry_(tde.entry_->clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::TimeDataEntry<Type>::~TimeDataEntry() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void Foam::TimeDataEntry<Type>::reset(const dictionary& dict) +{ + entry_.reset + ( + DataEntry<Type>::New + ( + name_, + dict + ).ptr() + ); + + entry_->convertTimeBase(time_); +} + + +template<class Type> +const Foam::word& Foam::TimeDataEntry<Type>::name() const +{ + return entry_->name(); +} + + +template<class Type> +Type Foam::TimeDataEntry<Type>::value(const scalar x) const +{ + return entry_->value(x); +} + + +template<class Type> +Type Foam::TimeDataEntry<Type>::integrate +( + const scalar x1, + const scalar x2 +) const +{ + return entry_->integrate(x1, x2); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const TimeDataEntry<Type>& de +) +{ + return de.entry_->operator<<(os, de); +} + + +template<class Type> +void Foam::TimeDataEntry<Type>::writeData(Ostream& os) const +{ + entry_->writeData(os); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.H b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.H new file mode 100644 index 0000000000000000000000000000000000000000..2cbe1a6115707575e144ff33eb3e653e3684b5f1 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::TimeDataEntry + +Description + Light wrapper around DataEntry to provide a mechanism to update time-based + entries. + +SourceFiles + TimeDataEntry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TimeDataEntry_H +#define TimeDataEntry_H + +#include "DataEntry.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +template<class Type> +class TimeDataEntry; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const TimeDataEntry<Type>& +); + +/*---------------------------------------------------------------------------*\ + Class TimeDataEntry Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class TimeDataEntry +{ + +protected: + + // Protected data + + //- Reference to the time database + const Time& time_; + + //- Name of the data entry + const word name_; + + //- The underlying DataEntry + autoPtr<DataEntry<Type> > entry_; + + +public: + + // Constructor + + //- Construct from entry name + TimeDataEntry + ( + const Time& t, + const word& name, + const dictionary& dict + ); + + //- Construct null from entry name + TimeDataEntry + ( + const Time& t, + const word& entryName + ); + + //- Copy constructor + TimeDataEntry(const TimeDataEntry<Type>& tde); + + + //- Destructor + virtual ~TimeDataEntry(); + + + // Member Functions + + // Access + + //- Reset entry by re-reading from dictionary + void reset(const dictionary& dict); + + //- Return the name of the entry + const word& name() const; + + + // Evaluation + + //- Return value as a function of (scalar) independent variable + virtual Type value(const scalar x) const; + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const; + + + // I/O + + //- Ostream Operator + friend Ostream& operator<< <Type> + ( + Ostream& os, + const TimeDataEntry<Type>& de + ); + + //- Write in dictionary format + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TimeDataEntry.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index 68f0c2a5bf926e1812886b95de3a6ea9f5bfb42e..878398220ef20ce73d72a8a7c823a6d71b2c525b 100644 --- a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -66,6 +66,12 @@ void Foam::actuationDiskSource::checkData() const << "disk direction vector is approximately zero" << exit(FatalIOError); } + if (returnReduce(upstreamCellId_, maxOp<label>()) == -1) + { + FatalErrorIn("Foam::actuationDiskSource::checkData()") + << "upstream location " << upstreamPoint_ << " not found in mesh" + << exit(FatalIOError); + } } @@ -83,7 +89,9 @@ Foam::actuationDiskSource::actuationDiskSource diskDir_(coeffs_.lookup("diskDir")), Cp_(readScalar(coeffs_.lookup("Cp"))), Ct_(readScalar(coeffs_.lookup("Ct"))), - diskArea_(readScalar(coeffs_.lookup("diskArea"))) + diskArea_(readScalar(coeffs_.lookup("diskArea"))), + upstreamPoint_(coeffs_.lookup("upstreamPoint")), + upstreamCellId_(-1) { coeffs_.lookup("fieldNames") >> fieldNames_; applied_.setSize(fieldNames_.size(), false); @@ -91,6 +99,8 @@ Foam::actuationDiskSource::actuationDiskSource Info<< " - creating actuation disk zone: " << this->name() << endl; + upstreamCellId_ = mesh.findCell(upstreamPoint_); + checkData(); } diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H index 077442589258e6d73bdf45a31d511af6225abb57..80cd7bd54a88c2da40b4580de14b90308cdf3b48 100644 --- a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H +++ b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -48,6 +48,7 @@ Description Cp 0.1; // power coefficient Ct 0.5; // thrust coefficient diskArea 5.0; // disk area + upstreamPoint (0 0 0); // upstream point } @@ -92,6 +93,12 @@ protected: //- Disk area scalar diskArea_; + //- Upstream point sample + point upstreamPoint_; + + //- Upstream cell ID + label upstreamCellId_; + private: diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C index dbaf95c4b94d77bf14ae3e547462dbc59b40cd2e..959e86f5b3fedf05088ef1ee7bcb739e13605add 100644 --- a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C +++ b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C @@ -42,20 +42,27 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance ) const { scalar a = 1.0 - Cp_/Ct_; - scalarField T(cells.size()); vector uniDiskDir = diskDir_/mag(diskDir_); tensor E(tensor::zero); E.xx() = uniDiskDir.x(); E.yy() = uniDiskDir.y(); E.zz() = uniDiskDir.z(); - forAll(cells, i) + vector upU = vector(VGREAT, VGREAT, VGREAT); + scalar upRho = VGREAT; + if (upstreamCellId_ != -1) { - T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a); + upU = U[upstreamCellId_]; + upRho = rho[upstreamCellId_]; } + reduce(upU, minOp<vector>()); + reduce(upRho, minOp<scalar>()); + + scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1 - a); + forAll(cells, i) { - Usource[cells[i]] -= ((Vcells[cells[i]]/V())*T[i]*E) & U[cells[i]]; + Usource[cells[i]] += ((Vcells[cells[i]]/V())*T*E) & upU; } } diff --git a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H index 4c464bcfd36754571d947eca2af534ca456a8969..134e93b5eae64116d38e0e8048a29980598a8f27 100644 --- a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H +++ b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H @@ -53,6 +53,7 @@ Description Ct 0.5; // thrust coefficient diskArea 5.0; // disk area coeffs (0.1 0.5 0.01); // radial distribution coefficients + upstreamPoint (0 0 0); // upstream point } diff --git a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C index 127263c94f2ff5dbc937020e6d8e45c862678b76..adea6154550cf1642d52834d7af47b26efe18d64 100644 --- a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C +++ b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C @@ -44,11 +44,9 @@ addRadialActuationDiskAxialInertialResistance ) const { scalar a = 1.0 - Cp_/Ct_; - scalarField T(cells.size()); scalarField Tr(cells.size()); const vector uniDiskDir = diskDir_/mag(diskDir_); - tensor E(tensor::zero); E.xx() = uniDiskDir.x(); E.yy() = uniDiskDir.y(); @@ -65,21 +63,27 @@ addRadialActuationDiskAxialInertialResistance + radialCoeffs_[1]*sqr(maxR)/2.0 + radialCoeffs_[2]*pow4(maxR)/3.0; - forAll(cells, i) + vector upU = vector(VGREAT, VGREAT, VGREAT); + scalar upRho = VGREAT; + if (upstreamCellId_ != -1) { - T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a); + upU = U[upstreamCellId_]; + upRho = rho[upstreamCellId_]; + } + reduce(upU, minOp<vector>()); + reduce(upRho, minOp<scalar>()); + scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1.0 - a); + forAll(cells, i) + { scalar r2 = magSqr(mesh().cellCentres()[cells[i]] - avgCentre); Tr[i] = - T[i] + T *(radialCoeffs_[0] + radialCoeffs_[1]*r2 + radialCoeffs_[2]*sqr(r2)) /intCoeffs; - } - forAll(cells, i) - { - Usource[cells[i]] -= ((Vcells[cells[i]]/V_)*Tr[i]*E) & U[cells[i]]; + Usource[cells[i]] += ((Vcells[cells[i]]/V_)*Tr[i]*E) & upU; } if (debug) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index d9b5cf57cf4c54fc16e5792be5adb988a259cb91..ab8a6a1c5c89c3666cc5734a3ec87fb787df0d42 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.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 @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "ConeInjection.H" -#include "DataEntry.H" +#include "TimeDataEntry.H" #include "mathematicalConstants.H" #include "unitConversion.H" @@ -51,11 +51,40 @@ Foam::ConeInjection<CloudType>::ConeInjection ), flowRateProfile_ ( - DataEntry<scalar>::New("flowRateProfile", this->coeffDict()) + TimeDataEntry<scalar> + ( + owner.db().time(), + "flowRateProfile", + this->coeffDict() + ) + ), + Umag_ + ( + TimeDataEntry<scalar> + ( + owner.db().time(), + "Umag", + this->coeffDict() + ) + ), + thetaInner_ + ( + TimeDataEntry<scalar> + ( + owner.db().time(), + "thetaInner", + this->coeffDict() + ) + ), + thetaOuter_ + ( + TimeDataEntry<scalar> + ( + owner.db().time(), + "thetaOuter", + this->coeffDict() + ) ), - Umag_(DataEntry<scalar>::New("Umag", this->coeffDict())), - thetaInner_(DataEntry<scalar>::New("thetaInner", this->coeffDict())), - thetaOuter_(DataEntry<scalar>::New("thetaOuter", this->coeffDict())), sizeDistribution_ ( distributionModels::distributionModel::New @@ -67,6 +96,8 @@ Foam::ConeInjection<CloudType>::ConeInjection tanVec1_(positionAxis_.size()), tanVec2_(positionAxis_.size()) { + duration_ = owner.db().time().userTimeToTime(duration_); + // Normalise direction vector and determine direction vectors // tangential to injector axis direction forAll(positionAxis_, i) @@ -92,7 +123,7 @@ Foam::ConeInjection<CloudType>::ConeInjection } // Set total volume to inject - this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_); // Set/cache the injector cells forAll(positionAxis_, i) @@ -121,10 +152,10 @@ Foam::ConeInjection<CloudType>::ConeInjection injectorTetPts_(im.injectorTetPts_), duration_(im.duration_), parcelsPerInjector_(im.parcelsPerInjector_), - flowRateProfile_(im.flowRateProfile_().clone().ptr()), - Umag_(im.Umag_().clone().ptr()), - thetaInner_(im.thetaInner_().clone().ptr()), - thetaOuter_(im.thetaOuter_().clone().ptr()), + flowRateProfile_(im.flowRateProfile_), + Umag_(im.Umag_), + thetaInner_(im.thetaInner_), + thetaOuter_(im.thetaOuter_), sizeDistribution_(im.sizeDistribution_().clone().ptr()), nInjected_(im.nInjected_), tanVec1_(im.tanVec1_), @@ -157,7 +188,7 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - const scalar targetVolume = flowRateProfile_().integrate(0, time1); + const scalar targetVolume = flowRateProfile_.integrate(0, time1); const label targetParcels = parcelsPerInjector_*targetVolume/this->volumeTotal_; @@ -184,7 +215,7 @@ Foam::scalar Foam::ConeInjection<CloudType>::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return flowRateProfile_().integrate(time0, time1); + return flowRateProfile_.integrate(time0, time1); } else { @@ -229,8 +260,8 @@ void Foam::ConeInjection<CloudType>::setProperties const label i = parcelI % positionAxis_.size(); scalar t = time - this->SOI_; - scalar ti = thetaInner_().value(t); - scalar to = thetaOuter_().value(t); + scalar ti = thetaInner_.value(t); + scalar to = thetaOuter_.value(t); scalar coneAngle = degToRad(rnd.position<scalar>(ti, to)); scalar alpha = sin(coneAngle); @@ -242,7 +273,7 @@ void Foam::ConeInjection<CloudType>::setProperties dirVec += normal; dirVec /= mag(dirVec); - parcel.U() = Umag_().value(t)*dirVec; + parcel.U() = Umag_.value(t)*dirVec; // set particle diameter parcel.d() = sizeDistribution_().sample(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H index 900606dedbe623a8e3094c15bd64c8ceeb7d3a89..e41103aff0b8e5807f5934b18850dda0e3dab4c0 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,17 +45,13 @@ SourceFiles #include "InjectionModel.H" #include "distributionModel.H" #include "vectorList.H" +#include "TimeDataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes - -template<class Type> -class DataEntry; - /*---------------------------------------------------------------------------*\ Class ConeInjection Declaration \*---------------------------------------------------------------------------*/ @@ -80,22 +76,22 @@ class ConeInjection labelList injectorTetPts_; //- Injection duration [s] - const scalar duration_; + scalar duration_; //- Number of parcels to introduce per injector const label parcelsPerInjector_; //- Flow rate profile relative to SOI [] - const autoPtr<DataEntry<scalar> > flowRateProfile_; + const TimeDataEntry<scalar> flowRateProfile_; //- Parcel velocity magnitude relative to SOI [m/s] - const autoPtr<DataEntry<scalar> > Umag_; + const TimeDataEntry<scalar> Umag_; //- Inner cone angle relative to SOI [deg] - const autoPtr<DataEntry<scalar> > thetaInner_; + const TimeDataEntry<scalar> thetaInner_; //- Outer cone angle relative to SOI [deg] - const autoPtr<DataEntry<scalar> > thetaOuter_; + const TimeDataEntry<scalar> thetaOuter_; //- Parcel size distribution model const autoPtr<distributionModels::distributionModel> sizeDistribution_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index 08e824f35b1b52499b6caddd0bbe3e53e5231264..f03736d159397c04c116516ec3d64bdb9b210692 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.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 @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "ConeNozzleInjection.H" -#include "DataEntry.H" +#include "TimeDataEntry.H" #include "mathematicalConstants.H" #include "distributionModel.H" @@ -74,26 +74,12 @@ void Foam::ConeNozzleInjection<CloudType>::setFlowType() } else if (flowType == "pressureDrivenVelocity") { - Pinj_.reset - ( - DataEntry<scalar>::New - ( - "Pinj", - this->coeffDict() - ).ptr() - ); + Pinj_.reset(this->coeffDict()); flowType_ = ftPressureDrivenVelocity; } else if (flowType == "flowRateAndDischarge") { - Cd_.reset - ( - DataEntry<scalar>::New - ( - "Cd", - this->coeffDict() - ).ptr() - ); + Cd_.reset(this->coeffDict()); flowType_ = ftFlowRateAndDischarge; } else @@ -132,24 +118,27 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection ), flowRateProfile_ ( - DataEntry<scalar>::New + TimeDataEntry<scalar> ( + owner.db().time(), "flowRateProfile", this->coeffDict() ) ), thetaInner_ ( - DataEntry<scalar>::New + TimeDataEntry<scalar> ( + owner.db().time(), "thetaInner", this->coeffDict() ) ), thetaOuter_ ( - DataEntry<scalar>::New + TimeDataEntry<scalar> ( + owner.db().time(), "thetaOuter", this->coeffDict() ) @@ -167,8 +156,8 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection normal_(vector::zero), UMag_(0.0), - Cd_(NULL), - Pinj_(NULL) + Cd_(owner.db().time(), "Cd"), + Pinj_(owner.db().time(), "Pinj") { if (innerDiameter_ >= outerDiameter_) { @@ -183,6 +172,8 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection << exit(FatalError); } + duration_ = owner.db().time().userTimeToTime(duration_); + setInjectionMethod(); setFlowType(); @@ -208,7 +199,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection tanVec2_ = direction_^tanVec1_; // Set total volume to inject - this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_); } @@ -230,26 +221,17 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection tetPtI_(im.tetPtI_), direction_(im.direction_), parcelsPerSecond_(im.parcelsPerSecond_), - flowRateProfile_(im.flowRateProfile_().clone().ptr()), - thetaInner_(im.thetaInner_().clone().ptr()), - thetaOuter_(im.thetaOuter_().clone().ptr()), + flowRateProfile_(im.flowRateProfile_), + thetaInner_(im.thetaInner_), + thetaOuter_(im.thetaOuter_), sizeDistribution_(im.sizeDistribution_().clone().ptr()), tanVec1_(im.tanVec1_), tanVec2_(im.tanVec1_), normal_(im.normal_), UMag_(im.UMag_), - Cd_(NULL), - Pinj_(NULL) -{ - if (im.Cd_.valid()) - { - Cd_.reset(im.Cd_().clone().ptr()); - } - if (im.Pinj_.valid()) - { - Pinj_.reset(im.Pinj_().clone().ptr()); - } -} + Cd_(im.Cd_), + Pinj_(im.Pinj_) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -295,7 +277,7 @@ Foam::scalar Foam::ConeNozzleInjection<CloudType>::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return flowRateProfile_().integrate(time0, time1); + return flowRateProfile_.integrate(time0, time1); } else { @@ -383,8 +365,8 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties const scalar deg2Rad = mathematical::pi/180.0; scalar t = time - this->SOI_; - scalar ti = thetaInner_().value(t); - scalar to = thetaOuter_().value(t); + scalar ti = thetaInner_.value(t); + scalar to = thetaOuter_.value(t); scalar coneAngle = rndGen.sample01<scalar>()*(to - ti) + ti; coneAngle *= deg2Rad; @@ -407,7 +389,7 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties { scalar pAmbient = this->owner().pAmbient(); scalar rho = parcel.rho(); - scalar UMag = ::sqrt(2.0*(Pinj_().value(t) - pAmbient)/rho); + scalar UMag = ::sqrt(2.0*(Pinj_.value(t) - pAmbient)/rho); parcel.U() = UMag*dirVec; break; } @@ -417,10 +399,10 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_; scalar massFlowRate = this->massTotal() - *flowRateProfile_().value(t) + *flowRateProfile_.value(t) /this->volumeTotal(); - scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai)); + scalar Umag = massFlowRate/(parcel.rho()*Cd_.value(t)*(Ao - Ai)); parcel.U() = Umag*dirVec; break; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H index 330cda3ce67e20bcfcb6b4baccaeb64c317cf195..766b363c2703a32753d01106ad60312a1450d484 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,7 @@ namespace Foam // Forward declaration of classes template<class Type> -class DataEntry; +class TimeDataEntry; class distributionModel; @@ -111,7 +111,7 @@ private: const scalar innerDiameter_; //- Injection duration [s] - const scalar duration_; + scalar duration_; //- Injector position [m] vector position_; @@ -132,13 +132,13 @@ private: const label parcelsPerSecond_; //- Flow rate profile relative to SOI [] - const autoPtr<DataEntry<scalar> > flowRateProfile_; + const TimeDataEntry<scalar> flowRateProfile_; //- Inner cone angle relative to SOI [deg] - const autoPtr<DataEntry<scalar> > thetaInner_; + const TimeDataEntry<scalar> thetaInner_; //- Outer cone angle relative to SOI [deg] - const autoPtr<DataEntry<scalar> > thetaOuter_; + const TimeDataEntry<scalar> thetaOuter_; //- Parcel size PDF model const autoPtr<distributionModels::distributionModel> sizeDistribution_; @@ -162,10 +162,10 @@ private: scalar UMag_; //- Discharge coefficient, relative to SOI [m/s] - autoPtr<DataEntry<scalar> > Cd_; + TimeDataEntry<scalar> Cd_; //- Injection pressure [Pa] - autoPtr<DataEntry<scalar> > Pinj_; + TimeDataEntry<scalar> Pinj_; // Private Member Functions diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C index 8f36cc78bcedf20aa4612b3a7892c68f37700979..6fd75381c7d265de4a19506938b9de8eafdb2251 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.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 @@ -48,16 +48,18 @@ Foam::InflationInjection<CloudType>::InflationInjection duration_(readScalar(this->coeffDict().lookup("duration"))), flowRateProfile_ ( - DataEntry<scalar>::New + TimeDataEntry<scalar> ( + owner.db().time(), "flowRateProfile", this->coeffDict() ) ), growthRate_ ( - DataEntry<scalar>::New + TimeDataEntry<scalar> ( + owner.db().time(), "growthRate", this->coeffDict() ) @@ -76,6 +78,8 @@ Foam::InflationInjection<CloudType>::InflationInjection ) ) { + duration_ = owner.db().time().userTimeToTime(duration_); + if (selfSeed_) { dSeed_ = readScalar(this->coeffDict().lookup("dSeed")); @@ -111,7 +115,7 @@ Foam::InflationInjection<CloudType>::InflationInjection } // Set total volume/mass to inject - this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_); + this->volumeTotal_ = fraction_*flowRateProfile_.integrate(0.0, duration_); this->massTotal_ *= fraction_; } @@ -128,8 +132,8 @@ Foam::InflationInjection<CloudType>::InflationInjection generationCells_(im.generationCells_), inflationCells_(im.inflationCells_), duration_(im.duration_), - flowRateProfile_(im.flowRateProfile_().clone().ptr()), - growthRate_(im.growthRate_().clone().ptr()), + flowRateProfile_(im.flowRateProfile_), + growthRate_(im.growthRate_), newParticles_(im.newParticles_), volumeAccumulator_(im.volumeAccumulator_), fraction_(im.fraction_), @@ -167,7 +171,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject List<DynamicList<typename CloudType::parcelType*> >& cellOccupancy = this->owner().cellOccupancy(); - scalar gR = growthRate_().value(time1); + scalar gR = growthRate_.value(time1); scalar dT = time1 - time0; @@ -202,7 +206,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject if ((time0 >= 0.0) && (time0 < duration_)) { volumeAccumulator_ += - fraction_*flowRateProfile_().integrate(time0, time1); + fraction_*flowRateProfile_.integrate(time0, time1); } labelHashSet cellCentresUsed; @@ -424,7 +428,7 @@ Foam::scalar Foam::InflationInjection<CloudType>::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return fraction_*flowRateProfile_().integrate(time0, time1); + return fraction_*flowRateProfile_.integrate(time0, time1); } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H index 07efb9fa73d07d3bb8cfda774e35626a25a6d1f0..b01f4eeda9f557ef24ea3ffb717bb16e8a0c2a0f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,13 +81,13 @@ class InflationInjection labelList inflationCells_; //- Injection duration [s] - const scalar duration_; + scalar duration_; //- Flow rate profile relative to SOI [m3/s] - const autoPtr<DataEntry<scalar> > flowRateProfile_; + TimeDataEntry<scalar> flowRateProfile_; //- Growth rate of particle diameters towards target [m/s] - const autoPtr<DataEntry<scalar> > growthRate_; + TimeDataEntry<scalar> growthRate_; //- Positions, velocities, diameters and target diameters of // new particles after splitting diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index abdce88750ea61fc4196d5068c2c501e479438d2..46583ec5488c90de8b08731f7dc5a9ef7eeff317 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.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 @@ -316,6 +316,7 @@ Foam::InjectionModel<CloudType>::InjectionModel { this->coeffDict().lookup("massTotal") >> massTotal_; this->coeffDict().lookup("SOI") >> SOI_; + SOI_ = owner.db().time().userTimeToTime(SOI_); } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C index ab10a98a0958d0846a96883d2ba280df67bdf5bd..b803a52ccd03f41f4c1f0d8e3bbbd59e8264b456 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.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 @@ -57,6 +57,8 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection injectorTetFaces_(0), injectorTetPts_(0) { + duration_ = owner.db().time().userTimeToTime(duration_); + // Set/cache the injector cells injectorCells_.setSize(injectors_.size()); injectorTetFaces_.setSize(injectors_.size()); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H index 9c88bc16e2c488139aef87fee6f79f56e8af0bcf..77807ac944a3b9c2a6b37d7ecbc0b3ac843dc2df 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,7 +73,7 @@ class KinematicLookupTableInjection const word inputFileName_; //- Injection duration - common to all injection sources - const scalar duration_; + scalar duration_; //- Number of parcels per injector - common to all injection sources const scalar parcelsPerSecond_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C index 1834fe07b041f4bd0c43ee26c4ae9c48f43ae951..edaef803b662ce642c6b858559c1be0635e07878 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.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 @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "PatchInjection.H" -#include "DataEntry.H" +#include "TimeDataEntry.H" #include "distributionModel.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -47,7 +47,12 @@ Foam::PatchInjection<CloudType>::PatchInjection U0_(this->coeffDict().lookup("U0")), flowRateProfile_ ( - DataEntry<scalar>::New("flowRateProfile", this->coeffDict()) + TimeDataEntry<scalar> + ( + owner.db().time(), + "flowRateProfile", + this->coeffDict() + ) ), sizeDistribution_ ( @@ -76,6 +81,8 @@ Foam::PatchInjection<CloudType>::PatchInjection const polyPatch& patch = owner.mesh().boundaryMesh()[patchId_]; + duration_ = owner.db().time().userTimeToTime(duration_); + cellOwners_ = patch.faceCells(); label patchSize = cellOwners_.size(); @@ -84,7 +91,7 @@ Foam::PatchInjection<CloudType>::PatchInjection fraction_ = scalar(patchSize)/totalPatchSize; // Set total volume/mass to inject - this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_); + this->volumeTotal_ = fraction_*flowRateProfile_.integrate(0.0, duration_); this->massTotal_ *= fraction_; } @@ -101,7 +108,7 @@ Foam::PatchInjection<CloudType>::PatchInjection duration_(im.duration_), parcelsPerSecond_(im.parcelsPerSecond_), U0_(im.U0_), - flowRateProfile_(im.flowRateProfile_().clone().ptr()), + flowRateProfile_(im.flowRateProfile_), sizeDistribution_(im.sizeDistribution_().clone().ptr()), cellOwners_(im.cellOwners_), fraction_(im.fraction_) @@ -171,7 +178,7 @@ Foam::scalar Foam::PatchInjection<CloudType>::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return fraction_*flowRateProfile_().integrate(time0, time1); + return fraction_*flowRateProfile_.integrate(time0, time1); } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H index f33349932be20bb4e9e67bd6689dc5218a11f8c7..fde6bcdd67cd57582ef66c8ceac0f4a2e1959185 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ namespace Foam { template<class Type> -class DataEntry; +class TimeDataEntry; class distributionModel; @@ -73,7 +73,7 @@ class PatchInjection const label patchId_; //- Injection duration [s] - const scalar duration_; + scalar duration_; //- Number of parcels to introduce per second [] const label parcelsPerSecond_; @@ -82,7 +82,7 @@ class PatchInjection const vector U0_; //- Flow rate profile relative to SOI [] - const autoPtr<DataEntry<scalar> > flowRateProfile_; + const TimeDataEntry<scalar> flowRateProfile_; //- Parcel size distribution model const autoPtr<distributionModels::distributionModel> sizeDistribution_; diff --git a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C index dd3d80ca0b3e8d1c87e230018e996f23070d55a0..07de5839eba589c0691212efe8c57db532e16783 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.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 @@ -56,6 +56,8 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection injectorTetFaces_(0), injectorTetPts_(0) { + duration_ = owner.db().time().userTimeToTime(duration_); + // Set/cache the injector cells injectorCells_.setSize(injectors_.size()); injectorTetFaces_.setSize(injectors_.size()); diff --git a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H index 25a9657a69a6b081b97ac321516a8a60015524f8..7a080d74eb31d185405b4f98cd553ca6190831f2 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,7 +76,7 @@ class ReactingLookupTableInjection const word inputFileName_; //- Injection duration - common to all injection sources - const scalar duration_; + scalar duration_; //- Number of parcels per injector - common to all injection sources const scalar parcelsPerSecond_; diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C index 274c8cc7187c3bd649f3301a77bd33d7dfd1b090..9fb28ece1ac2f3fbaafb6edc48924db3f79e856a 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.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 @@ -57,6 +57,8 @@ ReactingMultiphaseLookupTableInjection injectorTetFaces_(0), injectorTetPts_(0) { + duration_ = owner.db().time().userTimeToTime(duration_); + // Set/cache the injector cells injectorCells_.setSize(injectors_.size()); injectorTetFaces_.setSize(injectors_.size()); diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H index a41ba3cdc5011c17058aeda5bbad314ea0e5503e..00a89913ad953768ce763e1e5f9173d6aa008c29 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,7 +79,7 @@ class ReactingMultiphaseLookupTableInjection const word inputFileName_; //- Injection duration - common to all injection sources - const scalar duration_; + scalar duration_; //- Number of parcels per injector - common to all injection sources const scalar parcelsPerSecond_; diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C index 7208eab35312e3ec6f564957c030a72fb8646571..1220c229de3d572596f2740eb864120d5a6b6ec9 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.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 @@ -57,6 +57,8 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection injectorTetFaces_(0), injectorTetPts_(0) { + duration_ = owner.db().time().userTimeToTime(duration_); + // Set/cache the injector cells injectorCells_.setSize(injectors_.size()); injectorTetFaces_.setSize(injectors_.size()); diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H index c7019bb86007161584b6b9b62af42fc4a3a5274a..13a2ae49ebd30edae0ccbc9391505dd6e897ca4b 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ class ThermoLookupTableInjection const word inputFileName_; //- Injection duration - common to all injection sources - const scalar duration_; + scalar duration_; //- Number of parcels per injector - common to all injection sources const scalar parcelsPerSecond_; diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 3671592e114831afc47605d643daad560b1cb118..b9f8e2f1c3de0247223decba3c6a7367872dcca1 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -215,7 +215,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() ( "externalWallHeatFluxTemperatureFvPatchScalarField" "::updateCoeffs()" - ) << "Illegal mode " << operationModeNames[oldMode_] + ) << "Illegal heat flux mode " << operationModeNames[oldMode_] << exit(FatalError); } @@ -261,10 +261,31 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write { mixedFvPatchScalarField::write(os); temperatureCoupledBase::write(os); - q_.writeEntry("q", os); - h_.writeEntry("h", os); - Ta_.writeEntry("Ta", os); - this->writeEntry("value", os); + switch (oldMode_) + { + case fixedHeatFlux: + { + q_.writeEntry("q", os); + break; + } + case fixedHeatTransferCoeff: + { + h_.writeEntry("h", os); + Ta_.writeEntry("Ta", os); + break; + } + default: + { + FatalErrorIn + ( + "void externalWallHeatFluxTemperatureFvPatchScalarField::write" + "(" + "Ostream& os" + ") const" + ) << "Illegal heat flux mode " << operationModeNames[oldMode_] + << abort(FatalError); + } + } } diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index e28a68590391b8cbd750611ab51f601a04872179..d667a8b26eacb9c5c620e095849988d87b11aeb7 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -29,6 +29,7 @@ $(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScal $(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index a3d313e30285ffb9eaf10ac5c4f658518f6abec0..4b4273ff32ffcbb39accd680c50c2ac391ec8496 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -51,6 +51,8 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField z_(pTraits<vector>::zero), z0_(0), kappa_(0.41), + Uref_(0), + Href_(0), zGround_(0) {} @@ -69,6 +71,8 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField z_(ptf.z_), z0_(ptf.z0_), kappa_(ptf.kappa_), + Uref_(ptf.Uref_), + Href_(ptf.Href_), zGround_(ptf.zGround_) {} @@ -82,10 +86,12 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - Ustar_(readScalar(dict.lookup("Ustar"))), + Ustar_(p.size()), z_(dict.lookup("z")), z0_(readScalar(dict.lookup("z0"))), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + Uref_(readScalar(dict.lookup("Uref"))), + Href_(readScalar(dict.lookup("Href"))), zGround_("zGround", dict, p.size()) { if (mag(z_) < SMALL) @@ -103,6 +109,11 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField << abort(FatalError); } + forAll (Ustar_, i) + { + Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001))); + } + z_ /= mag(z_); evaluate(); @@ -121,6 +132,8 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField z_(blpsf.z_), z0_(blpsf.z0_), kappa_(blpsf.kappa_), + Uref_(blpsf.Uref_), + Href_(blpsf.Href_), zGround_(blpsf.zGround_) {} @@ -138,14 +151,16 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs() void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - os.writeKeyword("Ustar") - << Ustar_ << token::END_STATEMENT << nl; os.writeKeyword("z") << z_ << token::END_STATEMENT << nl; os.writeKeyword("z0") << z0_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("Uref") + << Uref_ << token::END_STATEMENT << nl; + os.writeKeyword("Href") + << Href_ << token::END_STATEMENT << nl; os.writeKeyword("zGround") << zGround_ << token::END_STATEMENT << nl; writeEntry("value", os); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H index ab08c621c95da1aa092c751da6192598e066a7d8..a1ff656334b9c5f17a9b0eefafc35615008fb6bc 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -41,6 +41,16 @@ Description z0 is the surface roughness lenght zGround minium vlaue in z direction + + and: + + Ustar = K Uref/ln((Zref + z0)/z0) + + where: + + Uref is the reference velocity at Zref + Zref is the reference height. + \endverbatim Reference: @@ -78,17 +88,23 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField // Private data //- Frictional velocity - const scalar Ustar_; + scalarField Ustar_; //- Direction of the z-coordinate vector z_; //- Surface roughness lenght - const scalar z0_; + scalarField z0_; //- Von Karman constant const scalar kappa_; + //- Reference velocity + const scalar Uref_; + + //- Reference hight + const scalar Href_; + //- Minimum corrdinate value in z direction const scalarField zGround_; @@ -158,7 +174,7 @@ public: // Member functions //- Return max value - scalar Ustar() const + scalarField Ustar() const { return Ustar_; } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index d2c3dfde62d47a8570b63b1ed07482463a381e92..628b300afd389db3bda931085dae6cbcc68b6089 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -88,16 +88,16 @@ atmBoundaryLayerInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - Ustar_(0), + Ustar_(p.size()), n_(dict.lookup("n")), z_(dict.lookup("z")), - z0_(readScalar(dict.lookup("z0"))), + z0_("z0", dict, p.size()), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), Uref_(readScalar(dict.lookup("Uref"))), Href_(readScalar(dict.lookup("Href"))), zGround_("zGround", dict, p.size()) { - if (mag(n_) < SMALL || mag(z_) < SMALL || mag(z0_) < SMALL) + if (mag(n_) < SMALL || mag(z_) < SMALL) { FatalErrorIn ( @@ -108,14 +108,17 @@ atmBoundaryLayerInletVelocityFvPatchVectorField "onst dictionary&" ")" ) - << "magnitude of n, z and z0 vectors must be greater than zero" + << "magnitude of n or z must be greater than zero" << abort(FatalError); } n_ /= mag(n_); z_ /= mag(z_); - Ustar_ = kappa_*Uref_/(log((Href_ + z0_)/max(z0_ , 0.001))); + forAll (Ustar_, i) + { + Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001))); + } evaluate(); } @@ -153,12 +156,12 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs() if ((coord[i] - zGround_[i]) < Href_) { Un[i] = - (Ustar_/kappa_) - * log((coord[i] - zGround_[i] + z0_)/max(z0_, 0.001)); + (Ustar_[i]/kappa_) + * log((coord[i] - zGround_[i] + z0_[i])/max(z0_[i], 0.001)); } else { - Un[i] = (Uref_); + Un[i] = Uref_; } } @@ -171,8 +174,7 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs() void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - os.writeKeyword("z0") - << z0_ << token::END_STATEMENT << nl; + zGround_.writeEntry("z0", os) ; os.writeKeyword("n") << n_ << token::END_STATEMENT << nl; os.writeKeyword("z") diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H index a3a87ab9d2931cea7413a3df5bda2793e67466ce..684405ece39d259079c0200ef5fe88e960e41c90 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -92,7 +92,7 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField // Private data //- Frictional velocity - scalar Ustar_; + scalarField Ustar_; //- Flow direction vector n_; @@ -101,7 +101,7 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField vector z_; //- Surface roughness lenght - const scalar z0_; + scalarField z0_; //- Von Karman constant const scalar kappa_; @@ -181,7 +181,7 @@ public: // Member functions //- Return Ustar - scalar& Ustar() + scalarField& Ustar() { return Ustar_; } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..162de9255a0d560f93176252f8c25468dbd59ac8 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "nutkAtmRoughWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + +tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const +{ + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + const tmp<volScalarField> tk = rasModel.k(); + const volScalarField& k = tk(); + const tmp<volScalarField> tnu = rasModel.nu(); + const volScalarField& nu = tnu(); + const scalarField& nuw = nu.boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + tmp<scalarField> tnutw(new scalarField(*this)); + scalarField& nutw = tnutw(); + + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uStar = Cmu25*sqrt(k[faceCellI]); + scalar yPlus = uStar*y[faceI]/nuw[faceI]; + + scalar Edash = (y[faceI] + z0_[faceI])/z0_[faceI]; + + nutw[faceI] = + nuw[faceI]*(yPlus*kappa_/log(max(Edash, 1+1e-4)) - 1); + + if (debug) + { + Info<< "yPlus = " << yPlus + << ", Edash = " << Edash + << ", nutw = " << nutw[faceI] + << endl; + } + } + + return tnutw; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +nutkAtmRoughWallFunctionFvPatchScalarField:: +nutkAtmRoughWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + nutkWallFunctionFvPatchScalarField(p, iF), + z0_(p.size(), 0.0) +{} + + +nutkAtmRoughWallFunctionFvPatchScalarField:: +nutkAtmRoughWallFunctionFvPatchScalarField +( + const nutkAtmRoughWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + z0_(ptf.z0_, mapper) +{} + + +nutkAtmRoughWallFunctionFvPatchScalarField:: +nutkAtmRoughWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + nutkWallFunctionFvPatchScalarField(p, iF, dict), + z0_("z0", dict, p.size()) +{} + + +nutkAtmRoughWallFunctionFvPatchScalarField:: +nutkAtmRoughWallFunctionFvPatchScalarField +( + const nutkAtmRoughWallFunctionFvPatchScalarField& rwfpsf +) +: + nutkWallFunctionFvPatchScalarField(rwfpsf), + z0_(rwfpsf.z0_) +{} + + +nutkAtmRoughWallFunctionFvPatchScalarField:: +nutkAtmRoughWallFunctionFvPatchScalarField +( + const nutkAtmRoughWallFunctionFvPatchScalarField& rwfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + nutkWallFunctionFvPatchScalarField(rwfpsf, iF), + z0_(rwfpsf.z0_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void nutkAtmRoughWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + nutkWallFunctionFvPatchScalarField::autoMap(m); + z0_.autoMap(m); +} + + +void nutkAtmRoughWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + nutkWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const nutkAtmRoughWallFunctionFvPatchScalarField& nrwfpsf = + refCast<const nutkAtmRoughWallFunctionFvPatchScalarField>(ptf); + + z0_.rmap(nrwfpsf.z0_, addr); +} + + +void nutkAtmRoughWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField<scalar>::write(os); + writeLocalEntries(os); + z0_.writeEntry("z0", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + nutkAtmRoughWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..aa045de4234d019479a1cbb1ebd2ccc4eca8e575 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::RASModels:: + nutkAtmRoughWallFunctionFvPatchScalarField + +Description + Boundary condition for turbulent (kinematic) viscosity for atmospheric + velocity profiles. + Desinged to be used togheter with atmBoundaryLayerInletVelocity. + It follows U = (Ustar/K) ln((z - zGround + z0)/z0) + + where: + + Ustar is the frictional velocity + K is karman's constant + z0 is the surface roughness lenght + z is the verical coordinate + zGround is the minumum coordinate value in z direction. + + +SourceFiles + nutkAtmRoughWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nutkAtmRoughWallFunctionFvPatchScalarField_H +#define nutkAtmRoughWallFunctionFvPatchScalarField_H + +#include "nutkWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class nutkAtmRoughWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class nutkAtmRoughWallFunctionFvPatchScalarField +: + public nutkWallFunctionFvPatchScalarField +{ +protected: + + // Protected data + + //- Surface roughness lenght + scalarField z0_; + + + // Protected Member Functions + + + //- Calculate the turbulence viscosity + virtual tmp<scalarField> calcNut() const; + + +public: + + //- Runtime type information + TypeName("nutkAtmRoughWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + nutkAtmRoughWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + nutkAtmRoughWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // nutkAtmRoughWallFunctionFvPatchScalarField + // onto a new patch + nutkAtmRoughWallFunctionFvPatchScalarField + ( + const nutkAtmRoughWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + nutkAtmRoughWallFunctionFvPatchScalarField + ( + const nutkAtmRoughWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new nutkAtmRoughWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + nutkAtmRoughWallFunctionFvPatchScalarField + ( + const nutkAtmRoughWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new nutkAtmRoughWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Acces functions + + // Return z0 + scalarField& z0() + { + return z0_; + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0/epsilon b/tutorials/incompressible/simpleFoam/turbineSiting/0/epsilon index 8a3f6570841ba0fb5562a5d22a9e636f8a6da612..cbbcc3aebf1d66be973620bc24c7b867d2b14c96 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0/epsilon +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0/epsilon @@ -40,7 +40,8 @@ boundaryField inlet { type atmBoundaryLayerInletEpsilon; - Ustar $Ustar; + Uref $Uref; + Href $Href; z $zDirection; z0 $z0; value $internalField; diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0/include/ABLConditions b/tutorials/incompressible/simpleFoam/turbineSiting/0/include/ABLConditions index be005f46a0764e366af7149e6670fb6ba8826638..b63b50f4175e2d921da42ba7fbf516706c4df3e4 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0/include/ABLConditions +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0/include/ABLConditions @@ -6,10 +6,9 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -Ustar 0.82; Uref 10.0; Href 20; -z0 0.1; +z0 uniform 0.1; turbulentKE 1.3; windDirection (1 0 0); zDirection (0 0 1); diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0/nut b/tutorials/incompressible/simpleFoam/turbineSiting/0/nut index 5e17706e0a03a745d6377c9ebef48157cb080498..be1471daf357a8706ba9f6132434ac48bd875808 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0/nut +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0/nut @@ -36,9 +36,8 @@ boundaryField "terrain_.*" { - type nutkRoughWallFunction; - Ks uniform 0.2; //Ks = 20 Z0 - Cs uniform 0.5; + type nutkAtmRoughWallFunction; + z0 $Z0; value uniform 0.0; } diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary index 7abdd81f4fef7404693356fc268d5daa1c6fff5d..7b72e85f595d014f15070eef4db4e25d5088980a 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary +++ b/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary @@ -15,43 +15,37 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -6 +5 ( outlet { type patch; - nFaces 922; - startFace 364825; + nFaces 600; + startFace 51900; } sides { type patch; - nFaces 1834; - startFace 365747; + nFaces 1200; + startFace 52500; } inlet { type patch; - nFaces 923; - startFace 367581; + nFaces 600; + startFace 53700; } ground { type wall; - nFaces 0; - startFace 368504; + nFaces 900; + startFace 54300; } top { type patch; nFaces 900; - startFace 368504; - } - terrain_patch0 - { - type wall; - nFaces 16037; - startFace 369404; + startFace 55200; } ) diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/constant/sourcesProperties b/tutorials/incompressible/simpleFoam/turbineSiting/constant/sourcesProperties index 00249342e45a83992c644f81ecf52b52d495462f..a57b5a3b7b34398ead9e3db058e1b200e971a041 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/constant/sourcesProperties +++ b/tutorials/incompressible/simpleFoam/turbineSiting/constant/sourcesProperties @@ -27,10 +27,11 @@ disk1 actuationDiskSourceCoeffs { fieldNames (U); - diskDir (-1 0 0); // orientation of the disk - Cp 0.53; // Cp - Ct 0.58; // Ct - diskArea 40; // disk area + diskDir (-1 0 0); // orientation of the disk + Cp 0.386; // Cp + Ct 0.58; // Ct + diskArea 40; // disk area + upstreamPoint (581849 4785810 1065); } } @@ -50,6 +51,7 @@ disk2 Cp 0.53; Ct 0.58; diskArea 40; + upstreamPoint (581753 4785663 1070); } } diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/system/changeDictionaryDict b/tutorials/incompressible/simpleFoam/turbineSiting/system/changeDictionaryDict index 5ad20a759e52fbf70b8170677347d64dec979c0e..e90a3425ce88d78c34307ac640258a2943897b96 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/system/changeDictionaryDict +++ b/tutorials/incompressible/simpleFoam/turbineSiting/system/changeDictionaryDict @@ -15,6 +15,7 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "$FOAM_CASE/0/include/initialConditions" +#include "$FOAM_CASE/0/include/ABLConditions" dictionaryReplacement { @@ -99,12 +100,12 @@ dictionaryReplacement inlet { type atmBoundaryLayerInletVelocity; - Uref 10.0; - Href 20; - n (1 0 0); - z (0 0 1); - z0 0.1; - zGround 935.0; + Uref $Uref; + Href $Href; + n $windDirection; + z $zDirection; + z0 $z0; + zGround $zGround; value uniform $flowVelocity; } "terrain_.*" @@ -141,9 +142,8 @@ dictionaryReplacement } "terrain_.*" { - type nutkRoughWallFunction; - Ks uniform 0.2; //Ks = 20 Z0 - Cs uniform 0.5; + type nutkAtmRoughWallFunction; + z0 $z0; value uniform 0.0; } ground @@ -170,11 +170,12 @@ dictionaryReplacement inlet { type atmBoundaryLayerInletEpsilon; - Ustar 0.82; - z (0 0 1); - z0 0.1; + z $zDirection; + z0 $z0; + zGround $zGround; + Uref $Uref; + Href $Href; value uniform $turbulentEpsilon; - zGround 935.0; } "terrain_.*" {