openfoam/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C
Will Bainbridge 22aae2816d ENH: combustionModels: Changed the construction order
The combustion and chemistry models no longer select and own the
thermodynamic model; they hold a reference instead. The construction of
the combustion and chemistry models has been changed to require a
reference to the thermodyanmics, rather than the mesh and a phase name.

At the solver-level the thermo, turbulence and combustion models are now
selected in sequence. The cyclic dependency between the three models has
been resolved, and the raw-pointer based post-construction step for the
combustion model has been removed.

The old solver-level construction sequence (typically in createFields.H)
was as follows:

    autoPtr<combustionModels::psiCombustionModel> combustion
    (
        combustionModels::psiCombustionModel::New(mesh)
    );

    psiReactionThermo& thermo = combustion->thermo();

    // Create rho, U, phi, etc...

    autoPtr<compressible::turbulenceModel> turbulence
    (
        compressible::turbulenceModel::New(rho, U, phi, thermo)
    );

    combustion->setTurbulence(*turbulence);

The new sequence is:

    autoPtr<psiReactionThermo> thermo(psiReactionThermo::New(mesh));

    // Create rho, U, phi, etc...

    autoPtr<compressible::turbulenceModel> turbulence
    (
        compressible::turbulenceModel::New(rho, U, phi, *thermo)
    );

    autoPtr<combustionModels::psiCombustionModel> combustion
    (
        combustionModels::psiCombustionModel::New(*thermo, *turbulence)
    );

ENH: combustionModel, chemistryModel: Simplified model selection

The combustion and chemistry model selection has been simplified so
that the user does not have to specify the form of the thermodynamics.

Examples of new combustion and chemistry entries are as follows:

    In constant/combustionProperties:

        combustionModel PaSR;

        combustionModel FSD;

    In constant/chemistryProperties:

        chemistryType
        {
            solver          ode;
            method          TDAC;
        }

All the angle bracket parts of the model names (e.g.,
<psiThermoCombustion,gasHThermoPhysics>) have been removed as well as
the chemistryThermo entry.

The changes are mostly backward compatible. Only support for the
angle bracket form of chemistry solver names has been removed. Warnings
will print if some of the old entries are used, as the parts relating to
thermodynamics are now ignored.

ENH: combustionModel, chemistryModel: Simplified model selection

Updated all tutorials to the new format

STYLE: combustionModel: Namespace changes

Wrapped combustion model make macros in the Foam namespace and removed
combustion model namespace from the base classes. This fixes a namespace
specialisation bug in gcc 4.8. It is also somewhat less verbose in the
solvers.

This resolves bug report https://bugs.openfoam.org/view.php?id=2787

ENH: combustionModels: Default to the "none" model

When the constant/combustionProperties dictionary is missing, the solver
will now default to the "none" model. This is consistent with how
radiation models are selected.
2017-11-23 16:57:12 +00:00

215 lines
5.1 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-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 "ThermoPhaseModel.H"
#include "phaseSystem.H"
#include "fvmDdt.H"
#include "fvmDiv.H"
#include "fvmSup.H"
#include "fvmLaplacian.H"
#include "fvcDdt.H"
#include "fvcDiv.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseModel, class ThermoType>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::ThermoPhaseModel
(
const phaseSystem& fluid,
const word& phaseName,
const label index
)
:
BasePhaseModel(fluid, phaseName, index),
thermo_(ThermoType::New(fluid.mesh(), this->name()))
{
thermo_->validate
(
IOobject::groupName(phaseModel::typeName, this->name()),
"h",
"e"
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class BasePhaseModel, class ThermoType>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::~ThermoPhaseModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel, class ThermoType>
const Foam::rhoThermo&
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::thermo() const
{
return thermo_();
}
template<class BasePhaseModel, class ThermoType>
Foam::rhoThermo&
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::thermo()
{
return thermo_();
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::rho() const
{
return thermo_->rho();
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::mu() const
{
return thermo_->mu();
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::scalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::mu
(
const label patchi
) const
{
return thermo_->mu(patchi);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::nu() const
{
return thermo_->nu();
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::scalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::nu
(
const label patchi
) const
{
return thermo_->nu(patchi);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::kappa() const
{
return thermo_->kappa();
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::scalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::kappa
(
const label patchi
) const
{
return thermo_->kappa(patchi);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::kappaEff
(
const volScalarField& alphat
) const
{
return thermo_->kappaEff(alphat);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::scalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::kappaEff
(
const scalarField& alphat,
const label patchi
) const
{
return thermo_->kappaEff(alphat, patchi);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::alpha() const
{
return thermo_->alpha();
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::scalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::alpha
(
const label patchi
) const
{
return thermo_->alpha(patchi);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::alphaEff
(
const volScalarField& alphat
) const
{
return thermo_->alphaEff(alphat);
}
template<class BasePhaseModel, class ThermoType>
Foam::tmp<Foam::scalarField>
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::alphaEff
(
const scalarField& alphat,
const label patchi
) const
{
return thermo_->alphaEff(alphat, patchi);
}
// ************************************************************************* //