diff --git a/src/thermophysicalModels/thermophysicalProperties/Make/files b/src/thermophysicalModels/thermophysicalProperties/Make/files
index 0ca2221441..5499668c4a 100644
--- a/src/thermophysicalModels/thermophysicalProperties/Make/files
+++ b/src/thermophysicalModels/thermophysicalProperties/Make/files
@@ -1,5 +1,7 @@
thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C
+thermophysicalFunctions/noneFunc/noneFunc.C
+
NSRDSfunctions = thermophysicalFunctions/NSRDSfunctions
$(NSRDSfunctions)/NSRDSfunc0/NSRDSfunc0.C
$(NSRDSfunctions)/NSRDSfunc1/NSRDSfunc1.C
@@ -20,6 +22,7 @@ thermophysicalProperties/thermophysicalProperties.C
liquidProperties/liquidProperties/liquidProperties.C
liquidProperties/liquidMixtureProperties/liquidMixtureProperties.C
+liquidProperties/liquid/liquid.C
liquidProperties/H2O/H2O.C
liquidProperties/C7H16/C7H16.C
liquidProperties/C12H26/C12H26.C
diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.C b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.C
new file mode 100644
index 0000000000..be84a6f8c0
--- /dev/null
+++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.C
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "liquid.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(liquid, 0);
+ addToRunTimeSelectionTable(liquidProperties, liquid, dictionary);
+}
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::liquid::liquid(const dictionary& dict)
+:
+ liquidProperties(dict),
+ rho_(thermophysicalFunction::New(dict, "rho")),
+ pv_(thermophysicalFunction::New(dict, "pv")),
+ hl_(thermophysicalFunction::New(dict, "hl")),
+ Cp_(thermophysicalFunction::New(dict, "Cp")),
+ h_(thermophysicalFunction::New(dict, "h")),
+ Cpg_(thermophysicalFunction::New(dict, "Cpg")),
+ B_(thermophysicalFunction::New(dict, "B")),
+ mu_(thermophysicalFunction::New(dict, "mu")),
+ mug_(thermophysicalFunction::New(dict, "mug")),
+ kappa_(thermophysicalFunction::New(dict, "kappa")),
+ kappag_(thermophysicalFunction::New(dict, "kappag")),
+ sigma_(thermophysicalFunction::New(dict, "sigma")),
+ D_(thermophysicalFunction::New(dict, "D"))
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::liquid::writeData(Ostream& os) const
+{
+ liquidProperties::writeData(os); os << nl;
+ rho_->writeData(os); os << nl;
+ pv_->writeData(os); os << nl;
+ hl_->writeData(os); os << nl;
+ Cp_->writeData(os); os << nl;
+ h_->writeData(os); os << nl;
+ Cpg_->writeData(os); os << nl;
+ B_->writeData(os); os << nl;
+ mu_->writeData(os); os << nl;
+ mug_->writeData(os); os << nl;
+ kappa_->writeData(os); os << nl;
+ kappag_->writeData(os); os << nl;
+ sigma_->writeData(os); os << nl;
+ D_->writeData(os); os << endl;
+}
+
+
+// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
+
+Foam::Ostream& Foam::operator<<(Ostream& os, const liquid& l)
+{
+ l.writeData(os);
+ return os;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H
new file mode 100644
index 0000000000..3b8de47c1d
--- /dev/null
+++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H
@@ -0,0 +1,162 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::liquid
+
+Description
+ Generic thermophysical properties class for a liquid in which the
+ functions and coefficients for each property are run-time selected.
+
+SourceFiles
+ liquid.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef liquid_H
+#define liquid_H
+
+#include "liquidProperties.H"
+#include "thermophysicalFunction.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class liquid Declaration
+\*---------------------------------------------------------------------------*/
+
+class liquid
+:
+ public liquidProperties
+{
+ // Private Data
+
+ autoPtr rho_;
+ autoPtr pv_;
+ autoPtr hl_;
+ autoPtr Cp_;
+ autoPtr h_;
+ autoPtr Cpg_;
+ autoPtr B_;
+ autoPtr mu_;
+ autoPtr mug_;
+ autoPtr kappa_;
+ autoPtr kappag_;
+ autoPtr sigma_;
+ autoPtr D_;
+
+
+public:
+
+ friend class liquidProperties;
+
+ //- Runtime type information
+ TypeName("liquid");
+
+
+ // Constructors
+
+ //- Construct from dictionary
+ liquid(const dictionary& dict);
+
+ //- Construct and return clone
+ virtual autoPtr clone() const
+ {
+ return autoPtr(new liquid(*this));
+ }
+
+
+ // Member Functions
+
+ //- Liquid density [kg/m^3]
+ inline scalar rho(scalar p, scalar T) const;
+
+ //- Vapour pressure [Pa]
+ inline scalar pv(scalar p, scalar T) const;
+
+ //- Heat of vapourisation [J/kg]
+ inline scalar hl(scalar p, scalar T) const;
+
+ //- Liquid heat capacity [J/kg/K]
+ inline scalar Cp(scalar p, scalar T) const;
+
+ //- Liquid enthalpy [J/kg]
+ inline scalar h(scalar p, scalar T) const;
+
+ //- Ideal gas heat capacity [J/kg/K]
+ inline scalar Cpg(scalar p, scalar T) const;
+
+ //- Second Virial Coefficient [m^3/kg]
+ inline scalar B(scalar p, scalar T) const;
+
+ //- Liquid viscosity [Pa s]
+ inline scalar mu(scalar p, scalar T) const;
+
+ //- Vapour viscosity [Pa s]
+ inline scalar mug(scalar p, scalar T) const;
+
+ //- Liquid thermal conductivity [W/m/K]
+ inline scalar kappa(scalar p, scalar T) const;
+
+ //- Vapour thermal conductivity [W/m/K]
+ inline scalar kappag(scalar p, scalar T) const;
+
+ //- Surface tension [N/m]
+ inline scalar sigma(scalar p, scalar T) const;
+
+ //- Vapour diffusivity [m^2/s]
+ inline scalar D(scalar p, scalar T) const;
+
+ //- Vapour diffusivity [m^2/s] with specified binary pair
+ inline scalar D(scalar p, scalar T, scalar Wb) const;
+
+
+ // I-O
+
+ //- Write the function coefficients
+ void writeData(Ostream& os) const;
+
+ //- Ostream Operator
+ friend Ostream& operator<<(Ostream& os, const liquid& l);
+};
+
+
+Ostream& operator<<(Ostream& os, const liquid& l);
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "liquidI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquidI.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquidI.H
new file mode 100644
index 0000000000..72b544b09c
--- /dev/null
+++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquidI.H
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+inline Foam::scalar Foam::liquid::rho(scalar p, scalar T) const
+{
+ return rho_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::pv(scalar p, scalar T) const
+{
+ return pv_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::hl(scalar p, scalar T) const
+{
+ return hl_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::Cp(scalar p, scalar T) const
+{
+ return Cp_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::h(scalar p, scalar T) const
+{
+ return h_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::Cpg(scalar p, scalar T) const
+{
+ return Cpg_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::B(scalar p, scalar T) const
+{
+ return B_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::mu(scalar p, scalar T) const
+{
+ return mu_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::mug(scalar p, scalar T) const
+{
+ return mug_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::kappa(scalar p, scalar T) const
+{
+ return kappa_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::kappag(scalar p, scalar T) const
+{
+ return kappag_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::sigma(scalar p, scalar T) const
+{
+ return sigma_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::D(scalar p, scalar T) const
+{
+ return D_->f(p, T);
+}
+
+
+inline Foam::scalar Foam::liquid::D(scalar p, scalar T, scalar Wb) const
+{
+ // Currently ignoring the Wb argument
+ return D_->f(p, T);
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/noneFunc/noneFunc.C b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/noneFunc/noneFunc.C
new file mode 100644
index 0000000000..0fc475d403
--- /dev/null
+++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/noneFunc/noneFunc.C
@@ -0,0 +1,71 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "noneFunc.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(noneFunc, 0);
+ addToRunTimeSelectionTable(thermophysicalFunction, noneFunc, dictionary);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::noneFunc::noneFunc(const dictionary& dict)
+:
+ dictName_(dict.name())
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+Foam::scalar Foam::noneFunc::f(scalar p, scalar T) const
+{
+ FatalErrorInFunction
+ << "Required Function " << nl
+ << " " << dictName_ << nl
+ << " is not defined."
+ << exit(FatalError);
+
+ return 0;
+}
+
+void Foam::noneFunc::writeData(Ostream& os) const
+{}
+
+
+// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
+
+Foam::Ostream& Foam::operator<<(Ostream& os, const noneFunc& f)
+{
+ return os;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/noneFunc/noneFunc.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/noneFunc/noneFunc.H
new file mode 100644
index 0000000000..fb8f5a3131
--- /dev/null
+++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/noneFunc/noneFunc.H
@@ -0,0 +1,96 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::noneFunc
+
+Description
+ Undefined function which returns an error when called.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef noneFunc_H
+#define noneFunc_H
+
+#include "thermophysicalFunction.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of friend functions and operators
+class noneFunc;
+Ostream& operator<<(Ostream& os, const noneFunc& f);
+
+
+/*---------------------------------------------------------------------------*\
+ Class noneFunc Declaration
+\*---------------------------------------------------------------------------*/
+
+class noneFunc
+:
+ public thermophysicalFunction
+{
+ // Private member data
+
+ //- Name of dictionary from which this function is instantiated
+ fileName dictName_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("none");
+
+
+ // Constructors
+
+ //- Construct from dictionary
+ noneFunc(const dictionary& dict);
+
+
+ // Member Functions
+
+ //- Evaluate the function and return the result
+ scalar f(scalar p, scalar T) const;
+
+ //- Write the function coefficients
+ void writeData(Ostream& os) const;
+
+
+ // Ostream Operator
+
+ friend Ostream& operator<<(Ostream& os, const noneFunc& f);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C
index 210f7c02c8..876d253327 100644
--- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C
+++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "thermophysicalFunction.H"
-#include "HashTable.H"
+#include "noneFunc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -39,7 +39,8 @@ namespace Foam
Foam::autoPtr Foam::thermophysicalFunction::New
(
- const dictionary& dict
+ const dictionary& dict,
+ const word& name
)
{
if (debug)
@@ -49,23 +50,31 @@ Foam::autoPtr Foam::thermophysicalFunction::New
<< endl;
}
- const word thermophysicalFunctionType(dict.lookup("functionType"));
+ if (dict.isDict(name))
+ {
+ const dictionary& funcDict(dict.subDict(name));
+ const word thermophysicalFunctionType(funcDict.lookup("type"));
- dictionaryConstructorTable::iterator cstrIter =
+ dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(thermophysicalFunctionType);
- if (cstrIter == dictionaryConstructorTablePtr_->end())
- {
- FatalErrorInFunction
- << "Unknown thermophysicalFunction type "
- << thermophysicalFunctionType
- << nl << nl
- << "Valid thermophysicalFunction types are :" << endl
- << dictionaryConstructorTablePtr_->sortedToc()
- << abort(FatalError);
- }
+ if (cstrIter == dictionaryConstructorTablePtr_->end())
+ {
+ FatalErrorInFunction
+ << "Unknown thermophysicalFunction type "
+ << thermophysicalFunctionType
+ << nl << nl
+ << "Valid thermophysicalFunction types are :" << endl
+ << dictionaryConstructorTablePtr_->sortedToc()
+ << abort(FatalError);
+ }
- return autoPtr(cstrIter()(dict));
+ return autoPtr(cstrIter()(funcDict));
+ }
+ else
+ {
+ return autoPtr(new noneFunc(dict.name()/name));
+ }
}
diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H
index 7f3cf734e1..56e6ca3fed 100644
--- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H
+++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -76,7 +76,11 @@ public:
{}
//- Return pointer to new thermophysicalFunction created from dict
- static autoPtr New(const dictionary& dict);
+ static autoPtr New
+ (
+ const dictionary& dict,
+ const word& name
+ );
//- Destructor