1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
32 \*---------------------------------------------------------------------------*/
34 #ifndef PairCollision_H
35 #define PairCollision_H
37 #include "CollisionModel.H"
38 #include "InteractionLists.H"
39 #include "WallSiteData.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
48 template<class CloudType>
51 template<class CloudType>
55 /*---------------------------------------------------------------------------*\
56 Class PairCollision Declaration
57 \*---------------------------------------------------------------------------*/
59 template<class CloudType>
62 public CollisionModel<CloudType>
66 //- Tolerance to determine flat wall interactions
67 static scalar cosPhiMinFlatWall;
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;
79 //- PairModel to calculate the interaction between two parcels
80 autoPtr<PairModel<CloudType> > pairModel_;
82 //- WallModel to calculate the interaction between the parcel and walls
83 autoPtr<WallModel<CloudType> > wallModel_;
85 //- Interactions lists determining which cells are in
86 // interaction range of each other
87 InteractionLists<typename CloudType::parcelType> il_;
90 // Private member functions
92 //- Pre collision tasks
93 void preInteraction();
95 //- Interactions between parcels
96 void parcelInteraction();
98 //- Interactions between real (on-processor) particles
99 void realRealInteraction();
101 //- Interactions between real and referred (off processor) particles
102 void realReferredInteraction();
104 //- Interactions with walls
105 void wallInteraction();
107 bool duplicatePointInList
109 const DynamicList<point>& existingPoints,
110 const point& pointToTest,
111 scalar duplicateRangeSqr
114 bool duplicatePointInList
116 const DynamicList<point>& existingPoints,
117 const point& pointToTest,
118 const scalarList& duplicateRangeSqr
121 //- Post collision tasks
122 void postInteraction();
124 //- Calculate the pair force between parcels
127 typename CloudType::parcelType& pA,
128 typename CloudType::parcelType& pB
131 //- Calculate the wall forces on a parcel
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
144 //- Runtime type information
145 TypeName("pairCollision");
150 //- Construct from components
151 PairCollision(const dictionary& dict, CloudType& owner);
154 PairCollision(PairCollision<CloudType>& cm);
156 //- Construct and return a clone
157 virtual autoPtr<CollisionModel<CloudType> > clone()
159 return autoPtr<CollisionModel<CloudType> >
161 new PairCollision<CloudType>(*this)
167 virtual ~PairCollision();
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;
176 //- Indicates whether model determines wall collisions or not,
177 // used to determine what value to use for wallImpactDistance
178 virtual bool controlsWallInteraction() const;
180 // Collision function
181 virtual void collide();
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 } // End namespace Foam
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 # include "PairCollision.C"
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 // ************************************************************************* //