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
81 
82  //- WallModel to calculate the interaction between the parcel and walls
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
103 
104  //- Interactions with walls
105  void wallInteraction();
106 
108  (
109  const DynamicList<point>& existingPoints,
110  const point& pointToTest,
111  scalar duplicateRangeSqr
112  ) const;
113 
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
151  PairCollision(const dictionary& dict, CloudType& owner);
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 // ************************************************************************* //
Foam::PairCollision::wallInteraction
void wallInteraction()
Interactions with walls.
Definition: PairCollision.C:176
Foam::PairCollision::clone
virtual autoPtr< CollisionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PairCollision.H:156
Foam::PairCollision::postInteraction
void postInteraction()
Post collision tasks.
Definition: PairCollision.C:511
Foam::PairCollision::TypeName
TypeName("pairCollision")
Runtime type information.
p
p
Definition: pEqn.H:62
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::PairCollision::realRealInteraction
void realRealInteraction()
Interactions between real (on-processor) particles.
Definition: PairCollision.C:75
Foam::PairCollision::nSubCycles
virtual label nSubCycles() const
Return the number of times to subcycle the current.
Definition: PairCollision.C:625
Foam::PairCollision
Definition: PairCollision.H:59
Foam::PairCollision::parcelInteraction
void parcelInteraction()
Interactions between parcels.
Definition: PairCollision.C:58
Foam::PairCollision::collide
virtual void collide()
Definition: PairCollision.C:661
CollisionModel.H
PairCollision.C
Foam::PairCollision::wallModel_
autoPtr< WallModel< CloudType > > wallModel_
WallModel to calculate the interaction between the parcel and walls.
Definition: PairCollision.H:82
Foam::PairCollision::flatWallDuplicateExclusion
static scalar flatWallDuplicateExclusion
Distance to multiply the distance to a wall with within.
Definition: PairCollision.H:73
Foam::label
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
Foam::InteractionLists< typename CloudType::parcelType >
Foam::PairCollision::realReferredInteraction
void realReferredInteraction()
Interactions between real and referred (off processor) particles.
Definition: PairCollision.C:125
Foam::PairCollision::pairModel_
autoPtr< PairModel< CloudType > > pairModel_
PairModel to calculate the interaction between two parcels.
Definition: PairCollision.H:79
Foam::PairCollision::evaluateWall
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
Calculate the wall forces on a parcel.
Definition: PairCollision.C:537
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::PairCollision::~PairCollision
virtual ~PairCollision()
Destructor.
Definition: PairCollision.C:618
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::PairCollision::controlsWallInteraction
virtual bool controlsWallInteraction() const
Indicates whether model determines wall collisions or not,.
Definition: PairCollision.C:654
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::PairCollision::il_
InteractionLists< typename CloudType::parcelType > il_
Interactions lists determining which cells are in.
Definition: PairCollision.H:86
Foam::WallModel
Templated wall interaction class.
Definition: PairCollision.H:51
WallSiteData.H
Foam::WallSiteData
Stores the patch ID and templated data to represent a collision with a wall to be passed to the wall ...
Definition: WallSiteData.H:50
Foam::PairCollision::preInteraction
void preInteraction()
Pre collision tasks.
Definition: PairCollision.C:43
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::PairCollision::evaluatePair
void evaluatePair(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const
Calculate the pair force between parcels.
Definition: PairCollision.C:526
InteractionLists.H
Foam::Vector< scalar >
Foam::PairCollision::PairCollision
PairCollision(const dictionary &dict, CloudType &owner)
Construct from components.
Definition: PairCollision.C:560
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PairModel
Templated pair interaction class.
Definition: PairCollision.H:48
Foam::PairCollision::cosPhiMinFlatWall
static scalar cosPhiMinFlatWall
Tolerance to determine flat wall interactions.
Definition: PairCollision.H:66
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::PairCollision::duplicatePointInList
bool duplicatePointInList(const DynamicList< point > &existingPoints, const point &pointToTest, scalar duplicateRangeSqr) const
Definition: PairCollision.C:472
Foam::CollisionModel
Templated collision model class.
Definition: CollidingCloud.H:53