diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H index 743b1d68ff740c1d951ef8ddcd799e9e27171125..d9ca1b09e05deaec756ea4cb83c22b703eb38e43 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H @@ -31,7 +31,7 @@ if (solveSpecies) == parcels.SYi(i, Yi) + combustion->R(Yi) - + sources(Yi) + + sources(rho, Yi) ); sources.constrain(YEqn); diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H index 9ef9d6a1a0e8e747a41f5c2f663ba66d7debff3f..3e4a041f90162e089b6ab0b29913534345f944ef 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H @@ -47,17 +47,10 @@ #include "createPhi.H" - Info<< "Creating turbulence model\n" << endl; - singlePhaseTransportModel laminarTransport(U, phi); const volScalarField nu(laminarTransport.nu()); - autoPtr<incompressible::turbulenceModel> turbulence - ( - incompressible::turbulenceModel::New(U, phi, laminarTransport) - ); - volScalarField mu ( IOobject diff --git a/applications/test/volPointInterpolation/Test-volPointInterpolation.C b/applications/test/volPointInterpolation/Test-volPointInterpolation.C index 1bbcd6da5e484edf333b620098f1bccc4362144d..96ffeeac377449a728a529de0f7c92180592cb22 100644 --- a/applications/test/volPointInterpolation/Test-volPointInterpolation.C +++ b/applications/test/volPointInterpolation/Test-volPointInterpolation.C @@ -33,11 +33,10 @@ Application int main(int argc, char *argv[]) { + #include "setRootCase.H" -# include "setRootCase.H" - -# include "createTime.H" -# include "createMesh.H" + #include "createTime.H" + #include "createMesh.H" Info<< "Reading field p\n" << endl; volScalarField p @@ -67,9 +66,29 @@ int main(int argc, char *argv[]) mesh ); + const pointMesh& pMesh = pointMesh::New(mesh); + const pointBoundaryMesh& pbm = pMesh.boundary(); + + Info<< "pointMesh boundary" << nl; + forAll(pbm, patchI) + { + Info<< "patch=" << pbm[patchI].name() + << ", type=" << pbm[patchI].type() + << ", coupled=" << pbm[patchI].coupled() + << endl; + } + const volPointInterpolation& pInterp = volPointInterpolation::New(mesh); + pointScalarField pp(pInterp.interpolate(p)); + Info<< pp.name() << " boundary" << endl; + forAll(pp.boundaryField(), patchI) + { + Info<< pbm[patchI].name() << " coupled=" + << pp.boundaryField()[patchI].coupled()<< endl; + } + pp.write(); pointVectorField pU(pInterp.interpolate(U)); diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/files b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/files deleted file mode 100644 index c96d0406ba110b3e312419edc690c91ee5e83336..0000000000000000000000000000000000000000 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -redistributeMeshPar.C - -EXE = $(FOAM_APPBIN)/redistributeMeshPar diff --git a/applications/utilities/parallelProcessing/redistributePar/Make/files b/applications/utilities/parallelProcessing/redistributePar/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..ce0b6760d450aa3779b1ddb3cdd766d53048e14f --- /dev/null +++ b/applications/utilities/parallelProcessing/redistributePar/Make/files @@ -0,0 +1,3 @@ +redistributePar.C + +EXE = $(FOAM_APPBIN)/redistributePar diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options b/applications/utilities/parallelProcessing/redistributePar/Make/options similarity index 100% rename from applications/utilities/parallelProcessing/redistributeMeshPar/Make/options rename to applications/utilities/parallelProcessing/redistributePar/Make/options diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C similarity index 99% rename from applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C rename to applications/utilities/parallelProcessing/redistributePar/redistributePar.C index e8522fa18b8eec8a35e046e37619d1ab0dc5ee66..5eaff912ef31ea5a9d1122fbbb9cbce4f0beb63d 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application - redistributeMeshPar + redistributePar Description Redistributes existing decomposed mesh and fields according to the current @@ -42,7 +42,7 @@ Description cp -r constant processor0 # Distribute - mpirun -np ddd redistributeMeshPar -parallel + mpirun -np ddd redistributePar -parallel \endverbatim \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C new file mode 100644 index 0000000000000000000000000000000000000000..3fe17d24a01e1cbf6c973d3ce7e9ca448d171059 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "CSV.H" +#include "DynamicList.H" +#include "IFstream.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +namespace Foam +{ + // doesn't recognize specialization otherwise + template<> + scalar CSV<scalar>::readValue(const List<string>& splitted) + { + if (componentColumns_[0] >= splitted.size()) + { + FatalErrorIn("CSV<scalar>::readValue(const List<string>&)") + << "No column " << componentColumns_[0] << " in " + << splitted << endl + << exit(FatalError); + } + + return readScalar(IStringStream(splitted[componentColumns_[0]])()); + } + + + template<class Type> + Type CSV<Type>::readValue(const List<string>& splitted) + { + Type result; + + for (label i = 0; i < pTraits<Type>::nComponents; i++) + { + if (componentColumns_[i] >= splitted.size()) + { + FatalErrorIn("CSV<Type>::readValue(const List<string>&)") + << "No column " << componentColumns_[i] << " in " + << splitted << endl + << exit(FatalError); + } + + result[i] = + readScalar(IStringStream(splitted[componentColumns_[i]])()); + } + + return result; + } +} + + +template<class Type> +void Foam::CSV<Type>::read() +{ + IFstream is(fName_.expand()); + + DynamicList<Tuple2<scalar, Type> > values; + + // skip header + if (headerLine_) + { + string line; + is.getLine(line); + } + + // read data + while (is.good()) + { + string line; + is.getLine(line); + + DynamicList<string> splitted; + + std::size_t pos = 0; + while (pos != std::string::npos) + { + std::size_t nPos = line.find(separator_, pos); + + if (nPos == std::string::npos) + { + splitted.append(line.substr(pos)); + pos = nPos; + } + else + { + splitted.append(line.substr(pos, nPos - pos)); + pos = nPos + 1; + } + } + + if (splitted.size() <= 1) + { + break; + } + + scalar x = readScalar(IStringStream(splitted[refColumn_])()); + Type value = readValue(splitted); + + values.append(Tuple2<scalar,Type>(x, value)); + } + + this->table_.transfer(values); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::CSV<Type>::CSV(const word& entryName, const dictionary& dict) +: + DataEntry<Type>(entryName), + TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")), + coeffs_(dict.subDict(type() + "Coeffs")), + headerLine_(readBool(coeffs_.lookup("hasHeaderLine"))), + refColumn_(readLabel(coeffs_.lookup("refColumn"))), + componentColumns_(coeffs_.lookup("componentColumns")), + separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]), + fName_(coeffs_.lookup("fileName")) +{ + if (componentColumns_.size() != pTraits<Type>::nComponents) + { + FatalErrorIn("Foam::CSV<Type>::CSV(const word&, Istream&)") + << componentColumns_ << " does not have the expected length of " + << pTraits<Type>::nComponents << endl + << exit(FatalError); + } + + read(); + + TableBase<Type>::check(); +} + + +template<class Type> +Foam::CSV<Type>::CSV(const CSV<Type>& tbl) +: + DataEntry<Type>(tbl), + TableBase<Type>(tbl), + headerLine_(tbl.headerLine_), + refColumn_(tbl.refColumn_), + componentColumns_(tbl.componentColumns_), + separator_(tbl.separator_), + fName_(tbl.fName_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::CSV<Type>::~CSV() +{} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "CSVIO.C" + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H new file mode 100644 index 0000000000000000000000000000000000000000..c95406350b3b461546266e6cad4ee0badb3dffb4 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H @@ -0,0 +1,183 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::CSV + +Description + Templated CSV container data entry. Reference column is always a scalar, + e.g. time + + \verbatim + <entryName> csvFile + { + hasHeaderLine true; + refColumn 0; // reference column index + componentColumns (0 1 2); // component column indices + separator ","; // optional (defaults to ",") + fileName fileXYZ; // name of csv data file + outOfBounds clamp; // optional out-of-bounds handling + } + \endverbatim + +SourceFiles + CSV.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CSV_H +#define CSV_H + +#include "DataEntry.H" +#include "TableBase.H" +#include "Tuple2.H" +#include "labelList.H" +#include "ISstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<class Type> +class CSV; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const CSV<Type>& +); + +/*---------------------------------------------------------------------------*\ + Class CSV Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class CSV +: + public DataEntry<Type>, + public TableBase<Type> +{ + // Private data + + //- Coefficients dictionary (for convenience on reading) + dictionary coeffs_; + + //- Does the file have a header line? + bool headerLine_; + + //- Column of the time + label refColumn_; + + //- Labels of the components + labelList componentColumns_; + + //- Separator character + char separator_; + + //- File name for csv table (optional) + fileName fName_; + + + // Private Member Functions + + //- Read csv data table + void read(); + + //- Read the next value from the splitted string + Type readValue(const List<string>&); + + //- Disallow default bitwise assignment + void operator=(const CSV<Type>&); + + +public: + + //- Runtime type information + TypeName("csvFile"); + + + // Constructors + + //- Construct from entry name and Istream + CSV(const word& entryName, const dictionary& dict); + + //- Copy constructor + CSV(const CSV<Type>& tbl); + + //- Construct and return a clone + virtual tmp<DataEntry<Type> > clone() const + { + return tmp<DataEntry<Type> >(new CSV<Type>(*this)); + } + + + //- Destructor + virtual ~CSV(); + + + // Member Functions + + //- 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 + + //- Ostream Operator + friend Ostream& operator<< <Type> + ( + Ostream& os, + const CSV<Type>& cnst + ); + + //- Write in dictionary format + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "CSV.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C new file mode 100644 index 0000000000000000000000000000000000000000..d16ca23ab89696b9a8a5169962c0c649bc180c61 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "DataEntry.H" + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const CSV<Type>& tbl +) +{ + if (os.format() == IOstream::ASCII) + { + os << static_cast<const DataEntry<Type>& >(tbl) + << token::SPACE << tbl.headerLine_ + << token::SPACE << tbl.timeColumn_ + << token::SPACE << tbl.componentColumns_ + << token::SPACE << tbl.separator_ + << token::SPACE << tbl.fileName_; + } + else + { + os << static_cast<const DataEntry<Type>& >(tbl); + } + + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const CSV<Type>&)" + ); + + return os; +} + + +template<class Type> +void Foam::CSV<Type>::writeData(Ostream& os) const +{ + DataEntry<Type>::writeData(os); + + os << token::END_STATEMENT << nl; + os << indent << word(type() + "Coeffs") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + os.writeKeyword("headerLine") << headerLine_ << token::END_STATEMENT << nl; + os.writeKeyword("refColumn") << refColumn_ << token::END_STATEMENT << nl; + os.writeKeyword("componentColumns") << componentColumns_ + << token::END_STATEMENT << nl; + os.writeKeyword("separator") << string(separator_) + << token::END_STATEMENT << nl; + os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl; + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C index 2fe5238d8d890eed0825a70801d63f590dcecc0c..410052f5608004d9862724051d820692fcafa361 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C @@ -28,11 +28,14 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> -Foam::Constant<Type>::Constant(const word& entryName, Istream& is) +Foam::Constant<Type>::Constant(const word& entryName, const dictionary& dict) : DataEntry<Type>(entryName), value_(pTraits<Type>::zero) { + Istream& is(dict.lookup(entryName)); + word entryType(is); + is >> value_; } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H index 658a667240998f6cce3609b808ac84e6b4fc57e7..c42e07e054e15c843961e5cae9db8111031fcd03 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H @@ -83,7 +83,7 @@ public: // Constructors //- Construct from entry name and Istream - Constant(const word& entryName, Istream& is); + Constant(const word& entryName, const dictionary& dict); //- Copy constructor Constant(const Constant<Type>& cnst); diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H index 03d1da361a0fa759c00dfbe563e35468ed431068..5b3e7831016a61333bdc38ddfd09cd69eb25d454 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H @@ -92,9 +92,9 @@ public: dictionary, ( const word& entryName, - Istream& is + const dictionary& dict ), - (entryName, is) + (entryName, dict) ); diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C index a62ce1054f0ad4424e7333051166c1fbf07685ea..57cf79c419ba39e5763c32a1605ed5345096f3af 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C @@ -35,7 +35,6 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New ) { Istream& is(dict.lookup(entryName)); - word DataEntryType(is); typename dictionaryConstructorTable::iterator cstrIter = @@ -54,7 +53,7 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New << exit(FatalError); } - return autoPtr<DataEntry<Type> >(cstrIter()(entryName, is)); + return autoPtr<DataEntry<Type> >(cstrIter()(entryName, dict)); } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C index 91e501f5be505fdbd6686679a36fbfe6d3a30544..dd60ac90fb55af2d46f848aa8e2184c90d317765 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C @@ -28,17 +28,17 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> -Foam::Table<Type>::Table(const word& entryName, Istream& is) +Foam::Table<Type>::Table(const word& entryName, const dictionary& dict) : DataEntry<Type>(entryName), - table_(is) + TableBase<Type>(entryName, dictionary::null) { - if (!table_.size()) - { - FatalErrorIn("Foam::Table<Type>::Table(const Istream&)") - << "Table for entry " << this->name_ << " is invalid (empty)" - << nl << exit(FatalError); - } + Istream& is(dict.lookup(entryName)); + word entryType(is); + + is >> this->table_; + + TableBase<Type>::check(); } @@ -46,7 +46,7 @@ template<class Type> Foam::Table<Type>::Table(const Table<Type>& tbl) : DataEntry<Type>(tbl), - table_(tbl.table_) + TableBase<Type>(tbl) {} @@ -57,98 +57,6 @@ Foam::Table<Type>::~Table() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -Type Foam::Table<Type>::value(const scalar x) const -{ - // Return zero if out of bounds - if (x < table_[0].first() || x > table_.last().first()) - { - return pTraits<Type>::zero; - } - - // Find i such that x(i) < x < x(i+1) - label i = 0; - while ((table_[i+1].first() < x) && (i+1 < table_.size())) - { - i++; - } - - // Linear interpolation to find value. Note constructor needed for - // Table<label> to convert intermediate scalar back to label. - return Type - ( - (x - table_[i].first())/(table_[i+1].first() - table_[i].first()) - * (table_[i+1].second() - table_[i].second()) - + table_[i].second() - ); -} - - -template<class Type> -Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const -{ - // Initialise return value - Type sum = pTraits<Type>::zero; - - // Return zero if out of bounds - if ((x1 > table_.last().first()) || (x2 < table_[0].first())) - { - return sum; - } - - // Find next index greater than x1 - label id1 = 0; - while ((table_[id1].first() < x1) && (id1 < table_.size())) - { - id1++; - } - - // Find next index less than x2 - label id2 = table_.size() - 1; - while ((table_[id2].first() > x2) && (id2 >= 1)) - { - id2--; - } - - if ((id1 - id2) == 1) - { - // x1 and x2 lie within 1 interval - sum = 0.5*(value(x1) + value(x2))*(x2 - x1); - } - else - { - // x1 and x2 cross multiple intervals - - // Integrate table body - for (label i=id1; i<id2; i++) - { - sum += - (table_[i].second() + table_[i+1].second()) - * (table_[i+1].first() - table_[i].first()); - } - sum *= 0.5; - - // Add table ends (partial segments) - if (id1 > 0) - { - sum += 0.5 - * (value(x1) + table_[id1].second()) - * (table_[id1].first() - x1); - } - if (id2 < table_.size() - 1) - { - sum += 0.5 - * (table_[id2].second() + value(x2)) - * (x2 - table_[id2].first()); - } - } - - return sum; -} - - // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "TableIO.C" diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H index ab4ee3dd162451cbf6523f926edaf8ded31ab0d9..c1ba2121e8903cfd99292919c740b19e3c79bc6d 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H @@ -70,14 +70,9 @@ Ostream& operator<< template<class Type> class Table : - public DataEntry<Type> + public DataEntry<Type>, + public TableBase<Type> { - // Private data - - //- Table data - List<Tuple2<scalar, Type> > table_; - - // Private Member Functions //- Disallow default bitwise assignment @@ -93,7 +88,7 @@ public: // Constructors //- Construct from entry name and Istream - Table(const word& entryName, Istream& is); + Table(const word& entryName, const dictionary& dict); //- Copy constructor Table(const Table<Type>& tbl); @@ -112,10 +107,16 @@ public: // Member Functions //- Return Table value - Type value(const scalar x) const; + virtual Type value(const scalar x) const + { + return TableBase<Type>::value(x); + } //- Integrate between two (scalar) values - Type integrate(const scalar x1, const scalar x2) const; + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase<Type>::integrate(x1, x2); + } // I/O @@ -124,7 +125,7 @@ public: friend Ostream& operator<< <Type> ( Ostream& os, - const Table<Type>& cnst + const Table<Type>& tbl ); //- Write in dictionary format diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C new file mode 100644 index 0000000000000000000000000000000000000000..165b542ad8c9e290a2f1869d4d77f0123e12a5ec --- /dev/null +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C @@ -0,0 +1,399 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "TableBase.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict) +: + name_(name), + boundsHandling_ + ( + wordToBoundsHandling + ( + dict.lookupOrDefault<word>("outOfBounds", "clamp") + ) + ), + table_() +{} + + +template<class Type> +Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl) +: + name_(tbl.name_), + boundsHandling_(tbl.boundsHandling_), + table_(tbl.table_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::TableBase<Type>::~TableBase() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::word Foam::TableBase<Type>::boundsHandlingToWord +( + const boundsHandling& bound +) const +{ + word enumName("warn"); + + switch (bound) + { + case ERROR: + { + enumName = "error"; + break; + } + case WARN: + { + enumName = "warn"; + break; + } + case CLAMP: + { + enumName = "clamp"; + break; + } + case REPEAT: + { + enumName = "repeat"; + break; + } + } + + return enumName; +} + + +template<class Type> +typename Foam::TableBase<Type>::boundsHandling +Foam::TableBase<Type>::wordToBoundsHandling +( + const word& bound +) const +{ + if (bound == "error") + { + return ERROR; + } + else if (bound == "warn") + { + return WARN; + } + else if (bound == "clamp") + { + return CLAMP; + } + else if (bound == "repeat") + { + return REPEAT; + } + else + { + WarningIn("Foam::TableBase<Type>::wordToBoundsHandling(const word&)") + << "bad outOfBounds specifier " << bound << " using 'warn'" + << endl; + + return WARN; + } +} + + +template<class Type> +typename Foam::TableBase<Type>::boundsHandling +Foam::TableBase<Type>::outOfBounds +( + const boundsHandling& bound +) +{ + boundsHandling prev = boundsHandling_; + boundsHandling_ = bound; + return prev; +} + + +template<class Type> +void Foam::TableBase<Type>::check() const +{ + if (!table_.size()) + { + FatalErrorIn("Foam::TableBase<Type>::check() const") + << "Table for entry " << this->name_ << " is invalid (empty)" + << nl << exit(FatalError); + } + + label n = table_.size(); + scalar prevValue = table_[0].first(); + + for (label i = 1; i < n; ++i) + { + const scalar currValue = table_[i].first(); + + // avoid duplicate values (divide-by-zero error) + if (currValue <= prevValue) + { + FatalErrorIn("Foam::TableBase<Type>::check() const") + << "out-of-order value: " << currValue << " at index " << i + << exit(FatalError); + } + prevValue = currValue; + } +} + + +template<class Type> +bool Foam::TableBase<Type>::checkMinBounds +( + const scalar x, + scalar& xDash +) const +{ + if (x < table_[0].first()) + { + switch (boundsHandling_) + { + case ERROR: + { + FatalErrorIn + ( + "bool Foam::TableBase<Type>::checkMinBounds" + "(" + "const scalar, " + "scalar&" + ") const" + ) << "value (" << x << ") underflow" + << exit(FatalError); + break; + } + case WARN: + { + WarningIn + ( + "bool Foam::TableBase<Type>::checkMinBounds" + "(" + "const scalar, " + "scalar&" + ") const" + ) << "value (" << x << ") underflow" << nl + << endl; + + // fall-through to 'CLAMP' + } + case CLAMP: + { + xDash = table_[0].first(); + return true; + break; + } + case REPEAT: + { + // adjust x to >= minX + scalar span = table_.last().first() - table_[0].first(); + xDash = fmod(x - table_[0].first(), span) + table_[0].first(); + break; + } + } + } + else + { + xDash = x; + } + + return false; +} + + +template<class Type> +bool Foam::TableBase<Type>::checkMaxBounds +( + const scalar x, + scalar& xDash +) const +{ + if (x > table_.last().first()) + { + switch (boundsHandling_) + { + case ERROR: + { + FatalErrorIn + ( + "bool Foam::TableBase<Type>::checkMaxBounds" + "(" + "const scalar, " + "scalar&" + ") const" + ) << "value (" << x << ") overflow" + << exit(FatalError); + break; + } + case WARN: + { + WarningIn + ( + "bool Foam::TableBase<Type>::checkMaxBounds" + "(" + "const scalar, " + "scalar&" + ") const" + ) << "value (" << x << ") overflow" << nl + << endl; + + // fall-through to 'CLAMP' + } + case CLAMP: + { + xDash = table_.last().first(); + return true; + break; + } + case REPEAT: + { + // adjust x to >= minX + scalar span = table_.last().first() - table_[0].first(); + xDash = fmod(x - table_[0].first(), span) + table_[0].first(); + break; + } + } + } + else + { + xDash = x; + } + + return false; +} + + +template<class Type> +Type Foam::TableBase<Type>::value(const scalar x) const +{ + scalar xDash = x; + + if (checkMinBounds(x, xDash)) + { + return table_[0].second(); + } + + if (checkMaxBounds(xDash, xDash)) + { + return table_.last().second(); + } + + // Find i such that x(i) < xDash < x(i+1) + label i = 0; + while ((table_[i+1].first() < xDash) && (i+1 < table_.size())) + { + i++; + } + + // Linear interpolation to find value + return Type + ( + (xDash - table_[i].first())/(table_[i+1].first() - table_[i].first()) + * (table_[i+1].second() - table_[i].second()) + + table_[i].second() + ); +} + + +template<class Type> +Type Foam::TableBase<Type>::integrate(const scalar x1, const scalar x2) const +{ + // Initialise return value + Type sum = pTraits<Type>::zero; + + // Return zero if out of bounds + if ((x1 > table_.last().first()) || (x2 < table_[0].first())) + { + return sum; + } + + // Find next index greater than x1 + label id1 = 0; + while ((table_[id1].first() < x1) && (id1 < table_.size())) + { + id1++; + } + + // Find next index less than x2 + label id2 = table_.size() - 1; + while ((table_[id2].first() > x2) && (id2 >= 1)) + { + id2--; + } + + if ((id1 - id2) == 1) + { + // x1 and x2 lie within 1 interval + sum = 0.5*(value(x1) + value(x2))*(x2 - x1); + } + else + { + // x1 and x2 cross multiple intervals + + // Integrate table body + for (label i=id1; i<id2; i++) + { + sum += + (table_[i].second() + table_[i+1].second()) + * (table_[i+1].first() - table_[i].first()); + } + sum *= 0.5; + + // Add table ends (partial segments) + if (id1 > 0) + { + sum += 0.5 + * (value(x1) + table_[id1].second()) + * (table_[id1].first() - x1); + } + if (id2 < table_.size() - 1) + { + sum += 0.5 + * (table_[id2].second() + value(x2)) + * (x2 - table_[id2].first()); + } + } + + return sum; +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "TableBaseIO.C" + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H new file mode 100644 index 0000000000000000000000000000000000000000..f4d20028bcc0616cecb5d26ed9b2dab7d992cf60 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::TableBase + +Description + Base class for table with bounds handling, interpolation and integration + +SourceFiles + TableBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TableBase_H +#define TableBase_H + +#include "DataEntry.H" +#include "Tuple2.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<class Type> +class TableBase; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const TableBase<Type>& +); + +/*---------------------------------------------------------------------------*\ + Class TableBase Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class TableBase +{ +public: + + // Public data types + + //- Enumeration for handling out-of-bound values + enum boundsHandling + { + ERROR, /*!< Exit with a FatalError */ + WARN, /*!< Issue warning and clamp value (default) */ + CLAMP, /*!< Clamp value to the start/end value */ + REPEAT /*!< Treat as a repeating list */ + }; + + +protected: + + // Protected data + + //- Table name + word name_; + + //- Enumeration for handling out-of-bound values + boundsHandling boundsHandling_; + + //- Table data + List<Tuple2<scalar, Type> > table_; + + + // Protected Member Functions + + //- Disallow default bitwise assignment + void operator=(const TableBase<Type>&); + + +public: + + // Constructors + + //- Construct from dictionary - note table is not populated + TableBase(const word& name, const dictionary& dict); + + //- Copy constructor + TableBase(const TableBase<Type>& tbl); + + + //- Destructor + virtual ~TableBase(); + + + // Member Functions + + //- Return the out-of-bounds handling as a word + word boundsHandlingToWord(const boundsHandling& bound) const; + + //- Return the out-of-bounds handling as an enumeration + boundsHandling wordToBoundsHandling(const word& bound) const; + + //- Set the out-of-bounds handling from enum, return previous setting + boundsHandling outOfBounds(const boundsHandling& bound); + + //- Check the table for size and consistency + void check() const; + + //- Check minimum table bounds + bool checkMinBounds(const scalar x, scalar& xDash) const; + + //- Check maximum table bounds + bool checkMaxBounds(const scalar x, scalar& xDash) const; + + //- Return Table value + 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 TableBase<Type>& tbl + ); + + //- Write in dictionary format + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TableBase.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFieldsFwd.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C similarity index 63% rename from src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFieldsFwd.H rename to src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C index 5907a7ccf2a8944f4a1cd0bf33903fcd710d38d0..438c657a8f19e22acd142f423e69328d623bea94 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFieldsFwd.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C @@ -23,28 +23,45 @@ License \*---------------------------------------------------------------------------*/ -#ifndef timeVaryingUniformFixedValueFvPatchFieldsFwd_H -#define timeVaryingUniformFixedValueFvPatchFieldsFwd_H +#include "DataEntry.H" -#include "fieldTypes.H" +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const TableBase<Type>& tbl +) { + if (os.format() == IOstream::ASCII) + { + os << token::SPACE << tbl.table_; + } + else + { + os.write + ( + reinterpret_cast<const char*>(&tbl.table_), + sizeof(tbl.table_) + ); + } + + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const TableBase<Type>&, const bool)" + ); + + return os; +} + + +template<class Type> +void Foam::TableBase<Type>::writeData(Ostream& os) const +{ + os << nl << indent << table_ << token::END_STATEMENT << nl; +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template<class Type> class timeVaryingUniformFixedValueFvPatchField; - -makePatchTypeFieldTypedefs(timeVaryingUniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C index 6fd26f353f38d59545050ef7a2b8c4fdcb21280f..ec43d46dd9c37f91a96ca2015d5d4ba5ba6fcd6e 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C @@ -34,20 +34,8 @@ Foam::Ostream& Foam::operator<< const Table<Type>& tbl ) { - if (os.format() == IOstream::ASCII) - { - os << static_cast<const DataEntry<Type>& >(tbl) - << token::SPACE << tbl.table_; - } - else - { - os << static_cast<const DataEntry<Type>& >(tbl); - os.write - ( - reinterpret_cast<const char*>(&tbl.table_), - sizeof(tbl.table_) - ); - } + os << static_cast<const DataEntry<Type>&>(tbl) + << static_cast<const TableBase<Type>&>(tbl); // Check state of Ostream os.check @@ -63,8 +51,7 @@ template<class Type> void Foam::Table<Type>::writeData(Ostream& os) const { DataEntry<Type>::writeData(os); - - os << nl << indent << table_ << token::END_STATEMENT << nl; + TableBase<Type>::writeData(os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C similarity index 59% rename from src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C rename to src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C index 78b31de35dbeec55730e085ffb369a5e99ee7cb7..9c34b0cd1c2bf38ac75213b2704bb22288e0454d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C @@ -23,21 +23,47 @@ License \*---------------------------------------------------------------------------*/ -#include "timeVaryingUniformFixedValueFvPatchFields.H" -#include "addToRunTimeSelectionTable.H" -#include "volFields.H" +#include "TableFile.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -namespace Foam +template<class Type> +Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict) +: + DataEntry<Type>(entryName), + TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")), + fName_("none") { + const dictionary coeffs(dict.subDict(type() + "Coeffs")); + coeffs.lookup("fileName") >> fName_; -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + IFstream is(fName_.expand()); -makePatchFields(timeVaryingUniformFixedValue); + is >> this->table_; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + TableBase<Type>::check(); +} + + +template<class Type> +Foam::TableFile<Type>::TableFile(const TableFile<Type>& tbl) +: + DataEntry<Type>(tbl), + TableBase<Type>(tbl), + fName_(tbl.fName_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::TableFile<Type>::~TableFile() +{} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "TableFileIO.C" -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H new file mode 100644 index 0000000000000000000000000000000000000000..05b525d3a8741eb91c0ddfea6923a6a8c098cc55 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::TableFile + +Description + Templated table container data entry where data is read from file. + + \verbatim + <entryName> tableFile; + tableCoeffs + { + fileName dataFile; // name of data file + outOfBounds clamp; // optional out-of-bounds handling + } + \endverbatim + + Items are stored in a list of Tuple2's. First column is always stored as + scalar entries. Data is read in the form, e.g. for an entry \<entryName\> + that is (scalar, vector): + \verbatim + ( + 0.0 (1 2 3) + 1.0 (4 5 6) + ); + \endverbatim + + +SourceFiles + TableFile.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TableFile_H +#define TableFile_H + +#include "DataEntry.H" +#include "Tuple2.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<class Type> +class TableFile; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const TableFile<Type>& +); + +/*---------------------------------------------------------------------------*\ + Class TableFile Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class TableFile +: + public DataEntry<Type>, + public TableBase<Type> +{ + // Private data + + //- File name for csv table (optional) + fileName fName_; + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const TableFile<Type>&); + + +public: + + //- Runtime type information + TypeName("tableFile"); + + + // Constructors + + //- Construct from entry name and Istream + TableFile(const word& entryName, const dictionary& dict); + + //- Copy constructor + TableFile(const TableFile<Type>& tbl); + + //- Construct and return a clone + virtual tmp<DataEntry<Type> > clone() const + { + return tmp<DataEntry<Type> >(new TableFile<Type>(*this)); + } + + + //- Destructor + virtual ~TableFile(); + + + // Member Functions + + //- 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 + + //- Ostream Operator + friend Ostream& operator<< <Type> + ( + Ostream& os, + const TableFile<Type>& tbl + ); + + //- Write in dictionary format + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TableFile.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C similarity index 60% rename from src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.H rename to src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C index ecd444cd0ade02c33c6c3ffdeb464e82bdb0e2f8..6e2c4d339b2bf38b4b3ce6e5c04af9bb2780733c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C @@ -23,27 +23,41 @@ License \*---------------------------------------------------------------------------*/ -#ifndef timeVaryingUniformFixedValueFvPatchFields_H -#define timeVaryingUniformFixedValueFvPatchFields_H +#include "DataEntry.H" -#include "timeVaryingUniformFixedValueFvPatchField.H" -#include "fieldTypes.H" +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const TableFile<Type>& tbl +) { + os << static_cast<const DataEntry<Type>&>(tbl) + << static_cast<const TableBase<Type>&>(tbl); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const TableFile<Type>&)" + ); -makePatchTypeFieldTypedefs(timeVaryingUniformFixedValue); + return os; +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +template<class Type> +void Foam::TableFile<Type>::writeData(Ostream& os) const +{ + DataEntry<Type>::writeData(os); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + os << token::END_STATEMENT << nl + << indent << word(type() + "Coeffs") << nl + << indent << token::BEGIN_BLOCK << nl << incrIndent; + os.writeKeyword("fileName")<< fName_ << token::END_STATEMENT << nl; + os << decrIndent << indent << token::END_BLOCK << endl; +} -#endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C index 6d002412c54bb8b40f4b02d3539f4ddba6657a83..d443fb9b762a6fcb259e322405ae85da757aa6a1 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C @@ -23,27 +23,56 @@ License \*---------------------------------------------------------------------------*/ -#include "DataEntry.H" #include "Constant.H" +#include "CSV.H" +#include "DataEntry.H" #include "Table.H" +#include "TableFile.H" #include "label.H" #include "scalar.H" #include "vector.H" +#include "sphericalTensor.H" +#include "symmTensor.H" +#include "tensor.H" namespace Foam { makeDataEntry(label); makeDataEntryType(Constant, label); +// makeDataEntryType(CSV, label); makeDataEntryType(Table, label); + makeDataEntryType(TableFile, label); makeDataEntry(scalar); makeDataEntryType(Constant, scalar); + makeDataEntryType(CSV, scalar); makeDataEntryType(Table, scalar); + makeDataEntryType(TableFile, scalar); makeDataEntry(vector); makeDataEntryType(Constant, vector); + makeDataEntryType(CSV, vector); makeDataEntryType(Table, vector); + makeDataEntryType(TableFile, vector); + + makeDataEntry(sphericalTensor); + makeDataEntryType(Constant, sphericalTensor); + makeDataEntryType(CSV, sphericalTensor); + makeDataEntryType(Table, sphericalTensor); + makeDataEntryType(TableFile, sphericalTensor); + + makeDataEntry(symmTensor); + makeDataEntryType(Constant, symmTensor); + makeDataEntryType(CSV, symmTensor); + makeDataEntryType(Table, symmTensor); + makeDataEntryType(TableFile, symmTensor); + + makeDataEntry(tensor); + makeDataEntryType(Constant, tensor); + makeDataEntryType(CSV, tensor); + makeDataEntryType(Table, tensor); + makeDataEntryType(TableFile, tensor); } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C index e81f5a7bf1da61c18cd6a019f9266cb3c09a3abe..10111c8680091544e209557e29b1d7267e577027 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C @@ -34,12 +34,17 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::polynomial::polynomial(const word& entryName, Istream& is) +Foam::polynomial::polynomial(const word& entryName, const dictionary& dict) : DataEntry<scalar>(entryName), - coeffs_(is), + coeffs_(), canIntegrate_(true) { + Istream& is(dict.lookup(entryName)); + word entryType(is); + + is >> coeffs_; + if (!coeffs_.size()) { FatalErrorIn("Foam::polynomial::polynomial(const word&, Istream&)") diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H index 7aa5ecb3fd049897a09efbda7539188fc9aeeef0..37a45b33162f4e0b7ceeda9e621152b601dfcc20 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H @@ -94,7 +94,7 @@ public: // Constructors - polynomial(const word& entryName, Istream& is); + polynomial(const word& entryName, const dictionary& dict); //- Copy constructor polynomial(const polynomial& poly); diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.C b/src/combustionModels/singleStepCombustion/singleStepCombustion.C index e09b8363f6d7c2d58d9a84c88257fe08afce4111..319e5476b22a925676acbca5453f88f0981132cc 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.C +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.C @@ -80,17 +80,12 @@ singleStepCombustion<CombThermoType, ThermoType>::R { const label specieI = this->thermo_->composition().species()[Y.name()]; - const label fNorm = singleMixture_.specieProd()[specieI]; - - const volScalarField fres(singleMixture_.fres(specieI)); - const volScalarField wSpecie ( wFuel_*singleMixture_.specieStoichCoeffs()[specieI] - / max(fNorm*(Y - fres), scalar(0.001)) ); - return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y); + return wSpecie + fvm::Sp(0.0*wSpecie, Y); } diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 656cc2f0ed040d5a772ac9d21732307c2fd37a45..6a3caf2ff0a785c88626f739cb2f5fdf44a1a19a 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -158,8 +158,6 @@ $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVe $(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C $(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C $(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C -$(derivedFvPatchFields)/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C $(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index 226405b792a8d90e8f60adde47963c0323e63814..d4b2aa3df2fc5709492588490592a0d35366f49a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -31,8 +31,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam:: -flowRateInletVelocityFvPatchVectorField:: +Foam::flowRateInletVelocityFvPatchVectorField:: flowRateInletVelocityFvPatchVectorField ( const fvPatch& p, @@ -40,14 +39,13 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(p, iF), - flowRate_(0), + flowRate_(), phiName_("phi"), rhoName_("rho") {} -Foam:: -flowRateInletVelocityFvPatchVectorField:: +Foam::flowRateInletVelocityFvPatchVectorField:: flowRateInletVelocityFvPatchVectorField ( const flowRateInletVelocityFvPatchVectorField& ptf, @@ -57,14 +55,13 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), - flowRate_(ptf.flowRate_), + flowRate_(ptf.flowRate_().clone().ptr()), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_) {} -Foam:: -flowRateInletVelocityFvPatchVectorField:: +Foam::flowRateInletVelocityFvPatchVectorField:: flowRateInletVelocityFvPatchVectorField ( const fvPatch& p, @@ -73,28 +70,26 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(p, iF, dict), - flowRate_(readScalar(dict.lookup("flowRate"))), + flowRate_(DataEntry<scalar>::New("flowRate", dict)), phiName_(dict.lookupOrDefault<word>("phi", "phi")), rhoName_(dict.lookupOrDefault<word>("rho", "rho")) {} -Foam:: -flowRateInletVelocityFvPatchVectorField:: +Foam::flowRateInletVelocityFvPatchVectorField:: flowRateInletVelocityFvPatchVectorField ( const flowRateInletVelocityFvPatchVectorField& ptf ) : fixedValueFvPatchField<vector>(ptf), - flowRate_(ptf.flowRate_), + flowRate_(ptf.flowRate_().clone().ptr()), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_) {} -Foam:: -flowRateInletVelocityFvPatchVectorField:: +Foam::flowRateInletVelocityFvPatchVectorField:: flowRateInletVelocityFvPatchVectorField ( const flowRateInletVelocityFvPatchVectorField& ptf, @@ -102,7 +97,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, iF), - flowRate_(ptf.flowRate_), + flowRate_(ptf.flowRate_().clone().ptr()), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_) {} @@ -117,8 +112,10 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() return; } + const scalar t = db().time().value(); + // a simpler way of doing this would be nice - const scalar avgU = -flowRate_/gSum(patch().magSf()); + const scalar avgU = -flowRate_->value(t)/gSum(patch().magSf()); tmp<vectorField> n = patch().nf(); @@ -157,7 +154,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchField<vector>::write(os); - os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl; + flowRate_->writeData(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H index b00368a5a579ee63b37306254183a1b152a8ebed..f40674ea01c8387a6299e92242795192f8e94d84 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H @@ -57,6 +57,7 @@ SourceFiles #define flowRateInletVelocityFvPatchVectorField_H #include "fixedValueFvPatchFields.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +74,7 @@ class flowRateInletVelocityFvPatchVectorField // Private data //- Inlet integral flow rate - scalar flowRate_; + autoPtr<DataEntry<scalar> > flowRate_; //- Name of the flux transporting the field word phiName_; @@ -153,27 +154,11 @@ public: // Member functions - // Access - - //- Return the flux - scalar flowRate() const - { - return flowRate_; - } - - //- Return reference to the flux to allow adjustment - scalar& flowRate() - { - return flowRate_; - } - - //- Update the coefficients associated with the patch field virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; - }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index 7ccd38a18b42920cd20dc500f562858f9c40ff1a..a382b65c8d668305e0e69ec0b7a5e6cb56e592b0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C @@ -33,10 +33,13 @@ License void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: calcTangentialVelocity() { - vector axisHat = omega_/mag(omega_); + const scalar t = this->db().time().value(); + vector om = omega_->value(t); + + vector axisHat = om/mag(om); const vectorField tangentialVelocity ( - (-omega_) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())) + (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())) ); const vectorField n(patch().nf()); @@ -54,7 +57,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(p, iF), - omega_(vector::zero) + omega_() {} @@ -68,7 +71,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper), - omega_(ptf.omega_) + omega_(ptf.omega_().clone().ptr()) { calcTangentialVelocity(); } @@ -83,7 +86,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(p, iF, dict), - omega_(dict.lookup("omega")) + omega_(DataEntry<vector>::New("omega", dict)) { calcTangentialVelocity(); } @@ -92,11 +95,11 @@ rotatingPressureInletOutletVelocityFvPatchVectorField Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: rotatingPressureInletOutletVelocityFvPatchVectorField ( - const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf + const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf ) : - pressureInletOutletVelocityFvPatchVectorField(pivpvf), - omega_(pivpvf.omega_) + pressureInletOutletVelocityFvPatchVectorField(rppvf), + omega_(rppvf.omega_().clone().ptr()) { calcTangentialVelocity(); } @@ -105,12 +108,12 @@ rotatingPressureInletOutletVelocityFvPatchVectorField Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: rotatingPressureInletOutletVelocityFvPatchVectorField ( - const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf, + const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf, const DimensionedField<vector, volMesh>& iF ) : - pressureInletOutletVelocityFvPatchVectorField(pivpvf, iF), - omega_(pivpvf.omega_) + pressureInletOutletVelocityFvPatchVectorField(rppvf, iF), + omega_(rppvf.omega_().clone().ptr()) { calcTangentialVelocity(); } @@ -125,7 +128,7 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write { fvPatchVectorField::write(os); os.writeKeyword("phi") << phiName() << token::END_STATEMENT << nl; - os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl; + omega_->writeData(os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H index 3d2e3a7cc94f2f48d10e0af14078c36c7b5554d3..063585751876bca22fc4c63563017cbb6cf4bfd3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H @@ -40,6 +40,7 @@ SourceFiles #include "fvPatchFields.H" #include "pressureInletOutletVelocityFvPatchVectorField.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +48,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class rotatingPressureInletOutletVelocityFvPatch Declaration + Class rotatingPressureInletOutletVelocityFvPatch Declaration \*---------------------------------------------------------------------------*/ class rotatingPressureInletOutletVelocityFvPatchVectorField @@ -57,7 +58,7 @@ class rotatingPressureInletOutletVelocityFvPatchVectorField // Private data //- Angular velocity of the frame - vector omega_; + autoPtr<DataEntry<vector> > omega_; // Private Member Functions @@ -141,23 +142,6 @@ public: // Member functions - // Access - - //- Return the angular velocity of rotation - const vector& omega() const - { - return omega_; - } - - //- Reset the angular velocity of rotation - // and update the tangentialVelocity - void setOmega(const vector& omega) - { - omega_ = omega; - calcTangentialVelocity(); - } - - //- Write virtual void write(Ostream&) const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C index 249635c21b393c770adc9a5e0dee3c83e86d67ce..8bd52df99e3ca53d20e99868539c70e5c2e99be0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C @@ -39,7 +39,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(p, iF), - omega_(vector::zero) + omega_() {} @@ -53,7 +53,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(ptf, p, iF, mapper), - omega_(ptf.omega_) + omega_(ptf.omega_().clone().ptr()) {} @@ -66,30 +66,30 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(p, iF, dict), - omega_(dict.lookup("omega")) + omega_(DataEntry<vector>::New("omega", dict)) {} Foam::rotatingTotalPressureFvPatchScalarField:: rotatingTotalPressureFvPatchScalarField ( - const rotatingTotalPressureFvPatchScalarField& tppsf + const rotatingTotalPressureFvPatchScalarField& rtppsf ) : - totalPressureFvPatchScalarField(tppsf), - omega_(tppsf.omega_) + totalPressureFvPatchScalarField(rtppsf), + omega_(rtppsf.omega_().clone().ptr()) {} Foam::rotatingTotalPressureFvPatchScalarField:: rotatingTotalPressureFvPatchScalarField ( - const rotatingTotalPressureFvPatchScalarField& tppsf, + const rotatingTotalPressureFvPatchScalarField& rtppsf, const DimensionedField<scalar, volMesh>& iF ) : - totalPressureFvPatchScalarField(tppsf, iF), - omega_(tppsf.omega_) + totalPressureFvPatchScalarField(rtppsf, iF), + omega_(rtppsf.omega_().clone().ptr()) {} @@ -102,9 +102,12 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs() return; } - vector axisHat = omega_/mag(omega_); + const scalar t = this->db().time().value(); + const vector om = omega_->value(t); + + vector axisHat = om/mag(om); tmp<vectorField> rotationVelocity = - omega_ ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())); + om ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())); const vectorField Up ( @@ -119,7 +122,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs() void Foam::rotatingTotalPressureFvPatchScalarField::write(Ostream& os) const { totalPressureFvPatchScalarField::write(os); - os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl; + omega_->writeData(os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.H index d214d566272131381f939a4c75fe43e7fa118da7..68e1d19c8fd029ade7445e1c28c0b5532e625517 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.H @@ -36,6 +36,7 @@ SourceFiles #define rotatingTotalPressureFvPatchScalarField_H #include "totalPressureFvPatchScalarField.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class rotatingTotalPressureFvPatch Declaration + Class rotatingTotalPressureFvPatch Declaration \*---------------------------------------------------------------------------*/ class rotatingTotalPressureFvPatchScalarField @@ -53,7 +54,7 @@ class rotatingTotalPressureFvPatchScalarField // Private data //- Angular velocity of the frame - vector omega_; + autoPtr<DataEntry<vector> > omega_; public: @@ -126,21 +127,6 @@ public: // Member functions - // Access - - //- Return the angular velocity of rotation - const vector& omega() const - { - return omega_; - } - - //- Return the angular velocity of rotation - vector& omega() - { - return omega_; - } - - // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C index 9ed9bb388d7913770bb799229101f54a829db8a4..b7a30a84883a895698e861cf322cf42a255ee089 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C @@ -38,7 +38,7 @@ rotatingWallVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(p, iF), - origin_(vector::zero), + origin_(), axis_(vector::zero), omega_(0) {} @@ -56,7 +56,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), origin_(ptf.origin_), axis_(ptf.axis_), - omega_(ptf.omega_) + omega_(ptf.omega_().clone().ptr()) {} @@ -71,7 +71,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(p, iF), origin_(dict.lookup("origin")), axis_(dict.lookup("axis")), - omega_(readScalar(dict.lookup("omega"))) + omega_(DataEntry<scalar>::New("omega", dict)) { // Evaluate the wall velocity updateCoeffs(); @@ -81,27 +81,27 @@ rotatingWallVelocityFvPatchVectorField Foam::rotatingWallVelocityFvPatchVectorField:: rotatingWallVelocityFvPatchVectorField ( - const rotatingWallVelocityFvPatchVectorField& pivpvf + const rotatingWallVelocityFvPatchVectorField& rwvpvf ) : - fixedValueFvPatchField<vector>(pivpvf), - origin_(pivpvf.origin_), - axis_(pivpvf.axis_), - omega_(pivpvf.omega_) + fixedValueFvPatchField<vector>(rwvpvf), + origin_(rwvpvf.origin_), + axis_(rwvpvf.axis_), + omega_(rwvpvf.omega_().clone().ptr()) {} Foam::rotatingWallVelocityFvPatchVectorField:: rotatingWallVelocityFvPatchVectorField ( - const rotatingWallVelocityFvPatchVectorField& pivpvf, + const rotatingWallVelocityFvPatchVectorField& rwvpvf, const DimensionedField<vector, volMesh>& iF ) : - fixedValueFvPatchField<vector>(pivpvf, iF), - origin_(pivpvf.origin_), - axis_(pivpvf.axis_), - omega_(pivpvf.omega_) + fixedValueFvPatchField<vector>(rwvpvf, iF), + origin_(rwvpvf.origin_), + axis_(rwvpvf.axis_), + omega_(rwvpvf.omega_().clone().ptr()) {} @@ -114,10 +114,13 @@ void Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs() return; } + const scalar t = this->db().time().value(); + scalar om = omega_->value(t); + // Calculate the rotating wall velocity from the specification of the motion const vectorField Up ( - (-omega_)*((patch().Cf() - origin_) ^ (axis_/mag(axis_))) + (-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_))) ); // Remove the component of Up normal to the wall @@ -134,7 +137,7 @@ void Foam::rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const fvPatchVectorField::write(os); os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl; os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl; - os.writeKeyword("omega") << omega_ << token::END_STATEMENT << nl; + omega_->writeData(os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H index ac18cda23f3ff57cefc192771434607e1cb913da..41f821c6d88a41f72126a5b54ade7408e82db07e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H @@ -36,6 +36,7 @@ SourceFiles #define rotatingWallVelocityFvPatchVectorField_H #include "fixedValueFvPatchFields.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class rotatingWallVelocityFvPatch Declaration + Class rotatingWallVelocityFvPatch Declaration \*---------------------------------------------------------------------------*/ class rotatingWallVelocityFvPatchVectorField @@ -59,7 +60,7 @@ class rotatingWallVelocityFvPatchVectorField vector axis_; //- Rotational speed - scalar omega_; + autoPtr<DataEntry<scalar> > omega_; public: @@ -147,12 +148,6 @@ public: return axis_; } - //- Return the rotational speed - scalar omega() const - { - return omega_; - } - //- Return non-const access to the origin of the rotation vector& origin() { @@ -165,12 +160,6 @@ public: return axis_; } - //- Return non-const access to the rotational speed - scalar& omega() - { - return omega_; - } - //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C deleted file mode 100644 index 7dd71eb8b64148c1dfd1e92ef6771bfa3b658633..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C +++ /dev/null @@ -1,132 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "timeVaryingFlowRateInletVelocityFvPatchVectorField.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "surfaceFields.H" -#include "Time.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -timeVaryingFlowRateInletVelocityFvPatchVectorField -( - const fvPatch& p, - const DimensionedField<vector, volMesh>& iF -) -: - flowRateInletVelocityFvPatchVectorField(p, iF), - timeSeries_() -{} - - -Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -timeVaryingFlowRateInletVelocityFvPatchVectorField -( - const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf, - const fvPatch& p, - const DimensionedField<vector, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - flowRateInletVelocityFvPatchVectorField(ptf, p, iF, mapper), - timeSeries_(ptf.timeSeries_) -{} - - -Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -timeVaryingFlowRateInletVelocityFvPatchVectorField -( - const fvPatch& p, - const DimensionedField<vector, volMesh>& iF, - const dictionary& dict -) -: - flowRateInletVelocityFvPatchVectorField(p, iF, dict), - timeSeries_(dict) -{} - - -Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -timeVaryingFlowRateInletVelocityFvPatchVectorField -( - const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf -) -: - flowRateInletVelocityFvPatchVectorField(ptf), - timeSeries_(ptf.timeSeries_) -{} - - -Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -timeVaryingFlowRateInletVelocityFvPatchVectorField -( - const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf, - const DimensionedField<vector, volMesh>& iF -) -: - flowRateInletVelocityFvPatchVectorField(ptf, iF), - timeSeries_(ptf.timeSeries_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -updateCoeffs() -{ - if (updated()) - { - return; - } - - flowRate() = timeSeries_(this->db().time().timeOutputValue()); - flowRateInletVelocityFvPatchVectorField::updateCoeffs(); -} - - -void Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField:: -write(Ostream& os) const -{ - flowRateInletVelocityFvPatchVectorField::write(os); - timeSeries_.write(os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchVectorField, - timeVaryingFlowRateInletVelocityFvPatchVectorField - ); -} - - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.H deleted file mode 100644 index 0ba11a655db7fad811b6900c7357200ceb1e8799..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.H +++ /dev/null @@ -1,182 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::timeVaryingFlowRateInletVelocityFvPatchVectorField - -Description - A time-varying form of a flow normal vector boundary condition. The - variation is specified as an interpolationTable (see - Foam::interpolationTable). - - Example of the boundary condition specification: - \verbatim - inlet - { - type timeVaryingFlowRateInletVelocity; - flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s] - value uniform (0 0 0); // placeholder - fileName "$FOAM_CASE/time-series"; - outOfBounds repeat; // (error|warn|clamp|repeat) - } - \endverbatim - -Note - - The value is positive inwards - - may not work correctly for transonic inlets! - - strange behaviour with potentialFoam since the U equation is not solved - -See Also - Foam::interpolationTable and Foam::flowRateInletVelocityFvPatchVectorField - -SourceFiles - timeVaryingFlowRateInletVelocityFvPatchVectorField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef timeVaryingFlowRateInletVelocityFvPatchVectorField_H -#define timeVaryingFlowRateInletVelocityFvPatchVectorField_H - -#include "flowRateInletVelocityFvPatchVectorField.H" -#include "interpolationTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -/*---------------------------------------------------------------------------*\ - Class timeVaryingFlowRateInletVelocityFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class timeVaryingFlowRateInletVelocityFvPatchVectorField -: - public flowRateInletVelocityFvPatchVectorField -{ - // Private data - - //- the time series being used, including the bounding treatment - interpolationTable<scalar> timeSeries_; - - -public: - - //- Runtime type information - TypeName("timeVaryingFlowRateInletVelocity"); - - - // Constructors - - //- Construct from patch and internal field - timeVaryingFlowRateInletVelocityFvPatchVectorField - ( - const fvPatch&, - const DimensionedField<vector, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - timeVaryingFlowRateInletVelocityFvPatchVectorField - ( - const fvPatch&, - const DimensionedField<vector, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given patch field onto a new patch - timeVaryingFlowRateInletVelocityFvPatchVectorField - ( - const timeVaryingFlowRateInletVelocityFvPatchVectorField&, - const fvPatch&, - const DimensionedField<vector, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - timeVaryingFlowRateInletVelocityFvPatchVectorField - ( - const timeVaryingFlowRateInletVelocityFvPatchVectorField& - ); - - //- Construct and return a clone - virtual tmp<fvPatchVectorField> clone() const - { - return tmp<fvPatchVectorField> - ( - new timeVaryingFlowRateInletVelocityFvPatchVectorField(*this) - ); - } - - //- Construct as copy setting internal field reference - timeVaryingFlowRateInletVelocityFvPatchVectorField - ( - const timeVaryingFlowRateInletVelocityFvPatchVectorField&, - const DimensionedField<vector, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchVectorField> clone - ( - const DimensionedField<vector, volMesh>& iF - ) const - { - return tmp<fvPatchVectorField> - ( - new timeVaryingFlowRateInletVelocityFvPatchVectorField - ( - *this, - iF - ) - ); - } - - - // Member functions - - // Access - - //- Return the time series used - const interpolationTable<scalar>& timeSeries() const - { - return timeSeries_; - } - - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchField.C deleted file mode 100644 index 9ea28b4567e6f2ac308343133cfd915a320434dd..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchField.C +++ /dev/null @@ -1,137 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "timeVaryingUniformFixedValueFvPatchField.H" -#include "Time.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::timeVaryingUniformFixedValueFvPatchField<Type>:: -timeVaryingUniformFixedValueFvPatchField -( - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF -) -: - fixedValueFvPatchField<Type>(p, iF), - timeSeries_() -{} - - -template<class Type> -Foam::timeVaryingUniformFixedValueFvPatchField<Type>:: -timeVaryingUniformFixedValueFvPatchField -( - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchField<Type>(p, iF), - timeSeries_(dict) -{ - if (dict.found("value")) - { - fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size())); - } - else - { - updateCoeffs(); - } -} - - -template<class Type> -Foam::timeVaryingUniformFixedValueFvPatchField<Type>:: -timeVaryingUniformFixedValueFvPatchField -( - const timeVaryingUniformFixedValueFvPatchField<Type>& ptf, - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField<Type>(ptf, p, iF, mapper), - timeSeries_(ptf.timeSeries_) -{} - - -template<class Type> -Foam::timeVaryingUniformFixedValueFvPatchField<Type>:: -timeVaryingUniformFixedValueFvPatchField -( - const timeVaryingUniformFixedValueFvPatchField<Type>& ptf -) -: - fixedValueFvPatchField<Type>(ptf), - timeSeries_(ptf.timeSeries_) -{} - - -template<class Type> -Foam::timeVaryingUniformFixedValueFvPatchField<Type>:: -timeVaryingUniformFixedValueFvPatchField -( - const timeVaryingUniformFixedValueFvPatchField<Type>& ptf, - const DimensionedField<Type, volMesh>& iF -) -: - fixedValueFvPatchField<Type>(ptf, iF), - timeSeries_(ptf.timeSeries_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs() -{ - if (this->updated()) - { - return; - } - - fvPatchField<Type>::operator== - ( - timeSeries_(this->db().time().timeOutputValue()) - ); - fixedValueFvPatchField<Type>::updateCoeffs(); -} - - -template<class Type> -void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::write -( - Ostream& os -) const -{ - fvPatchField<Type>::write(os); - timeSeries_.write(os); - this->writeEntry("value", os); -} - - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchField.H deleted file mode 100644 index 2d1f6d97add2f05166e6485ad5febb01f7050ea1..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchField.H +++ /dev/null @@ -1,183 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::timeVaryingUniformFixedValueFvPatchField - -Description - A time-varying form of a uniform fixed value boundary condition. The - variation is specified as an interpolationTable (see - Foam::interpolationTable for read options). - - Example of the boundary condition specification: - \verbatim - inlet - { - type timeVaryingUniformFixedValue; - fileName "$FOAM_CASE/time-series"; - outOfBounds clamp; // (error|warn|clamp|repeat) - } - \endverbatim - -Note - This class is derived directly from a fixedValue patch rather than from - a uniformFixedValue patch. - -See Also - Foam::interpolationTable and Foam::fixedValueFvPatchField - -SourceFiles - timeVaryingUniformFixedValueFvPatchField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef timeVaryingUniformFixedValueFvPatchField_H -#define timeVaryingUniformFixedValueFvPatchField_H - -#include "fixedValueFvPatchField.H" -#include "interpolationTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class timeVaryingUniformFixedValueFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class timeVaryingUniformFixedValueFvPatchField -: - public fixedValueFvPatchField<Type> -{ - // Private data - - //- The time series being used, including the bounding treatment - interpolationTable<Type> timeSeries_; - - -public: - - //- Runtime type information - TypeName("timeVaryingUniformFixedValue"); - - - // Constructors - - //- Construct from patch and internal field - timeVaryingUniformFixedValueFvPatchField - ( - const fvPatch&, - const DimensionedField<Type, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - timeVaryingUniformFixedValueFvPatchField - ( - const fvPatch&, - const DimensionedField<Type, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given patch field onto a new patch - timeVaryingUniformFixedValueFvPatchField - ( - const timeVaryingUniformFixedValueFvPatchField<Type>&, - const fvPatch&, - const DimensionedField<Type, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - timeVaryingUniformFixedValueFvPatchField - ( - const timeVaryingUniformFixedValueFvPatchField<Type>& - ); - - //- Construct and return a clone - virtual tmp<fvPatchField<Type> > clone() const - { - return tmp<fvPatchField<Type> > - ( - new timeVaryingUniformFixedValueFvPatchField<Type>(*this) - ); - } - - //- Construct as copy setting internal field reference - timeVaryingUniformFixedValueFvPatchField - ( - const timeVaryingUniformFixedValueFvPatchField<Type>&, - const DimensionedField<Type, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchField<Type> > clone - ( - const DimensionedField<Type, volMesh>& iF - ) const - { - return tmp<fvPatchField<Type> > - ( - new timeVaryingUniformFixedValueFvPatchField<Type>(*this, iF) - ); - } - - - // Member functions - - // Access - - //- Return the time series used - const interpolationTable<Type>& timeSeries() const - { - return timeSeries_; - } - - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "timeVaryingUniformFixedValueFvPatchField.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index 622ac8959b9a77f94d6fe7698e7d116a019f35df..2770460e0de90cc352120e1231191f5113ce73d4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -40,7 +40,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), - uniformValue_(pTraits<Type>::zero) + uniformValue_() {} @@ -54,9 +54,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), - uniformValue_(ptf.uniformValue_) + uniformValue_(ptf.uniformValue_().clone().ptr()) { - fvPatchField<Type>::operator==(uniformValue_); + const scalar t = this->db().time().value(); + fvPatchField<Type>::operator==(uniformValue_->value(t)); } @@ -69,9 +70,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), - uniformValue_(pTraits<Type>(dict.lookup("uniformValue"))) + uniformValue_(DataEntry<Type>::New("uniformValue", dict)) { - fvPatchField<Type>::operator==(uniformValue_); + const scalar t = this->db().time().value(); + fvPatchField<Type>::operator==(uniformValue_->value(t)); } @@ -82,9 +84,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf), - uniformValue_(ptf.uniformValue_) + uniformValue_(ptf.uniformValue_().clone().ptr()) { - fvPatchField<Type>::operator==(uniformValue_); + const scalar t = this->db().time().value(); + fvPatchField<Type>::operator==(uniformValue_->value(t)); } @@ -96,9 +99,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), - uniformValue_(ptf.uniformValue_) + uniformValue_(ptf.uniformValue_().clone().ptr()) { - fvPatchField<Type>::operator==(uniformValue_); + const scalar t = this->db().time().value(); + fvPatchField<Type>::operator==(uniformValue_->value(t)); } @@ -111,7 +115,8 @@ void uniformFixedValueFvPatchField<Type>::autoMap ) { this->setSize(m.size()); - fvPatchField<Type>::operator==(uniformValue_); + const scalar t = this->db().time().value(); + fvPatchField<Type>::operator==(uniformValue_->value(t)); } @@ -119,8 +124,7 @@ template<class Type> void uniformFixedValueFvPatchField<Type>::write(Ostream& os) const { fvPatchField<Type>::write(os); - os.writeKeyword("uniformValue") - << uniformValue_ << token::END_STATEMENT << nl; + uniformValue_->writeData(os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H index 0c7b8e82e0b92fedddd5c0692a91cae9927705e9..1b9da9ca7bf6b15621883e5eeba6904107bfbee3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H @@ -37,6 +37,7 @@ SourceFiles #include "Random.H" #include "fixedValueFvPatchFields.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class uniformFixedValueFvPatch Declaration + Class uniformFixedValueFvPatch Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -54,7 +55,7 @@ class uniformFixedValueFvPatchField { // Private data - Type uniformValue_; + autoPtr<DataEntry<Type> > uniformValue_; public: @@ -127,21 +128,6 @@ public: // Member functions - // Access - - //- Return the fluctuation scale - const Type& uniformValue() const - { - return uniformValue_; - } - - //- Return reference to the fluctuation scale to allow adjustment - Type& uniformValue() - { - return uniformValue_; - } - - // Mapping functions //- Map (and resize as needed) from self given a mapping object diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C index 2e5f2345a7f8e6683094d3b93bf5459ba1f153cd..1e0aa90e4109ca4437d1703eed90973a84fd3380 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C @@ -235,7 +235,11 @@ tmp<Field<Type> > volPointInterpolation::flatBoundaryField { label bFaceI = bm[patchI].patch().start() - mesh.nInternalFaces(); - if (!isA<emptyFvPatch>(bm[patchI]) && !bm[patchI].coupled()) + if + ( + !isA<emptyFvPatch>(bm[patchI]) + && !vf.boundaryField()[patchI].coupled() + ) { SubList<Type> ( diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C index c4ed18d3e3564a038c6dbbdf154d02d24c07ce2f..cb47e0a101c8dd554968c4e9ec5875776dcdfd5c 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C @@ -31,6 +31,8 @@ License #include "coupledPointPatchFields.H" #include "pointConstraint.H" +#include "surfaceFields.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -75,11 +77,19 @@ void volPointInterpolation::calcBoundaryAddressing() const polyBoundaryMesh& pbm = mesh().boundaryMesh(); + // Get precalculated volField only so we can use coupled() tests for + // cyclicAMI + const surfaceScalarField& magSf = mesh().magSf(); + forAll(pbm, patchI) { const polyPatch& pp = pbm[patchI]; - if (!isA<emptyPolyPatch>(pp) && !pp.coupled()) + if + ( + !isA<emptyPolyPatch>(pp) + && !magSf.boundaryField()[patchI].coupled() + ) { label bFaceI = pp.start()-mesh().nInternalFaces(); diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 400f8955c5d4570414c56ae7b63ad6910832e273..8f951b6c524752853ce2921963ca278b8fd42b58 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -31,9 +31,33 @@ License #include "Time.H" #include "OFstream.H" #include "wallPolyPatch.H" +#include "cyclicAMIPolyPatch.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // +template<class ParticleType> +void Foam::Cloud<ParticleType>::checkPatches() const +{ + const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh(); + bool ok = true; + forAll(pbm, patchI) + { + if (isA<cyclicAMIPolyPatch>(pbm[patchI])) + { + ok = false; + break; + } + } + + if (!ok) + { + WarningIn("void Foam::Cloud<ParticleType>::initCloud(const bool)") + << "Particle tracking across AMI patches is not currently " + << "supported" << endl; + } +} + + template<class ParticleType> void Foam::Cloud<ParticleType>::calcCellWallFaces() const { @@ -76,6 +100,8 @@ Foam::Cloud<ParticleType>::Cloud nTrackingRescues_(), cellWallFacesPtr_() { + checkPatches(); + // Ask for the tetBasePtIs to trigger all processors to build // them, otherwise, if some processors have no particles then // there is a comms mismatch. @@ -100,6 +126,8 @@ Foam::Cloud<ParticleType>::Cloud nTrackingRescues_(), cellWallFacesPtr_() { + checkPatches(); + // Ask for the tetBasePtIs to trigger all processors to build // them, otherwise, if some processors have no particles then // there is a comms mismatch. diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index 69f792ad4622304c024cf7828780f5e50539c36d..56b4759f1aa1829e6bcc219a9b76b99c8205afaf 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -93,6 +93,9 @@ class Cloud // Private Member Functions + //- Check patches + void checkPatches() const; + //- Initialise cloud on IO constructor void initCloud(const bool checkClass); diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index a62e99808bef017265cf3bda09b25a96eed4dd59..1845d541657dd9525d5b9aa04b92799bb0f7b676 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -162,6 +162,8 @@ Foam::Cloud<ParticleType>::Cloud nTrackingRescues_(), cellWallFacesPtr_() { + checkPatches(); + initCloud(checkClass); } @@ -180,6 +182,8 @@ Foam::Cloud<ParticleType>::Cloud nTrackingRescues_(), cellWallFacesPtr_() { + checkPatches(); + initCloud(checkClass); } diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C index ebf14d47f03be4a99109f3bd95cd1ae470a72022..3bbb078c869bcca89c8051f926900711d48ae6f2 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C @@ -50,7 +50,7 @@ namespace Foam const char* Foam::NamedEnum < Foam::fieldValues::cellSource::operationType, - 7 + 8 >::names[] = { "none", @@ -59,7 +59,8 @@ namespace Foam "volIntegrate", "weightedAverage", "min", - "max" + "max", + "CoV" }; } @@ -67,7 +68,7 @@ namespace Foam const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2> Foam::fieldValues::cellSource::sourceTypeNames_; -const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7> +const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 8> Foam::fieldValues::cellSource::operationTypeNames_; diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H index b3231481f674831c875d30205597b9257fc52682..259c2aff88eea38066c11479f0999dddc9c5040a 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H @@ -52,6 +52,7 @@ Description - volAverage - volIntegrate - weightedAverage + - CoV (Coefficient of variation: standard deviation/mean) SourceFiles cellSource.C @@ -106,11 +107,12 @@ public: opVolIntegrate, opWeightedAverage, opMin, - opMax + opMax, + opCoV }; //- Operation type names - static const NamedEnum<operationType, 7> operationTypeNames_; + static const NamedEnum<operationType, 8> operationTypeNames_; private: diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C index 6c3fe94438d1e1d4785c47f51247f63208cd75bd..9a3263465cfdd4f06a1a2e0dd25af0d815f409f3 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C @@ -115,6 +115,23 @@ Type Foam::fieldValues::cellSource::processValues result = max(values); break; } + case opCoV: + { + Type meanValue = sum(values*V)/sum(V); + + const label nComp = pTraits<Type>::nComponents; + + for (direction d=0; d<nComp; ++d) + { + scalarField vals(values.component(d)); + scalar mean = component(meanValue, d); + scalar& res = setComponent(result, d); + + res = sqrt(sum(V*sqr(vals - mean))/(V.size()*sum(V)))/mean; + } + + break; + } default: { // Do nothing diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index 5141604eed0e8094f75b549f5a02c8495cd1d686..98a45084bfd3190df8a4f2575dd6658c26131740 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -53,7 +53,7 @@ namespace Foam const char* Foam::NamedEnum < Foam::fieldValues::faceSource::operationType, - 7 + 8 >::names[] = { "none", @@ -62,7 +62,8 @@ namespace Foam "areaIntegrate", "weightedAverage", "min", - "max" + "max", + "CoV" }; } @@ -71,7 +72,7 @@ namespace Foam const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3> Foam::fieldValues::faceSource::sourceTypeNames_; -const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 7> +const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 8> Foam::fieldValues::faceSource::operationTypeNames_; diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index 4ff40c837d98feeaba742e9d8fc4578a2d56c494..90f972c57434f6dd7416e68ea47aca591f638e3e 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H @@ -62,6 +62,7 @@ Description - weightedAverage - min - max + - CoV (Coefficient of variation: standard deviation/mean) Notes: - faces on empty patches get ignored @@ -132,11 +133,12 @@ public: opAreaIntegrate, opWeightedAverage, opMin, - opMax + opMax, + opCoV }; //- Operation type names - static const NamedEnum<operationType, 7> operationTypeNames_; + static const NamedEnum<operationType, 8> operationTypeNames_; private: diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index 47fb3a61e10e460ef461b85b487435a3dddb45fa..821fda5f6a937e1b18a4013b460b0a190e2a7147 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -134,6 +134,25 @@ Type Foam::fieldValues::faceSource::processValues result = max(values); break; } + case opCoV: + { + Type meanValue = sum(values*magSf)/sum(magSf); + + const label nComp = pTraits<Type>::nComponents; + + for (direction d=0; d<nComp; ++d) + { + scalarField vals(values.component(d)); + scalar mean = component(meanValue, d); + scalar& res = setComponent(result, d); + + res = + sqrt(sum(magSf*sqr(vals - mean))/(magSf.size()*sum(magSf))) + /mean; + } + + break; + } default: { // Do nothing diff --git a/tutorials/basic/potentialFoam/cylinder/0.org/U b/tutorials/basic/potentialFoam/cylinder/0.org/U index 4d3f4887056b3e3534a90f3c1615c1afd4df2ea5..c4b3d7fb847efb27b1bb62a66c1edcf5302b29c5 100644 --- a/tutorials/basic/potentialFoam/cylinder/0.org/U +++ b/tutorials/basic/potentialFoam/cylinder/0.org/U @@ -38,7 +38,7 @@ boundaryField left { type uniformFixedValue; - uniformValue (1 0 0); + uniformValue constant (1 0 0); } cylinder diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/extrudeToRegionMeshDict b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/extrudeToRegionMeshDict index 424d9deb692596b00e0766a02629453d30945106..c32e4b3bccbe475b31085219c69b48e355df807b 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/extrudeToRegionMeshDict +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/extrudeToRegionMeshDict @@ -22,7 +22,7 @@ oneD true; sampleMode nearestPatchFace; -oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch +oneDPolyPatchType empty; //wedge extrudeModel linearNormal; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties index 289df92fcca267b150237b1acba26bab60d4ee68..619c448058ca64e0f31fca477c9838a6395c8fdf 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties @@ -15,8 +15,8 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//combustionModel infinitelyFastChemistry<psiCombustionModel,gasThermoPhysics>; -combustionModel FSD<psiCombustionModel,gasThermoPhysics>; +combustionModel infinitelyFastChemistry<psiCombustionModel,gasThermoPhysics>; +//combustionModel FSD<psiCombustionModel,gasThermoPhysics>; active true; diff --git a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/0/U b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/0/U index 4260cb9c6770c07df09c7c152eacdf3946d1e639..0d8701320a12fd4bb641f6b61c3f21c254b28bba 100644 --- a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/0/U +++ b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/0/U @@ -43,7 +43,7 @@ boundaryField inlet { type flowRateInletVelocity; - flowRate 0.1; + flowRate constant 0.1; value uniform (0 0 0); } outlet diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/U b/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/U index 46bccfbff4be6ace7acd99e0758dab70eb2c3474..c9822054aff3223147af983d91e4ef4d4c646e44 100644 --- a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/U +++ b/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/U @@ -43,7 +43,7 @@ boundaryField inlet { type flowRateInletVelocity; - flowRate 0.1; + flowRate constant 0.1; value uniform (0 0 0); } outlet diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/U b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/U index 383b73855f114cebc0095690da04716b4010d8b5..b66f23d6cb6b26067ac01026aa738c1153365861 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/U +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/U @@ -43,7 +43,7 @@ boundaryField inlet { type flowRateInletVelocity; - flowRate 0.1; + flowRate constant 0.1; value uniform (0 0 0); } outlet diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/U b/tutorials/compressible/rhoSimplecFoam/squareBend/0/U index 70c4444bbdab136e21f6a47cad3840de0338da0f..70988607c87df6f0cbf431c7736807fcbb9568cd 100644 --- a/tutorials/compressible/rhoSimplecFoam/squareBend/0/U +++ b/tutorials/compressible/rhoSimplecFoam/squareBend/0/U @@ -28,7 +28,7 @@ boundaryField inlet { type flowRateInletVelocity; - flowRate 0.5; //0.75; + flowRate constant 0.5; //0.75; value uniform (0 0 0); } outlet diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U index 383b73855f114cebc0095690da04716b4010d8b5..b66f23d6cb6b26067ac01026aa738c1153365861 100644 --- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U +++ b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U @@ -43,7 +43,7 @@ boundaryField inlet { type flowRateInletVelocity; - flowRate 0.1; + flowRate constant 0.1; value uniform (0 0 0); } outlet diff --git a/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/system/controlDict b/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/system/controlDict index 58d0742ace5aee7970a58bb8ffb90852b20185fe..841980b5d801c0173def40ebbe6d62fd4aea3946 100644 --- a/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/system/controlDict +++ b/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application potentialFreeSurfaceFoam; +application potentialFreeSurfaceFoam; startFrom startTime; diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0/U b/tutorials/incompressible/simpleFoam/turbineSiting/0/U index ecb87de1345b74266b5080b8278a73ca6a7fabb1..b3849b272567f38e1e712f5bd544595fedc93b56 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0/U +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0/U @@ -54,8 +54,8 @@ boundaryField ground { type uniformFixedValue; - uniformValue (0 0 0); value uniform (0 0 0); + uniformValue constant (0 0 0); } #include "include/sideAndTopPatches" diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0/k b/tutorials/incompressible/simpleFoam/turbineSiting/0/k index 613ed84b420699ed207e75881580272e9dd3816f..8b36838310ac7cd09abbcc7708ba1d1224c4be20 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0/k +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0/k @@ -33,8 +33,8 @@ boundaryField inlet { type uniformFixedValue; - uniformValue $turbulentKE; value $turbulentKE; + uniformValue constant $turbulentKE; } "terrain_.*" { diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0/p b/tutorials/incompressible/simpleFoam/turbineSiting/0/p index bbe55f1225c27c87198e818edbf93e53b14a4c02..0d4fc2dd15eb54f15584e58491a49193788634c3 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0/p +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0/p @@ -30,8 +30,8 @@ boundaryField outlet { type uniformFixedValue; - value uniform $pressure; - uniformValue $pressure; + value $pressure; + uniformValue constant $pressure; } "terrain_.*" diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun index 4959242f82ce1350389b70ae6a7e879dd8467a99..9a2202867e0aa8dd1fccc83ac7173f4f80cfc10c 100755 --- a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun +++ b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun @@ -25,7 +25,7 @@ cp system/decomposeParDict-4proc system/decomposeParDict # Unset floating point trapping since creating processor directories unset FOAM_SIGFPE unset FOAM_SETNAN -runParallel redistributeMeshPar 4 -overwrite +runParallel redistributePar 4 -overwrite runParallel renumberMesh 4 -overwrite # Add wildcard entries for meshes patches since not preserved diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0.org/U b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0.org/U index c1593b9e45af1e7c0cca0ff2edf1e8d47b27c8f4..352d6b50277375ebbd80840c8e5422c6f53647df 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0.org/U +++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0.org/U @@ -32,13 +32,13 @@ boundaryField inletCentral { type flowRateInletVelocity; - flowRate 0.00379; + flowRate constant 0.00379; value uniform (0 14.68 0); } inletSides { type flowRateInletVelocity; - flowRate 0.00832; + flowRate constant 0.00832; value uniform (0 17.79 0); } outlet diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0/U b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0/U index c1593b9e45af1e7c0cca0ff2edf1e8d47b27c8f4..352d6b50277375ebbd80840c8e5422c6f53647df 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0/U +++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/0/U @@ -32,13 +32,13 @@ boundaryField inletCentral { type flowRateInletVelocity; - flowRate 0.00379; + flowRate constant 0.00379; value uniform (0 14.68 0); } inletSides { type flowRateInletVelocity; - flowRate 0.00832; + flowRate constant 0.00832; value uniform (0 17.79 0); } outlet diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U index c1593b9e45af1e7c0cca0ff2edf1e8d47b27c8f4..352d6b50277375ebbd80840c8e5422c6f53647df 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U @@ -32,13 +32,13 @@ boundaryField inletCentral { type flowRateInletVelocity; - flowRate 0.00379; + flowRate constant 0.00379; value uniform (0 14.68 0); } inletSides { type flowRateInletVelocity; - flowRate 0.00832; + flowRate constant 0.00832; value uniform (0 17.79 0); } outlet diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U index c1593b9e45af1e7c0cca0ff2edf1e8d47b27c8f4..352d6b50277375ebbd80840c8e5422c6f53647df 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U @@ -32,13 +32,13 @@ boundaryField inletCentral { type flowRateInletVelocity; - flowRate 0.00379; + flowRate constant 0.00379; value uniform (0 14.68 0); } inletSides { type flowRateInletVelocity; - flowRate 0.00832; + flowRate constant 0.00832; value uniform (0 17.79 0); } outlet