mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Exposing specieComposition from ReactingMixture
The FO BilgerMixtureFraction needs access to specieComposition which is stored in ReactingMixture. A virtual mechanism was added to basicSpecieMixture to access specieComposition form rho and psi reationThermos. ptr was changed to autoPtr to avoid memory leaks (Kutalmis Bercin)
This commit is contained in:
committed by
Andrew Heather
parent
9f53fdcc36
commit
a16c4ae920
@ -75,13 +75,15 @@ Foam::TDACChemistryModel<ReactionThermo, ThermoType>::TDACChemistryModel
|
|||||||
// Store the species composition according to the species index
|
// Store the species composition according to the species index
|
||||||
speciesTable speciesTab = composition.species();
|
speciesTable speciesTab = composition.species();
|
||||||
|
|
||||||
const HashTable<List<specieElement>>& specComp =
|
autoPtr<HashTable<List<specieElement>>> specCompPtr
|
||||||
|
(
|
||||||
dynamicCast<const reactingMixture<ThermoType>&>(this->thermo())
|
dynamicCast<const reactingMixture<ThermoType>&>(this->thermo())
|
||||||
.specieComposition();
|
.specieComposition()
|
||||||
|
);
|
||||||
|
|
||||||
forAll(specieComp_, i)
|
forAll(specieComp_, i)
|
||||||
{
|
{
|
||||||
specieComp_[i] = specComp[this->Y()[i].member()];
|
specieComp_[i] = (specCompPtr.ref())[this->Y()[i].member()];
|
||||||
}
|
}
|
||||||
|
|
||||||
mechRed_ = chemistryReductionMethod<ReactionThermo, ThermoType>::New
|
mechRed_ = chemistryReductionMethod<ReactionThermo, ThermoType>::New
|
||||||
|
|||||||
@ -21,4 +21,5 @@ derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField
|
|||||||
|
|
||||||
functionObjects/moleFractions/moleFractionsFunctionObjects.C
|
functionObjects/moleFractions/moleFractionsFunctionObjects.C
|
||||||
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libreactionThermophysicalModels
|
LIB = $(FOAM_LIBBIN)/libreactionThermophysicalModels
|
||||||
|
|||||||
@ -4,6 +4,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
|
||||||
|
-I$(LIB_SRC)/functionObjects/field/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2014-2017 OpenFOAM Foundation
|
Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,12 +43,15 @@ SourceFiles
|
|||||||
#define basicSpecieMixture_H
|
#define basicSpecieMixture_H
|
||||||
|
|
||||||
#include "basicMultiComponentMixture.H"
|
#include "basicMultiComponentMixture.H"
|
||||||
|
#include "specieElement.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
typedef HashTable<List<specieElement>> speciesCompositionTable;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class basicSpecieMixture Declaration
|
Class basicSpecieMixture Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -202,6 +206,16 @@ public:
|
|||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T
|
const scalar T
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
|
//- Species composition
|
||||||
|
virtual autoPtr<speciesCompositionTable> specieComposition() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
autoPtr<speciesCompositionTable>
|
||||||
|
(
|
||||||
|
new speciesCompositionTable()
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -115,9 +116,13 @@ public:
|
|||||||
using PtrList<Reaction<ThermoType>>::operator[];
|
using PtrList<Reaction<ThermoType>>::operator[];
|
||||||
|
|
||||||
//- Table of species composition
|
//- Table of species composition
|
||||||
const speciesCompositionTable& specieComposition() const
|
virtual autoPtr<speciesCompositionTable> specieComposition() const
|
||||||
{
|
{
|
||||||
return speciesComposition_;
|
return
|
||||||
|
autoPtr<speciesCompositionTable>
|
||||||
|
(
|
||||||
|
new speciesCompositionTable(speciesComposition_)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,12 +45,15 @@ SourceFiles
|
|||||||
#include "basicSpecieMixture.H"
|
#include "basicSpecieMixture.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "specieElement.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
typedef HashTable<List<specieElement>> speciesCompositionTable;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class psiReactionThermo Declaration
|
Class psiReactionThermo Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -137,6 +140,16 @@ public:
|
|||||||
|
|
||||||
//- Return the composition of the multi-component mixture
|
//- Return the composition of the multi-component mixture
|
||||||
virtual const basicSpecieMixture& composition() const = 0;
|
virtual const basicSpecieMixture& composition() const = 0;
|
||||||
|
|
||||||
|
//- Table of species composition
|
||||||
|
autoPtr<speciesCompositionTable> specieComposition() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
autoPtr<speciesCompositionTable>
|
||||||
|
(
|
||||||
|
composition().specieComposition()
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,12 +45,15 @@ SourceFiles
|
|||||||
#include "basicSpecieMixture.H"
|
#include "basicSpecieMixture.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "specieElement.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
typedef HashTable<List<specieElement>> speciesCompositionTable;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class rhoReactionThermo Declaration
|
Class rhoReactionThermo Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -137,6 +140,16 @@ public:
|
|||||||
|
|
||||||
//- Return the composition of the multi-component mixture
|
//- Return the composition of the multi-component mixture
|
||||||
virtual const basicSpecieMixture& composition() const = 0;
|
virtual const basicSpecieMixture& composition() const = 0;
|
||||||
|
|
||||||
|
//- Table of species composition
|
||||||
|
autoPtr<speciesCompositionTable> specieComposition() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
autoPtr<speciesCompositionTable>
|
||||||
|
(
|
||||||
|
composition().specieComposition()
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user