1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011-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/>.
28 Wrapper around kinematic parcel types to add collision modelling
35 \*---------------------------------------------------------------------------*/
37 #ifndef CollidingParcel_H
38 #define CollidingParcel_H
42 #include "CollisionRecordList.H"
43 #include "labelFieldIOField.H"
44 #include "vectorFieldIOField.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 typedef CollisionRecordList<vector, vector> collisionRecordList;
53 typedef vectorFieldCompactIOField pairDataFieldCompactIOField;
54 typedef vectorFieldCompactIOField wallDataFieldCompactIOField;
56 template<class ParcelType>
57 class CollidingParcel;
59 // Forward declaration of friend functions
61 template<class ParcelType>
65 const CollidingParcel<ParcelType>&
68 /*---------------------------------------------------------------------------*\
69 Class CollidingParcel Declaration
70 \*---------------------------------------------------------------------------*/
72 template<class ParcelType>
81 //- Particle collision records
82 collisionRecordList collisionRecords_;
87 // Static data members
89 //- String representation of properties
90 static string propHeader;
92 //- Runtime type information
93 TypeName("CollidingParcel");
98 //- Construct from owner, position, and cloud owner
99 // Other properties initialised as null
100 inline CollidingParcel
102 const polyMesh& mesh,
103 const vector& position,
105 const label tetFaceI,
109 //- Construct from components
110 inline CollidingParcel
112 const polyMesh& mesh,
113 const vector& position,
115 const label tetFaceI,
118 const scalar nParticle0,
120 const scalar dTarget0,
123 const vector& angularMomentum0,
124 const vector& torque0,
125 const typename ParcelType::constantProperties& constProps
128 //- Construct from Istream
131 const polyMesh& mesh,
133 bool readFields = true
136 //- Construct as a copy
137 CollidingParcel(const CollidingParcel& p);
139 //- Construct as a copy
140 CollidingParcel(const CollidingParcel& p, const polyMesh& mesh);
142 //- Construct and return a (basic particle) clone
143 virtual autoPtr<particle> clone() const
145 return autoPtr<particle>(new CollidingParcel(*this));
148 //- Construct and return a (basic particle) clone
149 virtual autoPtr<particle> clone(const polyMesh& mesh) const
151 return autoPtr<particle>(new CollidingParcel(*this, mesh));
154 //- Factory class to read-construct particles used for
158 const polyMesh& mesh_;
162 iNew(const polyMesh& mesh)
167 autoPtr<CollidingParcel<ParcelType> > operator()(Istream& is) const
169 return autoPtr<CollidingParcel<ParcelType> >
171 new CollidingParcel<ParcelType>(mesh_, is, true)
181 //- Return const access to the collision records
182 inline const collisionRecordList& collisionRecords() const;
184 //- Return access to collision records
185 inline collisionRecordList& collisionRecords();
191 template<class TrackData>
192 bool move(TrackData& td, const scalar trackTime);
198 template<class CloudType>
199 static void readFields(CloudType& c);
202 template<class CloudType>
203 static void writeFields(const CloudType& c);
208 friend Ostream& operator<< <ParcelType>
211 const CollidingParcel<ParcelType>&
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 } // End namespace Foam
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 #include "CollidingParcelI.H"
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 #include "CollidingParcel.C"
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 // ************************************************************************* //