1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 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
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
36 \*---------------------------------------------------------------------------*/
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Class forward declarations
53 /*---------------------------------------------------------------------------*\
54 Class molecule Declaration
55 \*---------------------------------------------------------------------------*/
59 public Particle<molecule>
63 //- Be careful with the ordering of data.
64 // It has an impact on binary transfer:
65 // -# Put the largest data members 1st
67 // -# Don't go scalar-label, scalar-label, because in 64bit mode,
68 // the labels will be padded by 4bytes.
73 // - Velocity of molecule
76 // - Acceleration of molecule
80 vector tetherPosition_;
82 // - Potential energy that this molecules posseses
83 scalar potentialEnergy_;
85 // - r_ij f_ij, stress dyad
88 // - Is the molecule tethered?
91 // - id (type) of molecule
97 friend class Cloud<molecule>;
99 //- Class used to pass tracking data to the trackToFace function
102 public Particle<molecule>::trackData
104 //- Reference to the cloud containing this particle
105 moleculeCloud& molCloud_;
107 // label specifying which part of the integration algorithm is taking
108 // place (i.e. leapfrog 1 or leapfrog 2. Predictor or Corrector)
118 moleculeCloud& molCloud,
124 inline moleculeCloud& molCloud();
126 inline label part() const;
131 //- Construct from components
134 const Cloud<molecule>& c,
135 const vector& position,
140 const vector& tetherPosition,
141 const label tethered,
145 //- Construct from Istream
148 const Cloud<molecule>& c,
150 bool readFields = true
153 //- Construct and return a clone
154 autoPtr<molecule> clone() const
156 return autoPtr<molecule>(new molecule(*this));
162 void transformProperties(const tensor& T);
164 void transformProperties(const vector& separation);
169 inline label id() const;
172 inline scalar mass() const;
175 inline const vector& U() const;
178 //- Return acceleration
179 inline const vector& A() const;
182 //- Return potential energy
183 inline scalar potentialEnergy() const;
184 inline scalar& potentialEnergy();
186 //- Return stress contribution
187 inline const tensor& rf() const;
191 inline label tethered() const;
193 //- Return tetherPosition
194 inline const vector& tetherPosition() const;
195 inline vector& tetherPosition();
199 bool move(trackData&);
204 //- Overridable function to handle the particle hitting a processorPatch
205 void hitProcessorPatch
207 const processorPolyPatch&,
208 molecule::trackData& td
211 //- Overridable function to handle the particle hitting a processorPatch
213 void hitProcessorPatch
215 const processorPolyPatch&,
219 //- Overridable function to handle the particle hitting a wallPatch
222 const wallPolyPatch&,
223 molecule::trackData& td
226 //- Overridable function to handle the particle hitting a wallPatch
230 const wallPolyPatch&,
234 //- Overridable function to handle the particle hitting a polyPatch
238 molecule::trackData& td
241 //- Overridable function to handle the particle hitting a polyPatch
249 static void readFields(moleculeCloud& mC);
251 static void writeFields(const moleculeCloud& mC);
254 // IOstream Operators
256 friend Ostream& operator<<(Ostream&, const molecule&);
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 } // End namespace Foam
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 #include "moleculeI.H"
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 // ************************************************************************* //