PolynomialEntry: Templated polynomial DataEntry to support all basic field types from scalar to tensor

This allows polynomial functions for e.g. velocity to be specified in the uniformFixedValue BC

Consider a linear function for Ux(t) with Uy and Uz = 0:

    inlet
    {
        type            uniformFixedValue;
        uniformValue    polynomial
        (
            ((10 0 0)   (0 0 0))
            ((100 0 0)  (1 0 0))
        );
    }

Resolves bug report http://www.openfoam.org/mantisbt/view.php?id=1508
This commit is contained in:
Henry
2015-02-06 09:57:20 +00:00
parent c628b79d10
commit e72b2557d5
14 changed files with 210 additions and 144 deletions

View File

@ -73,8 +73,6 @@ primitives/triad/triad.C
/* functions, data entries */ /* functions, data entries */
primitives/functions/DataEntry/makeDataEntries.C primitives/functions/DataEntry/makeDataEntries.C
primitives/functions/DataEntry/polynomial/polynomial.C
primitives/functions/DataEntry/polynomial/polynomialIO.C
primitives/functions/Polynomial/polynomialFunction.C primitives/functions/Polynomial/polynomialFunction.C

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -226,6 +226,12 @@ inline Scalar cmptMultiply(const Scalar s1, const Scalar s2)
} }
inline Scalar cmptPow(const Scalar s1, const Scalar s2)
{
return pow(s1, s2);
}
inline Scalar cmptDivide(const Scalar s1, const Scalar s2) inline Scalar cmptDivide(const Scalar s1, const Scalar s2)
{ {
return s1/s2; return s1/s2;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -346,6 +346,19 @@ inline VectorSpace<Form, Cmpt, nCmpt> cmptMultiply
} }
template<class Form, class Cmpt, int nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt> cmptPow
(
const VectorSpace<Form, Cmpt, nCmpt>& vs1,
const VectorSpace<Form, Cmpt, nCmpt>& vs2
)
{
Form v;
VectorSpaceOps<nCmpt,0>::op(v, vs1, vs2, cmptPowOp<Cmpt>());
return v;
}
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, int nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt> cmptDivide inline VectorSpace<Form, Cmpt, nCmpt> cmptDivide
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,7 +31,20 @@ License
namespace Foam namespace Foam
{ {
// doesn't recognize specialization otherwise template<>
label CSV<label>::readValue(const List<string>& splitted)
{
if (componentColumns_[0] >= splitted.size())
{
FatalErrorIn("CSV<label>::readValue(const List<string>&)")
<< "No column " << componentColumns_[0] << " in "
<< splitted << endl
<< exit(FatalError);
}
return readLabel(IStringStream(splitted[componentColumns_[0]])());
}
template<> template<>
scalar CSV<scalar>::readValue(const List<string>& splitted) scalar CSV<scalar>::readValue(const List<string>& splitted)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,6 +103,7 @@ Foam::dimensioned<Type> Foam::Constant<Type>::dimIntegrate
return dimensioned<Type>("dimensionedValue", dimensions_, (x2-x1)*value_); return dimensioned<Type>("dimensionedValue", dimensions_, (x2-x1)*value_);
} }
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ConstantIO.C" #include "ConstantIO.C"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DataEntry.H" #include "Constant.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,24 +23,18 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "polynomial.H" #include "PolynomialEntry.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(polynomial, 0);
addToRunTimeSelectionTable(scalarDataEntry, polynomial, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polynomial::polynomial(const word& entryName, const dictionary& dict) template<class Type>
Foam::PolynomialEntry<Type>::PolynomialEntry
(
const word& entryName,
const dictionary& dict
)
: :
scalarDataEntry(entryName), DataEntry<Type>(entryName),
coeffs_(), coeffs_(),
canIntegrate_(true), canIntegrate_(true),
dimensions_(dimless) dimensions_(dimless)
@ -61,14 +55,15 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::polynomial::polynomial(const word&, const dictionary&)" "PolynomialEntry<Type>::"
) << "polynomial coefficients for entry " << this->name_ "PolynomialEntry(const word&, const dictionary&)"
) << "PolynomialEntry coefficients for entry " << this->name_
<< " are invalid (empty)" << nl << exit(FatalError); << " are invalid (empty)" << nl << exit(FatalError);
} }
forAll(coeffs_, i) forAll(coeffs_, i)
{ {
if (mag(coeffs_[i].second() + 1) < ROOTVSMALL) if (mag(coeffs_[i].second() + pTraits<Type>::one) < ROOTVSMALL)
{ {
canIntegrate_ = false; canIntegrate_ = false;
break; break;
@ -81,21 +76,23 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
{ {
WarningIn WarningIn
( (
"Foam::polynomial::polynomial(const word&, const dictionary&)" "PolynomialEntry<Type>::PolynomialEntry"
) << "Polynomial " << this->name_ << " cannot be integrated" "(const word&, const dictionary&)"
) << "PolynomialEntry " << this->name_ << " cannot be integrated"
<< endl; << endl;
} }
} }
} }
Foam::polynomial::polynomial template<class Type>
Foam::PolynomialEntry<Type>::PolynomialEntry
( (
const word& entryName, const word& entryName,
const List<Tuple2<scalar, scalar> >& coeffs const List<Tuple2<Type, Type> >& coeffs
) )
: :
scalarDataEntry(entryName), DataEntry<Type>(entryName),
coeffs_(coeffs), coeffs_(coeffs),
canIntegrate_(true), canIntegrate_(true),
dimensions_(dimless) dimensions_(dimless)
@ -104,9 +101,9 @@ Foam::polynomial::polynomial
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::polynomial::polynomial" "Foam::PolynomialEntry<Type>::PolynomialEntry"
"(const word&, const List<Tuple2<scalar, scalar> >&)" "(const word&, const List<Tuple2<Type, Type> >&)"
) << "polynomial coefficients for entry " << this->name_ ) << "PolynomialEntry coefficients for entry " << this->name_
<< " are invalid (empty)" << nl << exit(FatalError); << " are invalid (empty)" << nl << exit(FatalError);
} }
@ -125,18 +122,19 @@ Foam::polynomial::polynomial
{ {
WarningIn WarningIn
( (
"Foam::polynomial::polynomial" "Foam::PolynomialEntry<Type>::PolynomialEntry"
"(const word&, const List<Tuple2<scalar, scalar> >&)" "(const word&, const List<Tuple2<Type, Type> >&)"
) << "Polynomial " << this->name_ << " cannot be integrated" ) << "PolynomialEntry " << this->name_ << " cannot be integrated"
<< endl; << endl;
} }
} }
} }
Foam::polynomial::polynomial(const polynomial& poly) template<class Type>
Foam::PolynomialEntry<Type>::PolynomialEntry(const PolynomialEntry& poly)
: :
scalarDataEntry(poly), DataEntry<Type>(poly),
coeffs_(poly.coeffs_), coeffs_(poly.coeffs_),
canIntegrate_(poly.canIntegrate_), canIntegrate_(poly.canIntegrate_),
dimensions_(poly.dimensions_) dimensions_(poly.dimensions_)
@ -145,48 +143,76 @@ Foam::polynomial::polynomial(const polynomial& poly)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polynomial::~polynomial() template<class Type>
Foam::PolynomialEntry<Type>::~PolynomialEntry()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::polynomial::convertTimeBase(const Time& t) template<class Type>
void Foam::PolynomialEntry<Type>::convertTimeBase(const Time& t)
{ {
forAll(coeffs_, i) forAll(coeffs_, i)
{ {
scalar value = coeffs_[i].first(); Type value = coeffs_[i].first();
coeffs_[i].first() = t.userTimeToTime(value); for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
{
setComponent(coeffs_[i].first(), cmpt) =
t.userTimeToTime(component(value, cmpt));
}
} }
} }
Foam::scalar Foam::polynomial::value(const scalar x) const template<class Type>
Type Foam::PolynomialEntry<Type>::value(const scalar x) const
{ {
scalar y = 0.0; Type y(pTraits<Type>::zero);
forAll(coeffs_, i) forAll(coeffs_, i)
{ {
y += coeffs_[i].first()*pow(x, coeffs_[i].second()); y += cmptMultiply
(
coeffs_[i].first(),
cmptPow(pTraits<Type>::one*x, coeffs_[i].second())
);
} }
return y; return y;
} }
Foam::scalar Foam::polynomial::integrate(const scalar x1, const scalar x2) const template<class Type>
Type Foam::PolynomialEntry<Type>::integrate
(
const scalar x1,
const scalar x2
) const
{ {
scalar intx = 0.0; Type intx(pTraits<Type>::zero);
if (canIntegrate_) if (canIntegrate_)
{ {
forAll(coeffs_, i) forAll(coeffs_, i)
{ {
intx += intx += cmptMultiply
coeffs_[i].first()/(coeffs_[i].second() + 1) (
*( cmptDivide
pow(x2, coeffs_[i].second() + 1) (
- pow(x1, coeffs_[i].second() + 1) coeffs_[i].first(),
); coeffs_[i].second() + pTraits<Type>::one
),
cmptPow
(
pTraits<Type>::one*x2,
coeffs_[i].second() + pTraits<Type>::one
)
- cmptPow
(
pTraits<Type>::one*x1,
coeffs_[i].second() + pTraits<Type>::one
)
);
} }
} }
@ -194,22 +220,24 @@ Foam::scalar Foam::polynomial::integrate(const scalar x1, const scalar x2) const
} }
Foam::dimensioned<Foam::scalar> Foam::polynomial::dimValue template<class Type>
Foam::dimensioned<Type> Foam::PolynomialEntry<Type>::dimValue
( (
const scalar x const scalar x
) const ) const
{ {
return dimensioned<scalar>("dimensionedValue", dimensions_, value(x)); return dimensioned<Type>("dimensionedValue", dimensions_, value(x));
} }
Foam::dimensioned<Foam::scalar> Foam::polynomial::dimIntegrate template<class Type>
Foam::dimensioned<Type> Foam::PolynomialEntry<Type>::dimIntegrate
( (
const scalar x1, const scalar x1,
const scalar x2 const scalar x2
) const ) const
{ {
return dimensioned<scalar> return dimensioned<Type>
( (
"dimensionedValue", "dimensionedValue",
dimensions_, dimensions_,
@ -218,4 +246,9 @@ Foam::dimensioned<Foam::scalar> Foam::polynomial::dimIntegrate
} }
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "PolynomialEntryIO.C"
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,15 +22,15 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::polynomial Foam::PolynomialEntry
Description Description
Polynomial container data entry for scalars. Items are stored in a list of PolynomialEntry container data entry for scalars. Items are stored in a
Tuple2's. Data is input in the form, e.g. for an entry \<entryName\> that list of Tuple2's. Data is input in the form,
describes y = x^2 + 2x^3 e.g. for an entry \<entryName\> that describes y = x^2 + 2x^3
\verbatim \verbatim
<entryName> polynomial [0 0 1 0 0] // optional dimensions <entryName> polynomial [0 0 1 0 0] // optional dimensions
( (
(1 2) (1 2)
(2 3) (2 3)
@ -38,12 +38,12 @@ Description
\endverbatim \endverbatim
SourceFiles SourceFiles
polynomial.C PolynomialEntry.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef polynomial_H #ifndef PolynomialEntry_H
#define polynomial_H #define PolynomialEntry_H
#include "DataEntry.H" #include "DataEntry.H"
#include "Tuple2.H" #include "Tuple2.H"
@ -56,27 +56,27 @@ namespace Foam
{ {
// Forward declaration of classes // Forward declaration of classes
class polynomial;
template<class Type>
class PolynomialEntry;
// Forward declaration of friend functions // Forward declaration of friend functions
Ostream& operator<< template<class Type>
( Ostream& operator<<(Ostream&, const PolynomialEntry<Type>&);
Ostream&,
const polynomial&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class polynomial Declaration Class PolynomialEntry Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class polynomial template<class Type>
class PolynomialEntry
: :
public scalarDataEntry public DataEntry<Type>
{ {
// Private data // Private data
//- Polynomial coefficients - list of prefactor, exponent //- PolynomialEntry coefficients - list of prefactor, exponent
List<Tuple2<scalar, scalar> > coeffs_; List<Tuple2<Type, Type> > coeffs_;
//- Flag to indicate whether poly can be integrated //- Flag to indicate whether poly can be integrated
bool canIntegrate_; bool canIntegrate_;
@ -88,7 +88,7 @@ class polynomial
// Private Member Functions // Private Member Functions
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const polynomial&); void operator=(const PolynomialEntry<Type>&);
public: public:
@ -99,23 +99,27 @@ public:
// Constructors // Constructors
polynomial(const word& entryName, const dictionary& dict); PolynomialEntry(const word& entryName, const dictionary& dict);
//- Construct from components //- Construct from components
polynomial(const word& entryName, const List<Tuple2<scalar, scalar> >&); PolynomialEntry
(
const word& entryName,
const List<Tuple2<Type, Type> >&
);
//- Copy constructor //- Copy constructor
polynomial(const polynomial& poly); PolynomialEntry(const PolynomialEntry& poly);
//- Construct and return a clone //- Construct and return a clone
virtual tmp<scalarDataEntry> clone() const virtual tmp<DataEntry<Type> > clone() const
{ {
return tmp<scalarDataEntry>(new polynomial(*this)); return tmp<DataEntry<Type> >(new PolynomialEntry(*this));
} }
//- Destructor //- Destructor
virtual ~polynomial(); virtual ~PolynomialEntry();
// Member Functions // Member Functions
@ -128,17 +132,17 @@ public:
// Evaluation // Evaluation
//- Return polynomial value //- Return PolynomialEntry value
scalar value(const scalar x) const; Type value(const scalar x) const;
//- Integrate between two (scalar) values //- Integrate between two (scalar) values
scalar integrate(const scalar x1, const scalar x2) const; Type integrate(const scalar x1, const scalar x2) const;
//- Return dimensioned constant value //- Return dimensioned constant value
dimensioned<scalar> dimValue(const scalar) const; dimensioned<Type> dimValue(const scalar) const;
//- Integrate between two values and return dimensioned type //- Integrate between two values and return dimensioned type
dimensioned<scalar> dimIntegrate dimensioned<Type> dimIntegrate
( (
const scalar x1, const scalar x1,
const scalar x2 const scalar x2
@ -148,10 +152,10 @@ public:
// I/O // I/O
//- Ostream Operator //- Ostream Operator
friend Ostream& operator<< friend Ostream& operator<< <Type>
( (
Ostream& os, Ostream& os,
const polynomial& cnst const PolynomialEntry<Type>& cnst
); );
//- Write in dictionary format //- Write in dictionary format
@ -165,6 +169,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "PolynomialEntry.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,24 +23,25 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "polynomial.H" #include "PolynomialEntry.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const polynomial& poly const PolynomialEntry<Type>& poly
) )
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
os << static_cast<const DataEntry<scalar>& >(poly) os << static_cast<const DataEntry<Type>& >(poly)
<< token::SPACE << poly.coeffs_; << token::SPACE << poly.coeffs_;
} }
else else
{ {
os << static_cast<const DataEntry<scalar>& >(poly); os << static_cast<const DataEntry<Type>& >(poly);
os.write os.write
( (
reinterpret_cast<const char*>(&poly.coeffs_), reinterpret_cast<const char*>(&poly.coeffs_),
@ -51,16 +52,17 @@ Foam::Ostream& Foam::operator<<
// Check state of Ostream // Check state of Ostream
os.check os.check
( (
"Ostream& operator<<(Ostream&, const polynomial&)" "Ostream& operator<<(Ostream&, const PolynomialEntry&)"
); );
return os; return os;
} }
void Foam::polynomial::writeData(Ostream& os) const template<class Type>
void Foam::PolynomialEntry<Type>::writeData(Ostream& os) const
{ {
DataEntry<scalar>::writeData(os); DataEntry<Type>::writeData(os);
os << nl << indent << coeffs_ << token::END_STATEMENT << nl; os << nl << indent << coeffs_ << token::END_STATEMENT << nl;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,6 +25,7 @@ License
#include "CompatibilityConstant.H" #include "CompatibilityConstant.H"
#include "Constant.H" #include "Constant.H"
#include "PolynomialEntry.H"
#include "CSV.H" #include "CSV.H"
#include "DataEntry.H" #include "DataEntry.H"
#include "Table.H" #include "Table.H"
@ -42,13 +43,15 @@ namespace Foam
makeDataEntry(label); makeDataEntry(label);
makeDataEntryType(CompatibilityConstant, label); makeDataEntryType(CompatibilityConstant, label);
makeDataEntryType(Constant, label); makeDataEntryType(Constant, label);
// makeDataEntryType(CSV, label); //makeDataEntryType(PolynomialEntry, label);
makeDataEntryType(CSV, label);
makeDataEntryType(Table, label); makeDataEntryType(Table, label);
makeDataEntryType(TableFile, label); makeDataEntryType(TableFile, label);
makeDataEntry(scalar); makeDataEntry(scalar);
makeDataEntryType(CompatibilityConstant, scalar); makeDataEntryType(CompatibilityConstant, scalar);
makeDataEntryType(Constant, scalar); makeDataEntryType(Constant, scalar);
makeDataEntryType(PolynomialEntry, scalar);
makeDataEntryType(CSV, scalar); makeDataEntryType(CSV, scalar);
makeDataEntryType(Table, scalar); makeDataEntryType(Table, scalar);
makeDataEntryType(TableFile, scalar); makeDataEntryType(TableFile, scalar);
@ -56,6 +59,7 @@ namespace Foam
makeDataEntry(vector); makeDataEntry(vector);
makeDataEntryType(CompatibilityConstant, vector); makeDataEntryType(CompatibilityConstant, vector);
makeDataEntryType(Constant, vector); makeDataEntryType(Constant, vector);
makeDataEntryType(PolynomialEntry, vector);
makeDataEntryType(CSV, vector); makeDataEntryType(CSV, vector);
makeDataEntryType(Table, vector); makeDataEntryType(Table, vector);
makeDataEntryType(TableFile, vector); makeDataEntryType(TableFile, vector);
@ -63,6 +67,7 @@ namespace Foam
makeDataEntry(sphericalTensor); makeDataEntry(sphericalTensor);
makeDataEntryType(CompatibilityConstant, sphericalTensor); makeDataEntryType(CompatibilityConstant, sphericalTensor);
makeDataEntryType(Constant, sphericalTensor); makeDataEntryType(Constant, sphericalTensor);
makeDataEntryType(PolynomialEntry, sphericalTensor);
makeDataEntryType(CSV, sphericalTensor); makeDataEntryType(CSV, sphericalTensor);
makeDataEntryType(Table, sphericalTensor); makeDataEntryType(Table, sphericalTensor);
makeDataEntryType(TableFile, sphericalTensor); makeDataEntryType(TableFile, sphericalTensor);
@ -70,6 +75,7 @@ namespace Foam
makeDataEntry(symmTensor); makeDataEntry(symmTensor);
makeDataEntryType(CompatibilityConstant, symmTensor); makeDataEntryType(CompatibilityConstant, symmTensor);
makeDataEntryType(Constant, symmTensor); makeDataEntryType(Constant, symmTensor);
makeDataEntryType(PolynomialEntry, symmTensor);
makeDataEntryType(CSV, symmTensor); makeDataEntryType(CSV, symmTensor);
makeDataEntryType(Table, symmTensor); makeDataEntryType(Table, symmTensor);
makeDataEntryType(TableFile, symmTensor); makeDataEntryType(TableFile, symmTensor);
@ -77,6 +83,7 @@ namespace Foam
makeDataEntry(tensor); makeDataEntry(tensor);
makeDataEntryType(CompatibilityConstant, tensor); makeDataEntryType(CompatibilityConstant, tensor);
makeDataEntryType(Constant, tensor); makeDataEntryType(Constant, tensor);
makeDataEntryType(PolynomialEntry, tensor);
makeDataEntryType(CSV, tensor); makeDataEntryType(CSV, tensor);
makeDataEntryType(Table, tensor); makeDataEntryType(Table, tensor);
makeDataEntryType(TableFile, tensor); makeDataEntryType(TableFile, tensor);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -166,6 +166,7 @@ Op(minus, x - y)
Op(multiply, x * y) Op(multiply, x * y)
Op(divide, x / y) Op(divide, x / y)
Op(cmptMultiply, cmptMultiply(x, y)) Op(cmptMultiply, cmptMultiply(x, y))
Op(cmptPow, cmptPow(x, y))
Op(cmptDivide, cmptDivide(x, y)) Op(cmptDivide, cmptDivide(x, y))
Op(stabilise, stabilise(x, y)) Op(stabilise, stabilise(x, y))
Op(max, max(x, y)) Op(max, max(x, y))

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,7 +28,7 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "Tuple2.H" #include "Tuple2.H"
#include "polynomial.H" #include "PolynomialEntry.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -107,7 +107,7 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
this->jumpTable_.reset this->jumpTable_.reset
( (
new polynomial("jumpTable", coeffs) new PolynomialEntry<scalar>("jumpTable", coeffs)
); );
} }
else else

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,15 +25,10 @@ License
#include "uniformFixedGradientFvPatchField.H" #include "uniformFixedGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -45,7 +40,7 @@ uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
template<class Type> template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
@ -58,7 +53,7 @@ uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
template<class Type> template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
( (
const uniformFixedGradientFvPatchField<Type>& ptf, const uniformFixedGradientFvPatchField<Type>& ptf,
const fvPatch& p, const fvPatch& p,
@ -76,7 +71,7 @@ uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
template<class Type> template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
@ -99,7 +94,7 @@ uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
template<class Type> template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
( (
const uniformFixedGradientFvPatchField<Type>& ptf const uniformFixedGradientFvPatchField<Type>& ptf
) )
@ -115,7 +110,7 @@ uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
template<class Type> template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
( (
const uniformFixedGradientFvPatchField<Type>& ptf, const uniformFixedGradientFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -142,7 +137,7 @@ uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void uniformFixedGradientFvPatchField<Type>::updateCoeffs() void Foam::uniformFixedGradientFvPatchField<Type>::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
{ {
@ -157,7 +152,7 @@ void uniformFixedGradientFvPatchField<Type>::updateCoeffs()
template<class Type> template<class Type>
void uniformFixedGradientFvPatchField<Type>::write(Ostream& os) const void Foam::uniformFixedGradientFvPatchField<Type>::write(Ostream& os) const
{ {
fixedGradientFvPatchField<Type>::write(os); fixedGradientFvPatchField<Type>::write(os);
uniformGradient_->writeData(os); uniformGradient_->writeData(os);
@ -165,8 +160,4 @@ void uniformFixedGradientFvPatchField<Type>::write(Ostream& os) const
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,15 +25,10 @@ License
#include "uniformFixedValueFvPatchField.H" #include "uniformFixedValueFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -45,7 +40,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
template<class Type> template<class Type>
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
@ -58,7 +53,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
template<class Type> template<class Type>
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
( (
const uniformFixedValueFvPatchField<Type>& ptf, const uniformFixedValueFvPatchField<Type>& ptf,
const fvPatch& p, const fvPatch& p,
@ -76,7 +71,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
template<class Type> template<class Type>
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
@ -99,7 +94,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
template<class Type> template<class Type>
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
( (
const uniformFixedValueFvPatchField<Type>& ptf const uniformFixedValueFvPatchField<Type>& ptf
) )
@ -115,7 +110,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
template<class Type> template<class Type>
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
( (
const uniformFixedValueFvPatchField<Type>& ptf, const uniformFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -142,7 +137,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void uniformFixedValueFvPatchField<Type>::updateCoeffs() void Foam::uniformFixedValueFvPatchField<Type>::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
{ {
@ -157,16 +152,12 @@ void uniformFixedValueFvPatchField<Type>::updateCoeffs()
template<class Type> template<class Type>
void uniformFixedValueFvPatchField<Type>::write(Ostream& os) const void Foam::uniformFixedValueFvPatchField<Type>::write(Ostream& os) const
{ {
// Note: do not write value
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
uniformValue_->writeData(os); uniformValue_->writeData(os);
this->writeEntry("value", os);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //