PairCollision.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::PairCollision
26 
27 Description
28 
29 SourceFiles
30  PairCollision.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef PairCollision_H
35 #define PairCollision_H
36 
37 #include "CollisionModel.H"
38 #include "InteractionLists.H"
39 #include "WallSiteData.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 
48 template<class CloudType>
49 class PairModel;
50 
51 template<class CloudType>
52 class WallModel;
53 
54 
55 /*---------------------------------------------------------------------------*\
56  Class PairCollision Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class CloudType>
60 class PairCollision
61 :
62  public CollisionModel<CloudType>
63 {
64  // Static data
65 
66  //- Tolerance to determine flat wall interactions
67  static scalar cosPhiMinFlatWall;
68 
69  //- Distance to multiply the distance to a wall with within
70  // which a duplicate flat wall interaction is defined. If
71  // cosPhiFlatWall = 1 - e, this = sqrt(2e - e^2) < sqrt(3e)
72  // for all e < 1, giving a safe tolerance (i.e. no double
73  // interactions next to each other.)
74  static scalar flatWallDuplicateExclusion;
75 
76 
77  // Private data
78 
79  //- PairModel to calculate the interaction between two parcels
80  autoPtr<PairModel<CloudType>> pairModel_;
81 
82  //- WallModel to calculate the interaction between the parcel and walls
83  autoPtr<WallModel<CloudType>> wallModel_;
84 
85  //- Interactions lists determining which cells are in
86  // interaction range of each other
88 
89 
90  // Private member functions
91 
92  //- Pre collision tasks
93  void preInteraction();
94 
95  //- Interactions between parcels
96  void parcelInteraction();
97 
98  //- Interactions between real (on-processor) particles
99  void realRealInteraction();
100 
101  //- Interactions between real and referred (off processor) particles
102  void realReferredInteraction();
103 
104  //- Interactions with walls
105  void wallInteraction();
106 
107  bool duplicatePointInList
108  (
109  const DynamicList<point>& existingPoints,
110  const point& pointToTest,
111  scalar duplicateRangeSqr
112  ) const;
113 
114  bool duplicatePointInList
115  (
116  const DynamicList<point>& existingPoints,
117  const point& pointToTest,
118  const scalarList& duplicateRangeSqr
119  ) const;
120 
121  //- Post collision tasks
122  void postInteraction();
123 
124  //- Calculate the pair force between parcels
125  void evaluatePair
126  (
127  typename CloudType::parcelType& pA,
128  typename CloudType::parcelType& pB
129  ) const;
130 
131  //- Calculate the wall forces on a parcel
132  void evaluateWall
133  (
134  typename CloudType::parcelType& p,
135  const List<point>& flatSitePoints,
136  const List<WallSiteData<vector>>& flatSiteData,
137  const List<point>& sharpSitePoints,
138  const List<WallSiteData<vector>>& sharpSiteData
139  ) const;
140 
141 
142 public:
143 
144  //- Runtime type information
145  TypeName("pairCollision");
146 
147 
148  // Constructors
149 
150  //- Construct from components
152 
153  //- Construct copy
155 
156  //- Construct and return a clone
158  {
160  (
161  new PairCollision<CloudType>(*this)
162  );
163  }
164 
165 
166  //- Destructor
167  virtual ~PairCollision();
168 
169 
170  // Member Functions
171 
172  //- Return the number of times to subcycle the current
173  // timestep to meet the criteria of the collision model.
174  virtual label nSubCycles() const;
175 
176  // Collision function
177  virtual void collide();
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #ifdef NoRepository
188  #include "PairCollision.C"
189 #endif
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
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
virtual autoPtr< CollisionModel< CloudType > > clone() const
Construct and return a clone.
TypeName("pairCollision")
Runtime type information.
virtual void collide()
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.
PairCollision(const dictionary &dict, CloudType &owner)
Construct from components.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
virtual label nSubCycles() const
Return the number of times to subcycle the current.
Templated pair interaction class.
Definition: PairCollision.H:48
Templated collision model class.
Templated wall interaction class.
Definition: PairCollision.H:51
Stores the patch ID and templated data to represent a collision with a wall to be passed to the wall ...
Definition: WallSiteData.H:50
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual ~PairCollision()
Destructor.
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Namespace for OpenFOAM.