Commit 22aae281 authored by Will Bainbridge's avatar Will Bainbridge Committed by Andrew Heather
Browse files

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.
parent 255ec736
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -37,7 +37,8 @@ Description
#include "fvCFD.H"
#include "psiReactionThermo.H"
#include "psiChemistryModel.H"
#include "BasicChemistryModel.H"
#include "reactingMixture.H"
#include "chemistrySolver.H"
#include "OFstream.H"
#include "thermoPhysicsTypes.H"
......
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();
PtrList<volScalarField>& Y = composition.Y();
volScalarField& p = thermo.p();
......@@ -23,14 +23,16 @@
#include "createBaseFields.H"
Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<psiChemistryModel> pChemistry(psiChemistryModel::New(mesh));
psiChemistryModel& chemistry = pChemistry();
psiReactionThermo& thermo = chemistry.thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h");
autoPtr<BasicChemistryModel<psiReactionThermo>> pChemistry
(
BasicChemistryModel<psiReactionThermo>::New(thermo)
);
volScalarField rho
(
IOobject
......
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiCombustionModel> combustion
(
combustionModels::psiCombustionModel::New
(
mesh
)
);
Info<< "Reading thermophysical properties\n" << endl;
psiReactionThermo& thermo = combustion->thermo();
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo);
......@@ -74,8 +64,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the combustion model
combustion->setTurbulence(turbulence());
Info<< "Creating combustion model\n" << endl;
autoPtr<CombustionModel<psiReactionThermo>> combustion
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
#include "readGravitationalAcceleration.H"
......
......@@ -41,7 +41,8 @@ Description
#include "radiationModel.H"
#include "SLGThermo.H"
#include "solidChemistryModel.H"
#include "psiCombustionModel.H"
#include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
......
#include "createRDeltaT.H"
Info<< "Creating reaction model\n" << endl;
autoPtr<combustionModels::psiCombustionModel> reaction
(
combustionModels::psiCombustionModel::New(mesh)
);
psiReactionThermo& thermo = reaction->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
......@@ -18,8 +13,7 @@ if (!composition.species().found(inertSpecie))
{
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
<< composition.species() << exit(FatalIOError);
}
volScalarField rho
......@@ -47,7 +41,6 @@ volVectorField U
mesh
);
volScalarField& p = thermo.p();
#include "compressibleCreatePhi.H"
......@@ -68,8 +61,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the reaction model
reaction->setTurbulence(turbulence());
Info<< "Creating reaction model\n" << endl;
autoPtr<CombustionModel<psiReactionThermo>> reaction
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
......
......@@ -34,7 +34,8 @@ Description
#include "fvCFD.H"
#include "turbulentFluidThermoModel.H"
#include "psiCombustionModel.H"
#include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "multivariateScheme.H"
#include "pimpleControl.H"
#include "pressureControl.H"
......
#include "createRDeltaT.H"
Info<< "Creating reaction model\n" << endl;
autoPtr<combustionModels::rhoCombustionModel> reaction
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = reaction->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
rhoReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
......@@ -67,9 +62,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the reaction model
reaction->setTurbulence(turbulence());
Info<< "Creating reaction model\n" << endl;
autoPtr<CombustionModel<rhoReactionThermo>> reaction
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
......
......@@ -34,7 +34,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "rhoCombustionModel.H"
#include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "turbulentFluidThermoModel.H"
#include "multivariateScheme.H"
#include "pimpleControl.H"
......
#include "createRDeltaT.H"
Info<< "Creating reaction model\n" << endl;
autoPtr<combustionModels::rhoCombustionModel> reaction
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = reaction->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
rhoReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
......@@ -69,8 +64,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the reaction model
reaction->setTurbulence(turbulence());
Info<< "Creating reaction model\n" << endl;
autoPtr<CombustionModel<rhoReactionThermo>> reaction
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
......
......@@ -34,7 +34,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "rhoCombustionModel.H"
#include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "turbulentFluidThermoModel.H"
#include "multivariateScheme.H"
#include "pimpleControl.H"
......
......@@ -37,7 +37,8 @@ Description
#include "turbulentFluidThermoModel.H"
#include "basicThermoCloud.H"
#include "coalCloud.H"
#include "psiCombustionModel.H"
#include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "fvOptions.H"
#include "radiationModel.H"
#include "SLGThermo.H"
......
......@@ -2,14 +2,9 @@
#include "readGravitationalAcceleration.H"
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiCombustionModel> combustion
(
combustionModels::psiCombustionModel::New(mesh)
);
psiReactionThermo& thermo = combustion->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo);
......@@ -112,8 +107,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the combustion model
combustion->setTurbulence(turbulence());
Info<< "Creating combustion model\n" << endl;
autoPtr<CombustionModel<psiReactionThermo>> combustion
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
volScalarField Qdot
(
......
#include "createRDeltaT.H"
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::rhoCombustionModel> combustion
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = combustion->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
rhoReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo);
......@@ -68,8 +63,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the combustion model
combustion->setTurbulence(turbulence());
Info<< "Creating combustion model\n" << endl;
autoPtr<CombustionModel<rhoReactionThermo>> combustion
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
......
......@@ -37,7 +37,8 @@ Description
#include "turbulentFluidThermoModel.H"
#include "basicReactingMultiphaseCloud.H"
#include "surfaceFilmModel.H"
#include "rhoCombustionModel.H"
#include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H"
#include "SLGThermo.H"
#include "fvOptions.H"
......
#include "readGravitationalAcceleration.H"
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::rhoCombustionModel> combustion
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = combustion->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
rhoReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo);
......@@ -91,8 +86,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the combustion model
combustion->setTurbulence(turbulence());
Info<< "Creating combustion model\n" << endl;
autoPtr<CombustionModel<rhoReactionThermo>> combustion
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
Info<< "Creating multi-variate interpolation scheme\n" << endl;
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
......
......@@ -33,7 +33,8 @@ Description
#include "fvCFD.H"
#include "turbulentFluidThermoModel.H"
#include "basicReactingMultiphaseCloud.H"
#include "rhoCombustionModel.H"
#include "rhoReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H"
#include "IOporosityModelList.H"
#include "fvOptions.H"
......
#include "readGravitationalAcceleration.H"
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiCombustionModel> combustion
(
combustionModels::psiCombustionModel::New(mesh)
);
psiReactionThermo& thermo = combustion->thermo();
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh));
psiReactionThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
SLGThermo slgThermo(mesh, thermo);
......@@ -91,8 +86,11 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);
// Set the turbulence into the combustion model
combustion->setTurbulence(turbulence());
Info<< "Creating combustion model\n" << endl;
autoPtr<CombustionModel<psiReactionThermo>> combustion
(
CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
......
......@@ -35,7 +35,8 @@ Description
#include "engineMesh.H"
#include "turbulentFluidThermoModel.H"
#include "basicSprayCloud.H"
#include "psiCombustionModel.H"
#include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H"
#include "SLGThermo.H"
#include "pimpleControl.H"
......
......@@ -37,7 +37,8 @@ Description
#include "dynamicFvMesh.H"
#include "turbulenceModel.H"
#include "basicSprayCloud.H"
#include "psiCombustionModel.H"
#include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "radiationModel.H"
#include "SLGThermo.H"
#include "pimpleControl.H"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment