From 9ed8a6bdf52bb3e8d6e3b2b1814c4538c4efb7a6 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 28 Nov 2016 11:59:17 +0000 Subject: [PATCH] combustionModels::zoneCombustion: Corrected base-class to avoid duplicate instantiation of the thermodynamics package. The 'zoneCombustion' model is now selected in constant/combustionProperties by either combustionModel zoneCombustion; or combustionModel zoneCombustion; as appropriate. Resolves bug-report http://bugs.openfoam.org/view.php?id=2354 --- src/combustionModels/diffusion/diffusions.C | 5 +++-- .../psiChemistryCombustion.H | 2 -- .../psiCombustionModel/psiCombustionModel.H | 3 +++ .../rhoChemistryCombustion.H | 2 -- .../rhoCombustionModel/rhoCombustionModel.H | 3 +++ .../zoneCombustion/zoneCombustion.C | 18 +++++++++++++++++- .../zoneCombustion/zoneCombustion.H | 8 +++++++- .../zoneCombustion/zoneCombustions.C | 9 ++++----- 8 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/combustionModels/diffusion/diffusions.C b/src/combustionModels/diffusion/diffusions.C index e358c96d3..68ec7b73a 100644 --- a/src/combustionModels/diffusion/diffusions.C +++ b/src/combustionModels/diffusion/diffusions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,8 @@ makeCombustionTypesThermo rhoCombustionModel ); - // Combustion models based on sensibleInternalEnergy + +// Combustion models based on sensibleInternalEnergy makeCombustionTypesThermo ( diff --git a/src/combustionModels/psiCombustionModel/psiChemistryCombustion/psiChemistryCombustion.H b/src/combustionModels/psiCombustionModel/psiChemistryCombustion/psiChemistryCombustion.H index ba6d479b1..6da449665 100644 --- a/src/combustionModels/psiCombustionModel/psiChemistryCombustion/psiChemistryCombustion.H +++ b/src/combustionModels/psiCombustionModel/psiChemistryCombustion/psiChemistryCombustion.H @@ -73,8 +73,6 @@ protected: public: - typedef psiCombustionModel CombustionModel; - // Constructors //- Construct from components and thermo diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModel/psiCombustionModel.H b/src/combustionModels/psiCombustionModel/psiCombustionModel/psiCombustionModel.H index b18ce1d56..ae4a75c41 100644 --- a/src/combustionModels/psiCombustionModel/psiCombustionModel/psiCombustionModel.H +++ b/src/combustionModels/psiCombustionModel/psiCombustionModel/psiCombustionModel.H @@ -68,6 +68,9 @@ class psiCombustionModel public: + typedef psiReactionThermo ReactionThermo; + + //- Runtime type information TypeName("psiCombustionModel"); diff --git a/src/combustionModels/rhoCombustionModel/rhoChemistryCombustion/rhoChemistryCombustion.H b/src/combustionModels/rhoCombustionModel/rhoChemistryCombustion/rhoChemistryCombustion.H index 55084db0b..93d473102 100644 --- a/src/combustionModels/rhoCombustionModel/rhoChemistryCombustion/rhoChemistryCombustion.H +++ b/src/combustionModels/rhoCombustionModel/rhoChemistryCombustion/rhoChemistryCombustion.H @@ -73,8 +73,6 @@ protected: public: - typedef rhoCombustionModel CombustionModel; - // Constructors //- Construct from components and thermo diff --git a/src/combustionModels/rhoCombustionModel/rhoCombustionModel/rhoCombustionModel.H b/src/combustionModels/rhoCombustionModel/rhoCombustionModel/rhoCombustionModel.H index daf6970ab..2e261a5b9 100644 --- a/src/combustionModels/rhoCombustionModel/rhoCombustionModel/rhoCombustionModel.H +++ b/src/combustionModels/rhoCombustionModel/rhoCombustionModel/rhoCombustionModel.H @@ -69,6 +69,9 @@ class rhoCombustionModel public: + typedef rhoReactionThermo ReactionThermo; + + //- Runtime type information TypeName("rhoCombustionModel"); diff --git a/src/combustionModels/zoneCombustion/zoneCombustion.C b/src/combustionModels/zoneCombustion/zoneCombustion.C index c74acbac2..3cec4e119 100644 --- a/src/combustionModels/zoneCombustion/zoneCombustion.C +++ b/src/combustionModels/zoneCombustion/zoneCombustion.C @@ -112,7 +112,7 @@ Foam::combustionModels::zoneCombustion::zoneCombustion Type(modelType, mesh, combustionProperties, phaseName), combustionModelPtr_ ( - Type::CombustionModel::New + Type::New ( mesh, "zoneCombustionProperties", @@ -132,6 +132,22 @@ Foam::combustionModels::zoneCombustion::~zoneCombustion() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +template +typename Type::ReactionThermo& +Foam::combustionModels::zoneCombustion::thermo() +{ + return combustionModelPtr_->thermo(); +} + + +template +const typename Type::ReactionThermo& +Foam::combustionModels::zoneCombustion::thermo() const +{ + return combustionModelPtr_->thermo(); +} + + template void Foam::combustionModels::zoneCombustion::correct() { diff --git a/src/combustionModels/zoneCombustion/zoneCombustion.H b/src/combustionModels/zoneCombustion/zoneCombustion.H index 00d44935c..ca014f98d 100644 --- a/src/combustionModels/zoneCombustion/zoneCombustion.H +++ b/src/combustionModels/zoneCombustion/zoneCombustion.H @@ -57,7 +57,7 @@ class zoneCombustion // Private data //- The combustion model to be zone-filtered - autoPtr combustionModelPtr_; + autoPtr combustionModelPtr_; //- List of zone names in which the reactions are active wordList zoneNames_; @@ -102,6 +102,12 @@ public: // Member Functions + //- Return access to the thermo package + virtual typename Type::ReactionThermo& thermo(); + + //- Return const access to the thermo package + virtual const typename Type::ReactionThermo& thermo() const; + //- Correct combustion rate virtual void correct(); diff --git a/src/combustionModels/zoneCombustion/zoneCombustions.C b/src/combustionModels/zoneCombustion/zoneCombustions.C index 507779c22..9c0c9279f 100644 --- a/src/combustionModels/zoneCombustion/zoneCombustions.C +++ b/src/combustionModels/zoneCombustion/zoneCombustions.C @@ -25,14 +25,13 @@ License #include "makeCombustionTypes.H" -#include "psiChemistryCombustion.H" -#include "rhoChemistryCombustion.H" +#include "psiCombustionModel.H" +#include "rhoCombustionModel.H" #include "zoneCombustion.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeCombustionTypes(zoneCombustion, psiChemistryCombustion, psiCombustionModel); -makeCombustionTypes(zoneCombustion, rhoChemistryCombustion, rhoCombustionModel); - +makeCombustionTypes(zoneCombustion, psiCombustionModel, psiCombustionModel); +makeCombustionTypes(zoneCombustion, rhoCombustionModel, rhoCombustionModel); // ************************************************************************* //