mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Thermodynamics: templated New function to reuse in all basic thermo types
This commit is contained in:
@ -1,18 +1,10 @@
|
|||||||
mixtures/basicMixture/basicMixture.C
|
|
||||||
mixtures/basicMixture/basicMixtures.C
|
|
||||||
|
|
||||||
basicThermo/basicThermo.C
|
basicThermo/basicThermo.C
|
||||||
basicThermo/basicThermoNew.C
|
|
||||||
|
|
||||||
fluidThermo/fluidThermo.C
|
fluidThermo/fluidThermo.C
|
||||||
fluidThermo/fluidThermoNew.C
|
|
||||||
|
|
||||||
psiThermo/psiThermo/psiThermo.C
|
psiThermo/psiThermo/psiThermo.C
|
||||||
psiThermo/psiThermo/psiThermoNew.C
|
|
||||||
psiThermo/hePsiThermo/hePsiThermos.C
|
psiThermo/hePsiThermo/hePsiThermos.C
|
||||||
|
|
||||||
rhoThermo/rhoThermo/rhoThermo.C
|
rhoThermo/rhoThermo/rhoThermo.C
|
||||||
rhoThermo/rhoThermo/rhoThermoNew.C
|
|
||||||
rhoThermo/heRhoThermo/heRhoThermos.C
|
rhoThermo/heRhoThermo/heRhoThermos.C
|
||||||
|
|
||||||
derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
|
derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
|
||||||
|
|||||||
@ -156,6 +156,15 @@ Foam::basicThermo::basicThermo
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return NewThermo<basicThermo>(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::basicThermo::~basicThermo()
|
Foam::basicThermo::~basicThermo()
|
||||||
@ -247,6 +256,41 @@ void Foam::basicThermo::validate
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::basicThermo::splitThermoName
|
||||||
|
(
|
||||||
|
const word& thermoName,
|
||||||
|
const int nCmpt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wordList cmpts(nCmpt);
|
||||||
|
|
||||||
|
string::size_type beg=0, end=0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while
|
||||||
|
(
|
||||||
|
(end = thermoName.find('<', beg)) != string::npos
|
||||||
|
|| (end = thermoName.find(',', beg)) != string::npos
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (beg < end)
|
||||||
|
{
|
||||||
|
cmpts[i] = thermoName.substr(beg, end-beg);
|
||||||
|
cmpts[i++].replaceAll(">","");
|
||||||
|
}
|
||||||
|
beg = end + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beg < thermoName.size())
|
||||||
|
{
|
||||||
|
cmpts[i] = thermoName.substr(beg, string::npos);
|
||||||
|
cmpts[i++].replaceAll(">","");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmpts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::volScalarField& Foam::basicThermo::p()
|
Foam::volScalarField& Foam::basicThermo::p()
|
||||||
{
|
{
|
||||||
return p_;
|
return p_;
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
|
#include "wordIOList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -93,6 +94,7 @@ public:
|
|||||||
(mesh)
|
(mesh)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
@ -150,6 +152,12 @@ public:
|
|||||||
const word&
|
const word&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Split name of thermo package into a list of the components names
|
||||||
|
static wordList splitThermoName
|
||||||
|
(
|
||||||
|
const word& thermoName,
|
||||||
|
const int nCmpt
|
||||||
|
);
|
||||||
|
|
||||||
//- Update properties
|
//- Update properties
|
||||||
virtual void correct() = 0;
|
virtual void correct() = 0;
|
||||||
@ -336,6 +344,126 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class Thermo>
|
||||||
|
autoPtr<Thermo> NewThermo
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOdictionary thermoDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"thermophysicalProperties",
|
||||||
|
mesh.time().constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
typename Thermo::fvMeshConstructorTable::iterator cstrIter =
|
||||||
|
Thermo::fvMeshConstructorTablePtr_->find(thermoTypeName);
|
||||||
|
|
||||||
|
// Print error message if package not found in the table
|
||||||
|
if (cstrIter == Thermo::fvMeshConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn(Thermo::typeName + "::New(const fvMesh&)")
|
||||||
|
<< "Unknown " << Thermo::typeName << " type " << nl
|
||||||
|
<< "thermoType" << thermoTypeDict << nl << nl
|
||||||
|
<< "Valid " << Thermo::typeName << " types are:" << nl << nl;
|
||||||
|
|
||||||
|
// Get the list of all the suitable thermo packages available
|
||||||
|
wordList validThermoTypeNames
|
||||||
|
(
|
||||||
|
Thermo::fvMeshConstructorTablePtr_->sortedToc()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Build a table of the thermo packages constituent parts
|
||||||
|
// Note: row-0 contains the names of constituent parts
|
||||||
|
List<wordList> validThermoTypeNameCmpts
|
||||||
|
(
|
||||||
|
validThermoTypeNames.size() + 1
|
||||||
|
);
|
||||||
|
|
||||||
|
validThermoTypeNameCmpts[0].setSize(nCmpt);
|
||||||
|
forAll(validThermoTypeNameCmpts[0], j)
|
||||||
|
{
|
||||||
|
validThermoTypeNameCmpts[0][j] = cmptNames[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split the thermo package names into their constituent parts
|
||||||
|
forAll(validThermoTypeNames, i)
|
||||||
|
{
|
||||||
|
validThermoTypeNameCmpts[i+1] =
|
||||||
|
Thermo::splitThermoName(validThermoTypeNames[i], nCmpt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the table of available packages
|
||||||
|
// in terms of their constituent parts
|
||||||
|
printTable(validThermoTypeNameCmpts, FatalError);
|
||||||
|
|
||||||
|
FatalError<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<Thermo>(cstrIter()(mesh));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thermoTypeName = word(thermoDict.lookup("thermoType"));
|
||||||
|
|
||||||
|
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
|
||||||
|
|
||||||
|
typename Thermo::fvMeshConstructorTable::iterator cstrIter =
|
||||||
|
Thermo::fvMeshConstructorTablePtr_->find(thermoTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == Thermo::fvMeshConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn(Thermo::typeName + "::New(const fvMesh&)")
|
||||||
|
<< "Unknown " << Thermo::typeName << " type "
|
||||||
|
<< thermoTypeName << nl << nl
|
||||||
|
<< "Valid " << Thermo::typeName << " types are:" << nl
|
||||||
|
<< Thermo::fvMeshConstructorTablePtr_->sortedToc() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<Thermo>(cstrIter()(mesh));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -1,71 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 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 "basicThermo.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New
|
|
||||||
(
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// get model name, but do not register the dictionary
|
|
||||||
// otherwise it is registered in the database twice
|
|
||||||
const word modelType
|
|
||||||
(
|
|
||||||
IOdictionary
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"thermophysicalProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
).lookup("thermoType")
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Selecting thermodynamics package " << modelType << endl;
|
|
||||||
|
|
||||||
fvMeshConstructorTable::iterator cstrIter =
|
|
||||||
fvMeshConstructorTablePtr_->find(modelType);
|
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
|
||||||
{
|
|
||||||
FatalErrorIn("basicThermo::New(const fvMesh&)")
|
|
||||||
<< "Unknown basicThermo type " << modelType << nl << nl
|
|
||||||
<< "Valid basicThermo types are:" << nl
|
|
||||||
<< fvMeshConstructorTablePtr_->sortedToc() << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoPtr<basicThermo>(cstrIter()(mesh));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -49,6 +49,15 @@ Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const dictionary& dict)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return NewThermo<fluidThermo>(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fluidThermo::~fluidThermo()
|
Foam::fluidThermo::~fluidThermo()
|
||||||
|
|||||||
@ -1,71 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 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 "fluidThermo.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New
|
|
||||||
(
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// get model name, but do not register the dictionary
|
|
||||||
// otherwise it is registered in the database twice
|
|
||||||
const word modelType
|
|
||||||
(
|
|
||||||
IOdictionary
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"thermophysicalProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
).lookup("thermoType")
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Selecting thermodynamics package " << modelType << endl;
|
|
||||||
|
|
||||||
fvMeshConstructorTable::iterator cstrIter =
|
|
||||||
fvMeshConstructorTablePtr_->find(modelType);
|
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
|
||||||
{
|
|
||||||
FatalErrorIn("fluidThermo::New(const fvMesh&)")
|
|
||||||
<< "Unknown fluidThermo type " << modelType << nl << nl
|
|
||||||
<< "Valid fluidThermo types are:" << nl
|
|
||||||
<< fvMeshConstructorTablePtr_->sortedToc() << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoPtr<fluidThermo>(cstrIter()(mesh));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -24,29 +24,12 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "basicMixture.H"
|
#include "basicMixture.H"
|
||||||
#include "fvMesh.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(basicMixture, 0);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
basicMixture::basicMixture(const dictionary&, const fvMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
basicMixture::~basicMixture()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -35,8 +35,6 @@ SourceFiles
|
|||||||
#ifndef basicMixture_H
|
#ifndef basicMixture_H
|
||||||
#define basicMixture_H
|
#define basicMixture_H
|
||||||
|
|
||||||
#include "typeInfo.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -58,18 +56,11 @@ public:
|
|||||||
typedef basicMixture basicMixtureType;
|
typedef basicMixture basicMixtureType;
|
||||||
|
|
||||||
|
|
||||||
// Runtime type information
|
|
||||||
TypeName("basicMixture");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from dictionary and mesh
|
//- Construct from dictionary and mesh
|
||||||
basicMixture(const dictionary&, const fvMesh&);
|
basicMixture(const dictionary&, const fvMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~basicMixture();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,253 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
|
||||||
|
|
||||||
Description
|
|
||||||
Mixture instantiation
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "error.H"
|
|
||||||
|
|
||||||
#include "basicMixture.H"
|
|
||||||
#include "makeBasicMixture.H"
|
|
||||||
|
|
||||||
#include "specie.H"
|
|
||||||
#include "perfectGas.H"
|
|
||||||
#include "rhoConst.H"
|
|
||||||
#include "incompressiblePerfectGas.H"
|
|
||||||
|
|
||||||
#include "eConstThermo.H"
|
|
||||||
|
|
||||||
#include "hConstThermo.H"
|
|
||||||
#include "janafThermo.H"
|
|
||||||
#include "sensibleInternalEnergy.H"
|
|
||||||
#include "sensibleEnthalpy.H"
|
|
||||||
#include "thermo.H"
|
|
||||||
|
|
||||||
#include "constTransport.H"
|
|
||||||
#include "sutherlandTransport.H"
|
|
||||||
|
|
||||||
#include "icoPolynomial.H"
|
|
||||||
#include "hPolynomialThermo.H"
|
|
||||||
#include "polynomialTransport.H"
|
|
||||||
|
|
||||||
#include "pureMixture.H"
|
|
||||||
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
hConstThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
hConstThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
janafThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
hConstThermo,
|
|
||||||
rhoConst,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
polynomialTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
hPolynomialThermo,
|
|
||||||
icoPolynomial,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
hConstThermo,
|
|
||||||
incompressiblePerfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
hConstThermo,
|
|
||||||
incompressiblePerfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleEnthalpy,
|
|
||||||
janafThermo,
|
|
||||||
incompressiblePerfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
eConstThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
eConstThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
hConstThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
hConstThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
janafThermo,
|
|
||||||
perfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
hConstThermo,
|
|
||||||
rhoConst,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
polynomialTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
hPolynomialThermo,
|
|
||||||
icoPolynomial,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
constTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
hConstThermo,
|
|
||||||
incompressiblePerfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
hConstThermo,
|
|
||||||
incompressiblePerfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
makeBasicMixture
|
|
||||||
(
|
|
||||||
pureMixture,
|
|
||||||
sutherlandTransport,
|
|
||||||
sensibleInternalEnergy,
|
|
||||||
janafThermo,
|
|
||||||
incompressiblePerfectGas,
|
|
||||||
specie
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::basicMixture
|
|
||||||
|
|
||||||
Description
|
|
||||||
Macros for creating 'basic' mixtures for basic fluid thermo packages
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef makeBasicMixture_H
|
|
||||||
#define makeBasicMixture_H
|
|
||||||
|
|
||||||
#include "basicMixture.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#define makeBasicMixture(Mixture,Transport,Type,Thermo,EqnOfState,Specie) \
|
|
||||||
\
|
|
||||||
typedef \
|
|
||||||
Mixture<Transport<species::thermo<Thermo<EqnOfState<Specie> >, Type> > > \
|
|
||||||
Mixture##Transport##Type##Thermo##EqnOfState##Specie; \
|
|
||||||
\
|
|
||||||
defineTemplateTypeNameAndDebugWithName \
|
|
||||||
(Mixture##Transport##Type##Thermo##EqnOfState##Specie, \
|
|
||||||
#Mixture"<"#Transport"<"#Thermo"<"#EqnOfState"<"#Specie">>,"#Type">>", 0)
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -45,13 +45,6 @@ pureMixture<ThermoType>::pureMixture
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
pureMixture<ThermoType>::~pureMixture()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
|
|||||||
@ -65,20 +65,12 @@ public:
|
|||||||
typedef ThermoType thermoType;
|
typedef ThermoType thermoType;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("pureMixture");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from dictionary and mesh
|
//- Construct from dictionary and mesh
|
||||||
pureMixture(const dictionary&, const fvMesh&);
|
pureMixture(const dictionary&, const fvMesh&);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~pureMixture();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
const ThermoType& cellMixture(const label) const
|
const ThermoType& cellMixture(const label) const
|
||||||
|
|||||||
@ -70,6 +70,15 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::psiThermo> Foam::psiThermo::New
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return NewThermo<psiThermo>(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::psiThermo::~psiThermo()
|
Foam::psiThermo::~psiThermo()
|
||||||
|
|||||||
@ -1,94 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2012 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 "psiThermo.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::psiThermo> Foam::psiThermo::New
|
|
||||||
(
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOdictionary thermoDict
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"thermophysicalProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
word thermoTypeName;
|
|
||||||
|
|
||||||
if (thermoDict.isDict("thermoType"))
|
|
||||||
{
|
|
||||||
const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
|
|
||||||
|
|
||||||
word type(thermoTypeDict.lookup("type"));
|
|
||||||
word mixture(thermoTypeDict.lookup("mixture"));
|
|
||||||
word transport(thermoTypeDict.lookup("transport"));
|
|
||||||
word thermo(thermoTypeDict.lookup("thermo"));
|
|
||||||
word energy(thermoTypeDict.lookup("energy"));
|
|
||||||
word equationOfState(thermoTypeDict.lookup("equationOfState"));
|
|
||||||
word specie(thermoTypeDict.lookup("specie"));
|
|
||||||
|
|
||||||
thermoTypeName =
|
|
||||||
type + '<'
|
|
||||||
+ mixture + '<'
|
|
||||||
+ transport + '<'
|
|
||||||
+ thermo + '<'
|
|
||||||
+ equationOfState + '<'
|
|
||||||
+ specie + ">>,"
|
|
||||||
+ energy + ">>>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
thermoTypeName = word(thermoDict.lookup("thermoType"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
|
|
||||||
|
|
||||||
fvMeshConstructorTable::iterator cstrIter =
|
|
||||||
fvMeshConstructorTablePtr_->find(thermoTypeName);
|
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
|
||||||
{
|
|
||||||
FatalErrorIn("psiThermo::New(const fvMesh&)")
|
|
||||||
<< "Unknown psiThermo type " << thermoTypeName << nl << nl
|
|
||||||
<< "Valid psiThermo types are:" << nl
|
|
||||||
<< fvMeshConstructorTablePtr_->sortedToc() << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoPtr<psiThermo>(cstrIter()(mesh));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -130,6 +130,15 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::rhoThermo> Foam::rhoThermo::New
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return NewThermo<rhoThermo>(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::rhoThermo::~rhoThermo()
|
Foam::rhoThermo::~rhoThermo()
|
||||||
|
|||||||
@ -1,72 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2012 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"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::rhoThermo> Foam::rhoThermo::New
|
|
||||||
(
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// get model name, but do not register the dictionary
|
|
||||||
// otherwise it is registered in the database twice
|
|
||||||
const word modelType
|
|
||||||
(
|
|
||||||
IOdictionary
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"thermophysicalProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
).lookup("thermoType")
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Selecting thermodynamics package " << modelType << endl;
|
|
||||||
|
|
||||||
fvMeshConstructorTable::iterator cstrIter =
|
|
||||||
fvMeshConstructorTablePtr_->find(modelType);
|
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
|
||||||
{
|
|
||||||
FatalErrorIn("rhoThermo::New(const fvMesh&)")
|
|
||||||
<< "Unknown rhoThermo type "
|
|
||||||
<< modelType << nl << nl
|
|
||||||
<< "Valid rhoThermo types are:" << nl
|
|
||||||
<< fvMeshConstructorTablePtr_->sortedToc() << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoPtr<rhoThermo>(cstrIter()(mesh));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Reference in New Issue
Block a user