SurfaceReactionModel.H
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) 2011-2018 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 Class
25  Foam::SurfaceReactionModel
26 
27 Description
28  Templated surface reaction model class
29 
30 SourceFiles
31  SurfaceReactionModel.C
32  SurfaceReactionModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef SurfaceReactionModel_H
37 #define SurfaceReactionModel_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "CloudSubModelBase.H"
43 #include "scalarField.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class SurfaceReactionModel Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class CloudType>
55 class SurfaceReactionModel
56 :
57  public CloudSubModelBase<CloudType>
58 {
59 protected:
60 
61  // Protected data
62 
63  //- Mass of lagrangian phase converted
64  scalar dMass_;
65 
66 
67 public:
68 
69  //-Runtime type information
70  TypeName("surfaceReactionModel");
71 
72 
73  //- Declare runtime constructor selection table
75  (
76  autoPtr,
78  dictionary,
79  (
80  const dictionary& dict,
82  ),
83  (dict, cloud)
84  );
85 
86 
87  // Constructors
88 
89  //- Construct null from owner
91 
92  //- Construct from dictionary
94  (
95  const dictionary& dict,
96  CloudType& cloud,
97  const word& type
98  );
99 
100  //- Construct copy
102 
103  //- Construct and return a clone
104  virtual autoPtr<SurfaceReactionModel<CloudType>> clone() const = 0;
105 
106 
107  //- Destructor
108  virtual ~SurfaceReactionModel();
109 
110 
111  //- Selector
113  (
114  const dictionary& dict,
115  CloudType& cloud
116  );
117 
118 
119  // Member Functions
120 
121  //- Update surface reactions
122  // Returns the heat of reaction
123  virtual scalar calculate
124  (
125  const scalar dt,
126  const label celli,
127  const scalar d,
128  const scalar T,
129  const scalar Tc,
130  const scalar pc,
131  const scalar rhoc,
132  const scalar mass,
133  const scalarField& YGas,
134  const scalarField& YLiquid,
135  const scalarField& YSolid,
136  const scalarField& YMixture,
137  const scalar N,
138  scalarField& dMassGas,
139  scalarField& dMassLiquid,
140  scalarField& dMassSolid,
141  scalarField& dMassSRCarrier
142  ) const = 0;
143 
144  //- Add to devolatilisation mass
145  void addToSurfaceReactionMass(const scalar dMass);
146 
147 
148  // I-O
149 
150  //- Write injection info to stream
151  virtual void info(Ostream& os);
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 #define makeSurfaceReactionModel(CloudType) \
162  \
163  typedef Foam::CloudType::reactingMultiphaseCloudType \
164  reactingMultiphaseCloudType; \
165  defineNamedTemplateTypeNameAndDebug \
166  ( \
167  Foam::SurfaceReactionModel<reactingMultiphaseCloudType>, \
168  0 \
169  ); \
170  namespace Foam \
171  { \
172  defineTemplateRunTimeSelectionTable \
173  ( \
174  SurfaceReactionModel<reactingMultiphaseCloudType>, \
175  dictionary \
176  ); \
177  }
178 
180 #define makeSurfaceReactionModelType(SS, CloudType) \
181  \
182  typedef Foam::CloudType::reactingMultiphaseCloudType \
183  reactingMultiphaseCloudType; \
184  defineNamedTemplateTypeNameAndDebug \
185  (Foam::SS<reactingMultiphaseCloudType>, 0); \
186  \
187  Foam::SurfaceReactionModel<reactingMultiphaseCloudType>:: \
188  adddictionaryConstructorToTable \
189  <Foam::SS<reactingMultiphaseCloudType>> \
190  add##SS##CloudType##reactingMultiphaseCloudType##ConstructorToTable_;
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #ifdef NoRepository
196  #include "SurfaceReactionModel.C"
197 #endif
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
virtual autoPtr< SurfaceReactionModel< CloudType > > clone() const =0
Construct and return a clone.
declareRunTimeSelectionTable(autoPtr, SurfaceReactionModel, dictionary,(const dictionary &dict, CloudType &cloud),(dict, cloud))
Declare runtime constructor selection table.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
static autoPtr< SurfaceReactionModel< CloudType > > New(const dictionary &dict, CloudType &cloud)
Selector.
virtual ~SurfaceReactionModel()
Destructor.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
TypeName("surfaceReactionModel")
Runtime type information.
virtual void info(Ostream &os)
Write injection info to stream.
A class for handling words, derived from string.
Definition: word.H:59
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
virtual scalar calculate(const scalar dt, const label celli, const scalar d, const scalar T, const scalar Tc, const scalar pc, const scalar rhoc, const scalar mass, const scalarField &YGas, const scalarField &YLiquid, const scalarField &YSolid, const scalarField &YMixture, const scalar N, scalarField &dMassGas, scalarField &dMassLiquid, scalarField &dMassSolid, scalarField &dMassSRCarrier) const =0
Update surface reactions.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
scalar dMass_
Mass of lagrangian phase converted.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
SurfaceReactionModel(CloudType &owner)
Construct null from owner.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
void addToSurfaceReactionMass(const scalar dMass)
Add to devolatilisation mass.
label N
Definition: createFields.H:22
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
Templated surface reaction model class.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Namespace for OpenFOAM.