mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
liquidThermo: rhoThermo instantiated on liquidProperties
This allows single, multi-phase and VoF compressible simulations to be performed
with the accurate thermophysical property functions for liquids provided by the
liquidProperty classes. e.g. in the
multiphase/compressibleInterFoam/laminar/depthCharge2D tutorial water can now be
specified by
thermoType
{
type heRhoThermo;
mixture pureMixture;
properties liquid;
energy sensibleInternalEnergy;
}
mixture
{
H2O;
}
as an alternative to the previous less accurate representation defined by
thermoType
{
type heRhoThermo;
mixture pureMixture;
transport const;
thermo hConst;
equationOfState perfectFluid;
specie specie;
energy sensibleInternalEnergy;
}
mixture
{
specie
{
molWeight 18.0;
}
equationOfState
{
R 3000;
rho0 1027;
}
thermodynamics
{
Cp 4195;
Hf 0;
}
transport
{
mu 3.645e-4;
Pr 2.289;
}
}
However the increase in accuracy of the new simpler and more convenient
specification and representation comes at a cost: the NSRDS functions used by
the liquidProperties classes are relatively expensive to evaluate and the
depthCharge2D case takes ~14% longer to run.
This commit is contained in:
@ -6,6 +6,7 @@ psiThermo/psiThermos.C
|
|||||||
|
|
||||||
rhoThermo/rhoThermo.C
|
rhoThermo/rhoThermo.C
|
||||||
rhoThermo/rhoThermos.C
|
rhoThermo/rhoThermos.C
|
||||||
|
rhoThermo/liquidThermo.C
|
||||||
|
|
||||||
derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
|
derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
|
||||||
derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
|
derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
|
||||||
|
|||||||
@ -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-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -449,14 +449,28 @@ Foam::wordList Foam::basicThermo::splitThermoName
|
|||||||
{
|
{
|
||||||
cmpts[i] = thermoName.substr(beg, end-beg);
|
cmpts[i] = thermoName.substr(beg, end-beg);
|
||||||
cmpts[i++].replaceAll(">","");
|
cmpts[i++].replaceAll(">","");
|
||||||
|
|
||||||
|
// If the number of number of components in the name
|
||||||
|
// is greater than nCmpt return an empty list
|
||||||
|
if (i == nCmpt)
|
||||||
|
{
|
||||||
|
return wordList::null();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
beg = end + 1;
|
beg = end + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the number of number of components in the name is not equal to nCmpt
|
||||||
|
// return an empty list
|
||||||
|
if (i + 1 != nCmpt)
|
||||||
|
{
|
||||||
|
return wordList::null();
|
||||||
|
}
|
||||||
|
|
||||||
if (beg < thermoName.size())
|
if (beg < thermoName.size())
|
||||||
{
|
{
|
||||||
cmpts[i] = thermoName.substr(beg, string::npos);
|
cmpts[i] = thermoName.substr(beg, string::npos);
|
||||||
cmpts[i++].replaceAll(">","");
|
cmpts[i].replaceAll(">","");
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmpts;
|
return cmpts;
|
||||||
|
|||||||
@ -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-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -135,6 +135,17 @@ public:
|
|||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
|
//- Generic lookup for thermodynamics package thermoTypeName
|
||||||
|
template<class Thermo, class Table>
|
||||||
|
static typename Table::iterator lookupThermo
|
||||||
|
(
|
||||||
|
const dictionary& thermoTypeDict,
|
||||||
|
Table* tablePtr,
|
||||||
|
const int nCmpt,
|
||||||
|
const char* cmptNames[],
|
||||||
|
const word& thermoTypeName
|
||||||
|
);
|
||||||
|
|
||||||
//- Generic lookup for each of the related thermodynamics packages
|
//- Generic lookup for each of the related thermodynamics packages
|
||||||
template<class Thermo, class Table>
|
template<class Thermo, class Table>
|
||||||
static typename Table::iterator lookupThermo
|
static typename Table::iterator lookupThermo
|
||||||
|
|||||||
@ -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) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,40 +30,13 @@ License
|
|||||||
template<class Thermo, class Table>
|
template<class Thermo, class Table>
|
||||||
typename Table::iterator Foam::basicThermo::lookupThermo
|
typename Table::iterator Foam::basicThermo::lookupThermo
|
||||||
(
|
(
|
||||||
const dictionary& thermoDict,
|
const dictionary& thermoTypeDict,
|
||||||
Table* tablePtr
|
Table* tablePtr,
|
||||||
|
const int nCmpt,
|
||||||
|
const char* cmptNames[],
|
||||||
|
const word& thermoTypeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word thermoTypeName;
|
|
||||||
|
|
||||||
if (thermoDict.isDict("thermoType"))
|
|
||||||
{
|
|
||||||
const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
|
|
||||||
|
|
||||||
Info<< "Selecting thermodynamics package " << thermoTypeDict << endl;
|
|
||||||
|
|
||||||
const int nCmpt = 7;
|
|
||||||
const char* cmptNames[nCmpt] =
|
|
||||||
{
|
|
||||||
"type",
|
|
||||||
"mixture",
|
|
||||||
"transport",
|
|
||||||
"thermo",
|
|
||||||
"equationOfState",
|
|
||||||
"specie",
|
|
||||||
"energy"
|
|
||||||
};
|
|
||||||
|
|
||||||
// Construct the name of the thermo package from the components
|
|
||||||
thermoTypeName =
|
|
||||||
word(thermoTypeDict.lookup("type")) + '<'
|
|
||||||
+ word(thermoTypeDict.lookup("mixture")) + '<'
|
|
||||||
+ word(thermoTypeDict.lookup("transport")) + '<'
|
|
||||||
+ word(thermoTypeDict.lookup("thermo")) + '<'
|
|
||||||
+ word(thermoTypeDict.lookup("equationOfState")) + '<'
|
|
||||||
+ word(thermoTypeDict.lookup("specie")) + ">>,"
|
|
||||||
+ word(thermoTypeDict.lookup("energy")) + ">>>";
|
|
||||||
|
|
||||||
// Lookup the thermo package
|
// Lookup the thermo package
|
||||||
typename Table::iterator cstrIter = tablePtr->find(thermoTypeName);
|
typename Table::iterator cstrIter = tablePtr->find(thermoTypeName);
|
||||||
|
|
||||||
@ -73,7 +46,8 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
|||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unknown " << Thermo::typeName << " type " << nl
|
<< "Unknown " << Thermo::typeName << " type " << nl
|
||||||
<< "thermoType" << thermoTypeDict << nl << nl
|
<< "thermoType" << thermoTypeDict << nl << nl
|
||||||
<< "Valid " << Thermo::typeName << " types are:" << nl << nl;
|
<< "Valid " << Thermo::typeName << " types are:"
|
||||||
|
<< nl << nl;
|
||||||
|
|
||||||
// Get the list of all the suitable thermo packages available
|
// Get the list of all the suitable thermo packages available
|
||||||
wordList validThermoTypeNames
|
wordList validThermoTypeNames
|
||||||
@ -95,11 +69,21 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Split the thermo package names into their constituent parts
|
// Split the thermo package names into their constituent parts
|
||||||
|
// Removing incompatible entries from the list
|
||||||
|
label j = 0;
|
||||||
forAll(validThermoTypeNames, i)
|
forAll(validThermoTypeNames, i)
|
||||||
{
|
{
|
||||||
validThermoTypeNameCmpts[i+1] =
|
wordList names
|
||||||
Thermo::splitThermoName(validThermoTypeNames[i], nCmpt);
|
(
|
||||||
|
Thermo::splitThermoName(validThermoTypeNames[i], nCmpt)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (names.size())
|
||||||
|
{
|
||||||
|
validThermoTypeNameCmpts[j++] = names;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
validThermoTypeNameCmpts.setSize(j);
|
||||||
|
|
||||||
// Print the table of available packages
|
// Print the table of available packages
|
||||||
// in terms of their constituent parts
|
// in terms of their constituent parts
|
||||||
@ -110,9 +94,89 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
|||||||
|
|
||||||
return cstrIter;
|
return cstrIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Thermo, class Table>
|
||||||
|
typename Table::iterator Foam::basicThermo::lookupThermo
|
||||||
|
(
|
||||||
|
const dictionary& thermoDict,
|
||||||
|
Table* tablePtr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (thermoDict.isDict("thermoType"))
|
||||||
|
{
|
||||||
|
const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
|
||||||
|
|
||||||
|
Info<< "Selecting thermodynamics package " << thermoTypeDict << endl;
|
||||||
|
|
||||||
|
if (thermoTypeDict.found("properties"))
|
||||||
|
{
|
||||||
|
const int nCmpt = 4;
|
||||||
|
const char* cmptNames[nCmpt] =
|
||||||
|
{
|
||||||
|
"type",
|
||||||
|
"mixture",
|
||||||
|
"properties",
|
||||||
|
"energy"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Construct the name of the thermo package from the components
|
||||||
|
const word thermoTypeName
|
||||||
|
(
|
||||||
|
word(thermoTypeDict.lookup("type")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("mixture")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("properties")) + ','
|
||||||
|
+ word(thermoTypeDict.lookup("energy")) + ">>"
|
||||||
|
);
|
||||||
|
|
||||||
|
return lookupThermo<Thermo, Table>
|
||||||
|
(
|
||||||
|
thermoTypeDict,
|
||||||
|
tablePtr,
|
||||||
|
nCmpt,
|
||||||
|
cmptNames,
|
||||||
|
thermoTypeName
|
||||||
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thermoTypeName = word(thermoDict.lookup("thermoType"));
|
const int nCmpt = 7;
|
||||||
|
const char* cmptNames[nCmpt] =
|
||||||
|
{
|
||||||
|
"type",
|
||||||
|
"mixture",
|
||||||
|
"transport",
|
||||||
|
"thermo",
|
||||||
|
"equationOfState",
|
||||||
|
"specie",
|
||||||
|
"energy"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Construct the name of the thermo package from the components
|
||||||
|
const word thermoTypeName
|
||||||
|
(
|
||||||
|
word(thermoTypeDict.lookup("type")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("mixture")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("transport")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("thermo")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("equationOfState")) + '<'
|
||||||
|
+ word(thermoTypeDict.lookup("specie")) + ">>,"
|
||||||
|
+ word(thermoTypeDict.lookup("energy")) + ">>>"
|
||||||
|
);
|
||||||
|
|
||||||
|
return lookupThermo<Thermo, Table>
|
||||||
|
(
|
||||||
|
thermoTypeDict,
|
||||||
|
tablePtr,
|
||||||
|
nCmpt,
|
||||||
|
cmptNames,
|
||||||
|
thermoTypeName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const word thermoTypeName(thermoDict.lookup("thermoType"));
|
||||||
|
|
||||||
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
|
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
|
||||||
|
|
||||||
|
|||||||
91
src/thermophysicalModels/basic/rhoThermo/liquidThermo.C
Normal file
91
src/thermophysicalModels/basic/rhoThermo/liquidThermo.C
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 "rhoThermo.H"
|
||||||
|
#include "heRhoThermo.H"
|
||||||
|
#include "pureMixture.H"
|
||||||
|
#include "thermo.H"
|
||||||
|
#include "sensibleEnthalpy.H"
|
||||||
|
#include "sensibleInternalEnergy.H"
|
||||||
|
|
||||||
|
#include "thermophysicalPropertiesSelector.H"
|
||||||
|
#include "liquidProperties.H"
|
||||||
|
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
typedef heRhoThermo
|
||||||
|
<
|
||||||
|
rhoThermo,
|
||||||
|
pureMixture
|
||||||
|
<
|
||||||
|
species::thermo
|
||||||
|
<
|
||||||
|
thermophysicalPropertiesSelector<liquidProperties>,
|
||||||
|
sensibleInternalEnergy
|
||||||
|
>
|
||||||
|
>
|
||||||
|
> heRhoThermopureMixtureliquidProperties;
|
||||||
|
|
||||||
|
defineTemplateTypeNameAndDebugWithName
|
||||||
|
(
|
||||||
|
heRhoThermopureMixtureliquidProperties,
|
||||||
|
"heRhoThermo<pureMixture<liquid,sensibleInternalEnergy>>",
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
basicThermo,
|
||||||
|
heRhoThermopureMixtureliquidProperties,
|
||||||
|
fvMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
fluidThermo,
|
||||||
|
heRhoThermopureMixtureliquidProperties,
|
||||||
|
fvMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
rhoThermo,
|
||||||
|
heRhoThermopureMixtureliquidProperties,
|
||||||
|
fvMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -31,8 +31,6 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(H2O, 0);
|
defineTypeNameAndDebug(H2O, 0);
|
||||||
addToRunTimeSelectionTable(thermophysicalProperties, H2O,);
|
|
||||||
addToRunTimeSelectionTable(thermophysicalProperties, H2O, dictionary);
|
|
||||||
addToRunTimeSelectionTable(liquidProperties, H2O,);
|
addToRunTimeSelectionTable(liquidProperties, H2O,);
|
||||||
addToRunTimeSelectionTable(liquidProperties, H2O, dictionary);
|
addToRunTimeSelectionTable(liquidProperties, H2O, dictionary);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ class liquidProperties
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeName("liquidProperties");
|
TypeName("liquid");
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
@ -148,6 +148,15 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
|
||||||
|
//- Is the equation of state is incompressible i.e. rho != f(p)
|
||||||
|
static const bool incompressible = true;
|
||||||
|
|
||||||
|
//- Is the equation of state is isochoric i.e. rho = const
|
||||||
|
static const bool isochoric = false;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Physical constants which define the specie
|
// Physical constants which define the specie
|
||||||
|
|||||||
@ -72,7 +72,7 @@ class solidProperties
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("solidProperties");
|
TypeName("solid");
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|||||||
@ -115,12 +115,6 @@ public:
|
|||||||
//- Molecular weight [kg/kmol]
|
//- Molecular weight [kg/kmol]
|
||||||
inline scalar W() const;
|
inline scalar W() const;
|
||||||
|
|
||||||
//- Is the equation of state is incompressible i.e. rho != f(p)
|
|
||||||
static const bool incompressible = true;
|
|
||||||
|
|
||||||
//- Is the equation of state is isochoric i.e. rho = const
|
|
||||||
static const bool isochoric = false;
|
|
||||||
|
|
||||||
//- Limit the temperature to be in the range Tlow_ to Thigh_
|
//- Limit the temperature to be in the range Tlow_ to Thigh_
|
||||||
inline scalar limit(const scalar T) const;
|
inline scalar limit(const scalar T) const;
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::scalar Foam::thermophysicalProperties::limit(const scalar T) const
|
inline Foam::scalar Foam::thermophysicalProperties::limit(const scalar T) const
|
||||||
{
|
{
|
||||||
return T;
|
return T;
|
||||||
|
|||||||
@ -0,0 +1,61 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 "thermophysicalPropertiesSelector.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::
|
||||||
|
thermophysicalPropertiesSelector
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
propertiesPtr_(ThermophysicalProperties::New(name))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::
|
||||||
|
thermophysicalPropertiesSelector
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word name(dict.first()->keyword());
|
||||||
|
|
||||||
|
if (dict.isDict(name))
|
||||||
|
{
|
||||||
|
propertiesPtr_ = ThermophysicalProperties::New(dict.subDict(name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
propertiesPtr_ = ThermophysicalProperties::New(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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::thermophysicalPropertiesSelector
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wrapper class providing run-time selection of thermophysicalProperties
|
||||||
|
for the templated thermodynamics packages.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermophysicalPropertiesSelectorI.H
|
||||||
|
thermophysicalPropertiesSelector.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermophysicalPropertiesSelector_H
|
||||||
|
#define thermophysicalPropertiesSelector_H
|
||||||
|
|
||||||
|
#include "thermophysicalProperties.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermophysicalPropertiesSelector Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
class thermophysicalPropertiesSelector
|
||||||
|
{
|
||||||
|
// Private member data
|
||||||
|
|
||||||
|
autoPtr<ThermophysicalProperties> propertiesPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name
|
||||||
|
thermophysicalPropertiesSelector(const word& name);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
thermophysicalPropertiesSelector(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
|
||||||
|
//- Is the equation of state is incompressible i.e. rho != f(p)
|
||||||
|
static const bool incompressible =
|
||||||
|
ThermophysicalProperties::incompressible;
|
||||||
|
|
||||||
|
//- Is the equation of state is isochoric i.e. rho = const
|
||||||
|
static const bool isochoric =
|
||||||
|
ThermophysicalProperties::isochoric;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Physical constants which define the specie
|
||||||
|
|
||||||
|
//- Molecular weight [kg/kmol]
|
||||||
|
inline scalar W() const;
|
||||||
|
|
||||||
|
//- Limit the temperature to be in the range Tlow_ to Thigh_
|
||||||
|
inline scalar limit(const scalar T) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Fundamental equation of state properties
|
||||||
|
|
||||||
|
//- Liquid density [kg/m^3]
|
||||||
|
inline scalar rho(scalar p, scalar T) const;
|
||||||
|
|
||||||
|
//- Liquid compressibility rho/p [s^2/m^2]
|
||||||
|
// Note: currently it is assumed the liquid is incompressible
|
||||||
|
inline scalar psi(scalar p, scalar T) const;
|
||||||
|
|
||||||
|
//- Return (Cp - Cv) [J/(kg K]
|
||||||
|
// Note: currently it is assumed the liquid is incompressible
|
||||||
|
// so CpMCv 0
|
||||||
|
inline scalar CpMCv(scalar p, scalar T) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Fundamental thermodynamic properties
|
||||||
|
|
||||||
|
//- Heat capacity at constant pressure [J/(kg K)]
|
||||||
|
inline scalar Cp(const scalar p, const scalar T) const;
|
||||||
|
|
||||||
|
//- Absolute Enthalpy [J/kg]
|
||||||
|
inline scalar Ha(const scalar p, const scalar T) const;
|
||||||
|
|
||||||
|
//- Sensible enthalpy [J/kg]
|
||||||
|
inline scalar Hs(const scalar p, const scalar T) const;
|
||||||
|
|
||||||
|
//- Chemical enthalpy [J/kg]
|
||||||
|
inline scalar Hc() const;
|
||||||
|
|
||||||
|
// Entropy [J/(kg K)]
|
||||||
|
inline scalar S(const scalar p, const scalar T) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Physical properties
|
||||||
|
|
||||||
|
//- Liquid viscosity [Pa s]
|
||||||
|
inline scalar mu(scalar p, scalar T) const;
|
||||||
|
|
||||||
|
//- Liquid thermal conductivity [W/(m K)]
|
||||||
|
inline scalar kappa(scalar p, scalar T) const;
|
||||||
|
|
||||||
|
//- Liquid thermal diffusivity of enthalpy [kg/ms]
|
||||||
|
inline scalar alphah(const scalar p, const scalar T) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "thermophysicalPropertiesSelectorI.H"
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "thermophysicalPropertiesSelector.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,175 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::W() const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->W();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::limit
|
||||||
|
(
|
||||||
|
const scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->limit(T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::rho
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->rho(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::psi
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->psi(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::CpMCv
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->CpMCv(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::Cp
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->Cp(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::Ha
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->Ha(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::Hs
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->Hs(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::Hc() const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->Hc();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::S
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->S(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::mu
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->mu(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::kappa
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->kappa(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ThermophysicalProperties>
|
||||||
|
inline Foam::scalar
|
||||||
|
Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::alphah
|
||||||
|
(
|
||||||
|
scalar p,
|
||||||
|
scalar T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return propertiesPtr_->alphah(p, T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -15,6 +15,21 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermoType
|
||||||
|
{
|
||||||
|
type heRhoThermo;
|
||||||
|
mixture pureMixture;
|
||||||
|
properties liquid;
|
||||||
|
energy sensibleInternalEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
|
mixture
|
||||||
|
{
|
||||||
|
H2O;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
thermoType
|
thermoType
|
||||||
{
|
{
|
||||||
type heRhoThermo;
|
type heRhoThermo;
|
||||||
@ -48,6 +63,7 @@ mixture
|
|||||||
Pr 2.289;
|
Pr 2.289;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user