WallModel.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-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 Class
25  Foam::WallModel
26 
27 Description
28  Templated wall interaction class
29 
30 SourceFiles
31  WallModel.C
32  WallModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef WallModel_H
37 #define WallModel_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "WallSiteData.H"
43 #include "point.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class WallModel Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class CloudType>
55 class WallModel
56 {
57  // Private Data
58 
59  //- The CollisionModel dictionary
60  const dictionary& dict_;
61 
62  //- Reference to the owner cloud class
63  CloudType& owner_;
64 
65  //- The coefficients dictionary
66  const dictionary coeffDict_;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("wallModel");
73 
74  //- Declare runtime constructor selection table
76  (
77  autoPtr,
78  WallModel,
79  dictionary,
80  (
81  const dictionary& dict,
83  ),
84  (dict, owner)
85  );
86 
87 
88  // Constructors
89 
90  //- Construct from components
91  WallModel
92  (
93  const dictionary& dict,
95  const word& type
96  );
97 
98 
99  //- Destructor
100  virtual ~WallModel();
101 
102 
103  //- Selector
105  (
106  const dictionary& dict,
108  );
109 
110 
111  // Access
112 
113  //- Return the owner cloud object
114  const CloudType& owner() const;
115 
116  //- Return non-const access to the owner cloud object
117  CloudType& owner();
118 
119  //- Return the dictionary
120  const dictionary& dict() const;
121 
122  //- Return the coefficients dictionary
123  const dictionary& coeffDict() const;
124 
125 
126  // Member Functions
127 
128  //- Return the effective radius for a particle for the model
129  virtual scalar pREff(const typename CloudType::parcelType& p) const = 0;
130 
131  //- Whether the WallModel has a timestep limit that will
132  // require subCycling
133  virtual bool controlsTimestep() const = 0;
134 
135  //- For WallModels that control the timestep, calculate the
136  // number of subCycles needed to satisfy the minimum
137  // allowable timestep
138  virtual label nSubCycles() const = 0;
139 
140  //- Calculate the wall interaction for a parcel
141  virtual void evaluateWall
142  (
143  typename CloudType::parcelType& p,
144  const List<point>& flatSitePoints,
145  const List<WallSiteData<vector>>& flatSiteData,
146  const List<point>& sharpSitePoints,
147  const List<WallSiteData<vector>>& sharpSiteData
148  ) const = 0;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #define makeWallModel(CloudType) \
159  \
160  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
161  \
162  defineNamedTemplateTypeNameAndDebug \
163  ( \
164  Foam::WallModel<collidingCloudType>, \
165  0 \
166  ); \
167  \
168  namespace Foam \
169  { \
170  defineTemplateRunTimeSelectionTable \
171  ( \
172  WallModel<collidingCloudType>, \
173  dictionary \
174  ); \
175  }
176 
177 
178 #define makeWallModelType(SS, CloudType) \
179  \
180  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
181  \
182  defineNamedTemplateTypeNameAndDebug(Foam::SS<collidingCloudType>, 0); \
183  \
184  Foam::WallModel<collidingCloudType>:: \
185  adddictionaryConstructorToTable<Foam::SS<collidingCloudType>> \
186  add##SS##CloudType##ConstructorToTable_;
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
192  #include "WallModel.C"
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
Templated wall interaction class.
Definition: WallModel.H:55
virtual scalar pREff(const typename CloudType::parcelType &p) const =0
Return the effective radius for a particle for the model.
WallModel(const dictionary &dict, CloudType &owner, const word &type)
Construct from components.
Definition: WallModel.C:32
virtual void evaluateWall(typename CloudType::parcelType &p, const List< point > &flatSitePoints, const List< WallSiteData< vector >> &flatSiteData, const List< point > &sharpSitePoints, const List< WallSiteData< vector >> &sharpSiteData) const =0
Calculate the wall interaction for a parcel.
virtual label nSubCycles() const =0
For WallModels that control the timestep, calculate the.
const dictionary & coeffDict() const
Return the coefficients dictionary.
Definition: WallModel.C:78
virtual ~WallModel()
Destructor.
Definition: WallModel.C:47
virtual bool controlsTimestep() const =0
Whether the WallModel has a timestep limit that will.
const dictionary & dict() const
Return the dictionary.
Definition: WallModel.C:70
const CloudType & owner() const
Return the owner cloud object.
Definition: WallModel.C:55
TypeName("wallModel")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, WallModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
static autoPtr< WallModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: WallModelNew.C:33
Stores the patch ID and templated data to represent a collision with a wall to be passed to the wall ...
Definition: WallSiteData.H:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Macros to ease declaration of run-time selection tables.
volScalarField & p