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-2023 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 {
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 {
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 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:67
bool set(const Key &, const T &newElmt)
Assign a new hashedEntry, overwriting existing entries.
Definition: HashTableI.H:91
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A wordList with hashed indices for faster lookup by name.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
Phase transfer model representing change from one phase to another due to reactions....
reactionDriven(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
virtual HashPtrTable< volScalarField > dmidtf() const
The mass transfer rate for individual species.
virtual const hashedWordList & species() const
The list of individual species that are transferred.
A class for handling words, derived from string.
Definition: word.H:62
defineTypeNameAndDebug(cavitation, 0)
addToRunTimeSelectionTable(phaseTransferModel, cavitation, dictionary)
Namespace for OpenFOAM.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
dictionary dict
PtrList< volScalarField > & Y