1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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/>.
25 Foam::streamLineParticle
28 Particle class that samples fields as it passes through. Used in streamline
34 \*---------------------------------------------------------------------------*/
36 #ifndef streamLineParticle_H
37 #define streamLineParticle_H
41 #include "interpolationCellPoint.H"
42 #include "vectorList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 class streamLineParticleCloud;
51 /*---------------------------------------------------------------------------*\
52 Class streamLineParticle Declaration
53 \*---------------------------------------------------------------------------*/
55 class streamLineParticle
62 //- Class used to pass tracking data to the trackToFace function
65 public particle::TrackingData<Cloud<streamLineParticle> >
71 const PtrList<interpolationCellPoint<scalar> >& vsInterp_;
72 const PtrList<interpolationCellPoint<vector> >& vvInterp_;
74 const bool trackForward_;
75 const label nSubCycle_;
77 DynamicList<vectorList>& allPositions_;
78 List<DynamicList<scalarList> >& allScalars_;
79 List<DynamicList<vectorList> >& allVectors_;
86 Cloud<streamLineParticle>& cloud,
87 const PtrList<interpolationCellPoint<scalar> >& vsInterp,
88 const PtrList<interpolationCellPoint<vector> >& vvInterp,
90 const bool trackForward,
91 const label nSubCycle,
92 DynamicList<List<point> >& allPositions,
93 List<DynamicList<scalarList> >& allScalars,
94 List<DynamicList<vectorList> >& allVectors
97 particle::TrackingData<Cloud<streamLineParticle> >(cloud),
101 trackForward_(trackForward),
102 nSubCycle_(nSubCycle),
103 allPositions_(allPositions),
104 allScalars_(allScalars),
105 allVectors_(allVectors)
114 //- Lifetime of particle. Particle dies when reaches 0.
117 //- sampled positions
118 DynamicList<point> sampledPositions_;
121 List<DynamicList<scalar> > sampledScalars_;
124 List<DynamicList<vector> > sampledVectors_;
127 // Private Member Functions
129 //- Estimate dt to cross from current face to next one in nSubCycle
131 scalar calcSubCycleDeltaT
138 //- Interpolate all quantities; return interpolated velocity.
139 vector interpolateFields
151 //- Construct from components
155 const vector& position,
160 //- Construct from Istream
165 bool readFields = true
169 streamLineParticle(const streamLineParticle& p);
171 //- Construct and return a clone
172 autoPtr<particle> clone() const
174 return autoPtr<particle>(new streamLineParticle(*this));
177 //- Factory class to read-construct particles used for
181 const polyMesh& mesh_;
185 iNew(const polyMesh& mesh)
190 autoPtr<streamLineParticle> operator()(Istream& is) const
192 return autoPtr<streamLineParticle>
194 new streamLineParticle(mesh_, is, true)
204 //- Track all particles to their end point
205 bool move(trackingData&, const scalar trackTime);
208 //- Overridable function to handle the particle hitting a patch
209 // Executed before other patch-hitting functions
215 const scalar trackFraction,
216 const tetIndices& tetIs
219 //- Overridable function to handle the particle hitting a wedge
222 const wedgePolyPatch&,
226 //- Overridable function to handle the particle hitting a
228 void hitSymmetryPatch
230 const symmetryPolyPatch&,
234 //- Overridable function to handle the particle hitting a cyclic
237 const cyclicPolyPatch&,
241 //- Overridable function to handle the particle hitting a
243 void hitProcessorPatch
245 const processorPolyPatch&,
249 //- Overridable function to handle the particle hitting a wallPatch
252 const wallPolyPatch&,
257 //- Overridable function to handle the particle hitting a polyPatch
268 static void readFields(Cloud<streamLineParticle>&);
271 static void writeFields(const Cloud<streamLineParticle>&);
276 friend Ostream& operator<<(Ostream&, const streamLineParticle&);
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 } // End namespace Foam
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 // ************************************************************************* //