Commit 8aabbec7 authored by Will Bainbridge's avatar Will Bainbridge Committed by Andrew Heather
Browse files

ENH: reactionThermo: Single component mixture

This mixture allows a reacting solver to be used with a single component
fluid without the additional case files usually required for reacting
thermodynamics.

reactionThermo: Instantiated more single component mixtures

ENH: reactionThermo: Select singleComponentMixture as pureMixture

A pureMixture can now be specified in a reacting solver. This further
enhances compatibility between non-reacting and reacting solvers.

To achieve this, mixtures now have a typeName function of the same form
as the lower thermodyanmic models. In addition, to avoid name clashes,
the reacting thermo make macros have been split into those that create
entries on multiple selection tables, and those that just add to the
reaction thermo table.
parent 2193c8e3
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -54,43 +54,6 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef
constTransport
<
species::thermo
<
hConstThermo
<
perfectFluid<specie>
>,
sensibleInternalEnergy
>
> constFluidEThermoPhysics;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// multi-component liquid
makeReactionThermo
(
rhoThermo,
rhoReactionThermo,
heRhoThermo,
multiComponentMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectFluid,
specie
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
using namespace interfaceCompositionModels;
......
......@@ -214,7 +214,7 @@ makeThermo
// multiComponentMixture, sensibleInternalEnergy:
makeReactionMixtureThermo
makeReactionMixtureThermos
(
rhoThermo,
rhoReactionThermo,
......@@ -223,7 +223,7 @@ makeReactionMixtureThermo
constRefGasEThermoPhysics
);
makeReactionMixtureThermo
makeReactionMixtureThermos
(
rhoThermo,
rhoReactionThermo,
......@@ -232,7 +232,7 @@ makeReactionMixtureThermo
constRefFluidEThermoPhysics
);
makeReactionMixtureThermo
makeReactionMixtureThermos
(
rhoThermo,
rhoReactionThermo,
......@@ -244,7 +244,7 @@ makeReactionMixtureThermo
// multiComponentMixture, sensibleEnthalpy:
makeReactionMixtureThermo
makeReactionMixtureThermos
(
rhoThermo,
rhoReactionThermo,
......@@ -253,7 +253,7 @@ makeReactionMixtureThermo
constRefRhoConstHThermoPhysics
);
makeReactionMixtureThermo
makeReactionMixtureThermos
(
rhoThermo,
rhoReactionThermo,
......@@ -262,7 +262,7 @@ makeReactionMixtureThermo
constRefFluidHThermoPhysics
);
makeReactionMixtureThermo
makeReactionMixtureThermos
(
rhoThermo,
rhoReactionThermo,
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -66,9 +66,9 @@ defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie, \
( \
#Cthermo"<"#Mixture"<" \
+ Transport##Type##Thermo##EqnOfState##Specie::typeName() \
+ ">>" \
#Cthermo"<" \
+ Mixture<Transport##Type##Thermo##EqnOfState##Specie>::typeName() \
+ ">" \
).c_str(), \
0 \
);
......
......@@ -73,6 +73,12 @@ public:
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "pureMixture<" + ThermoType::typeName() + '>';
}
const ThermoType& mixture() const
{
return mixture_;
......
......@@ -31,82 +31,100 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeReactionMixtureThermo(BaseThermo,BaseReactionThermo,CThermo,Mixture,ThermoPhys) \
#define defineReactionMixtureThermo(BaseReactionThermo,CThermo,Mixture,ThermoPhys) \
\
typedef CThermo \
< \
BaseReactionThermo, \
SpecieMixture \
typedef CThermo \
< \
Mixture \
BaseReactionThermo, \
SpecieMixture \
< \
ThermoPhys \
Mixture \
< \
ThermoPhys \
> \
> \
> \
> CThermo##Mixture##ThermoPhys; \
> CThermo##Mixture##ThermoPhys; \
\
defineTemplateTypeNameAndDebugWithName \
( \
CThermo##Mixture##ThermoPhys, \
(#CThermo"<" + Mixture<ThermoPhys>::typeName() + ">").c_str(), \
0 \
)
#define addReactionMixtureThermo(BaseThermo,CThermoMixtureThermoPhys) \
\
defineTemplateTypeNameAndDebugWithName \
( \
CThermo##Mixture##ThermoPhys, \
(#CThermo"<"#Mixture"<" + ThermoPhys::typeName() + ">>").c_str(), \
0 \
); \
addToRunTimeSelectionTable \
( \
BaseThermo, \
CThermoMixtureThermoPhys, \
fvMesh \
)
#define makeReactionMixtureThermos(BaseThermo,BaseReactionThermo,CThermo,Mixture,ThermoPhys) \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
CThermo##Mixture##ThermoPhys, \
fvMesh \
); \
defineReactionMixtureThermo(BaseReactionThermo,CThermo,Mixture,ThermoPhys);\
\
addToRunTimeSelectionTable \
( \
fluidThermo, \
CThermo##Mixture##ThermoPhys, \
fvMesh \
); \
addReactionMixtureThermo(basicThermo, CThermo##Mixture##ThermoPhys); \
addReactionMixtureThermo(fluidThermo, CThermo##Mixture##ThermoPhys); \
addReactionMixtureThermo(BaseThermo, CThermo##Mixture##ThermoPhys); \
addReactionMixtureThermo(BaseReactionThermo, CThermo##Mixture##ThermoPhys)
#define makeReactionMixtureThermo(BaseReactionThermo,CThermo,Mixture,ThermoPhys) \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
CThermo##Mixture##ThermoPhys, \
fvMesh \
); \
defineReactionMixtureThermo(BaseReactionThermo,CThermo,Mixture,ThermoPhys);\
\
addToRunTimeSelectionTable \
( \
BaseReactionThermo, \
CThermo##Mixture##ThermoPhys, \
fvMesh \
);
addReactionMixtureThermo(BaseReactionThermo, CThermo##Mixture##ThermoPhys)
#define makeReactionThermo(BaseThermo,BaseReactionThermo,CThermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie) \
#define defineThermoPhys(Transport,Type,Thermo,EqnOfState,Specie) \
\
typedef \
Transport \
< \
species::thermo \
typedef \
Transport \
< \
Thermo \
species::thermo \
< \
EqnOfState \
Thermo \
< \
Specie \
> \
>, \
Type \
EqnOfState \
< \
Specie \
> \
>, \
Type \
> \
> \
> Transport##Type##Thermo##EqnOfState##Specie; \
Transport##Type##Thermo##EqnOfState##Specie \
#define makeReactionThermos(BaseThermo,BaseReactionThermo,CThermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie) \
\
defineThermoPhys(Transport,Type,Thermo,EqnOfState,Specie); \
\
makeReactionMixtureThermos \
( \
BaseThermo, \
BaseReactionThermo, \
CThermo, \
Mixture, \
Transport##Type##Thermo##EqnOfState##Specie \
)
#define makeReactionThermo(BaseReactionThermo,CThermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie) \
\
defineThermoPhys(Transport,Type,Thermo,EqnOfState,Specie); \
\
makeReactionMixtureThermo \
( \
BaseThermo, \
BaseReactionThermo, \
CThermo, \
Mixture, \
Transport##Type##Thermo##EqnOfState##Specie \
);
makeReactionMixtureThermo \
( \
BaseReactionThermo, \
CThermo, \
Mixture, \
Transport##Type##Thermo##EqnOfState##Specie \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -99,6 +99,12 @@ public:
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "egrMixture<" + ThermoType::typeName() + '>';
}
const dimensionedScalar& stoicRatio() const
{
return stoicRatio_;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -90,6 +90,12 @@ public:
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "homogeneousMixture<" + ThermoType::typeName() + '>';
}
const ThermoType& mixture(const scalar) const;
const ThermoType& cellMixture(const label celli) const
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -96,6 +96,12 @@ public:
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "inhomogeneousMixture<" + ThermoType::typeName() + '>';
}
const dimensionedScalar& stoicRatio() const
{
return stoicRatio_;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -111,6 +111,12 @@ public:
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "multiComponentMixture<" + ThermoType::typeName() + '>';
}
const ThermoType& cellMixture(const label celli) const;
const ThermoType& patchFaceMixture
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -93,6 +93,12 @@ public:
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "reactingMixture<" + ThermoType::typeName() + '>';
}
//- Read dictionary
void read(const dictionary&);
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "singleComponentMixture.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoType>
Foam::singleComponentMixture<ThermoType>::singleComponentMixture
(
const dictionary& thermoDict,
const fvMesh& mesh,
const word& phaseName
)
:
basicSpecieMixture(thermoDict, wordList::null(), mesh, phaseName),
thermo_(thermoDict.subDict("mixture"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ThermoType>
Foam::singleComponentMixture<ThermoType>::~singleComponentMixture()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class ThermoType>
void Foam::singleComponentMixture<ThermoType>::read
(
const dictionary& thermoDict
)
{
thermo_ = ThermoType(thermoDict.subDict("mixture"));
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::singleComponentMixture
Description
Single component mixture
SourceFiles
singleComponentMixture.C
\*---------------------------------------------------------------------------*/
#ifndef singleComponentMixture_H
#define singleComponentMixture_H
#include "basicSpecieMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class singleComponentMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoType>
class singleComponentMixture
:
public basicSpecieMixture
{
// Private data
//- Thermo model
ThermoType thermo_;
public:
//- The type of thermodynamics this mixture is instantiated for
typedef ThermoType thermoType;
// Constructors
//- Construct from dictionary, mesh and phase name
singleComponentMixture(const dictionary&, const fvMesh&, const word&);
//- Destructor
virtual ~singleComponentMixture();
// Member Functions
//- Return the instantiated type name
// Note: This defines the same name as pureMixture so that
// non-reacting and reacting solvers are compatable
static word typeName()
{
return "pureMixture<" + ThermoType::typeName() + '>';
}
//- Get the mixture for the given cell
const ThermoType& cellMixture(const label celli) const
{
return thermo_;
}
//- Get the mixture for the given patch face
const ThermoType& patchFaceMixture
(
const label patchi,
const label facei
) const
{
return thermo_;
}
//- Get the volumetric mixture for the given cell
const ThermoType& cellVolMixture
(
const scalar p,
const scalar T,
const label celli
)
{
return thermo_;
}