porting changes
[OpenFOAM-1.5.x.git] / src / lagrangian / solidParticle / solidParticle.H
blobcd4ec4eea5205d036c9dcb2329e9046b7ad18b53
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::solidParticle
28 Description
29     Simple solid spherical particle class with one-way coupling with the
30     continuous phase.
32 SourceFiles
33     solidParticleI.H
34     solidParticle.C
35     solidParticleIO.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef solidParticle_H
40 #define solidParticle_H
42 #include "Particle.H"
43 #include "IOstream.H"
44 #include "autoPtr.H"
45 #include "interpolationCellPoint.H"
46 #include "contiguous.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
53 class solidParticleCloud;
55 /*---------------------------------------------------------------------------*\
56                            Class solidParticle Declaration
57 \*---------------------------------------------------------------------------*/
59 class solidParticle
61     public Particle<solidParticle>
63     // Private member data
65         //- Diameter
66         scalar d_;
68         //- Velocity of parcel
69         vector U_;
72 public:
74     friend class Cloud<solidParticle>;
76     //- Class used to pass tracking data to the trackToFace function
77     class trackData
78     {
79         //- Reference to the cloud containing this particle
80         solidParticleCloud& spc_;
82         // Interpolators for continuous phase fields
84             const interpolationCellPoint<scalar>& rhoInterp_;
85             const interpolationCellPoint<vector>& UInterp_;
86             const interpolationCellPoint<scalar>& nuInterp_;
88         //- Local gravitational or other body-force acceleration
89         const vector& g_;
92     public:
94         bool switchProcessor;
95         bool keepParticle;
98         // Constructors
100             inline trackData
101             (
102                 solidParticleCloud& spc,
103                 const interpolationCellPoint<scalar>& rhoInterp,
104                 const interpolationCellPoint<vector>& UInterp,
105                 const interpolationCellPoint<scalar>& nuInterp,
106                 const vector& g
107             );
110         // Member functions
112             inline solidParticleCloud& spc();
114             inline const interpolationCellPoint<scalar>& rhoInterp() const;
116             inline const interpolationCellPoint<vector>& UInterp() const;
118             inline const interpolationCellPoint<scalar>& nuInterp() const;
120             inline const vector& g() const;
121     };
124     // Constructors
126         //- Construct from components
127         inline solidParticle
128         (
129             const Cloud<solidParticle>& c,
130             const vector& position,
131             const label celli,
132             const scalar m,
133             const vector& U
134         );
136         //- Construct from Istream
137         solidParticle
138         (
139             const Cloud<solidParticle>& c,
140             Istream& is,
141             bool readFields = true
142         );
144         //- Construct and return a clone
145         autoPtr<solidParticle> clone() const
146         {
147             return autoPtr<solidParticle>(new solidParticle(*this));
148         }
151     // Member Functions
153         // Access
155             //- Return diameter
156             inline scalar d() const;
158             //- Return velocity
159             inline const vector& U() const;
161             //- The nearest distance to a wall that
162             //  the particle can be in the n direction
163             inline scalar wallImpactDistance(const vector& n) const;
166         //- Tracking
167         bool move(trackData&);
170         //- Overridable function to handle the particle hitting a processorPatch
171         void hitProcessorPatch
172         (
173             const processorPolyPatch&,
174             solidParticle::trackData& td
175         );
177         //- Overridable function to handle the particle hitting a processorPatch
178         //- without trackData
179         void hitProcessorPatch
180         (
181             const processorPolyPatch&,
182             int&
183         );
185         //- Overridable function to handle the particle hitting a wallPatch
186         void hitWallPatch
187         (
188             const wallPolyPatch&,
189             solidParticle::trackData& td
190         );
192         //- Overridable function to handle the particle hitting a wallPatch
193         //- without trackData
194         void hitWallPatch
195         (
196             const wallPolyPatch&,
197             int&
198         );
200         //- Overridable function to handle the particle hitting a polyPatch
201         void hitPatch
202         (
203             const polyPatch&,
204             solidParticle::trackData& td
205         );
207         //- Overridable function to handle the particle hitting a polyPatch
208         //- without trackData
209         void hitPatch
210         (
211             const polyPatch&,
212             int&
213         );
215         //- Transform the physical properties of the particle
216         //  according to the given transformation tensor
217         void transformProperties
218         (
219             const tensor& T
220         );
222         //- Transform the physical properties of the particle
223         //  according to the given separation vector
224         void transformProperties
225         (
226             const vector& separation
227         );
230     // I-O
232         static void readFields(Cloud<solidParticle>& c);
234         static void writeFields(const Cloud<solidParticle>& c);
237     // Ostream Operator
239         friend Ostream& operator<<(Ostream&, const solidParticle&);
243 template<>
244 inline bool contiguous<solidParticle>()
246     return true;
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 } // End namespace Foam
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 #include "solidParticleI.H"
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 #endif
262 // ************************************************************************* //