reactionDriven.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "reactionDriven.H"
27 #include "phasePair.H"
28 #include "phaseSystem.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace phaseTransferModels
36 {
37  defineTypeNameAndDebug(reactionDriven, 0);
38  addToRunTimeSelectionTable(phaseTransferModel, reactionDriven, dictionary);
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 (
47  const dictionary& dict,
48  const phasePair& pair
49 )
50 :
51  phaseTransferModel(dict, pair),
52  reactingName_(dict.lookup("reactingPhase")),
53  reactingPhase_
54  (
55  reactingName_ == pair_.first() ? pair_.phase1() : pair_.phase2()
56  ),
57  otherPhase_
58  (
59  pair.otherPhase(reactingPhase_)
60  ),
61  sign_
62  (
63  reactingName_ == pair_.first() ? -1 : 1
64  ),
65  species_(dict.lookup("species"))
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
70 
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
79 {
80  return species_;
81 }
82 
83 
86 {
87  HashPtrTable<volScalarField> result;
88 
89  forAll(species_, i)
90  {
91  const word name = species_[i];
92 
93  volScalarField& Y =
94  const_cast<volScalarField&>(reactingPhase_.Y(name));
95 
96  result.set
97  (
98  species_[i],
99  (sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr()
100  );
101  }
102 
103  return result;
104 };
105 
106 
107 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:50
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
stressControl lookup("compactNormalStress") >> compactNormalStress
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual const hashedWordList & species() const
The list of individual species that are transferred.
reactionDriven(const dictionary &dict, const phasePair &pair)
Construct from components.
virtual HashPtrTable< volScalarField > dmidtf() const
The mass transfer rate for individual species.
A wordList with hashed indices for faster lookup by name.
PtrList< volScalarField > & Y
Namespace for OpenFOAM.