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.
This commit is contained in:
Will Bainbridge
2017-11-23 16:57:12 +00:00
committed by Andrew Heather
parent 255ec7366b
commit 22aae2816d
190 changed files with 2266 additions and 2991 deletions

View File

@ -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
@ -37,7 +37,8 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "psiReactionThermo.H" #include "psiReactionThermo.H"
#include "psiChemistryModel.H" #include "BasicChemistryModel.H"
#include "reactingMixture.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "OFstream.H" #include "OFstream.H"
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"

View File

@ -1,4 +1,8 @@
scalar dtChem = refCast<const psiChemistryModel>(chemistry).deltaTChem()[0]; BasicChemistryModel<psiReactionThermo>& chemistry = pChemistry();
scalar dtChem = refCast<const BasicChemistryModel<psiReactionThermo>>
(
chemistry
).deltaTChem()[0];
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();

View File

@ -23,14 +23,16 @@
#include "createBaseFields.H" #include "createBaseFields.H"
Info<< nl << "Reading thermophysicalProperties" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiChemistryModel> pChemistry(psiChemistryModel::New(mesh)); autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = pThermo();
psiChemistryModel& chemistry = pChemistry();
psiReactionThermo& thermo = chemistry.thermo();
thermo.validate(args.executable(), "h"); thermo.validate(args.executable(), "h");
autoPtr<BasicChemistryModel<psiReactionThermo>> pChemistry
(
BasicChemistryModel<psiReactionThermo>::New(thermo)
);
volScalarField rho volScalarField rho
( (
IOobject IOobject

View File

@ -1,16 +1,6 @@
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiCombustionModel> combustion
(
combustionModels::psiCombustionModel::New
(
mesh
)
);
Info<< "Reading thermophysical properties\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = combustion->thermo(); psiReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);
@ -74,8 +64,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the combustion model Info<< "Creating combustion model\n" << endl;
combustion->setTurbulence(turbulence()); autoPtr<CombustionModel<psiReactionThermo>> combustion
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"

View File

@ -41,7 +41,8 @@ Description
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "solidChemistryModel.H" #include "solidChemistryModel.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "fvOptions.H" #include "fvOptions.H"

View File

@ -1,13 +1,8 @@
#include "createRDeltaT.H" #include "createRDeltaT.H"
Info<< "Creating reaction model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
autoPtr<combustionModels::psiCombustionModel> reaction psiReactionThermo& thermo = pThermo();
(
combustionModels::psiCombustionModel::New(mesh)
);
psiReactionThermo& thermo = reaction->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
@ -18,8 +13,7 @@ if (!composition.species().found(inertSpecie))
{ {
FatalIOErrorIn(args.executable().c_str(), thermo) FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species " << "Inert specie " << inertSpecie << " not found in available species "
<< composition.species() << composition.species() << exit(FatalIOError);
<< exit(FatalIOError);
} }
volScalarField rho volScalarField rho
@ -47,7 +41,6 @@ volVectorField U
mesh mesh
); );
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
@ -68,8 +61,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the reaction model Info<< "Creating reaction model\n" << endl;
reaction->setTurbulence(turbulence()); autoPtr<CombustionModel<psiReactionThermo>> reaction
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

View File

@ -34,7 +34,8 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureControl.H" #include "pressureControl.H"

View File

@ -1,13 +1,8 @@
#include "createRDeltaT.H" #include "createRDeltaT.H"
Info<< "Creating reaction model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
autoPtr<combustionModels::rhoCombustionModel> reaction rhoReactionThermo& thermo = pThermo();
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = reaction->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
@ -67,9 +62,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the reaction model Info<< "Creating reaction model\n" << endl;
reaction->setTurbulence(turbulence()); autoPtr<CombustionModel<rhoReactionThermo>> reaction
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
#include "readhRef.H" #include "readhRef.H"

View File

@ -34,7 +34,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "rhoCombustionModel.H" #include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -1,13 +1,8 @@
#include "createRDeltaT.H" #include "createRDeltaT.H"
Info<< "Creating reaction model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
autoPtr<combustionModels::rhoCombustionModel> reaction rhoReactionThermo& thermo = pThermo();
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = reaction->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
@ -69,8 +64,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the reaction model Info<< "Creating reaction model\n" << endl;
reaction->setTurbulence(turbulence()); autoPtr<CombustionModel<rhoReactionThermo>> reaction
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

View File

@ -34,7 +34,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "rhoCombustionModel.H" #include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -37,7 +37,8 @@ Description
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicThermoCloud.H" #include "basicThermoCloud.H"
#include "coalCloud.H" #include "coalCloud.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "fvOptions.H" #include "fvOptions.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"

View File

@ -2,14 +2,9 @@
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
Info<< "Creating combustion model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
autoPtr<combustionModels::psiCombustionModel> combustion psiReactionThermo& thermo = pThermo();
(
combustionModels::psiCombustionModel::New(mesh)
);
psiReactionThermo& thermo = combustion->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);
@ -112,8 +107,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the combustion model Info<< "Creating combustion model\n" << endl;
combustion->setTurbulence(turbulence()); autoPtr<CombustionModel<psiReactionThermo>> combustion
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
volScalarField Qdot volScalarField Qdot
( (

View File

@ -1,13 +1,8 @@
#include "createRDeltaT.H" #include "createRDeltaT.H"
Info<< "Creating combustion model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
autoPtr<combustionModels::rhoCombustionModel> combustion rhoReactionThermo& thermo = pThermo();
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = combustion->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);
@ -68,8 +63,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the combustion model Info<< "Creating combustion model\n" << endl;
combustion->setTurbulence(turbulence()); autoPtr<CombustionModel<rhoReactionThermo>> combustion
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
#include "readhRef.H" #include "readhRef.H"

View File

@ -37,7 +37,8 @@ Description
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicReactingMultiphaseCloud.H" #include "basicReactingMultiphaseCloud.H"
#include "surfaceFilmModel.H" #include "surfaceFilmModel.H"
#include "rhoCombustionModel.H" #include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "fvOptions.H" #include "fvOptions.H"

View File

@ -1,13 +1,8 @@
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
Info<< "Creating combustion model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
autoPtr<combustionModels::rhoCombustionModel> combustion rhoReactionThermo& thermo = pThermo();
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = combustion->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);
@ -91,8 +86,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the combustion model Info<< "Creating combustion model\n" << endl;
combustion->setTurbulence(turbulence()); autoPtr<CombustionModel<rhoReactionThermo>> combustion
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
Info<< "Creating multi-variate interpolation scheme\n" << endl; Info<< "Creating multi-variate interpolation scheme\n" << endl;
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

View File

@ -33,7 +33,8 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicReactingMultiphaseCloud.H" #include "basicReactingMultiphaseCloud.H"
#include "rhoCombustionModel.H" #include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "IOporosityModelList.H" #include "IOporosityModelList.H"
#include "fvOptions.H" #include "fvOptions.H"

View File

@ -1,13 +1,8 @@
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
Info<< "Creating combustion model\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
autoPtr<combustionModels::psiCombustionModel> combustion psiReactionThermo& thermo = pThermo();
(
combustionModels::psiCombustionModel::New(mesh)
);
psiReactionThermo& thermo = combustion->thermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);
@ -91,8 +86,11 @@ autoPtr<compressible::turbulenceModel> turbulence
) )
); );
// Set the turbulence into the combustion model Info<< "Creating combustion model\n" << endl;
combustion->setTurbulence(turbulence()); autoPtr<CombustionModel<psiReactionThermo>> combustion
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

View File

@ -35,7 +35,8 @@ Description
#include "engineMesh.H" #include "engineMesh.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicSprayCloud.H" #include "basicSprayCloud.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -37,7 +37,8 @@ Description
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicSprayCloud.H" #include "basicSprayCloud.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -36,7 +36,8 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicSprayCloud.H" #include "basicSprayCloud.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -98,6 +98,12 @@ void Foam::twoPhaseMixtureThermo::correct()
} }
Foam::word Foam::twoPhaseMixtureThermo::thermoName() const
{
return thermo1_->thermoName() + ',' + thermo2_->thermoName();
}
bool Foam::twoPhaseMixtureThermo::incompressible() const bool Foam::twoPhaseMixtureThermo::incompressible() const
{ {
return thermo1_->incompressible() && thermo2_->incompressible(); return thermo1_->incompressible() && thermo2_->incompressible();

View File

@ -113,6 +113,9 @@ public:
//- Update mixture properties //- Update mixture properties
virtual void correct(); virtual void correct();
//- Return the name of the thermo physics
virtual word thermoName() const;
//- Return true if the equation of state is incompressible //- Return true if the equation of state is incompressible
// i.e. rho != f(p) // i.e. rho != f(p)
virtual bool incompressible() const; virtual bool incompressible() const;

View File

@ -150,6 +150,21 @@ void Foam::multiphaseMixtureThermo::correctRho(const volScalarField& dp)
} }
Foam::word Foam::multiphaseMixtureThermo::thermoName() const
{
PtrDictionary<phaseModel>::const_iterator phasei = phases_.begin();
word name = phasei().thermo().thermoName();
for (++ phasei; phasei != phases_.end(); ++ phasei)
{
name += ',' + phasei().thermo().thermoName();
}
return name;
}
bool Foam::multiphaseMixtureThermo::incompressible() const bool Foam::multiphaseMixtureThermo::incompressible() const
{ {
bool ico = true; bool ico = true;

View File

@ -227,6 +227,9 @@ public:
//- Update densities for given pressure change //- Update densities for given pressure change
void correctRho(const volScalarField& dp); void correctRho(const volScalarField& dp);
//- Return the name of the thermo physics
virtual word thermoName() const;
//- Return true if the equation of state is incompressible //- Return true if the equation of state is incompressible
// i.e. rho != f(p) // i.e. rho != f(p)
virtual bool incompressible() const; virtual bool incompressible() const;

View File

@ -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) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,7 +63,9 @@ class MovingPhaseModel
: :
public BasePhaseModel public BasePhaseModel
{ {
// Private data protected:
// Protected data
//- Velocity field //- Velocity field
volVectorField U_; volVectorField U_;
@ -94,6 +96,8 @@ class MovingPhaseModel
tmp<surfaceScalarField> DbyA_; tmp<surfaceScalarField> DbyA_;
private:
// Private static member functions // Private static member functions
//- Calculate and return the flux field //- Calculate and return the flux field

View File

@ -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) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,26 +37,9 @@ Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::ReactingPhaseModel
const label index const label index
) )
: :
BasePhaseModel(fluid, phaseName, index, false), BasePhaseModel(fluid, phaseName, index),
reaction_ reaction_(ReactionType::New(this->thermo_(), this->turbulence_()))
( {}
ReactionType::New
(
fluid.mesh(),
combustionModel::combustionPropertiesName,
this->name()
)
)
{
this->thermo_ = &reaction_->thermo();
this->thermo_->validate
(
IOobject::groupName(phaseModel::typeName, this->name()),
"h",
"e"
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -71,21 +54,6 @@ Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::~ReactingPhaseModel()
template<class BasePhaseModel, class ReactionType> template<class BasePhaseModel, class ReactionType>
void Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::correctThermo() void Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::correctThermo()
{ {
reaction_->setTurbulence
(
const_cast<compressibleTurbulenceModel&>
(
this->mesh().template lookupObject<compressibleTurbulenceModel>
(
IOobject::groupName
(
turbulenceModel::propertiesName,
this->name()
)
)
)
);
BasePhaseModel::correctThermo(); BasePhaseModel::correctThermo();
reaction_->correct(); reaction_->correct();

View File

@ -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) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,28 +41,18 @@ Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::ThermoPhaseModel
( (
const phaseSystem& fluid, const phaseSystem& fluid,
const word& phaseName, const word& phaseName,
const label index, const label index
const bool createThermo
) )
: :
BasePhaseModel(fluid, phaseName, index) BasePhaseModel(fluid, phaseName, index),
thermo_(ThermoType::New(fluid.mesh(), this->name()))
{ {
if (createThermo)
{
thermoPtr_.reset
(
ThermoType::New(fluid.mesh(), this->name()).ptr()
);
thermo_ = thermoPtr_.ptr();
thermo_->validate thermo_->validate
( (
IOobject::groupName(phaseModel::typeName, this->name()), IOobject::groupName(phaseModel::typeName, this->name()),
"h", "h",
"e" "e"
); );
}
} }
@ -79,7 +69,7 @@ template<class BasePhaseModel, class ThermoType>
const Foam::rhoThermo& const Foam::rhoThermo&
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::thermo() const Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::thermo() const
{ {
return *thermo_; return thermo_();
} }
@ -87,7 +77,7 @@ template<class BasePhaseModel, class ThermoType>
Foam::rhoThermo& Foam::rhoThermo&
Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::thermo() Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::thermo()
{ {
return *thermo_; return thermo_();
} }

View File

@ -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) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,10 +62,7 @@ protected:
// Protected data // Protected data
//- Thermophysical model //- Thermophysical model
autoPtr<ThermoType> thermoPtr_; autoPtr<ThermoType> thermo_;
//- Thermophysical model
ThermoType* thermo_;
public: public:
@ -76,8 +73,7 @@ public:
( (
const phaseSystem& fluid, const phaseSystem& fluid,
const word& phaseName, const word& phaseName,
const label index, const label index
const bool createThermo = true
); );

View File

@ -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) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,7 +28,7 @@ License
#include "rhoThermo.H" #include "rhoThermo.H"
#include "rhoReactionThermo.H" #include "rhoReactionThermo.H"
#include "rhoCombustionModel.H" #include "CombustionModel.H"
#include "phaseModel.H" #include "phaseModel.H"
#include "ThermoPhaseModel.H" #include "ThermoPhaseModel.H"
@ -45,13 +45,13 @@ License
namespace Foam namespace Foam
{ {
typedef typedef
MovingPhaseModel
<
AnisothermalPhaseModel AnisothermalPhaseModel
< <
PurePhaseModel PurePhaseModel
< <
InertPhaseModel InertPhaseModel
<
MovingPhaseModel
< <
ThermoPhaseModel<phaseModel, rhoThermo> ThermoPhaseModel<phaseModel, rhoThermo>
> >
@ -69,13 +69,13 @@ namespace Foam
); );
typedef typedef
MovingPhaseModel
<
IsothermalPhaseModel IsothermalPhaseModel
< <
PurePhaseModel PurePhaseModel
< <
InertPhaseModel InertPhaseModel
<
MovingPhaseModel
< <
ThermoPhaseModel<phaseModel, rhoThermo> ThermoPhaseModel<phaseModel, rhoThermo>
> >
@ -93,13 +93,13 @@ namespace Foam
); );
typedef typedef
MovingPhaseModel
<
AnisothermalPhaseModel AnisothermalPhaseModel
< <
MultiComponentPhaseModel MultiComponentPhaseModel
< <
InertPhaseModel InertPhaseModel
<
MovingPhaseModel
< <
ThermoPhaseModel<phaseModel, rhoReactionThermo> ThermoPhaseModel<phaseModel, rhoReactionThermo>
> >
@ -117,17 +117,17 @@ namespace Foam
); );
typedef typedef
MovingPhaseModel
<
AnisothermalPhaseModel AnisothermalPhaseModel
< <
MultiComponentPhaseModel MultiComponentPhaseModel
< <
ReactingPhaseModel ReactingPhaseModel
< <
ThermoPhaseModel<phaseModel, rhoReactionThermo>, MovingPhaseModel
combustionModels::rhoCombustionModel <
> ThermoPhaseModel<phaseModel, rhoReactionThermo>
>,
CombustionModel<rhoReactionThermo>
> >
> >
> >

View File

@ -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-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,40 +23,51 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rhoChemistryCombustion.H" #include "ChemistryCombustion.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::rhoChemistryCombustion::rhoChemistryCombustion template<class ReactionThermo>
Foam::ChemistryCombustion<ReactionThermo>::ChemistryCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
rhoCombustionModel(modelType, mesh, combustionProperties, phaseName), CombustionModel<ReactionThermo>
chemistryPtr_(rhoChemistryModel::New(mesh, phaseName)) (
modelType,
thermo,
turb,
combustionProperties
),
chemistryPtr_(BasicChemistryModel<ReactionThermo>::New(thermo))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::rhoChemistryCombustion::~rhoChemistryCombustion() template<class ReactionThermo>
Foam::ChemistryCombustion<ReactionThermo>::
~ChemistryCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::rhoReactionThermo& template<class ReactionThermo>
Foam::combustionModels::rhoChemistryCombustion::thermo() ReactionThermo&
Foam::ChemistryCombustion<ReactionThermo>::thermo()
{ {
return chemistryPtr_->thermo(); return chemistryPtr_->thermo();
} }
const Foam::rhoReactionThermo& template<class ReactionThermo>
Foam::combustionModels::rhoChemistryCombustion::thermo() const const ReactionThermo&
Foam::ChemistryCombustion<ReactionThermo>::thermo() const
{ {
return chemistryPtr_->thermo(); return chemistryPtr_->thermo();
} }

