diff --git a/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.C b/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.C index 7466afb4c2..908b2fedc3 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.C +++ b/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.C @@ -30,14 +30,60 @@ License namespace Foam { + defineTypeNameAndDebug(APIdiffCoefFunc, 0); + addToRunTimeSelectionTable + ( + thermophysicalFunction, + APIdiffCoefFunc, + Istream + ); + addToRunTimeSelectionTable + ( + thermophysicalFunction, + APIdiffCoefFunc, + dictionary + ); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(APIdiffCoefFunc, 0); -addToRunTimeSelectionTable(thermophysicalFunction, APIdiffCoefFunc, Istream); +Foam::APIdiffCoefFunc::APIdiffCoefFunc +( + const scalar a, + const scalar b, + const scalar wf, + const scalar wa +) +: + a_(a), + b_(b), + wf_(wf), + wa_(wa), + alpha_(sqrt(1/wf_ + 1/wa_)), + beta_(sqr(cbrt(a_) + cbrt(b_))) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::APIdiffCoefFunc::APIdiffCoefFunc(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + wf_(readScalar(is)), + wa_(readScalar(is)), + alpha_(sqrt(1/wf_ + 1/wa_)), + beta_(sqr((cbrt(a_) + cbrt(b_)))) +{} + + +Foam::APIdiffCoefFunc::APIdiffCoefFunc(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + wf_(readScalar(dict.lookup("wf"))), + wa_(readScalar(dict.lookup("wa"))), + alpha_(sqrt(1/wf_ + 1/wa_)), + beta_(sqr((cbrt(a_) + cbrt(b_)))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.H b/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.H index 93ad9fb88d..65645cea4c 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.H +++ b/src/thermophysicalModels/thermophysicalFunctions/APIfunctions/APIdiffCoefFunc/APIdiffCoefFunc.H @@ -71,26 +71,19 @@ public: // Constructors //- Construct from components - APIdiffCoefFunc(scalar a, scalar b, scalar wf, scalar wa) - : - a_(a), - b_(b), - wf_(wf), - wa_(wa), - alpha_(sqrt(1/wf_ + 1/wa_)), - beta_(sqr(cbrt(a_) + cbrt(b_))) - {} + APIdiffCoefFunc + ( + const scalar a, + const scalar b, + const scalar wf, + const scalar wa + ); //- Construct from Istream - APIdiffCoefFunc(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - wf_(readScalar(is)), - wa_(readScalar(is)), - alpha_(sqrt(1/wf_ + 1/wa_)), - beta_(sqr((cbrt(a_) + cbrt(b_)))) - {} + APIdiffCoefFunc(Istream& is); + + //- Construct from dictionary + APIdiffCoefFunc(const dictionary& dict); // Member Functions diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.C index 54696aba1a..7d3333f2e6 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.C @@ -30,14 +30,52 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc0, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc0, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc0, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc0, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc0, Istream); +Foam::NSRDSfunc0::NSRDSfunc0 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e, + const scalar f +) +: + a_(a), + b_(b), + c_(c), + d_(d), + e_(e), + f_(f) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc0::NSRDSfunc0(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)), + e_(readScalar(is)), + f_(readScalar(is)) +{} + + +Foam::NSRDSfunc0::NSRDSfunc0(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))), + e_(readScalar(dict.lookup("e"))), + f_(readScalar(dict.lookup("f"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.H index a924cb658a..4faac5710d 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc0/NSRDSfunc0.H @@ -84,26 +84,21 @@ public: // Constructors //- Construct from components - NSRDSfunc0(scalar a, scalar b, scalar c, scalar d, scalar e, scalar f) - : - a_(a), - b_(b), - c_(c), - d_(d), - e_(e), - f_(f) - {} + NSRDSfunc0 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e, + const scalar f + ); //- Construct from Istream - NSRDSfunc0(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)), - e_(readScalar(is)), - f_(readScalar(is)) - {} + NSRDSfunc0(Istream& is); + + //- Construct from dictionary + NSRDSfunc0(const dictionary& dict); // Member Functions @@ -114,7 +109,6 @@ public: return ((((f_*T + e_)*T + d_)*T + c_)*T + b_)*T + a_; } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.C index 88d3e10f4b..c647f200fc 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.C @@ -30,14 +30,48 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc1, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc1, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc1, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc1, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc1, Istream); +Foam::NSRDSfunc1::NSRDSfunc1 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e +) +: + a_(a), + b_(b), + c_(c), + d_(d), + e_(e) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc1::NSRDSfunc1(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)), + e_(readScalar(is)) +{} + + +Foam::NSRDSfunc1::NSRDSfunc1(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))), + e_(readScalar(dict.lookup("e"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.H index 291bdd5b0b..05e1777020 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.H @@ -84,24 +84,20 @@ public: // Constructors //- Construct from components - NSRDSfunc1(scalar a, scalar b, scalar c, scalar d, scalar e) - : - a_(a), - b_(b), - c_(c), - d_(d), - e_(e) - {} + NSRDSfunc1 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e + ); //- Construct from Istream - NSRDSfunc1(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)), - e_(readScalar(is)) - {} + NSRDSfunc1(Istream& is); + + //- Construct from dictionary + NSRDSfunc1(const dictionary& dict); // Member Functions @@ -112,7 +108,6 @@ public: return exp(a_ + b_/T + c_*log(T) + d_*pow(T, e_)); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.C index 3b9f959120..421c24f6cb 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.C @@ -30,14 +30,53 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc14, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc14, Istream); + addToRunTimeSelectionTable + ( + thermophysicalFunction, + NSRDSfunc14, + dictionary + ); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc14, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc14, Istream); +Foam::NSRDSfunc14::NSRDSfunc14 +( + const scalar Tc, + const scalar a, + const scalar b, + const scalar c, + const scalar d +) +: + Tc_(Tc), + a_(a), + b_(b), + c_(c), + d_(d) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc14::NSRDSfunc14(Istream& is) +: + Tc_(readScalar(is)), + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)) +{} + + +Foam::NSRDSfunc14::NSRDSfunc14(const dictionary& dict) +: + Tc_(readScalar(dict.lookup("Tc"))), + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H index 3e27776c7b..4b976815eb 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H @@ -84,24 +84,20 @@ public: // Constructors //- Construct from components - NSRDSfunc14(scalar Tc, scalar a, scalar b, scalar c, scalar d) - : - Tc_(Tc), - a_(a), - b_(b), - c_(c), - d_(d) - {} + NSRDSfunc14 + ( + const scalar Tc, + const scalar a, + const scalar b, + const scalar c, + const scalar d + ); //- Construct from Istream - NSRDSfunc14(Istream& is) - : - Tc_(readScalar(is)), - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)) - {} + NSRDSfunc14(Istream& is); + + //- Construct from dictionary + NSRDSfunc14(const dictionary& dict); // Member Functions @@ -118,7 +114,6 @@ public: ); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.C index fde6e6bce9..31cbc6010a 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.C @@ -30,14 +30,44 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc2, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc2, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc2, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc2, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc2, Istream); +Foam::NSRDSfunc2::NSRDSfunc2 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d +) +: + a_(a), + b_(b), + c_(c), + d_(d) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc2::NSRDSfunc2(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)) +{} + + +Foam::NSRDSfunc2::NSRDSfunc2(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.H index aa21385bea..0b38ed44e8 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc2/NSRDSfunc2.H @@ -84,22 +84,19 @@ public: // Constructors //- Construct from components - NSRDSfunc2(scalar a, scalar b, scalar c, scalar d) - : - a_(a), - b_(b), - c_(c), - d_(d) - {} + NSRDSfunc2 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d + ); //- Construct from Istream - NSRDSfunc2(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)) - {} + NSRDSfunc2(Istream& is); + + //- Construct from dictionary + NSRDSfunc2(const dictionary& dict); // Member Functions @@ -110,7 +107,6 @@ public: return a_*pow(T, b_)/(1.0 + c_/T + d_/sqr(T)); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.C index 61724bd1d7..cd65cfc206 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.C @@ -30,14 +30,44 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc3, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc3, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc3, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc3, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc3, Istream); +Foam::NSRDSfunc3::NSRDSfunc3 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d +) +: + a_(a), + b_(b), + c_(c), + d_(d) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc3::NSRDSfunc3(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)) +{} + + +Foam::NSRDSfunc3::NSRDSfunc3(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.H index 94e2c10374..6c678b3aa7 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc3/NSRDSfunc3.H @@ -84,22 +84,19 @@ public: // Constructors //- Construct from components - NSRDSfunc3(scalar a, scalar b, scalar c, scalar d) - : - a_(a), - b_(b), - c_(c), - d_(d) - {} + NSRDSfunc3 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d + ); //- Construct from Istream - NSRDSfunc3(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)) - {} + NSRDSfunc3(Istream& is); + + //- Construct from dictionary + NSRDSfunc3(const dictionary& dict); // Member Functions @@ -110,7 +107,6 @@ public: return a_ + b_*exp(-c_/pow(T, d_)); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.C index 0520763dd2..347ae5b458 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.C @@ -30,14 +30,48 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc4, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc4, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc4, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc4, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc4, Istream); +Foam::NSRDSfunc4::NSRDSfunc4 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e +) +: + a_(a), + b_(b), + c_(c), + d_(d), + e_(e) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc4::NSRDSfunc4(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)), + e_(readScalar(is)) +{} + + +Foam::NSRDSfunc4::NSRDSfunc4(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))), + e_(readScalar(dict.lookup("e"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.H index a1323d40b8..90576e94e9 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc4/NSRDSfunc4.H @@ -84,24 +84,20 @@ public: // Constructors //- Construct from components - NSRDSfunc4(scalar a, scalar b, scalar c, scalar d, scalar e) - : - a_(a), - b_(b), - c_(c), - d_(d), - e_(e) - {} + NSRDSfunc4 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e + ); //- Construct from Istream - NSRDSfunc4(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)), - e_(readScalar(is)) - {} + NSRDSfunc4(Istream& is); + + //- Construct from dictionary + NSRDSfunc4(const dictionary& dict); // Member Functions @@ -112,7 +108,6 @@ public: return a_ + b_/T + c_/pow(T, 3) + d_/pow(T, 8) + e_/pow(T, 9); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.C index 12f931f60a..a0ba6ea881 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.C @@ -30,14 +30,44 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc5, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc5, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc5, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc5, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc5, Istream); +Foam::NSRDSfunc5::NSRDSfunc5 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d +) +: + a_(a), + b_(b), + c_(c), + d_(d) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc5::NSRDSfunc5(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)) +{} + + +Foam::NSRDSfunc5::NSRDSfunc5(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.H index d1c9b87e0f..8d95533b81 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc5/NSRDSfunc5.H @@ -84,22 +84,19 @@ public: // Constructors //- Construct from components - NSRDSfunc5(scalar a, scalar b, scalar c, scalar d) - : - a_(a), - b_(b), - c_(c), - d_(d) - {} + NSRDSfunc5 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d + ); //- Construct from Istream - NSRDSfunc5(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)) - {} + NSRDSfunc5(Istream& is); + + //- Construct from dictionary + NSRDSfunc5(const dictionary& dict); // Member Functions @@ -110,7 +107,6 @@ public: return a_/pow(b_, 1 + pow(1 - T/c_, d_)); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.C index 0d4b1d2ccd..acfd675072 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.C @@ -30,14 +30,52 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc6, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc6, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc6, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc6, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc6, Istream); +Foam::NSRDSfunc6::NSRDSfunc6 +( + const scalar Tc, + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e +) +: + Tc_(Tc), + a_(a), + b_(b), + c_(c), + d_(d), + e_(e) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc6::NSRDSfunc6(Istream& is) +: + Tc_(readScalar(is)), + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)), + e_(readScalar(is)) +{} + + +Foam::NSRDSfunc6::NSRDSfunc6(const dictionary& dict) +: + Tc_(readScalar(dict.lookup("Tc"))), + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))), + e_(readScalar(dict.lookup("e"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.H index f538c744e9..9623bc36eb 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc6/NSRDSfunc6.H @@ -84,26 +84,21 @@ public: // Constructors //- Construct from components - NSRDSfunc6(scalar Tc, scalar a, scalar b, scalar c, scalar d, scalar e) - : - Tc_(Tc), - a_(a), - b_(b), - c_(c), - d_(d), - e_(e) - {} + NSRDSfunc6 + ( + const scalar Tc, + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e + ); //- Construct from Istream - NSRDSfunc6(Istream& is) - : - Tc_(readScalar(is)), - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)), - e_(readScalar(is)) - {} + NSRDSfunc6(Istream& is); + + //- Construct from dictionary + NSRDSfunc6(const dictionary& dict); // Member Functions @@ -115,7 +110,6 @@ public: return a_*pow(1 - Tr, ((e_*Tr + d_)*Tr + c_)*Tr + b_); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.C b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.C index b5b14a5161..2d15a63dad 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.C +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.C @@ -30,14 +30,48 @@ License namespace Foam { + defineTypeNameAndDebug(NSRDSfunc7, 0); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc7, Istream); + addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc7, dictionary); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -defineTypeNameAndDebug(NSRDSfunc7, 0); -addToRunTimeSelectionTable(thermophysicalFunction, NSRDSfunc7, Istream); +Foam::NSRDSfunc7::NSRDSfunc7 +( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e +) +: + a_(a), + b_(b), + c_(c), + d_(d), + e_(e) +{} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +Foam::NSRDSfunc7::NSRDSfunc7(Istream& is) +: + a_(readScalar(is)), + b_(readScalar(is)), + c_(readScalar(is)), + d_(readScalar(is)), + e_(readScalar(is)) +{} + + +Foam::NSRDSfunc7::NSRDSfunc7(const dictionary& dict) +: + a_(readScalar(dict.lookup("a"))), + b_(readScalar(dict.lookup("b"))), + c_(readScalar(dict.lookup("c"))), + d_(readScalar(dict.lookup("d"))), + e_(readScalar(dict.lookup("e"))) +{} + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.H index ed70b6c90f..0bc7552ff4 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc7/NSRDSfunc7.H @@ -84,24 +84,20 @@ public: // Constructors //- Construct from components - NSRDSfunc7(scalar a, scalar b, scalar c, scalar d, scalar e) - : - a_(a), - b_(b), - c_(c), - d_(d), - e_(e) - {} + NSRDSfunc7 + ( + const scalar a, + const scalar b, + const scalar c, + const scalar d, + const scalar e + ); //- Construct from Istream - NSRDSfunc7(Istream& is) - : - a_(readScalar(is)), - b_(readScalar(is)), - c_(readScalar(is)), - d_(readScalar(is)), - e_(readScalar(is)) - {} + NSRDSfunc7(Istream& is); + + //- Construct from dictionary + NSRDSfunc7(const dictionary& dict); // Member Functions @@ -112,7 +108,6 @@ public: return a_ + b_*sqr((c_/T)/sinh(c_/T)) + d_*sqr((e_/T)/cosh(e_/T)); } - //- Write the function coefficients void writeData(Ostream& os) const { diff --git a/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C b/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C index aea12464ba..73845d6311 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C +++ b/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C @@ -34,6 +34,7 @@ namespace Foam { defineTypeNameAndDebug(thermophysicalFunction, 0); defineRunTimeSelectionTable(thermophysicalFunction, Istream); + defineRunTimeSelectionTable(thermophysicalFunction, dictionary); } @@ -70,4 +71,37 @@ Foam::autoPtr Foam::thermophysicalFunction::New return autoPtr(cstrIter()(is)); } + +Foam::autoPtr Foam::thermophysicalFunction::New +( + const dictionary& dict +) +{ + if (debug) + { + Info<< "thermophysicalFunction::New(const dictionary&) : " + << "constructing thermophysicalFunction" + << endl; + } + + const word thermophysicalFunctionType(dict.lookup("functionType")); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(thermophysicalFunctionType); + + if (cstrIter == IstreamConstructorTablePtr_->end()) + { + FatalErrorIn("thermophysicalFunction::New(const dictionary&)") + << "Unknown thermophysicalFunction type " + << thermophysicalFunctionType + << nl << nl + << "Valid thermophysicalFunction types are :" << endl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H b/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H index 84ab7beede..dc155a0276 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H +++ b/src/thermophysicalModels/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H @@ -37,6 +37,7 @@ Description #include "typeInfo.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" +#include "dictionary.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class thermophysicalFunction Declaration + Class thermophysicalFunction Declaration \*---------------------------------------------------------------------------*/ class thermophysicalFunction @@ -67,6 +68,15 @@ public: (is) ); + declareRunTimeSelectionTable + ( + autoPtr, + thermophysicalFunction, + dictionary, + (const dictionary& dict), + (dict) + ); + // Constructors @@ -74,9 +84,12 @@ public: thermophysicalFunction() {} - //- Return a pointer to a new thermophysicalFunction created from input + //- Return pointer to new thermophysicalFunction created from input static autoPtr New(Istream& is); + //- Return pointer to new thermophysicalFunction created from dict + static autoPtr New(const dictionary& dict); + //- Destructor virtual ~thermophysicalFunction()