fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / lagrangian / solidParticle / solidParticle.H
blob92ec07203f7c7f1aebb926d2066ef3e5d36cab36
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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 particle
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
168             //- Move
169             bool move(trackData&);
172         // Patch interactions
174             //- Overridable function to handle the particle hitting a patch
175             //  Executed before other patch-hitting functions
176             bool hitPatch
177             (
178                 const polyPatch&,
179                 solidParticle::trackData& td,
180                 const label patchI
181             );
183             //- Overridable function to handle the particle hitting a patch
184             //  Executed before other patch-hitting functions without trackData
185             bool hitPatch
186             (
187                 const polyPatch& p,
188                 int& td,
189                 const label patchI
190             );
192             //- Overridable function to handle the particle hitting a
193             //  processorPatch
194             void hitProcessorPatch
195             (
196                 const processorPolyPatch&,
197                 solidParticle::trackData& td
198             );
200             //- Overridable function to handle the particle hitting a
201             //  processorPatch without trackData
202             void hitProcessorPatch
203             (
204                 const processorPolyPatch&,
205                 int&
206             );
208             //- Overridable function to handle the particle hitting a wallPatch
209             void hitWallPatch
210             (
211                 const wallPolyPatch&,
212                 solidParticle::trackData& td
213             );
215             //- Overridable function to handle the particle hitting a wallPatch
216             //- without trackData
217             void hitWallPatch
218             (
219                 const wallPolyPatch&,
220                 int&
221             );
223             //- Overridable function to handle the particle hitting a polyPatch
224             void hitPatch
225             (
226                 const polyPatch&,
227                 solidParticle::trackData& td
228             );
230             //- Overridable function to handle the particle hitting a polyPatch
231             //- without trackData
232             void hitPatch
233             (
234                 const polyPatch&,
235                 int&
236             );
238             //- Transform the physical properties of the particle
239             //  according to the given transformation tensor
240             void transformProperties
241             (
242                 const tensor& T
243             );
245             //- Transform the physical properties of the particle
246             //  according to the given separation vector
247             void transformProperties
248             (
249                 const vector& separation
250             );
253     // I-O
255         static void readFields(Cloud<solidParticle>& c);
257         static void writeFields(const Cloud<solidParticle>& c);
260     // Ostream Operator
262         friend Ostream& operator<<(Ostream&, const solidParticle&);
266 template<>
267 inline bool contiguous<solidParticle>()
269     return true;
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 } // End namespace Foam
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 #include "solidParticleI.H"
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 #endif
285 // ************************************************************************* //