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-2022 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 "phaseSystem.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace phaseTransferModels
35 {
36  defineTypeNameAndDebug(reactionDriven, 0);
37  addToRunTimeSelectionTable(phaseTransferModel, reactionDriven, dictionary);
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  const dictionary& dict,
47  const phaseInterface& interface
48 )
49 :
50  phaseTransferModel(dict, interface),
51  interface_(interface),
52  reactingName_(dict.lookup("reactingPhase")),
53  reactingPhase_
54  (
55  reactingName_ == interface_.phase1().name()
56  ? interface_.phase1()
57  : interface_.phase2()
58  ),
59  otherPhase_(interface.otherPhase(reactingPhase_)),
60  sign_(reactingName_ == interface_.phase1().name() ? -1 : 1),
61  species_(dict.lookup("species"))
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
75 {
76  return species_;
77 }
78 
79 
82 {
83  HashPtrTable<volScalarField> result;
84 
85  forAll(species_, i)
86  {
87  const word name = species_[i];
88 
89  volScalarField& Y =
90  const_cast<volScalarField&>(reactingPhase_.Y(name));
91 
92  result.set
93  (
94  species_[i],
95  (sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr()
96  );
97  }
98 
99  return result;
100 };
101 
102 
103 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
reactionDriven(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
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:58
stressControl lookup("compactNormalStress") >> compactNormalStress
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual const hashedWordList & species() const
The list of individual species that are transferred.
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.