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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::PairCollision
28 
29 Group
30  grpLagrangianIntermediateCollisionSubModels
31 
32 Description
33 
34 SourceFiles
35  PairCollision.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef PairCollision_H
40 #define PairCollision_H
41 
42 #include "CollisionModel.H"
43 #include "InteractionLists.H"
44 #include "WallSiteData.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 
53 template<class CloudType>
54 class PairModel;
55 
56 template<class CloudType>
57 class WallModel;
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class PairCollision Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class CloudType>
65 class PairCollision
66 :
67  public CollisionModel<CloudType>
68 {
69  // Static data
70 
71  //- Tolerance to determine flat wall interactions
72  static scalar cosPhiMinFlatWall;
73 
74  //- Distance to multiply the distance to a wall with within
75  // which a duplicate flat wall interaction is defined. If
76  // cosPhiFlatWall = 1 - e, this = sqrt(2e - e^2) < sqrt(3e)
77  // for all e < 1, giving a safe tolerance (i.e. no double
78  // interactions next to each other.)
79  static scalar flatWallDuplicateExclusion;
80 
81 
82  // Private data
83 
84  //- PairModel to calculate the interaction between two parcels
85  autoPtr<PairModel<CloudType>> pairModel_;
86 
87  //- WallModel to calculate the interaction between the parcel and walls
88  autoPtr<WallModel<CloudType>> wallModel_;
89 
90  //- Interactions lists determining which cells are in
91  // interaction range of each other
93 
94 
95  // Private member functions
96 
97  //- Pre collision tasks
98  void preInteraction();
99 
100  //- Interactions between parcels
101  void parcelInteraction();
102 
103  //- Interactions between real (on-processor) particles
104  void realRealInteraction();
105 
106  //- Interactions between real and referred (off processor) particles
107  void realReferredInteraction();
108 
109  //- Interactions with walls
110  void wallInteraction();
111 
112  bool duplicatePointInList
113  (
114  const DynamicList<point>& existingPoints,
115  const point& pointToTest,
116  scalar duplicateRangeSqr
117  ) const;
118 
119  bool duplicatePointInList
120  (
121  const DynamicList<point>& existingPoints,
122  const point& pointToTest,
123  const scalarList& duplicateRangeSqr
124  ) const;
125 
126  //- Post collision tasks
127  void postInteraction();
128 
129  //- Calculate the pair force between parcels
130  void evaluatePair
131  (
132  typename CloudType::parcelType& pA,
133  typename CloudType::parcelType& pB
134  ) const;
135 
136  //- Calculate the wall forces on a parcel
137  void evaluateWall
138  (
139  typename CloudType::parcelType& p,
140  const List<point>& flatSitePoints,
141  const List<WallSiteData<vector>>& flatSiteData,
142  const List<point>& sharpSitePoints,
143  const List<WallSiteData<vector>>& sharpSiteData
144  ) const;
145 
146 
147 public:
148 
149  //- Runtime type information
150  TypeName("pairCollision");
151 
152 
153  // Constructors
154 
155  //- Construct from components
156  PairCollision(const dictionary& dict, CloudType& owner);
157 
158  //- Construct copy
160 
161  //- Construct and return a clone
163  {
165  (
166  new PairCollision<CloudType>(*this)
167  );
168  }
169 
170 
171  //- Destructor
172  virtual ~PairCollision();
173 
174 
175  // Member Functions
176 
177  //- Return the number of times to subcycle the current
178  // timestep to meet the criteria of the collision model.
179  virtual label nSubCycles() const;
180 
181  // Collision function
182  virtual void collide();
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #ifdef NoRepository
193  #include "PairCollision.C"
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
Foam::PairCollision::clone
virtual autoPtr< CollisionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PairCollision.H:161
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::PairCollision::TypeName
TypeName("pairCollision")
Runtime type information.
Foam::DynamicList< point >
Foam::PairCollision::nSubCycles
virtual label nSubCycles() const
Return the number of times to subcycle the current.
Definition: PairCollision.C:586
Foam::PairCollision
Definition: PairCollision.H:64
Foam::PairCollision::collide
virtual void collide()
Definition: PairCollision.C:615
CollisionModel.H
PairCollision.C
Foam::InteractionLists< typename CloudType::parcelType >
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::PairCollision::~PairCollision
virtual ~PairCollision()
Destructor.
Definition: PairCollision.C:579
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::WallModel
Templated wall interaction class.
Definition: PairCollision.H:56
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:52
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
InteractionLists.H
Foam::Vector< scalar >
Foam::PairCollision::PairCollision
PairCollision(const dictionary &dict, CloudType &owner)
Construct from components.
Definition: PairCollision.C:524
Foam::List< scalar >
Foam::PairModel
Templated pair interaction class.
Definition: PairCollision.H:53
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::CollisionModel
Templated collision model class.
Definition: CollidingCloud.H:58