Skip to content
Snippets Groups Projects
Commit a16c4ae9 authored by Sergio Ferraris's avatar Sergio Ferraris Committed by Andrew Heather
Browse files

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)
parent 9f53fdcc
No related branches found
No related tags found
1 merge request!393ENH: BilgerMixtureFraction: New function object
......@@ -75,13 +75,15 @@ Foam::TDACChemistryModel<ReactionThermo, ThermoType>::TDACChemistryModel
// Store the species composition according to the species index
speciesTable speciesTab = composition.species();
const HashTable<List<specieElement>>& specComp =
autoPtr<HashTable<List<specieElement>>> specCompPtr
(
dynamicCast<const reactingMixture<ThermoType>&>(this->thermo())
.specieComposition();
.specieComposition()
);
forAll(specieComp_, i)
{
specieComp_[i] = specComp[this->Y()[i].member()];
specieComp_[i] = (specCompPtr.ref())[this->Y()[i].member()];
}
mechRed_ = chemistryReductionMethod<ReactionThermo, ThermoType>::New
......
......@@ -21,4 +21,5 @@ derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField
functionObjects/moleFractions/moleFractionsFunctionObjects.C
LIB = $(FOAM_LIBBIN)/libreactionThermophysicalModels
......@@ -4,6 +4,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
-I$(LIB_SRC)/functionObjects/field/lnInclude
LIB_LIBS = \
-lfiniteVolume \
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -42,12 +43,15 @@ SourceFiles
#define basicSpecieMixture_H
#include "basicMultiComponentMixture.H"
#include "specieElement.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef HashTable<List<specieElement>> speciesCompositionTable;
/*---------------------------------------------------------------------------*\
Class basicSpecieMixture Declaration
\*---------------------------------------------------------------------------*/
......@@ -202,6 +206,16 @@ public:
const scalar p,
const scalar T
) const = 0;
//- Species composition
virtual autoPtr<speciesCompositionTable> specieComposition() const
{
return
autoPtr<speciesCompositionTable>
(
new speciesCompositionTable()
);
}
};
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -115,9 +116,13 @@ public:
using PtrList<Reaction<ThermoType>>::operator[];
//- 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 |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -45,12 +45,15 @@ SourceFiles
#include "basicSpecieMixture.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "specieElement.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef HashTable<List<specieElement>> speciesCompositionTable;
/*---------------------------------------------------------------------------*\
Class psiReactionThermo Declaration
\*---------------------------------------------------------------------------*/
......@@ -137,6 +140,16 @@ public:
//- Return the composition of the multi-component mixture
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 |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -45,12 +45,15 @@ SourceFiles
#include "basicSpecieMixture.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "specieElement.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef HashTable<List<specieElement>> speciesCompositionTable;
/*---------------------------------------------------------------------------*\
Class rhoReactionThermo Declaration
\*---------------------------------------------------------------------------*/
......@@ -137,6 +140,16 @@ public:
//- Return the composition of the multi-component mixture
virtual const basicSpecieMixture& composition() const = 0;
//- Table of species composition
autoPtr<speciesCompositionTable> specieComposition() const
{
return
autoPtr<speciesCompositionTable>
(
composition().specieComposition()
);
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment