DampingModel.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) 2013-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::DampingModel
26 
27 Description
28  Base class for collisional damping models.
29 
30 SourceFiles
31  DampingModel.C
32  DampingModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef DampingModel_H
37 #define DampingModel_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "CloudSubModelBase.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 
51 class TimeScaleModel;
52 
53 /*---------------------------------------------------------------------------*\
54  Class DampingModel Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class CloudType>
58 class DampingModel
59 :
60  public CloudSubModelBase<CloudType>
61 {
62 protected:
63 
64  // Protected data
65 
66  //- Time scale model
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("dampingModel");
74 
75  //- Declare runtime constructor selection table
77  (
78  autoPtr,
80  dictionary,
81  (
82  const dictionary& dict,
84  ),
85  (dict, owner)
86  );
87 
88 
89  // Constructors
90 
91  //- Construct null from owner
92  DampingModel(CloudType& owner);
93 
94  //- Construct from components
96  (
97  const dictionary& dict,
98  CloudType& owner,
99  const word& type
100  );
101 
102  //- Construct copy
104 
105  //- Construct and return a clone
106  virtual autoPtr<DampingModel<CloudType>> clone() const = 0;
107 
108 
109  //- Destructor
110  virtual ~DampingModel();
111 
112 
113  //- Selector
115  (
116  const dictionary& dict,
117  CloudType& owner
118  );
119 
120 
121  // Member Functions
122 
123  //- Calculate the velocity correction
124  virtual vector velocityCorrection
125  (
126  typename CloudType::parcelType& p,
127  const scalar deltaT
128  ) const = 0;
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 #define makeDampingModel(CloudType) \
139  \
140  typedef Foam::CloudType::MPPICCloudType MPPICCloudType; \
141  defineNamedTemplateTypeNameAndDebug \
142  ( \
143  Foam::DampingModel<MPPICCloudType>, \
144  0 \
145  ); \
146  \
147  namespace Foam \
148  { \
149  defineTemplateRunTimeSelectionTable \
150  ( \
151  DampingModel<MPPICCloudType>, \
152  dictionary \
153  ); \
154  }
155 
157 #define makeDampingModelType(SS, CloudType) \
158  \
159  typedef Foam::CloudType::MPPICCloudType MPPICCloudType; \
160  defineNamedTemplateTypeNameAndDebug \
161  (Foam::DampingModels::SS<MPPICCloudType>, 0); \
162  \
163  Foam::DampingModel<MPPICCloudType>:: \
164  adddictionaryConstructorToTable \
165  <Foam::DampingModels::SS<MPPICCloudType>> \
166  add##SS##CloudType##MPPICCloudType##ConstructorToTable_;
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #ifdef NoRepository
172  #include "DampingModel.C"
173 #endif
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
declareRunTimeSelectionTable(autoPtr, DampingModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
autoPtr< TimeScaleModel > timeScaleModel_
Time scale model.
Definition: DampingModel.H:66
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.
A class for handling words, derived from string.
Definition: word.H:59
virtual autoPtr< DampingModel< CloudType > > clone() const =0
Construct and return a clone.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
virtual vector velocityCorrection(typename CloudType::parcelType &p, const scalar deltaT) const =0
Calculate the velocity correction.
static autoPtr< DampingModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: DampingModel.C:78
DampingModel(CloudType &owner)
Construct null from owner.
Definition: DampingModel.C:32
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.
virtual ~DampingModel()
Destructor.
Definition: DampingModel.C:69
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
TypeName("dampingModel")
Runtime type information.
Base class for collisional damping models.
Definition: MPPICCloud.H:56
Namespace for OpenFOAM.