View File

@ -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-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,89 +22,85 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::psiThermoCombustion Foam::ChemistryCombustion
Description Description
Compressibility-based thermo model wrapper for combustion models Chemistry model wrapper for combustion models
SourceFiles SourceFiles
psiThermoCombustion.C ChemistryCombustion.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef psiThermoCombustion_H #ifndef ChemistryCombustion_H
#define psiThermoCombustion_H #define ChemistryCombustion_H
#include "autoPtr.H" #include "autoPtr.H"
#include "psiCombustionModel.H" #include "CombustionModel.H"
#include "psiReactionThermo.H" #include "BasicChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
namespace combustionModels
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
class psiThermoCombustion Declaration class ChemistryCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class psiThermoCombustion template<class ReactionThermo>
class ChemistryCombustion
: :
public psiCombustionModel public CombustionModel<ReactionThermo>
{ {
// Private Member Functions
//- Construct as copy (not implemented)
psiThermoCombustion(const psiThermoCombustion&);
//- Disallow default bitwise assignment
void operator=(const psiThermoCombustion&);
protected: protected:
// Protected data // Protected data
//- Pointer to chemistry model //- Pointer to chemistry model
autoPtr<psiReactionThermo> thermoPtr_; autoPtr<BasicChemistryModel<ReactionThermo>> chemistryPtr_;
public: public:
// Constructors // Constructors
//- Construct from components //- Construct from components and thermo
psiThermoCombustion ChemistryCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& phaseName const compressibleTurbulenceModel& turb,
const word& combustionProperties
); );
//- Destructor //- Destructor
virtual ~psiThermoCombustion(); virtual ~ChemistryCombustion();
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
virtual psiReactionThermo& thermo(); virtual ReactionThermo& thermo();
//- Return const access to the thermo package //- Return const access to the thermo package
virtual const psiReactionThermo& thermo() const; virtual const ReactionThermo& thermo() const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "ChemistryCombustion.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -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
@ -23,42 +23,55 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rhoCombustionModel.H" #include "CombustionModel.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
namespace combustionModels
{
defineTypeNameAndDebug(rhoCombustionModel, 0);
defineRunTimeSelectionTable(rhoCombustionModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::rhoCombustionModel::rhoCombustionModel template<class ReactionThermo>
Foam::CombustionModel<ReactionThermo>::CombustionModel
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
combustionModel(modelType, mesh, combustionProperties, phaseName) combustionModel(modelType, thermo, turb, combustionProperties)
{} {}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class ReactionThermo>
Foam::autoPtr<Foam::CombustionModel<ReactionThermo>>
Foam::CombustionModel<ReactionThermo>::New
(
ReactionThermo& thermo,
const compressibleTurbulenceModel& turb,
const word& combustionProperties
)
{
return
combustionModel::New<CombustionModel<ReactionThermo>>
(
thermo,
turb,
combustionProperties
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::rhoCombustionModel::~rhoCombustionModel() template<class ReactionThermo>
Foam::CombustionModel<ReactionThermo>::~CombustionModel()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::combustionModels::rhoCombustionModel::read() template<class ReactionThermo>
bool Foam::CombustionModel<ReactionThermo>::read()
{ {
if (combustionModel::read()) if (combustionModel::read())
{ {

View File

@ -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
@ -22,107 +22,97 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::psiCombustionModel Foam::CombustionModel
Description Description
Combustion models for compressibility-based thermodynamics Combustion models for templated thermodynamics
SourceFiles SourceFiles
psiCombustionModelI.H CombustionModelI.H
psiCombustionModel.C CombustionModel.C
psiCombustionModelNew.C CombustionModelNew.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef psiCombustionModel_H #ifndef CombustionModel_H
#define psiCombustionModel_H #define CombustionModel_H
#include "combustionModel.H" #include "combustionModel.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "psiReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
namespace combustionModels
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
class psiCombustionModel Declaration class CombustionModel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class psiCombustionModel template<class ReactionThermo>
class CombustionModel
: :
public combustionModel public combustionModel
{ {
// Private Member Functions
//- Construct as copy (not implemented)
psiCombustionModel(const psiCombustionModel&);
//- Disallow default bitwise assignment
void operator=(const psiCombustionModel&);
public: public:
typedef psiReactionThermo ReactionThermo; //- Thermo type
typedef ReactionThermo reactionThermo;
//- Runtime type information //- Runtime type information
TypeName("psiCombustionModel"); TypeName("CombustionModel");
//- Declare run-time constructor selection tables //- Declare run-time constructor selection tables
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
psiCombustionModel, CombustionModel,
dictionary, dictionary,
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
), ),
(modelType, mesh, combustionProperties, phaseName) (modelType, thermo, turb, combustionProperties)
); );
// Constructors // Constructors
//- Construct from components //- Construct from components
psiCombustionModel CombustionModel
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );
//- Selector //- Selector
static autoPtr<psiCombustionModel> New static autoPtr<CombustionModel> New
( (
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties=combustionPropertiesName, const compressibleTurbulenceModel& turb,
const word& phaseName=word::null const word& combustionProperties=combustionPropertiesName
); );
//- Destructor //- Destructor
virtual ~psiCombustionModel(); virtual ~CombustionModel();
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
virtual psiReactionThermo& thermo() = 0; virtual ReactionThermo& thermo() = 0;
//- Return const access to the thermo package //- Return const access to the thermo package
virtual const psiReactionThermo& thermo() const = 0; virtual const ReactionThermo& thermo() const = 0;
// IO // IO
@ -134,11 +124,16 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CombustionModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,18 +23,21 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // #include "makeCombustionTypes.H"
inline Foam::rhoReactionThermo& Foam::rhoChemistryModel::thermo() #include "CombustionModel.H"
#include "rhoReactionThermo.H"
#include "psiReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{ {
return *thermo_;
makeCombustion(psiReactionThermo);
makeCombustion(rhoReactionThermo);
} }
inline const Foam::rhoReactionThermo& Foam::rhoChemistryModel::thermo() const
{
return *thermo_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -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-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,42 +23,51 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "psiChemistryCombustion.H" #include "ThermoCombustion.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::psiChemistryCombustion::psiChemistryCombustion template<class ReactionThermo>
Foam::ThermoCombustion<ReactionThermo>::ThermoCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb
const word& phaseName
) )
: :
psiCombustionModel(modelType, mesh, combustionProperties, phaseName), CombustionModel<ReactionThermo>
chemistryPtr_(psiChemistryModel::New(mesh, phaseName)) (
modelType,
thermo,
turb,
combustionModel::combustionPropertiesName
),
thermo_(thermo)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::psiChemistryCombustion::~psiChemistryCombustion() template<class ReactionThermo>
Foam::ThermoCombustion<ReactionThermo>::~ThermoCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::psiReactionThermo& template<class ReactionThermo>
Foam::combustionModels::psiChemistryCombustion::thermo() ReactionThermo&
Foam::ThermoCombustion<ReactionThermo>::thermo()
{ {
return chemistryPtr_->thermo(); return thermo_;
} }
const Foam::psiReactionThermo& template<class ReactionThermo>
Foam::combustionModels::psiChemistryCombustion::thermo() const const ReactionThermo&
Foam::ThermoCombustion<ReactionThermo>::thermo() const
{ {
return chemistryPtr_->thermo(); return thermo_;
} }

View File

@ -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-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,53 +22,42 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::rhoThermoCombustion Foam::ThermoCombustion
Description Description
Density-based thermo model wrapper for combustion models Thermo model wrapper for combustion models
SourceFiles SourceFiles
rhoThermoCombustion.C ThermoCombustion.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef rhoThermoCombustion_H #ifndef ThermoCombustion_H
#define rhoThermoCombustion_H #define ThermoCombustion_H
#include "autoPtr.H" #include "autoPtr.H"
#include "rhoCombustionModel.H" #include "CombustionModel.H"
#include "rhoChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
namespace combustionModels
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
class rhoThermoCombustion Declaration class ThermoCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class rhoThermoCombustion template<class ReactionThermo>
class ThermoCombustion
: :
public rhoCombustionModel public CombustionModel<ReactionThermo>
{ {
// Private Member Functions
//- Construct as copy (not implemented)
rhoThermoCombustion(const rhoThermoCombustion&);
//- Disallow default bitwise assignment
void operator=(const rhoThermoCombustion&);
protected: protected:
// Protected data // Protected data
//- Pointer to thermo model //- Thermo
autoPtr<rhoReactionThermo> thermoPtr_; ReactionThermo& thermo_;
public: public:
@ -76,35 +65,40 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
rhoThermoCombustion ThermoCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& phaseName const compressibleTurbulenceModel& turb
); );
//- Destructor //- Destructor
virtual ~rhoThermoCombustion(); virtual ~ThermoCombustion();
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
virtual rhoReactionThermo& thermo(); virtual ReactionThermo& thermo();
//- Return const access to the thermo package //- Return const access to the thermo package
virtual const rhoReactionThermo& thermo() const; virtual const ReactionThermo& thermo() const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "ThermoCombustion.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,16 +27,16 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::EDC<Type>::EDC Foam::combustionModels::EDC<ReactionThermo>::EDC
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
laminar<Type>(modelType, mesh, combustionProperties, phaseName), laminar<ReactionThermo>(modelType, thermo, turb, combustionProperties),
version_ version_
( (
EDCversionNames.lookupOrDefault EDCversionNames.lookupOrDefault
@ -56,13 +56,13 @@ Foam::combustionModels::EDC<Type>::EDC
( (
IOobject IOobject
( (
IOobject::groupName(typeName + ":kappa", phaseName), this->thermo().phasePropertyName(typeName + ":kappa"),
mesh.time().timeName(), this->mesh().time().timeName(),
mesh, this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, this->mesh(),
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
) )
{} {}
@ -70,15 +70,15 @@ Foam::combustionModels::EDC<Type>::EDC
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::EDC<Type>::~EDC() Foam::combustionModels::EDC<ReactionThermo>::~EDC()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
void Foam::combustionModels::EDC<Type>::correct() void Foam::combustionModels::EDC<ReactionThermo>::correct()
{ {
if (this->active()) if (this->active())
{ {
@ -172,17 +172,17 @@ void Foam::combustionModels::EDC<Type>::correct()
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::EDC<Type>::R(volScalarField& Y) const Foam::combustionModels::EDC<ReactionThermo>::R(volScalarField& Y) const
{ {
return kappa_*laminar<Type>::R(Y); return kappa_*laminar<ReactionThermo>::R(Y);
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::EDC<Type>::Qdot() const Foam::combustionModels::EDC<ReactionThermo>::Qdot() const
{ {
tmp<volScalarField> tQdot tmp<volScalarField> tQdot
( (
@ -190,7 +190,7 @@ Foam::combustionModels::EDC<Type>::Qdot() const
( (
IOobject IOobject
( (
IOobject::groupName(typeName + ":Qdot", this->phaseName_), this->thermo().phasePropertyName(typeName + ":Qdot"),
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -211,10 +211,10 @@ Foam::combustionModels::EDC<Type>::Qdot() const
} }
template<class Type> template<class ReactionThermo>
bool Foam::combustionModels::EDC<Type>::read() bool Foam::combustionModels::EDC<ReactionThermo>::read()
{ {
if (Type::read()) if (laminar<ReactionThermo>::read())
{ {
version_ = version_ =
( (

View File

@ -128,10 +128,10 @@ const scalar EDCexp2[] = {3, 3, 2, 2};
Class EDC Declaration Class EDC Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class ReactionThermo>
class EDC class EDC
: :
public laminar<Type> public laminar<ReactionThermo>
{ {
// Private data // Private data
@ -170,9 +170,9 @@ public:
EDC EDC
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& type,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -25,8 +25,8 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "psiChemistryCombustion.H" #include "psiReactionThermo.H"
#include "rhoChemistryCombustion.H" #include "rhoReactionThermo.H"
#include "EDC.H" #include "EDC.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
@ -49,8 +49,12 @@ Foam::combustionModels::EDCdefaultVersion(EDCversions::v2005);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypes(EDC, psiChemistryCombustion, psiCombustionModel); namespace Foam
makeCombustionTypes(EDC, rhoChemistryCombustion, rhoCombustionModel); {
makeCombustionTypes(EDC, psiReactionThermo);
makeCombustionTypes(EDC, rhoReactionThermo);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -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
@ -36,21 +36,21 @@ namespace combustionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
FSD<CombThermoType, ThermoType>::FSD FSD<ReactionThermo, ThermoType>::FSD
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
singleStepCombustion<CombThermoType, ThermoType> singleStepCombustion<ReactionThermo, ThermoType>
( (
modelType, modelType,
mesh, thermo,
combustionProperties, turb,
phaseName combustionProperties
), ),
reactionRateFlameArea_ reactionRateFlameArea_
( (
@ -65,7 +65,7 @@ FSD<CombThermoType, ThermoType>::FSD
( (
IOobject IOobject
( (
IOobject::groupName("ft", phaseName), this->thermo().phasePropertyName("ft"),
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -87,23 +87,23 @@ FSD<CombThermoType, ThermoType>::FSD
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
FSD<CombThermoType, ThermoType>::~FSD() FSD<ReactionThermo, ThermoType>::~FSD()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
void FSD<CombThermoType, ThermoType>::calculateSourceNorm() void FSD<ReactionThermo, ThermoType>::calculateSourceNorm()
{ {
this->singleMixturePtr_->fresCorrect(); this->singleMixturePtr_->fresCorrect();
const label fuelI = this->singleMixturePtr_->fuelIndex(); const label fuelI = this->singleMixturePtr_->fuelIndex();
const volScalarField& YFuel = this->thermoPtr_->composition().Y()[fuelI]; const volScalarField& YFuel = this->thermo().composition().Y()[fuelI];
const volScalarField& YO2 = this->thermoPtr_->composition().Y("O2"); const volScalarField& YO2 = this->thermo().composition().Y("O2");
const dimensionedScalar s = this->singleMixturePtr_->s(); const dimensionedScalar s = this->singleMixturePtr_->s();
@ -152,7 +152,7 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
( (
IOobject IOobject
( (
IOobject::groupName("Pc", this->phaseName_), this->thermo().phasePropertyName("Pc"),
U.time().timeName(), U.time().timeName(),
U.db(), U.db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -171,7 +171,7 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
( (
IOobject IOobject
( (
IOobject::groupName("omegaFuelBar", this->phaseName_), this->thermo().phasePropertyName("omegaFuelBar"),
U.time().timeName(), U.time().timeName(),
U.db(), U.db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -297,7 +297,7 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
( (
IOobject IOobject
( (
IOobject::groupName("products", this->phaseName_), this->thermo().phasePropertyName("products"),
U.time().timeName(), U.time().timeName(),
U.db(), U.db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -313,7 +313,7 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
forAll(productsIndex, j) forAll(productsIndex, j)
{ {
label specieI = productsIndex[j]; label specieI = productsIndex[j];
const volScalarField& Yp = this->thermoPtr_->composition().Y()[specieI]; const volScalarField& Yp = this->thermo().composition().Y()[specieI];
products += Yp; products += Yp;
} }
@ -330,8 +330,8 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
} }
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
void FSD<CombThermoType, ThermoType>::correct() void FSD<ReactionThermo, ThermoType>::correct()
{ {
this->wFuel_ == dimensionedScalar(dimMass/dimTime/dimVolume, Zero); this->wFuel_ == dimensionedScalar(dimMass/dimTime/dimVolume, Zero);
@ -342,10 +342,10 @@ void FSD<CombThermoType, ThermoType>::correct()
} }
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
bool FSD<CombThermoType, ThermoType>::read() bool FSD<ReactionThermo, ThermoType>::read()
{ {
if (singleStepCombustion<CombThermoType, ThermoType>::read()) if (singleStepCombustion<ReactionThermo, ThermoType>::read())
{ {
this->coeffs().lookup("Cv") >> Cv_ ; this->coeffs().lookup("Cv") >> Cv_ ;
this->coeffs().lookup("ftVarMin") >> ftVarMin_; this->coeffs().lookup("ftVarMin") >> ftVarMin_;

View File

@ -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
@ -80,10 +80,10 @@ namespace combustionModels
Class FSD Declaration Class FSD Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
class FSD class FSD
: :
public singleStepCombustion <CombThermoType, ThermoType> public singleStepCombustion <ReactionThermo, ThermoType>
{ {
// Private data // Private data
@ -142,9 +142,9 @@ public:
FSD FSD
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,79 +26,73 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "psiThermoCombustion.H" #include "rhoReactionThermo.H"
#include "rhoCombustionModel.H"
#include "rhoThermoCombustion.H"
#include "FSD.H" #include "FSD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Combustion models based on sensibleEnthalpy // Combustion models based on sensibleEnthalpy
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
psiThermoCombustion, psiReactionThermo,
gasHThermoPhysics, gasHThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
psiThermoCombustion, psiReactionThermo,
constGasHThermoPhysics, constGasHThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
rhoThermoCombustion, rhoReactionThermo,
gasHThermoPhysics, gasHThermoPhysics
rhoCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
rhoThermoCombustion, rhoReactionThermo,
constGasHThermoPhysics, constGasHThermoPhysics
rhoCombustionModel
); );
// Combustion models based on sensibleInternalEnergy // Combustion models based on sensibleInternalEnergy
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
psiThermoCombustion, psiReactionThermo,
gasEThermoPhysics, gasEThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
psiThermoCombustion, psiReactionThermo,
constGasEThermoPhysics, constGasEThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
rhoThermoCombustion, rhoReactionThermo,
gasEThermoPhysics, gasEThermoPhysics
rhoCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
rhoThermoCombustion, rhoReactionThermo,
constGasEThermoPhysics, constGasEThermoPhysics
rhoCombustionModel
); );
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,14 +1,5 @@
combustionModel/combustionModel.C combustionModel/combustionModel.C
CombustionModel/CombustionModel/CombustionModels.C
psiCombustionModel/psiCombustionModel/psiCombustionModel.C
psiCombustionModel/psiCombustionModel/psiCombustionModelNew.C
psiCombustionModel/psiThermoCombustion/psiThermoCombustion.C
psiCombustionModel/psiChemistryCombustion/psiChemistryCombustion.C
rhoCombustionModel/rhoCombustionModel/rhoCombustionModel.C
rhoCombustionModel/rhoCombustionModel/rhoCombustionModelNew.C
rhoCombustionModel/rhoThermoCombustion/rhoThermoCombustion.C
rhoCombustionModel/rhoChemistryCombustion/rhoChemistryCombustion.C
diffusion/diffusions.C diffusion/diffusions.C
infinitelyFastChemistry/infinitelyFastChemistrys.C infinitelyFastChemistry/infinitelyFastChemistrys.C

View File

@ -27,28 +27,28 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::PaSR<Type>::PaSR Foam::combustionModels::PaSR<ReactionThermo>::PaSR
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
laminar<Type>(modelType, mesh, combustionProperties, phaseName), laminar<ReactionThermo>(modelType, thermo, turb, combustionProperties),
Cmix_(readScalar(this->coeffs().lookup("Cmix"))), Cmix_(readScalar(this->coeffs().lookup("Cmix"))),
kappa_ kappa_
( (
IOobject IOobject
( (
IOobject::groupName(typeName + ":kappa", phaseName), thermo.phasePropertyName(typeName + ":kappa"),
mesh.time().timeName(), this->mesh().time().timeName(),
mesh, this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, this->mesh(),
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
) )
{} {}
@ -56,19 +56,19 @@ Foam::combustionModels::PaSR<Type>::PaSR
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::PaSR<Type>::~PaSR() Foam::combustionModels::PaSR<ReactionThermo>::~PaSR()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
void Foam::combustionModels::PaSR<Type>::correct() void Foam::combustionModels::PaSR<ReactionThermo>::correct()
{ {
if (this->active()) if (this->active())
{ {
laminar<Type>::correct(); laminar<ReactionThermo>::correct();
tmp<volScalarField> tepsilon(this->turbulence().epsilon()); tmp<volScalarField> tepsilon(this->turbulence().epsilon());
const scalarField& epsilon = tepsilon(); const scalarField& epsilon = tepsilon();
@ -100,33 +100,33 @@ void Foam::combustionModels::PaSR<Type>::correct()
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::PaSR<Type>::R(volScalarField& Y) const Foam::combustionModels::PaSR<ReactionThermo>::R(volScalarField& Y) const
{ {
return kappa_*laminar<Type>::R(Y); return kappa_*laminar<ReactionThermo>::R(Y);
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<Type>::Qdot() const Foam::combustionModels::PaSR<ReactionThermo>::Qdot() const
{ {
return tmp<volScalarField> return tmp<volScalarField>
( (
new volScalarField new volScalarField
( (
IOobject::groupName(typeName + ":Qdot", this->phaseName_), this->thermo().phasePropertyName(typeName + ":Qdot"),
kappa_*laminar<Type>::Qdot() kappa_*laminar<ReactionThermo>::Qdot()
) )
); );
} }
template<class Type> template<class ReactionThermo>
bool Foam::combustionModels::PaSR<Type>::read() bool Foam::combustionModels::PaSR<ReactionThermo>::read()
{ {
if (laminar<Type>::read()) if (laminar<ReactionThermo>::read())
{ {
this->coeffs().lookup("Cmix") >> Cmix_; this->coeffs().lookup("Cmix") >> Cmix_;
return true; return true;

View File

@ -55,10 +55,10 @@ namespace combustionModels
Class PaSR Declaration Class PaSR Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class ReactionThermo>
class PaSR class PaSR
: :
public laminar<Type> public laminar<ReactionThermo>
{ {
// Private data // Private data
@ -90,9 +90,9 @@ public:
PaSR PaSR
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,14 +25,18 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "psiChemistryCombustion.H" #include "psiReactionThermo.H"
#include "rhoChemistryCombustion.H" #include "rhoReactionThermo.H"
#include "PaSR.H" #include "PaSR.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypes(PaSR, psiChemistryCombustion, psiCombustionModel); namespace Foam
makeCombustionTypes(PaSR, rhoChemistryCombustion, rhoCombustionModel); {
makeCombustionTypes(PaSR, psiReactionThermo);
makeCombustionTypes(PaSR, rhoReactionThermo);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -38,45 +38,59 @@ const Foam::word Foam::combustionModel::combustionPropertiesName
); );
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::IOobject Foam::combustionModel::createIOobject
(
basicThermo& thermo,
const word& combustionProperties
) const
{
IOobject io
(
thermo.phasePropertyName(combustionProperties),
thermo.db().time().constant(),
thermo.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.typeHeaderOk<IOdictionary>(true))
{
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
return io;
}
else
{
io.readOpt() = IOobject::NO_READ;
return io;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModel::combustionModel Foam::combustionModel::combustionModel
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, basicThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
IOdictionary IOdictionary(createIOobject(thermo, combustionProperties)),
( mesh_(thermo.p().mesh()),
IOobject turb_(turb),
(
IOobject::groupName(combustionProperties, phaseName),
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
turbulencePtr_(),
mesh_(mesh),
active_(lookupOrDefault<Switch>("active", true)), active_(lookupOrDefault<Switch>("active", true)),
coeffs_(optionalSubDict(modelType + "Coeffs")), coeffs_(optionalSubDict(modelType + "Coeffs")),
modelType_(modelType), modelType_(modelType)
phaseName_(phaseName)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModel::~combustionModel() Foam::combustionModel::~combustionModel()
{ {}
if (turbulencePtr_)
{
turbulencePtr_ = 0;
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //

View File

@ -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
@ -62,17 +62,24 @@ class combustionModel
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const combustionModel&); void operator=(const combustionModel&);
//- Construct the base IO object
IOobject createIOobject
(
basicThermo& thermo,
const word& combustionProperties
) const;
protected: protected:
// Protected data // Protected data
//- Reference to the turbulence model
compressibleTurbulenceModel* turbulencePtr_;
//- Reference to the mesh database //- Reference to the mesh database
const fvMesh& mesh_; const fvMesh& mesh_;
//- Reference to the turbulence model
const compressibleTurbulenceModel& turb_;
//- Active //- Active
Switch active_; Switch active_;
@ -82,9 +89,6 @@ protected:
//- Model type //- Model type
const word modelType_; const word modelType_;
//- Phase name
const word phaseName_;
public: public:
@ -101,9 +105,21 @@ public:
combustionModel combustionModel
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, basicThermo& thermo,
const word& combustionProperties=combustionPropertiesName, const compressibleTurbulenceModel& turb,
const word& phaseName=word::null const word& combustionProperties=combustionPropertiesName
);
// Selectors
//- Generic New for each of the related chemistry model
template<class CombustionModel>
static autoPtr<CombustionModel> New
(
typename CombustionModel::reactionThermo& thermo,
const compressibleTurbulenceModel& turb,
const word& combustionProperties
); );
@ -116,9 +132,6 @@ public:
//- Return const access to the mesh database //- Return const access to the mesh database
inline const fvMesh& mesh() const; inline const fvMesh& mesh() const;
//- Set turbulence
inline void setTurbulence(compressibleTurbulenceModel& turbModel);
//- Return access to turbulence //- Return access to turbulence
inline const compressibleTurbulenceModel& turbulence() const; inline const compressibleTurbulenceModel& turbulence() const;
@ -156,6 +169,10 @@ public:
#include "combustionModelI.H" #include "combustionModelI.H"
#ifdef NoRepository
#include "combustionModelTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -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
@ -34,16 +34,7 @@ inline const Foam::fvMesh& Foam::combustionModel::mesh() const
inline const Foam::compressibleTurbulenceModel& inline const Foam::compressibleTurbulenceModel&
Foam::combustionModel::turbulence() const Foam::combustionModel::turbulence() const
{ {
if (!turbulencePtr_) return turb_;
{
FatalErrorInFunction
<< "turbulencePtr_ is empty. Please use "
<< "combustionModel::setTurbulence "
<< "(compressibleTurbulenceModel&)"
<< abort(FatalError);
}
return *turbulencePtr_;
} }
@ -65,15 +56,6 @@ inline const Foam::Switch& Foam::combustionModel::active() const
} }
inline void Foam::combustionModel::setTurbulence
(
compressibleTurbulenceModel& turbModel
)
{
turbulencePtr_ = &turbModel;
}
inline const Foam::dictionary& Foam::combustionModel::coeffs() const inline const Foam::dictionary& Foam::combustionModel::coeffs() const
{ {
return coeffs_; return coeffs_;

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class CombustionModel>
Foam::autoPtr<CombustionModel> Foam::combustionModel::New
(
typename CombustionModel::reactionThermo& thermo,
const compressibleTurbulenceModel& turb,
const word& combustionProperties
)
{
IOobject combIO
(
IOobject
(
thermo.phasePropertyName(combustionProperties),
thermo.db().time().constant(),
thermo.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
word combModelName("none");
if (combIO.typeHeaderOk<IOdictionary>(false))
{
IOdictionary(combIO).lookup("combustionModel") >> combModelName;
}
else
{
Info<< "Combustion model not active: "
<< thermo.phasePropertyName(combustionProperties)
<< " not found" << endl;
}
Info<< "Selecting combustion model " << combModelName << endl;
const wordList cmpts2(basicThermo::splitThermoName(combModelName, 2));
const wordList cmpts3(basicThermo::splitThermoName(combModelName, 3));
if (cmpts2.size() == 2 || cmpts3.size() == 3)
{
combModelName = cmpts2.size() ? cmpts2[0] : cmpts3[0];
WarningInFunction
<< "Template parameters are no longer required when selecting a "
<< combustionModel::typeName << ". This information is now "
<< "obtained directly from the thermodynamics. Actually selecting "
<< "combustion model " << combModelName << "." << endl;
}
typedef typename CombustionModel::dictionaryConstructorTable cstrTableType;
cstrTableType* cstrTable = CombustionModel::dictionaryConstructorTablePtr_;
const word compCombModelName =
combModelName + '<' + CombustionModel::reactionThermo::typeName + '>';
const word thermoCombModelName =
combModelName + '<' + CombustionModel::reactionThermo::typeName + ','
+ thermo.thermoName() + '>';
typename cstrTableType::iterator compCstrIter =
cstrTable->find(compCombModelName);
typename cstrTableType::iterator thermoCstrIter =
cstrTable->find(thermoCombModelName);
if (compCstrIter == cstrTable->end() && thermoCstrIter == cstrTable->end())
{
FatalErrorInFunction
<< "Unknown " << combustionModel::typeName << " type "
<< combModelName << endl << endl;
const wordList names(cstrTable->toc());
wordList thisCmpts;
thisCmpts.append(word::null);
thisCmpts.append(CombustionModel::reactionThermo::typeName);
thisCmpts.append(basicThermo::splitThermoName(thermo.thermoName(), 5));
wordList validNames;
forAll(names, i)
{
wordList cmpts(basicThermo::splitThermoName(names[i], 2));
if (cmpts.size() != 2)
{
cmpts = basicThermo::splitThermoName(names[i], 7);
}
bool isValid = true;
for (label i = 1; i < cmpts.size() && isValid; ++ i)
{
isValid = isValid && cmpts[i] == thisCmpts[i];
}
if (isValid)
{
validNames.append(cmpts[0]);
}
}
FatalErrorInFunction
<< "Valid " << combustionModel::typeName << " types for this "
<< "thermodynamic model are:" << endl << validNames << endl;
List<wordList> validCmpts2, validCmpts7;
validCmpts2.append(wordList(2, word::null));
validCmpts2[0][0] = combustionModel::typeName;
validCmpts2[0][1] = "reactionThermo";
validCmpts7.append(wordList(7, word::null));
validCmpts7[0][0] = combustionModel::typeName;
validCmpts7[0][1] = "reactionThermo";
validCmpts7[0][2] = "transport";
validCmpts7[0][3] = "thermo";
validCmpts7[0][4] = "equationOfState";
validCmpts7[0][5] = "specie";
validCmpts7[0][6] = "energy";
forAll(names, i)
{
const wordList cmpts2(basicThermo::splitThermoName(names[i], 2));
const wordList cmpts7(basicThermo::splitThermoName(names[i], 7));
if (cmpts2.size() == 2)
{
validCmpts2.append(cmpts2);
}
if (cmpts7.size() == 7)
{
validCmpts7.append(cmpts7);
}
}
FatalErrorInFunction
<< "All " << validCmpts2[0][0] << '/' << validCmpts2[0][1]
<< " combinations are:" << endl << endl;
printTable(validCmpts2, FatalErrorInFunction);
FatalErrorInFunction << endl;
FatalErrorInFunction
<< "All " << validCmpts7[0][0] << '/' << validCmpts7[0][1]
<< "/thermoPhysics combinations are:" << endl << endl;
printTable(validCmpts7, FatalErrorInFunction);
FatalErrorInFunction << exit(FatalError);
}
return autoPtr<CombustionModel>
(
thermoCstrIter != cstrTable->end()
? thermoCstrIter()(combModelName, thermo, turb, combustionProperties)
: compCstrIter()(combModelName, thermo, turb, combustionProperties)
);
}
// ************************************************************************* //

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,61 +30,75 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCombustionTypesThermo(CombModel, CombType, Thermo, Table) \ namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCombustion(Comp) \
\ \
typedef Foam::combustionModels::CombModel \ typedef CombustionModel<Comp> CombustionModel##Comp; \
<Foam::combustionModels::CombType, Foam::Thermo> \
CombModel##CombType##Thermo; \
\ \
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
CombModel##CombType##Thermo, \ CombustionModel##Comp, \
#CombModel"<"#CombType","#Thermo">", \ ( \
word(CombustionModel##Comp::typeName_()) + "<" + Comp::typeName \
+ ">" \
).c_str(), \
0 \ 0 \
); \ ); \
\ \
namespace Foam \ defineTemplateRunTimeSelectionTable \
{ \
namespace combustionModels \
{ \
typedef CombModel<CombType, Thermo> CombModel##CombType##Thermo; \
addToRunTimeSelectionTable \
( \ ( \
Table, \ CombustionModel##Comp, \
CombModel##CombType##Thermo, \
dictionary \ dictionary \
); \ );
} \
}
#define makeCombustionTypes(CombModel, CombType, Table) \ #define makeCombustionTypesThermo(CombModel, Comp, Thermo) \
\ \
typedef Foam::combustionModels::CombModel \ typedef combustionModels::CombModel<Comp, Thermo> \
<Foam::combustionModels::CombType> \ CombModel##Comp##Thermo; \
CombModel##CombType; \
\ \
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
CombModel##CombType, \ CombModel##Comp##Thermo, \
#CombModel"<"#CombType">", \ ( \
word(CombModel##Comp##Thermo::typeName_()) + "<" + Comp::typeName \
+ "," + Thermo::typeName() + ">" \
).c_str(), \
0 \ 0 \
); \ ); \
\ \
namespace Foam \ CombustionModel<Comp>:: \
{ \ add##dictionary##ConstructorToTable<CombModel##Comp##Thermo> \
namespace combustionModels \ add##CombModel##Comp##Thermo##dictionary##ConstructorTo##\
{ \ CombustionModel##Comp##Table_;
typedef CombModel<CombType> CombModel##CombType; \
#define makeCombustionTypes(CombModel, Comp) \
\ \
addToRunTimeSelectionTable \ typedef combustionModels::CombModel<Comp> CombModel##Comp; \
\
defineTemplateTypeNameAndDebugWithName \
( \ ( \
Table, \ CombModel##Comp, \
CombModel##CombType, \ ( \
dictionary \ word(CombModel##Comp::typeName_()) + "<" + Comp::typeName + ">" \
).c_str(), \
0 \
); \ ); \
} \ \
} CombustionModel<Comp>:: \
add##dictionary##ConstructorToTable<CombModel##Comp> \
add##CombModel##Comp##dictionary##ConstructorTo##CombustionModel##Comp\
##Table_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -33,21 +33,21 @@ namespace combustionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
diffusion<CombThermoType, ThermoType>::diffusion diffusion<ReactionThermo, ThermoType>::diffusion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
singleStepCombustion<CombThermoType, ThermoType> singleStepCombustion<ReactionThermo, ThermoType>
( (
modelType, modelType,
mesh, thermo,
combustionProperties, turb,
phaseName combustionProperties
), ),
C_(readScalar(this->coeffs().lookup("C"))), C_(readScalar(this->coeffs().lookup("C"))),
oxidantName_(this->coeffs().template lookupOrDefault<word>("oxidant", "O2")) oxidantName_(this->coeffs().template lookupOrDefault<word>("oxidant", "O2"))
@ -56,15 +56,15 @@ diffusion<CombThermoType, ThermoType>::diffusion
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
diffusion<CombThermoType, ThermoType>::~diffusion() diffusion<ReactionThermo, ThermoType>::~diffusion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
void diffusion<CombThermoType, ThermoType>::correct() void diffusion<ReactionThermo, ThermoType>::correct()
{ {
this->wFuel_ == dimensionedScalar(dimMass/dimVolume/dimTime, Zero); this->wFuel_ == dimensionedScalar(dimMass/dimVolume/dimTime, Zero);
@ -75,12 +75,12 @@ void diffusion<CombThermoType, ThermoType>::correct()
const label fuelI = this->singleMixturePtr_->fuelIndex(); const label fuelI = this->singleMixturePtr_->fuelIndex();
const volScalarField& YFuel = const volScalarField& YFuel =
this->thermoPtr_->composition().Y()[fuelI]; this->thermo().composition().Y()[fuelI];
if (this->thermoPtr_->composition().contains(oxidantName_)) if (this->thermo().composition().contains(oxidantName_))
{ {
const volScalarField& YO2 = const volScalarField& YO2 =
this->thermoPtr_->composition().Y(oxidantName_); this->thermo().composition().Y(oxidantName_);
this->wFuel_ == this->wFuel_ ==
C_*this->turbulence().muEff() C_*this->turbulence().muEff()
@ -91,10 +91,10 @@ void diffusion<CombThermoType, ThermoType>::correct()
} }
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
bool diffusion<CombThermoType, ThermoType>::read() bool diffusion<ReactionThermo, ThermoType>::read()
{ {
if (singleStepCombustion<CombThermoType, ThermoType>::read()) if (singleStepCombustion<ReactionThermo, ThermoType>::read())
{ {
this->coeffs().lookup("C") >> C_ ; this->coeffs().lookup("C") >> C_ ;
this->coeffs().readIfPresent("oxidant", oxidantName_); this->coeffs().readIfPresent("oxidant", oxidantName_);

View File

@ -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-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,10 +53,10 @@ namespace combustionModels
Class diffusion Declaration Class diffusion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
class diffusion class diffusion
: :
public singleStepCombustion<CombThermoType, ThermoType> public singleStepCombustion<ReactionThermo, ThermoType>
{ {
// Private data // Private data
@ -88,9 +88,9 @@ public:
diffusion diffusion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,43 +26,42 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiThermoCombustion.H" #include "psiReactionThermo.H"
#include "rhoThermoCombustion.H" #include "rhoReactionThermo.H"
#include "diffusion.H" #include "diffusion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Combustion models based on sensibleEnthalpy // Combustion models based on sensibleEnthalpy
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
psiThermoCombustion, psiReactionThermo,
gasHThermoPhysics, gasHThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
psiThermoCombustion, psiReactionThermo,
constGasHThermoPhysics, constGasHThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
rhoThermoCombustion, rhoReactionThermo,
gasHThermoPhysics, gasHThermoPhysics
rhoCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
rhoThermoCombustion, rhoReactionThermo,
constGasHThermoPhysics, constGasHThermoPhysics
rhoCombustionModel
); );
@ -71,34 +70,31 @@ makeCombustionTypesThermo
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
psiThermoCombustion, psiReactionThermo,
gasEThermoPhysics, gasEThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
psiThermoCombustion, psiReactionThermo,
constGasEThermoPhysics, constGasEThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
rhoThermoCombustion, rhoReactionThermo,
gasEThermoPhysics, gasEThermoPhysics
rhoCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
diffusion, diffusion,
rhoThermoCombustion, rhoReactionThermo,
constGasEThermoPhysics, constGasEThermoPhysics
rhoCombustionModel
); );
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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
@ -32,21 +32,21 @@ namespace combustionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
infinitelyFastChemistry<CombThermoType, ThermoType>::infinitelyFastChemistry infinitelyFastChemistry<ReactionThermo, ThermoType>::infinitelyFastChemistry
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
singleStepCombustion<CombThermoType, ThermoType> singleStepCombustion<ReactionThermo, ThermoType>
( (
modelType, modelType,
mesh, thermo,
combustionProperties, turb,
phaseName combustionProperties
), ),
C_(readScalar(this->coeffs().lookup("C"))) C_(readScalar(this->coeffs().lookup("C")))
{} {}
@ -54,15 +54,15 @@ infinitelyFastChemistry<CombThermoType, ThermoType>::infinitelyFastChemistry
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
infinitelyFastChemistry<CombThermoType, ThermoType>::~infinitelyFastChemistry() infinitelyFastChemistry<ReactionThermo, ThermoType>::~infinitelyFastChemistry()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
void infinitelyFastChemistry<CombThermoType, ThermoType>::correct() void infinitelyFastChemistry<ReactionThermo, ThermoType>::correct()
{ {
this->wFuel_ == dimensionedScalar(dimMass/dimVolume/dimTime, Zero); this->wFuel_ == dimensionedScalar(dimMass/dimVolume/dimTime, Zero);
@ -73,13 +73,13 @@ void infinitelyFastChemistry<CombThermoType, ThermoType>::correct()
const label fuelI = this->singleMixturePtr_->fuelIndex(); const label fuelI = this->singleMixturePtr_->fuelIndex();
const volScalarField& YFuel = const volScalarField& YFuel =
this->thermoPtr_->composition().Y()[fuelI]; this->thermo().composition().Y()[fuelI];
const dimensionedScalar s = this->singleMixturePtr_->s(); const dimensionedScalar s = this->singleMixturePtr_->s();
if (this->thermoPtr_->composition().contains("O2")) if (this->thermo().composition().contains("O2"))
{ {
const volScalarField& YO2 = this->thermoPtr_->composition().Y("O2"); const volScalarField& YO2 = this->thermo().composition().Y("O2");
this->wFuel_ == this->wFuel_ ==
this->rho()/(this->mesh().time().deltaT()*C_) this->rho()/(this->mesh().time().deltaT()*C_)
@ -89,10 +89,10 @@ void infinitelyFastChemistry<CombThermoType, ThermoType>::correct()
} }
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
bool infinitelyFastChemistry<CombThermoType, ThermoType>::read() bool infinitelyFastChemistry<ReactionThermo, ThermoType>::read()
{ {
if (singleStepCombustion<CombThermoType, ThermoType>::read()) if (singleStepCombustion<ReactionThermo, ThermoType>::read())
{ {
this->coeffs().lookup("C") >> C_ ; this->coeffs().lookup("C") >> C_ ;
return true; return true;

View File

@ -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
@ -53,10 +53,10 @@ namespace combustionModels
Class infinitelyFastChemistry Declaration Class infinitelyFastChemistry Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
class infinitelyFastChemistry class infinitelyFastChemistry
: :
public singleStepCombustion<CombThermoType, ThermoType> public singleStepCombustion<ReactionThermo, ThermoType>
{ {
// Private data // Private data
@ -85,9 +85,9 @@ public:
infinitelyFastChemistry infinitelyFastChemistry
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,44 +26,43 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiThermoCombustion.H" #include "psiReactionThermo.H"
#include "rhoThermoCombustion.H" #include "rhoReactionThermo.H"
#include "infinitelyFastChemistry.H" #include "infinitelyFastChemistry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Combustion models based on sensibleEnthalpy // Combustion models based on sensibleEnthalpy
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
psiThermoCombustion, psiReactionThermo,
gasHThermoPhysics, gasHThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
psiThermoCombustion, psiReactionThermo,
constGasHThermoPhysics, constGasHThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
rhoThermoCombustion, rhoReactionThermo,
gasHThermoPhysics, gasHThermoPhysics
rhoCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
rhoThermoCombustion, rhoReactionThermo,
constGasHThermoPhysics, constGasHThermoPhysics
rhoCombustionModel
); );
// Combustion models based on sensibleInternalEnergy // Combustion models based on sensibleInternalEnergy
@ -71,34 +70,31 @@ makeCombustionTypesThermo
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
psiThermoCombustion, psiReactionThermo,
gasEThermoPhysics, gasEThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
psiThermoCombustion, psiReactionThermo,
constGasEThermoPhysics, constGasEThermoPhysics
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
rhoThermoCombustion, rhoReactionThermo,
gasEThermoPhysics, gasEThermoPhysics
rhoCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
rhoThermoCombustion, rhoReactionThermo,
constGasEThermoPhysics, constGasEThermoPhysics
rhoCombustionModel
); );
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,16 +29,22 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::laminar<Type>::laminar Foam::combustionModels::laminar<ReactionThermo>::laminar
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
Type(modelType, mesh, combustionProperties, phaseName), ChemistryCombustion<ReactionThermo>
(
modelType,
thermo,
turb,
combustionProperties
),
integrateReactionRate_ integrateReactionRate_
( (
this->coeffs().lookupOrDefault("integrateReactionRate", true) this->coeffs().lookupOrDefault("integrateReactionRate", true)
@ -57,23 +63,23 @@ Foam::combustionModels::laminar<Type>::laminar
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::laminar<Type>::~laminar() Foam::combustionModels::laminar<ReactionThermo>::~laminar()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::laminar<Type>::tc() const Foam::combustionModels::laminar<ReactionThermo>::tc() const
{ {
return this->chemistryPtr_->tc(); return this->chemistryPtr_->tc();
} }
template<class Type> template<class ReactionThermo>
void Foam::combustionModels::laminar<Type>::correct() void Foam::combustionModels::laminar<ReactionThermo>::correct()
{ {
if (this->active()) if (this->active())
{ {
@ -114,9 +120,9 @@ void Foam::combustionModels::laminar<Type>::correct()
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::laminar<Type>::R(volScalarField& Y) const Foam::combustionModels::laminar<ReactionThermo>::R(volScalarField& Y) const
{ {
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime)); tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
@ -134,9 +140,9 @@ Foam::combustionModels::laminar<Type>::R(volScalarField& Y) const
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::laminar<Type>::Qdot() const Foam::combustionModels::laminar<ReactionThermo>::Qdot() const
{ {
tmp<volScalarField> tQdot tmp<volScalarField> tQdot
( (
@ -144,7 +150,7 @@ Foam::combustionModels::laminar<Type>::Qdot() const
( (
IOobject IOobject
( (
IOobject::groupName(typeName + ":Qdot", this->phaseName_), this->thermo().phasePropertyName(typeName + ":Qdot"),
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -165,10 +171,10 @@ Foam::combustionModels::laminar<Type>::Qdot() const
} }
template<class Type> template<class ReactionThermo>
bool Foam::combustionModels::laminar<Type>::read() bool Foam::combustionModels::laminar<ReactionThermo>::read()
{ {
if (Type::read()) if (ChemistryCombustion<ReactionThermo>::read())
{ {
integrateReactionRate_ = integrateReactionRate_ =
this->coeffs().lookupOrDefault("integrateReactionRate", true); this->coeffs().lookupOrDefault("integrateReactionRate", true);

View File

@ -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) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,6 +38,8 @@ SourceFiles
#ifndef combustionModels_laminar_H #ifndef combustionModels_laminar_H
#define combustionModels_laminar_H #define combustionModels_laminar_H
#include "ChemistryCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -49,10 +51,10 @@ namespace combustionModels
Class laminar Declaration Class laminar Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class ReactionThermo>
class laminar class laminar
: :
public Type public ChemistryCombustion<ReactionThermo>
{ {
// Private data // Private data
@ -90,9 +92,9 @@ public:
laminar laminar
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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) 2013-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,14 +25,18 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "psiChemistryCombustion.H" #include "psiReactionThermo.H"
#include "rhoChemistryCombustion.H" #include "rhoReactionThermo.H"
#include "laminar.H" #include "laminar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypes(laminar, psiChemistryCombustion, psiCombustionModel); namespace Foam
makeCombustionTypes(laminar, rhoChemistryCombustion, rhoCombustionModel); {
makeCombustionTypes(laminar, psiReactionThermo);
makeCombustionTypes(laminar, rhoReactionThermo);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,36 +28,36 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType> template<class ReactionThermo>
Foam::combustionModels::noCombustion<CombThermoType>::noCombustion Foam::combustionModels::noCombustion<ReactionThermo>::noCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
CombThermoType(modelType, mesh, phaseName) ThermoCombustion<ReactionThermo>(modelType, thermo, turb)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType> template<class ReactionThermo>
Foam::combustionModels::noCombustion<CombThermoType>::~noCombustion() Foam::combustionModels::noCombustion<ReactionThermo>::~noCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType> template<class ReactionThermo>
void Foam::combustionModels::noCombustion<CombThermoType>::correct() void Foam::combustionModels::noCombustion<ReactionThermo>::correct()
{} {}
template<class CombThermoType> template<class ReactionThermo>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::noCombustion<CombThermoType>::R Foam::combustionModels::noCombustion<ReactionThermo>::R
( (
volScalarField& Y volScalarField& Y
) const ) const
@ -71,15 +71,15 @@ Foam::combustionModels::noCombustion<CombThermoType>::R
} }
template<class CombThermoType> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::noCombustion<CombThermoType>::Qdot() const Foam::combustionModels::noCombustion<ReactionThermo>::Qdot() const
{ {
return tmp<volScalarField>::New return tmp<volScalarField>::New
( (
IOobject IOobject
( (
IOobject::groupName(typeName + ":Qdot", this->phaseName_), this->thermo().phasePropertyName(typeName + ":Qdot"),
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -92,10 +92,10 @@ Foam::combustionModels::noCombustion<CombThermoType>::Qdot() const
} }
template<class CombThermoType> template<class ReactionThermo>
bool Foam::combustionModels::noCombustion<CombThermoType>::read() bool Foam::combustionModels::noCombustion<ReactionThermo>::read()
{ {
if (CombThermoType::read()) if (ThermoCombustion<ReactionThermo>::read())
{ {
return true; return true;
} }

View File

@ -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
@ -38,6 +38,8 @@ SourceFiles
#ifndef noCombustion_H #ifndef noCombustion_H
#define noCombustion_H #define noCombustion_H
#include "ThermoCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -49,10 +51,10 @@ namespace combustionModels
Class noCombustion Declaration Class noCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType> template<class ReactionThermo>
class noCombustion class noCombustion
: :
public CombThermoType public ThermoCombustion<ReactionThermo>
{ {
//- Disallow copy construct //- Disallow copy construct
@ -65,7 +67,7 @@ class noCombustion
public: public:
//- Runtime type information //- Runtime type information
TypeName("noCombustion"); TypeName("none");
// Constructors // Constructors
@ -74,9 +76,9 @@ public:
noCombustion noCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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
@ -25,28 +25,18 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "rhoCombustionModel.H" #include "rhoReactionThermo.H"
#include "psiThermoCombustion.H"
#include "rhoThermoCombustion.H"
#include "noCombustion.H" #include "noCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypes namespace Foam
( {
noCombustion,
psiThermoCombustion,
psiCombustionModel
);
makeCombustionTypes makeCombustionTypes(noCombustion, psiReactionThermo);
( makeCombustionTypes(noCombustion, rhoReactionThermo);
noCombustion,
rhoThermoCombustion,
rhoCombustionModel
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,111 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 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::psiChemistryCombustion
Description
Compressibility-based chemistry model wrapper for combustion models
SourceFiles
psiChemistryCombustion.C
\*---------------------------------------------------------------------------*/
#ifndef psiChemistryCombustion_H
#define psiChemistryCombustion_H
#include "autoPtr.H"
#include "psiCombustionModel.H"
#include "psiChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
class psiChemistryCombustion Declaration
\*---------------------------------------------------------------------------*/
class psiChemistryCombustion
:
public psiCombustionModel
{
// Private Member Functions
//- Construct as copy (not implemented)
psiChemistryCombustion(const psiChemistryCombustion&);
//- Disallow default bitwise assignment
void operator=(const psiChemistryCombustion&);
protected:
// Protected data
//- Pointer to chemistry model
autoPtr<psiChemistryModel> chemistryPtr_;
public:
// Constructors
//- Construct from components and thermo
psiChemistryCombustion
(
const word& modelType,
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
);
//- Destructor
virtual ~psiChemistryCombustion();
// Member Functions
//- Return access to the thermo package
virtual psiReactionThermo& thermo();
//- Return const access to the thermo package
virtual const psiReactionThermo& thermo() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,74 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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 "psiCombustionModel.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
namespace combustionModels
{
defineTypeNameAndDebug(psiCombustionModel, 0);
defineRunTimeSelectionTable(psiCombustionModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::psiCombustionModel::psiCombustionModel
(
const word& modelType,
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
)
:
combustionModel(modelType, mesh, combustionProperties, phaseName)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::psiCombustionModel::~psiCombustionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::combustionModels::psiCombustionModel::read()
{
if (combustionModel::read())
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,77 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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 "psiCombustionModel.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::combustionModels::psiCombustionModel>
Foam::combustionModels::psiCombustionModel::New
(
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
)
{
const word modelType
(
IOdictionary
(
IOobject
(
IOobject::groupName(combustionProperties, phaseName),
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("combustionModel")
);
Info<< "Selecting combustion model " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown psiCombustionModel type "
<< modelType << nl << nl
<< "Valid combustionModel types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
const word className = modelType.substr(0, modelType.find('<'));
return autoPtr<psiCombustionModel>
(
cstrIter()(className, mesh, combustionProperties, phaseName)
);
}
// ************************************************************************* //

View File

@ -1,64 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 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 "psiThermoCombustion.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::psiThermoCombustion::psiThermoCombustion
(
const word& modelType,
const fvMesh& mesh,
const word& phaseName
)
:
psiCombustionModel(modelType, mesh, combustionPropertiesName, phaseName),
thermoPtr_(psiReactionThermo::New(mesh, phaseName))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::psiThermoCombustion::~psiThermoCombustion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::psiReactionThermo&
Foam::combustionModels::psiThermoCombustion::thermo()
{
return *thermoPtr_;
}
const Foam::psiReactionThermo&
Foam::combustionModels::psiThermoCombustion::thermo() const
{
return *thermoPtr_;
}
// ************************************************************************* //

View File

@ -1,111 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 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::rhoChemistryCombustion
Description
Density-based chemistry model wrapper for combustion models
SourceFiles
rhoChemistryCombustion.C
\*---------------------------------------------------------------------------*/
#ifndef rhoChemistryCombustion_H
#define rhoChemistryCombustion_H
#include "autoPtr.H"
#include "rhoCombustionModel.H"
#include "rhoChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
class rhoChemistryCombustion Declaration
\*---------------------------------------------------------------------------*/
class rhoChemistryCombustion
:
public rhoCombustionModel
{
// Private Member Functions
//- Construct as copy (not implemented)
rhoChemistryCombustion(const rhoChemistryCombustion&);
//- Disallow default bitwise assignment
void operator=(const rhoChemistryCombustion&);
protected:
// Protected data
//- Pointer to chemistry model
autoPtr<rhoChemistryModel> chemistryPtr_;
public:
// Constructors
//- Construct from components and thermo
rhoChemistryCombustion
(
const word& modelType,
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
);
//- Destructor
virtual ~rhoChemistryCombustion();
// Member Functions
//- Return access to the thermo package
virtual rhoReactionThermo& thermo();
//- Return const access to the thermo package
virtual const rhoReactionThermo& thermo() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,153 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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::rhoCombustionModel
Description
Combustion models for rho-based thermodynamics
SourceFiles
rhoCombustionModelI.H
rhoCombustionModel.C
rhoCombustionModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef rhoCombustionModel_H
#define rhoCombustionModel_H
#include "combustionModel.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
class rhoCombustionModel Declaration
\*---------------------------------------------------------------------------*/
class rhoCombustionModel
:
public combustionModel
{
// Private Member Functions
//- Construct as copy (not implemented)
rhoCombustionModel(const rhoCombustionModel&);
//- Disallow default bitwise assignment
void operator=(const rhoCombustionModel&);
public:
typedef rhoReactionThermo ReactionThermo;
//- Runtime type information
TypeName("rhoCombustionModel");
//- Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
rhoCombustionModel,
dictionary,
(
const word& modelType,
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
),
(modelType, mesh, combustionProperties, phaseName)
);
// Constructors
//- Construct from components
rhoCombustionModel
(
const word& modelType,
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
);
//- Selector
static autoPtr<rhoCombustionModel> New
(
const fvMesh& mesh,
const word& combustionProperties=combustionPropertiesName,
const word& phaseName=word::null
);
//- Destructor
virtual ~rhoCombustionModel();
// Member Functions
// Access functions
//- Access combustion dict
inline const dictionary& coeff() const;
//- Return access to the thermo package
virtual rhoReactionThermo& thermo() = 0;
//- Return const access to the thermo package
virtual const rhoReactionThermo& thermo() const = 0;
// IO
//- Update properties from given dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,77 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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 "rhoCombustionModel.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::combustionModels::rhoCombustionModel>
Foam::combustionModels::rhoCombustionModel::New
(
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
)
{
const word modelType
(
IOdictionary
(
IOobject
(
IOobject::groupName(combustionProperties, phaseName),
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("combustionModel")
);
Info<< "Selecting combustion model " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown rhoCombustionModel type "
<< modelType << nl << nl
<< "Valid combustionModel types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
const word className = modelType.substr(0, modelType.find('<'));
return autoPtr<rhoCombustionModel>
(
cstrIter()(className, mesh, combustionProperties, phaseName)
);
}
// ************************************************************************* //

View File

@ -1,64 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 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 "rhoThermoCombustion.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::rhoThermoCombustion::rhoThermoCombustion
(
const word& modelType,
const fvMesh& mesh,
const word& phaseName
)
:
rhoCombustionModel(modelType, mesh, combustionPropertiesName, phaseName),
thermoPtr_(rhoReactionThermo::New(mesh, phaseName))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::rhoThermoCombustion::~rhoThermoCombustion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::rhoReactionThermo&
Foam::combustionModels::rhoThermoCombustion::thermo()
{
return *thermoPtr_;
}
const Foam::rhoReactionThermo&
Foam::combustionModels::rhoThermoCombustion::thermo() const
{
return *thermoPtr_;
}
// ************************************************************************* //

View File

@ -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
@ -33,22 +33,22 @@ namespace combustionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
singleStepCombustion<CombThermoType, ThermoType>::singleStepCombustion singleStepCombustion<ReactionThermo, ThermoType>::singleStepCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
CombThermoType(modelType, mesh, phaseName), ThermoCombustion<ReactionThermo>(modelType, thermo, turb),
singleMixturePtr_(nullptr), singleMixturePtr_(nullptr),
wFuel_ wFuel_
( (
IOobject IOobject
( (
IOobject::groupName("wFuel", phaseName), this->thermo().phasePropertyName("wFuel"),
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -89,21 +89,21 @@ singleStepCombustion<CombThermoType, ThermoType>::singleStepCombustion
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
singleStepCombustion<CombThermoType, ThermoType>::~singleStepCombustion() singleStepCombustion<ReactionThermo, ThermoType>::~singleStepCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
tmp<fvScalarMatrix> singleStepCombustion<CombThermoType, ThermoType>::R tmp<fvScalarMatrix> singleStepCombustion<ReactionThermo, ThermoType>::R
( (
volScalarField& Y volScalarField& Y
) const ) const
{ {
const label specieI = const label specieI =
this->thermoPtr_->composition().species()[Y.member()]; this->thermo().composition().species()[Y.member()];
volScalarField wSpecie volScalarField wSpecie
( (
@ -125,22 +125,22 @@ tmp<fvScalarMatrix> singleStepCombustion<CombThermoType, ThermoType>::R
} }
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
tmp<volScalarField> tmp<volScalarField>
singleStepCombustion<CombThermoType, ThermoType>::Qdot() const singleStepCombustion<ReactionThermo, ThermoType>::Qdot() const
{ {
const label fuelI = singleMixturePtr_->fuelIndex(); const label fuelI = singleMixturePtr_->fuelIndex();
volScalarField& YFuel = volScalarField& YFuel =
const_cast<volScalarField&>(this->thermoPtr_->composition().Y(fuelI)); const_cast<volScalarField&>(this->thermo().composition().Y(fuelI));
return -singleMixturePtr_->qFuel()*(R(YFuel) & YFuel); return -singleMixturePtr_->qFuel()*(R(YFuel) & YFuel);
} }
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
bool singleStepCombustion<CombThermoType, ThermoType>::read() bool singleStepCombustion<ReactionThermo, ThermoType>::read()
{ {
if (CombThermoType::read()) if (ThermoCombustion<ReactionThermo>::read())
{ {
return true; return true;
} }

View File

@ -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
@ -39,6 +39,7 @@ SourceFiles
#define singleStepCombustion_H #define singleStepCombustion_H
#include "singleStepReactingMixture.H" #include "singleStepReactingMixture.H"
#include "ThermoCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,10 +52,10 @@ namespace combustionModels
Class singleStepCombustion Declaration Class singleStepCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType> template<class ReactionThermo, class ThermoType>
class singleStepCombustion class singleStepCombustion
: :
public CombThermoType public ThermoCombustion<ReactionThermo>
{ {
// Private Member Functions // Private Member Functions
@ -87,9 +88,9 @@ public:
singleStepCombustion singleStepCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,9 +27,9 @@ License
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::zoneCombustion<Type>::filter Foam::combustionModels::zoneCombustion<ReactionThermo>::filter
( (
const tmp<fvScalarMatrix>& tR const tmp<fvScalarMatrix>& tR
) const ) const
@ -72,9 +72,9 @@ Foam::combustionModels::zoneCombustion<Type>::filter
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::zoneCombustion<Type>::filter Foam::combustionModels::zoneCombustion<ReactionThermo>::filter
( (
const tmp<volScalarField>& tS const tmp<volScalarField>& tS
) const ) const
@ -100,23 +100,29 @@ Foam::combustionModels::zoneCombustion<Type>::filter
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::zoneCombustion<Type>::zoneCombustion Foam::combustionModels::zoneCombustion<ReactionThermo>::zoneCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
) )
: :
Type(modelType, mesh, combustionProperties, phaseName), CombustionModel<ReactionThermo>
(
modelType,
thermo,
turb,
combustionProperties
),
combustionModelPtr_ combustionModelPtr_
( (
Type::New CombustionModel<ReactionThermo>::New
( (
mesh, thermo,
"zoneCombustionProperties", turb,
phaseName "zoneCombustionProperties"
) )
), ),
zoneNames_(this->coeffs().lookup("zones")) zoneNames_(this->coeffs().lookup("zones"))
@ -125,56 +131,58 @@ Foam::combustionModels::zoneCombustion<Type>::zoneCombustion
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
Foam::combustionModels::zoneCombustion<Type>::~zoneCombustion() Foam::combustionModels::zoneCombustion<ReactionThermo>::~zoneCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type> template<class ReactionThermo>
typename Type::ReactionThermo& ReactionThermo& Foam::combustionModels::zoneCombustion<ReactionThermo>::thermo()
Foam::combustionModels::zoneCombustion<Type>::thermo()
{ {
return combustionModelPtr_->thermo(); return combustionModelPtr_->thermo();
} }
template<class Type> template<class ReactionThermo>
const typename Type::ReactionThermo& const ReactionThermo&
Foam::combustionModels::zoneCombustion<Type>::thermo() const Foam::combustionModels::zoneCombustion<ReactionThermo>::thermo() const
{ {
return combustionModelPtr_->thermo(); return combustionModelPtr_->thermo();
} }
template<class Type> template<class ReactionThermo>
void Foam::combustionModels::zoneCombustion<Type>::correct() void Foam::combustionModels::zoneCombustion<ReactionThermo>::correct()
{ {
combustionModelPtr_->correct(); combustionModelPtr_->correct();
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::zoneCombustion<Type>::R(volScalarField& Y) const Foam::combustionModels::zoneCombustion<ReactionThermo>::R
(
volScalarField& Y
) const
{ {
return filter(combustionModelPtr_->R(Y)); return filter(combustionModelPtr_->R(Y));
} }
template<class Type> template<class ReactionThermo>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::zoneCombustion<Type>::Qdot() const Foam::combustionModels::zoneCombustion<ReactionThermo>::Qdot() const
{ {
return filter(combustionModelPtr_->Qdot()); return filter(combustionModelPtr_->Qdot());
} }
template<class Type> template<class ReactionThermo>
bool Foam::combustionModels::zoneCombustion<Type>::read() bool Foam::combustionModels::zoneCombustion<ReactionThermo>::read()
{ {
if (Type::read()) if (CombustionModel<ReactionThermo>::read())
{ {
combustionModelPtr_->read(); combustionModelPtr_->read();
return true; return true;

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,6 +38,8 @@ SourceFiles
#ifndef zoneCombustion_H #ifndef zoneCombustion_H
#define zoneCombustion_H #define zoneCombustion_H
#include "CombustionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -49,15 +51,15 @@ namespace combustionModels
Class zoneCombustion Declaration Class zoneCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class ReactionThermo>
class zoneCombustion class zoneCombustion
: :
public Type public CombustionModel<ReactionThermo>
{ {
// Private data // Private data
//- The combustion model to be zone-filtered //- The combustion model to be zone-filtered
autoPtr<Type> combustionModelPtr_; autoPtr<CombustionModel<ReactionThermo>> combustionModelPtr_;
//- List of zone names in which the reactions are active //- List of zone names in which the reactions are active
wordList zoneNames_; wordList zoneNames_;
@ -90,9 +92,9 @@ public:
zoneCombustion zoneCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh, ReactionThermo& thermo,
const word& combustionProperties, const compressibleTurbulenceModel& turb,
const word& phaseName const word& combustionProperties
); );
@ -103,10 +105,10 @@ public:
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
virtual typename Type::ReactionThermo& thermo(); virtual ReactionThermo& thermo();
//- Return const access to the thermo package //- Return const access to the thermo package
virtual const typename Type::ReactionThermo& thermo() const; virtual const ReactionThermo& thermo() const;
//- Correct combustion rate //- Correct combustion rate
virtual void correct(); virtual void correct();

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,13 +25,18 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "psiCombustionModel.H" #include "psiReactionThermo.H"
#include "rhoCombustionModel.H" #include "rhoReactionThermo.H"
#include "zoneCombustion.H" #include "zoneCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypes(zoneCombustion, psiCombustionModel, psiCombustionModel); namespace Foam
makeCombustionTypes(zoneCombustion, rhoCombustionModel, rhoCombustionModel); {
makeCombustionTypes(zoneCombustion, psiReactionThermo);
makeCombustionTypes(zoneCombustion, rhoReactionThermo);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -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
@ -47,9 +47,14 @@ addToRunTimeSelectionTable(pyrolysisModel, noPyrolysis, dictionary);
void noPyrolysis::constructThermoChemistry() void noPyrolysis::constructThermoChemistry()
{ {
solidThermo_.reset
(
solidReactionThermo::New(regionMesh()).ptr()
);
solidChemistry_.reset solidChemistry_.reset
( (
basicSolidChemistryModel::New(regionMesh()).ptr() basicSolidChemistryModel::New(solidThermo_()).ptr()
); );
radiation_.reset(radiation::radiationModel::New radiation_.reset(radiation::radiationModel::New
@ -97,6 +102,7 @@ noPyrolysis::noPyrolysis
) )
: :
pyrolysisModel(mesh, regionType), pyrolysisModel(mesh, regionType),
solidThermo_(nullptr),
solidChemistry_(nullptr), solidChemistry_(nullptr),
radiation_(nullptr) radiation_(nullptr)
{ {
@ -116,6 +122,7 @@ noPyrolysis::noPyrolysis
) )
: :
pyrolysisModel(mesh, regionType), pyrolysisModel(mesh, regionType),
solidThermo_(nullptr),
solidChemistry_(nullptr), solidChemistry_(nullptr),
radiation_(nullptr) radiation_(nullptr)
{ {

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,7 +81,10 @@ protected:
//- Reset solidChemistryModel and solidThermo pointers //- Reset solidChemistryModel and solidThermo pointers
void constructThermoChemistry(); void constructThermoChemistry();
//- Pointer to the solid chemistry model //- Reference to solid thermo
autoPtr<solidReactionThermo> solidThermo_;
//- Reference to the solid chemistry model
autoPtr<basicSolidChemistryModel> solidChemistry_; autoPtr<basicSolidChemistryModel> solidChemistry_;
//- Pointer to radiation model //- Pointer to radiation model
@ -148,7 +151,6 @@ public:
//- Evolve the pyrolysis equations //- Evolve the pyrolysis equations
virtual void evolveRegion(); virtual void evolveRegion();
}; };

View File

@ -152,7 +152,7 @@ void reactingOneDim::updatePhiGas()
forAll(gasTable, gasI) forAll(gasTable, gasI)
{ {
tmp<volScalarField> tHsiGas = tmp<volScalarField> tHsiGas =
solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI); solidChemistry_->gasHs(solidThermo_->p(), solidThermo_->T(), gasI);
const volScalarField& HsiGas = tHsiGas(); const volScalarField& HsiGas = tHsiGas();
@ -300,7 +300,7 @@ void reactingOneDim::solveEnergy()
InfoInFunction << endl; InfoInFunction << endl;
} }
tmp<volScalarField> alpha(solidThermo_.alpha()); tmp<volScalarField> alpha(solidThermo_->alpha());
fvScalarMatrix hEqn fvScalarMatrix hEqn
( (
@ -382,9 +382,9 @@ reactingOneDim::reactingOneDim
) )
: :
pyrolysisModel(modelType, mesh, regionType), pyrolysisModel(modelType, mesh, regionType),
solidChemistry_(basicSolidChemistryModel::New(regionMesh())), solidThermo_(solidReactionThermo::New(regionMesh())),
solidThermo_(solidChemistry_->solidThermo()), solidChemistry_(basicSolidChemistryModel::New(solidThermo_())),
radiation_(radiation::radiationModel::New(solidThermo_.T())), radiation_(radiation::radiationModel::New(solidThermo_->T())),
rho_ rho_
( (
IOobject IOobject
@ -395,10 +395,10 @@ reactingOneDim::reactingOneDim
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
solidThermo_.rho() solidThermo_->rho()
), ),
Ys_(solidThermo_.composition().Y()), Ys_(solidThermo_->composition().Y()),
h_(solidThermo_.he()), h_(solidThermo_->he()),
nNonOrthCorr_(-1), nNonOrthCorr_(-1),
maxDiff_(10), maxDiff_(10),
minimumDelta_(1e-4), minimumDelta_(1e-4),
@ -482,9 +482,9 @@ reactingOneDim::reactingOneDim
) )
: :
pyrolysisModel(modelType, mesh, dict, regionType), pyrolysisModel(modelType, mesh, dict, regionType),
solidChemistry_(basicSolidChemistryModel::New(regionMesh())), solidThermo_(solidReactionThermo::New(regionMesh())),
solidThermo_(solidChemistry_->solidThermo()), solidChemistry_(basicSolidChemistryModel::New(solidThermo_())),
radiation_(radiation::radiationModel::New(solidThermo_.T())), radiation_(radiation::radiationModel::New(solidThermo_->T())),
rho_ rho_
( (
IOobject IOobject
@ -495,10 +495,10 @@ reactingOneDim::reactingOneDim
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
solidThermo_.rho() solidThermo_->rho()
), ),
Ys_(solidThermo_.composition().Y()), Ys_(solidThermo_->composition().Y()),
h_(solidThermo_.he()), h_(solidThermo_->he()),
nNonOrthCorr_(-1), nNonOrthCorr_(-1),
maxDiff_(10), maxDiff_(10),
minimumDelta_(1e-4), minimumDelta_(1e-4),
@ -641,13 +641,13 @@ const volScalarField& reactingOneDim::rho() const
const volScalarField& reactingOneDim::T() const const volScalarField& reactingOneDim::T() const
{ {
return solidThermo_.T(); return solidThermo_->T();
} }
const tmp<volScalarField> reactingOneDim::Cp() const const tmp<volScalarField> reactingOneDim::Cp() const
{ {
return solidThermo_.Cp(); return solidThermo_->Cp();
} }
@ -659,7 +659,7 @@ tmp<volScalarField> reactingOneDim::kappaRad() const
tmp<volScalarField> reactingOneDim::kappa() const tmp<volScalarField> reactingOneDim::kappa() const
{ {
return solidThermo_.kappa(); return solidThermo_->kappa();
} }
@ -703,12 +703,12 @@ void reactingOneDim::evolveRegion()
calculateMassTransfer(); calculateMassTransfer();
solidThermo_.correct(); solidThermo_->correct();
Info<< "pyrolysis min/max(T) = " Info<< "pyrolysis min/max(T) = "
<< gMin(solidThermo_.T().primitiveField()) << gMin(solidThermo_->T().primitiveField())
<< ", " << ", "
<< gMax(solidThermo_.T().primitiveField()) << gMax(solidThermo_->T().primitiveField())
<< endl; << endl;
} }

View File

@ -77,12 +77,12 @@ protected:
// Protected data // Protected data
//- Reference to solid thermo
autoPtr<solidReactionThermo> solidThermo_;
//- Reference to the solid chemistry model //- Reference to the solid chemistry model
autoPtr<basicSolidChemistryModel> solidChemistry_; autoPtr<basicSolidChemistryModel> solidChemistry_;
//- Reference to solid thermo
solidReactionThermo& solidThermo_;
//- Pointer to radiation model //- Pointer to radiation model
autoPtr<radiation::radiationModel> radiation_; autoPtr<radiation::radiationModel> radiation_;

View File

@ -255,6 +255,9 @@ public:
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;
//- Return the name of the thermo physics
virtual word thermoName() const = 0;
//- Return true if the equation of state is incompressible //- Return true if the equation of state is incompressible
// i.e. rho != f(p) // i.e. rho != f(p)
virtual bool incompressible() const = 0; virtual bool incompressible() const = 0;

View File

@ -125,6 +125,12 @@ public:
return *this; return *this;
} }
//- Return the name of the thermo physics
virtual word thermoName() const
{
return MixtureType::thermoType::typeName();
}
//- Return true if the equation of state is incompressible //- Return true if the equation of state is incompressible
// i.e. rho != f(p) // i.e. rho != f(p)
virtual bool incompressible() const virtual bool incompressible() const

View File

@ -1,10 +1,5 @@
chemistryModel/basicChemistryModel/basicChemistryModel.C chemistryModel/basicChemistryModel/basicChemistryModel.C
chemistryModel/BasicChemistryModel/BasicChemistryModels.C
chemistryModel/psiChemistryModel/psiChemistryModel.C
chemistryModel/psiChemistryModel/psiChemistryModels.C
chemistryModel/rhoChemistryModel/rhoChemistryModel.C
chemistryModel/rhoChemistryModel/rhoChemistryModels.C
chemistryModel/TDACChemistryModel/reduction/makeChemistryReductionMethods.C chemistryModel/TDACChemistryModel/reduction/makeChemistryReductionMethods.C
chemistryModel/TDACChemistryModel/tabulation/makeChemistryTabulationMethods.C chemistryModel/TDACChemistryModel/tabulation/makeChemistryTabulationMethods.C

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,46 +23,38 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "psiChemistryModel.H" #include "BasicChemistryModel.H"
#include "fvMesh.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(psiChemistryModel, 0);
defineRunTimeSelectionTable(psiChemistryModel, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::psiChemistryModel::psiChemistryModel template<class ReactionThermo>
Foam::BasicChemistryModel<ReactionThermo>::BasicChemistryModel
( (
const fvMesh& mesh, ReactionThermo& thermo
const word& phaseName
) )
: :
basicChemistryModel(mesh, phaseName), basicChemistryModel(thermo),
thermo_(psiReactionThermo::New(mesh, phaseName)) thermo_(thermo)
{} {}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New template<class ReactionThermo>
( Foam::autoPtr<Foam::BasicChemistryModel<ReactionThermo>>
const fvMesh& mesh, Foam::BasicChemistryModel<ReactionThermo>::New(ReactionThermo& thermo)
const word& phaseName
)
{ {
return basicChemistryModel::New<psiChemistryModel>(mesh, phaseName); return basicChemistryModel::New<BasicChemistryModel<ReactionThermo>>
(
thermo
);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::psiChemistryModel::~psiChemistryModel() template<class ReactionThermo>
Foam::BasicChemistryModel<ReactionThermo>::~BasicChemistryModel()
{} {}

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,25 +22,23 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::rhoChemistryModel Foam::BasicChemistryModel
Description Description
Chemistry model for density-based thermodynamics Basic chemistry model templated on thermodynamics
SourceFiles SourceFiles
rhoChemistryModelI.H BasicChemistryModelI.H
rhoChemistryModel.C BasicChemistryModel.C
newChemistryModel.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef rhoChemistryModel_H #ifndef BasicChemistryModel_H
#define rhoChemistryModel_H #define BasicChemistryModel_H
#include "basicChemistryModel.H" #include "basicChemistryModel.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,72 +49,67 @@ namespace Foam
class fvMesh; class fvMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
class rhoChemistryModel Declaration class BasicChemistryModel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class rhoChemistryModel template<class ReactionThermo>
class BasicChemistryModel
: :
public basicChemistryModel public basicChemistryModel
{ {
// Private Member Functions
//- Construct as copy (not implemented)
rhoChemistryModel(const rhoChemistryModel&);
//- Disallow default bitwise assignment
void operator=(const rhoChemistryModel&);
protected: protected:
// Protected data // Protected data
//- Thermo package //- Thermo
autoPtr<rhoReactionThermo> thermo_; ReactionThermo& thermo_;
public: public:
//- Runtime type information //- Runtime type information
TypeName("rho"); TypeName("BasicChemistryModel");
//- Thermo type
typedef ReactionThermo reactionThermo;
//- Declare run-time constructor selection tables //- Declare run-time constructor selection tables
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
rhoChemistryModel, BasicChemistryModel,
fvMesh, thermo,
(const fvMesh& mesh, const word& phaseName), (ReactionThermo& thermo),
(mesh, phaseName) (thermo)
); );
// Constructors // Constructors
//- Construct from mesh and phase name //- Construct from thermo
rhoChemistryModel(const fvMesh& mesh, const word& phaseName); BasicChemistryModel(ReactionThermo& thermo);
//- Selector //- Selector
static autoPtr<rhoChemistryModel> New static autoPtr<BasicChemistryModel<ReactionThermo>> New
( (
const fvMesh& mesh, ReactionThermo& thermo
const word& phaseName=word::null
); );
//- Destructor //- Destructor
virtual ~rhoChemistryModel(); virtual ~BasicChemistryModel();
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
inline rhoReactionThermo& thermo(); inline ReactionThermo& thermo();
//- Return const access to the thermo package //- Return const access to the thermo package
inline const rhoReactionThermo& thermo() const; inline const ReactionThermo& thermo() const;
}; };
@ -126,7 +119,11 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "rhoChemistryModelI.H" #ifdef NoRepository
#include "BasicChemistryModel.C"
#endif
#include "BasicChemistryModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,17 +23,22 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "BasicChemistryModel.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::psiReactionThermo& Foam::psiChemistryModel::thermo() template<class ReactionThermo>
inline ReactionThermo& Foam::BasicChemistryModel<ReactionThermo>::thermo()
{ {
return *thermo_; return thermo_;
} }
inline const Foam::psiReactionThermo& Foam::psiChemistryModel::thermo() const template<class ReactionThermo>
inline const ReactionThermo&
Foam::BasicChemistryModel<ReactionThermo>::thermo() const
{ {
return *thermo_; return thermo_;
} }

View File

@ -0,0 +1,339 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
InClass
Foam::psiChemistryModel
Description
Creates chemistry model instances templated on the type of thermodynamics
\*---------------------------------------------------------------------------*/
#include "makeChemistryModel.H"
#include "psiReactionThermo.H"
#include "rhoReactionThermo.H"
#include "StandardChemistryModel.H"
#include "TDACChemistryModel.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Make base types
makeChemistryModel(psiReactionThermo);
makeChemistryModel(rhoReactionThermo);
// Chemistry moldels based on sensibleEnthalpy
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
constGasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
gasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
constIncompressibleGasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
incompressibleGasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
icoPoly8HThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
constGasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
gasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
constIncompressibleGasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
incompressibleGasHThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
icoPoly8HThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
constGasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
gasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
constIncompressibleGasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
incompressibleGasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
icoPoly8HThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
constGasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
gasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
constIncompressibleGasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
incompressibleGasHThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
icoPoly8HThermoPhysics
);
// Chemistry moldels based on sensibleInternalEnergy
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
constGasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
gasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
constIncompressibleGasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
incompressibleGasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
psiReactionThermo,
icoPoly8EThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
constGasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
gasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
constIncompressibleGasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
incompressibleGasEThermoPhysics
);
makeChemistryModelType
(
StandardChemistryModel,
rhoReactionThermo,
icoPoly8EThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
constGasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
gasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
constIncompressibleGasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
incompressibleGasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
psiReactionThermo,
icoPoly8EThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
constGasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
gasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
constIncompressibleGasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
incompressibleGasEThermoPhysics
);
makeChemistryModelType
(
TDACChemistryModel,
rhoReactionThermo,
icoPoly8EThermoPhysics
);
}
// ************************************************************************* //

View File

@ -23,21 +23,20 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "chemistryModel.H" #include "StandardChemistryModel.H"
#include "reactingMixture.H" #include "reactingMixture.H"
#include "UniformField.H" #include "UniformField.H"
#include "extrapolatedCalculatedFvPatchFields.H" #include "extrapolatedCalculatedFvPatchFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::chemistryModel<CompType, ThermoType>::chemistryModel Foam::StandardChemistryModel<ReactionThermo, ThermoType>::StandardChemistryModel
( (
const fvMesh& mesh, ReactionThermo& thermo
const word& phaseName
) )
: :
CompType(mesh, phaseName), BasicChemistryModel<ReactionThermo>(thermo),
ODESystem(), ODESystem(),
Y_(this->thermo().composition().Y()), Y_(this->thermo().composition().Y()),
reactions_ reactions_
@ -52,7 +51,14 @@ Foam::chemistryModel<CompType, ThermoType>::chemistryModel
nSpecie_(Y_.size()), nSpecie_(Y_.size()),
nReaction_(reactions_.size()), nReaction_(reactions_.size()),
Treact_(CompType::template lookupOrDefault<scalar>("Treact", 0.0)), Treact_
(
BasicChemistryModel<ReactionThermo>::template lookupOrDefault<scalar>
(
"Treact",
0.0
)
),
RR_(nSpecie_), RR_(nSpecie_),
c_(nSpecie_), c_(nSpecie_),
dcdt_(nSpecie_) dcdt_(nSpecie_)
@ -68,33 +74,34 @@ Foam::chemistryModel<CompType, ThermoType>::chemistryModel
IOobject IOobject
( (
"RR." + Y_[fieldi].name(), "RR." + Y_[fieldi].name(),
mesh.time().timeName(), this->mesh().time().timeName(),
mesh, this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, this->mesh(),
dimensionedScalar(dimMass/dimVolume/dimTime, Zero) dimensionedScalar(dimMass/dimVolume/dimTime, Zero)
) )
); );
} }
Info<< "chemistryModel: Number of species = " << nSpecie_ Info<< "StandardChemistryModel: Number of species = " << nSpecie_
<< " and reactions = " << nReaction_ << endl; << " and reactions = " << nReaction_ << endl;
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::chemistryModel<CompType, ThermoType>::~chemistryModel() Foam::StandardChemistryModel<ReactionThermo, ThermoType>::
~StandardChemistryModel()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::chemistryModel<CompType, ThermoType>::omega void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::omega
( (
const scalarField& c, const scalarField& c,
const scalar T, const scalar T,
@ -133,8 +140,8 @@ void Foam::chemistryModel<CompType, ThermoType>::omega
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::omegaI Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::omegaI
( (
const label index, const label index,
const scalarField& c, const scalarField& c,
@ -154,8 +161,8 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::omegaI
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::omega Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::omega
( (
const Reaction<ThermoType>& R, const Reaction<ThermoType>& R,
const scalarField& c, const scalarField& c,
@ -266,8 +273,8 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::omega
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::chemistryModel<CompType, ThermoType>::derivatives void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::derivatives
( (
const scalar time, const scalar time,
const scalarField& c, const scalarField& c,
@ -316,8 +323,8 @@ void Foam::chemistryModel<CompType, ThermoType>::derivatives
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::chemistryModel<CompType, ThermoType>::jacobian void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::jacobian
( (
const scalar t, const scalar t,
const scalarField& c, const scalarField& c,
@ -458,9 +465,9 @@ void Foam::chemistryModel<CompType, ThermoType>::jacobian
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::chemistryModel<CompType, ThermoType>::tc() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::tc() const
{ {
tmp<volScalarField> ttc tmp<volScalarField> ttc
( (
@ -532,9 +539,9 @@ Foam::chemistryModel<CompType, ThermoType>::tc() const
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::chemistryModel<CompType, ThermoType>::Qdot() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Qdot() const
{ {
tmp<volScalarField> tQdot tmp<volScalarField> tQdot
( (
@ -572,9 +579,9 @@ Foam::chemistryModel<CompType, ThermoType>::Qdot() const
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::chemistryModel<CompType, ThermoType>::calculateRR Foam::StandardChemistryModel<ReactionThermo, ThermoType>::calculateRR
( (
const label ri, const label ri,
const label si const label si
@ -641,8 +648,8 @@ Foam::chemistryModel<CompType, ThermoType>::calculateRR
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::chemistryModel<CompType, ThermoType>::calculate() void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::calculate()
{ {
if (!this->chemistry_) if (!this->chemistry_)
{ {
@ -677,14 +684,14 @@ void Foam::chemistryModel<CompType, ThermoType>::calculate()
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
template<class DeltaTType> template<class DeltaTType>
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::solve
( (
const DeltaTType& deltaT const DeltaTType& deltaT
) )
{ {
CompType::correct(); BasicChemistryModel<ReactionThermo>::correct();
scalar deltaTMin = GREAT; scalar deltaTMin = GREAT;
@ -748,8 +755,8 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::solve
( (
const scalar deltaT const scalar deltaT
) )
@ -763,8 +770,8 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::solve
( (
const scalarField& deltaT const scalarField& deltaT
) )

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::chemistryModel Foam::StandardChemistryModel
Description Description
Extends base chemistry model by adding a thermo package, and ODE functions. Extends base chemistry model by adding a thermo package, and ODE functions.
@ -30,14 +30,15 @@ Description
terms. terms.
SourceFiles SourceFiles
chemistryModelI.H StandardChemistryModelI.H
chemistryModel.C StandardChemistryModel.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef chemistryModel_H #ifndef StandardChemistryModel_H
#define chemistryModel_H #define StandardChemistryModel_H
#include "BasicChemistryModel.H"
#include "Reaction.H" #include "Reaction.H"
#include "ODESystem.H" #include "ODESystem.H"
#include "volFields.H" #include "volFields.H"
@ -52,13 +53,13 @@ namespace Foam
class fvMesh; class fvMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class chemistryModel Declaration Class StandardChemistryModel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
class chemistryModel class StandardChemistryModel
: :
public CompType, public BasicChemistryModel<ReactionThermo>,
public ODESystem public ODESystem
{ {
// Private Member Functions // Private Member Functions
@ -69,16 +70,17 @@ class chemistryModel
scalar solve(const DeltaTType& deltaT); scalar solve(const DeltaTType& deltaT);
//- Disallow copy constructor //- Disallow copy constructor
chemistryModel(const chemistryModel&); StandardChemistryModel(const StandardChemistryModel&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const chemistryModel&); void operator=(const StandardChemistryModel&);
protected: protected:
typedef ThermoType thermoType; typedef ThermoType thermoType;
// Protected data // Protected data
//- Reference to the field of specie mass fractions //- Reference to the field of specie mass fractions
@ -119,17 +121,17 @@ protected:
public: public:
//- Runtime type information //- Runtime type information
TypeName("chemistryModel"); TypeName("standard");
// Constructors // Constructors
//- Construct from mesh //- Construct from thermo
chemistryModel(const fvMesh& mesh, const word& phaseName); StandardChemistryModel(ReactionThermo& thermo);
//- Destructor //- Destructor
virtual ~chemistryModel(); virtual ~StandardChemistryModel();
// Member Functions // Member Functions
@ -272,12 +274,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "chemistryModelI.H" #include "StandardChemistryModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "chemistryModel.C" #include "StandardChemistryModel.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,73 +28,74 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::label Foam::chemistryModel<CompType, ThermoType>::nEqns() const inline Foam::label
Foam::StandardChemistryModel<ReactionThermo, ThermoType>::nEqns() const
{ {
// nEqns = number of species + temperature + pressure // nEqns = number of species + temperature + pressure
return nSpecie_ + 2; return nSpecie_ + 2;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>&
Foam::chemistryModel<CompType, ThermoType>::RR() Foam::StandardChemistryModel<ReactionThermo, ThermoType>::RR()
{ {
return RR_; return RR_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline const Foam::PtrList<Foam::Reaction<ThermoType>>& inline const Foam::PtrList<Foam::Reaction<ThermoType>>&
Foam::chemistryModel<CompType, ThermoType>::reactions() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::reactions() const
{ {
return reactions_; return reactions_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline const Foam::PtrList<ThermoType>& inline const Foam::PtrList<ThermoType>&
Foam::chemistryModel<CompType, ThermoType>::specieThermo() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::specieThermo() const
{ {
return specieThermo_; return specieThermo_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::label inline Foam::label
Foam::chemistryModel<CompType, ThermoType>::nSpecie() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::nSpecie() const
{ {
return nSpecie_; return nSpecie_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::label inline Foam::label
Foam::chemistryModel<CompType, ThermoType>::nReaction() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::nReaction() const
{ {
return nReaction_; return nReaction_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::scalar inline Foam::scalar
Foam::chemistryModel<CompType, ThermoType>::Treact() const Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Treact() const
{ {
return Treact_; return Treact_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::scalar& inline Foam::scalar&
Foam::chemistryModel<CompType, ThermoType>::Treact() Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Treact()
{ {
return Treact_; return Treact_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>& inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::chemistryModel<CompType, ThermoType>::RR Foam::StandardChemistryModel<ReactionThermo, ThermoType>::RR
( (
const label i const label i
) const ) const
@ -102,9 +103,9 @@ Foam::chemistryModel<CompType, ThermoType>::RR
return RR_[i]; return RR_[i];
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::chemistryModel<CompType, ThermoType>::RR Foam::StandardChemistryModel<ReactionThermo, ThermoType>::RR
( (
const label i const label i
) )

View File

@ -30,18 +30,21 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel Foam::TDACChemistryModel<ReactionThermo, ThermoType>::TDACChemistryModel
( (
const fvMesh& mesh, ReactionThermo& thermo
const word& phaseName
) )
: :
chemistryModel<CompType, ThermoType>(mesh, phaseName), StandardChemistryModel<ReactionThermo, ThermoType>(thermo),
variableTimeStep_ variableTimeStep_
( (
mesh.time().controlDict().lookupOrDefault("adjustTimeStep", false) this->mesh().time().controlDict().lookupOrDefault
|| fv::localEulerDdt::enabled(mesh) (
"adjustTimeStep",
false
)
|| fv::localEulerDdt::enabled(this->mesh())
), ),
timeSteps_(0), timeSteps_(0),
NsDAC_(this->nSpecie_), NsDAC_(this->nSpecie_),
@ -54,13 +57,13 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
( (
IOobject IOobject
( (
IOobject::groupName("TabulationResults", phaseName), thermo.phasePropertyName("TabulationResults"),
this->time().timeName(), this->time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, this->mesh(),
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
) )
{ {
@ -78,7 +81,7 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
specieComp_[i] = specComp[this->Y()[i].member()]; specieComp_[i] = specComp[this->Y()[i].member()];
} }
mechRed_ = chemistryReductionMethod<CompType, ThermoType>::New mechRed_ = chemistryReductionMethod<ReactionThermo, ThermoType>::New
( (
*this, *this,
*this *this
@ -93,8 +96,8 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
IOobject header IOobject header
( (
this->Y()[i].name(), this->Y()[i].name(),
mesh.time().timeName(), this->mesh().time().timeName(),
mesh, this->mesh(),
IOobject::NO_READ IOobject::NO_READ
); );
@ -108,7 +111,7 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
} }
} }
tabulation_ = chemistryTabulationMethod<CompType, ThermoType>::New tabulation_ = chemistryTabulationMethod<ReactionThermo, ThermoType>::New
( (
*this, *this,
*this *this
@ -136,15 +139,15 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::TDACChemistryModel<CompType, ThermoType>::~TDACChemistryModel() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::~TDACChemistryModel()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::omega void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::omega
( (
const scalarField& c, // Contains all species even when mechRed is active const scalarField& c, // Contains all species even when mechRed is active
const scalar T, const scalar T,
@ -197,8 +200,8 @@ void Foam::TDACChemistryModel<CompType, ThermoType>::omega
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::omega Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::omega
( (
const Reaction<ThermoType>& R, const Reaction<ThermoType>& R,
const scalarField& c, // Contains all species even when mechRed is active const scalarField& c, // Contains all species even when mechRed is active
@ -306,8 +309,8 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::omega
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::derivatives void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::derivatives
( (
const scalar time, const scalar time,
const scalarField& c, const scalarField& c,
@ -390,8 +393,8 @@ void Foam::TDACChemistryModel<CompType, ThermoType>::derivatives
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::jacobian void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::jacobian
( (
const scalar t, const scalar t,
const scalarField& c, const scalarField& c,
@ -575,8 +578,8 @@ void Foam::TDACChemistryModel<CompType, ThermoType>::jacobian
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::jacobian void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::jacobian
( (
const scalar t, const scalar t,
const scalarField& c, const scalarField& c,
@ -594,9 +597,9 @@ void Foam::TDACChemistryModel<CompType, ThermoType>::jacobian
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
template<class DeltaTType> template<class DeltaTType>
Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
( (
const DeltaTType& deltaT const DeltaTType& deltaT
) )
@ -625,7 +628,7 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
scalar nActiveSpecies = 0; scalar nActiveSpecies = 0;
scalar nAvg = 0; scalar nAvg = 0;
CompType::correct(); BasicChemistryModel<ReactionThermo>::correct();
scalar deltaTMin = GREAT; scalar deltaTMin = GREAT;
@ -880,8 +883,8 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
( (
const scalar deltaT const scalar deltaT
) )
@ -895,8 +898,8 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
( (
const scalarField& deltaT const scalarField& deltaT
) )
@ -905,8 +908,9 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::setTabulationResultsAdd void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
setTabulationResultsAdd
( (
const label celli const label celli
) )
@ -915,18 +919,16 @@ void Foam::TDACChemistryModel<CompType, ThermoType>::setTabulationResultsAdd
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::setTabulationResultsGrow void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
( setTabulationResultsGrow(const label celli)
const label celli
)
{ {
tabulationResults_[celli] = 1.0; tabulationResults_[celli] = 1.0;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>:: void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
setTabulationResultsRetrieve setTabulationResultsRetrieve
( (
const label celli const label celli

View File

@ -25,7 +25,7 @@ Class
Foam::TDACChemistryModel Foam::TDACChemistryModel
Description Description
Extends chemistryModel by adding the TDAC method. Extends StandardChemistryModel by adding the TDAC method.
References: References:
\verbatim \verbatim
@ -64,7 +64,7 @@ SourceFiles
#ifndef TDACChemistryModel_H #ifndef TDACChemistryModel_H
#define TDACChemistryModel_H #define TDACChemistryModel_H
#include "chemistryModel.H" #include "StandardChemistryModel.H"
#include "chemistryReductionMethod.H" #include "chemistryReductionMethod.H"
#include "chemistryTabulationMethod.H" #include "chemistryTabulationMethod.H"
#include "OFstream.H" #include "OFstream.H"
@ -78,10 +78,10 @@ namespace Foam
Class TDACChemistryModel Declaration Class TDACChemistryModel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
class TDACChemistryModel class TDACChemistryModel
: :
public chemistryModel<CompType, ThermoType> public StandardChemistryModel<ReactionThermo, ThermoType>
{ {
// Private member data // Private member data
@ -97,10 +97,12 @@ class TDACChemistryModel
List<List<specieElement>> specieComp_; List<List<specieElement>> specieComp_;
Field<label> completeToSimplifiedIndex_; Field<label> completeToSimplifiedIndex_;
DynamicList<label> simplifiedToCompleteIndex_; DynamicList<label> simplifiedToCompleteIndex_;
autoPtr<chemistryReductionMethod<CompType, ThermoType>> mechRed_; autoPtr<chemistryReductionMethod<ReactionThermo, ThermoType>>
mechRed_;
// Tabulation // Tabulation
autoPtr<chemistryTabulationMethod<CompType, ThermoType>> tabulation_; autoPtr<chemistryTabulationMethod<ReactionThermo, ThermoType>>
tabulation_;
// Log file for the average time spent reducing the chemistry // Log file for the average time spent reducing the chemistry
autoPtr<OFstream> cpuReduceFile_; autoPtr<OFstream> cpuReduceFile_;
@ -145,17 +147,13 @@ class TDACChemistryModel
public: public:
//- Runtime type information //- Runtime type information
TypeName("TDACChemistryModel"); TypeName("TDAC");
// Constructors // Constructors
//- Construct from mesh //- Construct from thermo
TDACChemistryModel TDACChemistryModel(ReactionThermo& thermo);
(
const fvMesh& mesh,
const word& phaseName
);
//- Destructor //- Destructor
@ -202,7 +200,7 @@ public:
// Chemistry model functions (overriding functions in // Chemistry model functions (overriding functions in
// chemistryModel to use the private solve function) // StandardChemistryModel to use the private solve function)
//- Solve the reaction system for the given time step //- Solve the reaction system for the given time step
// and return the characteristic time // and return the characteristic time
@ -213,8 +211,8 @@ public:
virtual scalar solve(const scalarField& deltaT); virtual scalar solve(const scalarField& deltaT);
// ODE functions (overriding functions in chemistryModel to take into // ODE functions (overriding functions in StandardChemistryModel to take
// account the variable number of species) // into account the variable number of species)
virtual void derivatives virtual void derivatives
( (
@ -273,7 +271,8 @@ public:
inline List<List<specieElement>>& specieComp(); inline List<List<specieElement>>& specieComp();
inline autoPtr<chemistryReductionMethod<CompType, ThermoType>>& inline
autoPtr<chemistryReductionMethod<ReactionThermo, ThermoType>>&
mechRed(); mechRed();
tmp<volScalarField> tabulationResults() const tmp<volScalarField> tabulationResults() const

View File

@ -25,25 +25,26 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline bool inline bool
Foam::TDACChemistryModel<CompType, ThermoType>::variableTimeStep() const Foam::TDACChemistryModel<ReactionThermo, ThermoType>::variableTimeStep() const
{ {
return variableTimeStep_; return variableTimeStep_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::label inline Foam::label
Foam::TDACChemistryModel<CompType, ThermoType>::timeSteps() const Foam::TDACChemistryModel<ReactionThermo, ThermoType>::timeSteps() const
{ {
return timeSteps_; return timeSteps_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::autoPtr<Foam::OFstream> inline Foam::autoPtr<Foam::OFstream>
Foam::TDACChemistryModel<CompType, ThermoType>::logFile(const word& name) const Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
logFile(const word& name) const
{ {
mkDir(this->mesh().time().path()/"TDAC"/this->group()); mkDir(this->mesh().time().path()/"TDAC"/this->group());
return autoPtr<OFstream> return autoPtr<OFstream>
@ -56,24 +57,25 @@ Foam::TDACChemistryModel<CompType, ThermoType>::logFile(const word& name) const
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::PtrList<Foam::volScalarField>& inline Foam::PtrList<Foam::volScalarField>&
Foam::TDACChemistryModel<CompType, ThermoType>::Y() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::Y()
{ {
return this->Y_; return this->Y_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::autoPtr<Foam::chemistryReductionMethod<CompType, ThermoType>>& inline
Foam::TDACChemistryModel<CompType, ThermoType>::mechRed() Foam::autoPtr<Foam::chemistryReductionMethod<ReactionThermo, ThermoType>>&
Foam::TDACChemistryModel<ReactionThermo, ThermoType>::mechRed()
{ {
return mechRed_; return mechRed_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline void Foam::TDACChemistryModel<CompType, ThermoType>::setActive inline void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::setActive
( (
const label i const label i
) )
@ -82,8 +84,8 @@ inline void Foam::TDACChemistryModel<CompType, ThermoType>::setActive
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline bool Foam::TDACChemistryModel<CompType, ThermoType>::active inline bool Foam::TDACChemistryModel<ReactionThermo, ThermoType>::active
( (
const label i const label i
) const ) const
@ -92,81 +94,84 @@ inline bool Foam::TDACChemistryModel<CompType, ThermoType>::active
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline void inline void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
Foam::TDACChemistryModel<CompType, ThermoType>::setNsDAC(const label newNsDAC) setNsDAC(const label newNsDAC)
{ {
NsDAC_ = newNsDAC; NsDAC_ = newNsDAC;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline void inline void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
Foam::TDACChemistryModel<CompType, ThermoType>::setNSpecie(const label newNs) setNSpecie(const label newNs)
{ {
this->nSpecie_ = newNs; this->nSpecie_ = newNs;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::DynamicList<Foam::label>& inline Foam::DynamicList<Foam::label>&
Foam::TDACChemistryModel<CompType, ThermoType>::simplifiedToCompleteIndex() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
simplifiedToCompleteIndex()
{ {
return simplifiedToCompleteIndex_; return simplifiedToCompleteIndex_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::Field<Foam::label>& inline Foam::Field<Foam::label>&
Foam::TDACChemistryModel<CompType, ThermoType>::completeToSimplifiedIndex() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
completeToSimplifiedIndex()
{ {
return completeToSimplifiedIndex_; return completeToSimplifiedIndex_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline const Foam::Field<Foam::label>& inline const Foam::Field<Foam::label>&
Foam::TDACChemistryModel<CompType, ThermoType>:: Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
completeToSimplifiedIndex() const completeToSimplifiedIndex() const
{ {
return completeToSimplifiedIndex_; return completeToSimplifiedIndex_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::Field<bool>& inline Foam::Field<bool>&
Foam::TDACChemistryModel<CompType, ThermoType>::reactionsDisabled() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::reactionsDisabled()
{ {
return reactionsDisabled_; return reactionsDisabled_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::scalarField& inline Foam::scalarField&
Foam::TDACChemistryModel<CompType, ThermoType>::completeC() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::completeC()
{ {
return completeC_; return completeC_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::scalarField& inline Foam::scalarField&
Foam::TDACChemistryModel<CompType, ThermoType>::simplifiedC() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::simplifiedC()
{ {
return simplifiedC_; return simplifiedC_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
inline Foam::List<Foam::List<Foam::specieElement>>& inline Foam::List<Foam::List<Foam::specieElement>>&
Foam::TDACChemistryModel<CompType, ThermoType>::specieComp() Foam::TDACChemistryModel<ReactionThermo, ThermoType>::specieComp()
{ {
return specieComp_; return specieComp_;
} }
template<class CompType, class ThermoType> template<class ReactionThermo, class ThermoType>
void Foam::TDACChemistryModel<CompType, ThermoType>::resetTabulationResults() void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::
resetTabulationResults()
{ {
for (auto& res : tabulationResults_) for (auto& res : tabulationResults_)
{ {

View File

@ -36,55 +36,75 @@ Foam::chemistryReductionMethod<CompType, ThermoType>::New
TDACChemistryModel<CompType, ThermoType>& chemistry TDACChemistryModel<CompType, ThermoType>& chemistry
) )
{ {
IOdictionary thermoDict const dictionary& reductionDict(dict.subDict("reduction"));
(
IOobject
(
IOobject::groupName("thermophysicalProperties",dict.group()),
dict.db().time().constant(),
dict.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
word thermoTypeName; const word methodName(reductionDict.lookup("method"));
if (thermoDict.isDict("thermoType")) Info<< "Selecting chemistry reduction method " << methodName << endl;
{
const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
thermoTypeName =
word(thermoTypeDict.lookup("transport")) + '<'
+ word(thermoTypeDict.lookup("thermo")) + '<'
+ word(thermoTypeDict.lookup("equationOfState")) + '<'
+ word(thermoTypeDict.lookup("specie")) + ">>,"
+ word(thermoTypeDict.lookup("energy")) + ">";
}
else
{
FatalIOErrorInFunction(thermoDict)
<< "thermoType is in the old format and must be upgraded"
<< exit(FatalIOError);
}
dictionary MRdict(dict.subDict("reduction")); const word methodTypeName =
methodName
+ '<' + CompType::typeName + ',' + ThermoType::typeName() + '>';
word methodName = auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodTypeName);
word(MRdict.lookup("method")) + '<'
+ word(dict.subDict("chemistryType").lookup("chemistryThermo")) + ','
+ thermoTypeName + '>';
auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodName);
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unknown chemistryReductionMethod type " << "Unknown " << typeName_() << " type " << methodName << endl
<< methodName << nl << nl << endl;
<< "Valid chemistryReductionMethod types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc() const wordList names(dictionaryConstructorTablePtr_->toc());
<< exit(FatalError);
wordList thisCmpts;
thisCmpts.append(word::null);
thisCmpts.append(CompType::typeName);
thisCmpts.append
(
basicThermo::splitThermoName(ThermoType::typeName(), 5)
);
wordList validNames;
forAll(names, i)
{
const wordList cmpts(basicThermo::splitThermoName(names[i], 7));
bool isValid = true;
for (label i = 1; i < cmpts.size() && isValid; ++ i)
{
isValid = isValid && cmpts[i] == thisCmpts[i];
}
if (isValid)
{
validNames.append(cmpts[0]);
}
}
FatalErrorInFunction
<< "Valid " << typeName_() << " types for this thermodynamic model "
<< "are:" << endl << validNames << endl;
List<wordList> validCmpts;
validCmpts.append(wordList(7, word::null));
validCmpts[0][0] = typeName_();
validCmpts[0][1] = "reactionThermo";
validCmpts[0][2] = "transport";
validCmpts[0][3] = "thermo";
validCmpts[0][4] = "equationOfState";
validCmpts[0][5] = "specie";
validCmpts[0][6] = "energy";
forAll(names, i)
{
validCmpts.append(basicThermo::splitThermoName(names[i], 7));
}
FatalErrorInFunction
<< "All " << validCmpts[0][0] << '/' << validCmpts[0][1]
<< "/thermoPhysics combinations are:" << endl << endl;
printTable(validCmpts, FatalErrorInFunction);
FatalErrorInFunction << exit(FatalError);
} }
return autoPtr<chemistryReductionMethod<CompType, ThermoType>> return autoPtr<chemistryReductionMethod<CompType, ThermoType>>

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,71 +27,71 @@ License
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiChemistryModel.H" #include "psiReactionThermo.H"
#include "rhoChemistryModel.H" #include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Chemistry solvers based on sensibleEnthalpy // Chemistry solvers based on sensibleEnthalpy
makeChemistryReductionMethods(psiChemistryModel, constGasHThermoPhysics); makeChemistryReductionMethods(psiReactionThermo, constGasHThermoPhysics);
makeChemistryReductionMethods(psiChemistryModel, gasHThermoPhysics); makeChemistryReductionMethods(psiReactionThermo, gasHThermoPhysics);
makeChemistryReductionMethods makeChemistryReductionMethods
( (
psiChemistryModel, psiReactionThermo,
constIncompressibleGasHThermoPhysics constIncompressibleGasHThermoPhysics
); );
makeChemistryReductionMethods makeChemistryReductionMethods
( (
psiChemistryModel, psiReactionThermo,
incompressibleGasHThermoPhysics incompressibleGasHThermoPhysics
); );
makeChemistryReductionMethods(psiChemistryModel, icoPoly8HThermoPhysics); makeChemistryReductionMethods(psiReactionThermo, icoPoly8HThermoPhysics);
makeChemistryReductionMethods(rhoChemistryModel, constGasHThermoPhysics); makeChemistryReductionMethods(rhoReactionThermo, constGasHThermoPhysics);
makeChemistryReductionMethods(rhoChemistryModel, gasHThermoPhysics); makeChemistryReductionMethods(rhoReactionThermo, gasHThermoPhysics);
makeChemistryReductionMethods makeChemistryReductionMethods
( (
rhoChemistryModel, rhoReactionThermo,
constIncompressibleGasHThermoPhysics constIncompressibleGasHThermoPhysics
); );
makeChemistryReductionMethods makeChemistryReductionMethods
( (
rhoChemistryModel, rhoReactionThermo,
incompressibleGasHThermoPhysics incompressibleGasHThermoPhysics
); );
makeChemistryReductionMethods(rhoChemistryModel, icoPoly8HThermoPhysics); makeChemistryReductionMethods(rhoReactionThermo, icoPoly8HThermoPhysics);
// Chemistry solvers based on sensibleInternalEnergy // Chemistry solvers based on sensibleInternalEnergy
makeChemistryReductionMethods(psiChemistryModel, constGasEThermoPhysics); makeChemistryReductionMethods(psiReactionThermo, constGasEThermoPhysics);
makeChemistryReductionMethods(psiChemistryModel, gasEThermoPhysics); makeChemistryReductionMethods(psiReactionThermo, gasEThermoPhysics);
makeChemistryReductionMethods makeChemistryReductionMethods
( (
psiChemistryModel, psiReactionThermo,
constIncompressibleGasEThermoPhysics constIncompressibleGasEThermoPhysics
); );
makeChemistryReductionMethods makeChemistryReductionMethods
( (
psiChemistryModel, psiReactionThermo,
incompressibleGasEThermoPhysics incompressibleGasEThermoPhysics
); );
makeChemistryReductionMethods(psiChemistryModel, icoPoly8EThermoPhysics); makeChemistryReductionMethods(psiReactionThermo, icoPoly8EThermoPhysics);
makeChemistryReductionMethods(rhoChemistryModel, constGasEThermoPhysics); makeChemistryReductionMethods(rhoReactionThermo, constGasEThermoPhysics);
makeChemistryReductionMethods(rhoChemistryModel, gasEThermoPhysics); makeChemistryReductionMethods(rhoReactionThermo, gasEThermoPhysics);
makeChemistryReductionMethods makeChemistryReductionMethods
( (
rhoChemistryModel, rhoReactionThermo,
constIncompressibleGasEThermoPhysics constIncompressibleGasEThermoPhysics
); );
makeChemistryReductionMethods makeChemistryReductionMethods
( (
rhoChemistryModel, rhoReactionThermo,
incompressibleGasEThermoPhysics incompressibleGasEThermoPhysics
); );
makeChemistryReductionMethods(rhoChemistryModel, icoPoly8EThermoPhysics); makeChemistryReductionMethods(rhoReactionThermo, icoPoly8EThermoPhysics);
} }

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,7 +62,9 @@ License
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
chemistryReductionMethod##CompChemModel##Thermo, \ chemistryReductionMethod##CompChemModel##Thermo, \
"chemistryReductionMethod<"#CompChemModel","#Thermo">", \ (word(chemistryReductionMethod##CompChemModel##Thermo::typeName_()) + \
'<' + word(CompChemModel::typeName_()) + "," + Thermo::typeName() + '>'\
).c_str(), \
0 \ 0 \
); \ ); \
\ \

View File

@ -36,61 +36,81 @@ Foam::chemistryTabulationMethod<CompType, ThermoType>::New
TDACChemistryModel<CompType, ThermoType>& chemistry TDACChemistryModel<CompType, ThermoType>& chemistry
) )
{ {
IOdictionary thermoDict const dictionary& tabulationDict(dict.subDict("tabulation"));
(
IOobject
(
IOobject::groupName("thermophysicalProperties",dict.group()),
dict.db().time().constant(),
dict.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
word thermoTypeName; const word methodName(tabulationDict.lookup("method"));
if (thermoDict.isDict("thermoType")) Info<< "Selecting chemistry tabulation method " << methodName << endl;
{ const word methodTypeName =
const dictionary& thermoTypeDict(thermoDict.subDict("thermoType")); methodName + '<' + CompType::typeName + ',' + ThermoType::typeName()
thermoTypeName = + '>';
word(thermoTypeDict.lookup("transport")) + '<'
+ word(thermoTypeDict.lookup("thermo")) + '<'
+ word(thermoTypeDict.lookup("equationOfState")) + '<'
+ word(thermoTypeDict.lookup("specie")) + ">>,"
+ word(thermoTypeDict.lookup("energy")) + ">";
}
else
{
FatalIOErrorInFunction(thermoDict)
<< "thermoType is in the old format and must be upgraded"
<< exit(FatalIOError);
}
dictionary tabdict(dict.subDict("tabulation")); auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodTypeName);
const word methodName =
word(tabdict.lookup("method")) + '<'
+ word(dict.subDict("chemistryType").lookup("chemistryThermo")) + ','
+ thermoTypeName + '>';
auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodName);
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unknown chemistryTabulationMethodType type " << "Unknown " << typeName_() << " type " << methodName << endl
<< methodName << nl << nl << endl;
<< "Valid chemistryTabulationMethodType types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc() const wordList names(dictionaryConstructorTablePtr_->toc());
<< exit(FatalError);
wordList thisCmpts;
thisCmpts.append(word::null);
thisCmpts.append(CompType::typeName);
thisCmpts.append
(
basicThermo::splitThermoName(ThermoType::typeName(), 5)
);
wordList validNames;
forAll(names, i)
{
const wordList cmpts(basicThermo::splitThermoName(names[i], 7));
bool isValid = true;
for (label i = 1; i < cmpts.size() && isValid; ++ i)
{
isValid = isValid && cmpts[i] == thisCmpts[i];
}
if (isValid)
{
validNames.append(cmpts[0]);
}
}
FatalErrorInFunction
<< "Valid " << typeName_() << " types for this thermodynamic model "
<< "are:" << endl << validNames << endl;
List<wordList> validCmpts;
validCmpts.append(wordList(7, word::null));
validCmpts[0][0] = typeName_();
validCmpts[0][1] = "reactionThermo";
validCmpts[0][2] = "transport";
validCmpts[0][3] = "thermo";
validCmpts[0][4] = "equationOfState";
validCmpts[0][5] = "specie";
validCmpts[0][6] = "energy";
forAll(names, i)
{
validCmpts.append(basicThermo::splitThermoName(names[i], 7));
}
FatalErrorInFunction
<< "All " << validCmpts[0][0] << '/' << validCmpts[0][1]
<< "/thermoPhysics combinations are:" << endl << endl;
printTable(validCmpts, FatalErrorInFunction);
FatalErrorInFunction << exit(FatalError);
} }
return autoPtr<chemistryTabulationMethod<CompType, ThermoType>> return autoPtr<chemistryTabulationMethod<CompType, ThermoType>>
( (
cstrIter()(dict, chemistry) cstrIter()(dict, chemistry)
); );
} }

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,74 +27,74 @@ License
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiChemistryModel.H" #include "psiReactionThermo.H"
#include "rhoChemistryModel.H" #include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Chemistry solvers based on sensibleEnthalpy // Chemistry solvers based on sensibleEnthalpy
makeChemistryTabulationMethods(psiChemistryModel, constGasHThermoPhysics); makeChemistryTabulationMethods(psiReactionThermo, constGasHThermoPhysics);
makeChemistryTabulationMethods(psiChemistryModel, gasHThermoPhysics); makeChemistryTabulationMethods(psiReactionThermo, gasHThermoPhysics);
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
psiChemistryModel, psiReactionThermo,
constIncompressibleGasHThermoPhysics constIncompressibleGasHThermoPhysics
); );
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
psiChemistryModel, psiReactionThermo,
incompressibleGasHThermoPhysics incompressibleGasHThermoPhysics
); );
makeChemistryTabulationMethods(psiChemistryModel, icoPoly8HThermoPhysics); makeChemistryTabulationMethods(psiReactionThermo, icoPoly8HThermoPhysics);
makeChemistryTabulationMethods(rhoChemistryModel, constGasHThermoPhysics); makeChemistryTabulationMethods(rhoReactionThermo, constGasHThermoPhysics);
makeChemistryTabulationMethods(rhoChemistryModel, gasHThermoPhysics); makeChemistryTabulationMethods(rhoReactionThermo, gasHThermoPhysics);
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
rhoChemistryModel, rhoReactionThermo,
constIncompressibleGasHThermoPhysics constIncompressibleGasHThermoPhysics
); );
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
rhoChemistryModel, rhoReactionThermo,
incompressibleGasHThermoPhysics incompressibleGasHThermoPhysics
); );
makeChemistryTabulationMethods(rhoChemistryModel, icoPoly8HThermoPhysics); makeChemistryTabulationMethods(rhoReactionThermo, icoPoly8HThermoPhysics);
// Chemistry solvers based on sensibleInternalEnergy // Chemistry solvers based on sensibleInternalEnergy
makeChemistryTabulationMethods(psiChemistryModel, constGasEThermoPhysics); makeChemistryTabulationMethods(psiReactionThermo, constGasEThermoPhysics);
makeChemistryTabulationMethods(psiChemistryModel, gasEThermoPhysics); makeChemistryTabulationMethods(psiReactionThermo, gasEThermoPhysics);
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
psiChemistryModel, psiReactionThermo,
constIncompressibleGasEThermoPhysics constIncompressibleGasEThermoPhysics
); );
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
psiChemistryModel, psiReactionThermo,
incompressibleGasEThermoPhysics incompressibleGasEThermoPhysics
); );
makeChemistryTabulationMethods(psiChemistryModel, icoPoly8EThermoPhysics); makeChemistryTabulationMethods(psiReactionThermo, icoPoly8EThermoPhysics);
makeChemistryTabulationMethods(rhoChemistryModel, constGasEThermoPhysics); makeChemistryTabulationMethods(rhoReactionThermo, constGasEThermoPhysics);
makeChemistryTabulationMethods(rhoChemistryModel, gasEThermoPhysics); makeChemistryTabulationMethods(rhoReactionThermo, gasEThermoPhysics);
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
rhoChemistryModel, rhoReactionThermo,
constIncompressibleGasEThermoPhysics constIncompressibleGasEThermoPhysics
); );
makeChemistryTabulationMethods makeChemistryTabulationMethods
( (
rhoChemistryModel, rhoReactionThermo,
incompressibleGasEThermoPhysics incompressibleGasEThermoPhysics
); );
makeChemistryTabulationMethods(rhoChemistryModel, icoPoly8EThermoPhysics); makeChemistryTabulationMethods(rhoReactionThermo, icoPoly8EThermoPhysics);
} }

View File

@ -57,7 +57,9 @@ License
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
chemistryTabulationMethod##CompChemModel##Thermo, \ chemistryTabulationMethod##CompChemModel##Thermo, \
"chemistryTabulationMethod<"#CompChemModel","#Thermo">", \ (word(chemistryTabulationMethod##CompChemModel##Thermo::typeName_()) + \
'<' + word(CompChemModel::typeName_()) + "," + Thermo::typeName() + '>'\
).c_str(), \
0 \ 0 \
); \ ); \
\ \

Some files were not shown because too many files have changed in this diff Show More