PairCollision.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 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
157  virtual autoPtr<CollisionModel<CloudType> > clone() const
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  //- Indicates whether model determines wall collisions or not,
177  // used to determine what value to use for wallImpactDistance
178  virtual bool controlsWallInteraction() const;
179 
180  // Collision function
181  virtual void collide();
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
192 # include "PairCollision.C"
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Templated wall interaction class.
Definition: PairCollision.H:51
const CloudType & owner() const
Return const access to the owner cloud.
Stores the patch ID and templated data to represent a collision with a wall to be passed to the wall ...
Definition: WallSiteData.H:50
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
PairCollision(const dictionary &dict, CloudType &owner)
Construct from components.
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.
Namespace for OpenFOAM.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
virtual bool controlsWallInteraction() const
Indicates whether model determines wall collisions or not,.
Templated collision model class.
volScalarField & p
Definition: createFields.H:51
virtual label nSubCycles() const
Return the number of times to subcycle the current.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
virtual ~PairCollision()
Destructor.
Builds direct interaction list, specifying which local (real) cells are potentially in range of each ...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
Templated pair interaction class.
Definition: PairCollision.H:48
TypeName("pairCollision")
Runtime type information.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
virtual void collide()
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117