Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef molecule_H
00038 #define molecule_H
00039
00040 #include <lagrangian/Particle.H>
00041 #include <OpenFOAM/IOstream.H>
00042 #include <OpenFOAM/autoPtr.H>
00043 #include <OpenFOAM/diagTensor.H>
00044
00045
00046
00047 namespace Foam
00048 {
00049
00050
00051 class moleculeCloud;
00052
00053
00054
00055
00056
00057 class molecule
00058 :
00059 public Particle<molecule>
00060 {
00061
00062 public:
00063
00064
00065
00066
00067
00068 enum specialTypes
00069 {
00070 SPECIAL_TETHERED = -1,
00071 SPECIAL_FROZEN = -2,
00072 NOT_SPECIAL = 0,
00073 SPECIAL_USER = 1
00074 };
00075
00076
00077 class constantProperties
00078 {
00079
00080
00081
00082 Field<vector> siteReferencePositions_;
00083
00084 List<scalar> siteMasses_;
00085
00086 List<scalar> siteCharges_;
00087
00088 List<label> siteIds_;
00089
00090 List<bool> pairPotentialSites_;
00091
00092 List<bool> electrostaticSites_;
00093
00094 diagTensor momentOfInertia_;
00095
00096 scalar mass_;
00097
00098
00099
00100 void checkSiteListSizes() const;
00101
00102 void setInteracionSiteBools
00103 (
00104 const List<word>& siteIds,
00105 const List<word>& pairPotSiteIds
00106 );
00107
00108 bool linearMoleculeTest() const;
00109
00110
00111 public:
00112
00113 inline constantProperties();
00114
00115
00116 inline constantProperties(const dictionary& dict);
00117
00118
00119
00120 inline const Field<vector>& siteReferencePositions() const;
00121
00122 inline const List<scalar>& siteMasses() const;
00123
00124 inline const List<scalar>& siteCharges() const;
00125
00126 inline const List<label>& siteIds() const;
00127
00128 inline List<label>& siteIds();
00129
00130 inline const List<bool>& pairPotentialSites() const;
00131
00132 inline bool pairPotentialSite(label sId) const;
00133
00134 inline const List<bool>& electrostaticSites() const;
00135
00136 inline bool electrostaticSite(label sId) const;
00137
00138 inline const diagTensor& momentOfInertia() const;
00139
00140 inline bool linearMolecule() const;
00141
00142 inline bool pointMolecule() const;
00143
00144 inline label degreesOfFreedom() const;
00145
00146 inline scalar mass() const;
00147
00148 inline label nSites() const;
00149 };
00150
00151
00152
00153 class trackData
00154 :
00155 public Particle<molecule>::trackData
00156 {
00157 moleculeCloud& molCloud_;
00158
00159
00160 label part_;
00161
00162
00163 public:
00164
00165
00166
00167 trackData
00168 (
00169 moleculeCloud& molCloud,
00170 label part
00171 );
00172
00173
00174
00175 inline moleculeCloud& molCloud();
00176
00177 inline label part() const;
00178 };
00179
00180
00181 private:
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 tensor Q_;
00193
00194 vector v_;
00195
00196 vector a_;
00197
00198 vector pi_;
00199
00200 vector tau_;
00201
00202 vector specialPosition_;
00203
00204 scalar potentialEnergy_;
00205
00206
00207 tensor rf_;
00208
00209 label special_;
00210
00211 label id_;
00212
00213 List<vector> siteForces_;
00214
00215 List<vector> sitePositions_;
00216
00217
00218
00219
00220 tensor rotationTensorX(scalar deltaT) const;
00221
00222 tensor rotationTensorY(scalar deltaT) const;
00223
00224 tensor rotationTensorZ(scalar deltaT) const;
00225
00226
00227 public:
00228
00229 friend class Cloud<molecule>;
00230
00231
00232
00233
00234 inline molecule
00235 (
00236 const Cloud<molecule>& c,
00237 const vector& position,
00238 const label celli,
00239 const tensor& Q,
00240 const vector& v,
00241 const vector& a,
00242 const vector& pi,
00243 const vector& tau,
00244 const vector& specialPosition,
00245 const constantProperties& constProps,
00246 const label special,
00247 const label id
00248 );
00249
00250
00251 molecule
00252 (
00253 const Cloud<molecule>& c,
00254 Istream& is,
00255 bool readFields = true
00256 );
00257
00258
00259 autoPtr<molecule> clone() const
00260 {
00261 return autoPtr<molecule>(new molecule(*this));
00262 }
00263
00264
00265
00266
00267
00268
00269 bool move(trackData&);
00270
00271 void transformProperties(const tensor& T);
00272
00273 void transformProperties(const vector& separation);
00274
00275 void setSitePositions(const constantProperties& constProps);
00276
00277 void setSiteSizes(label size);
00278
00279
00280
00281
00282 inline const tensor& Q() const;
00283 inline tensor& Q();
00284
00285 inline const vector& v() const;
00286 inline vector& v();
00287
00288 inline const vector& a() const;
00289 inline vector& a();
00290
00291 inline const vector& pi() const;
00292 inline vector& pi();
00293
00294 inline const vector& tau() const;
00295 inline vector& tau();
00296
00297 inline const List<vector>& siteForces() const;
00298 inline List<vector>& siteForces();
00299
00300 inline const List<vector>& sitePositions() const;
00301 inline List<vector>& sitePositions();
00302
00303 inline const vector& specialPosition() const;
00304 inline vector& specialPosition();
00305
00306 inline scalar potentialEnergy() const;
00307 inline scalar& potentialEnergy();
00308
00309 inline const tensor& rf() const;
00310 inline tensor& rf();
00311
00312 inline label special() const;
00313
00314 inline bool tethered() const;
00315
00316 inline label id() const;
00317
00318
00319
00320
00321
00322
00323 bool hitPatch
00324 (
00325 const polyPatch&,
00326 molecule::trackData& td,
00327 const label patchI
00328 );
00329
00330
00331
00332 bool hitPatch
00333 (
00334 const polyPatch& p,
00335 int& td,
00336 const label patchI
00337 );
00338
00339
00340 void hitProcessorPatch
00341 (
00342 const processorPolyPatch&,
00343 molecule::trackData& td
00344 );
00345
00346
00347
00348 void hitProcessorPatch
00349 (
00350 const processorPolyPatch&,
00351 int&
00352 );
00353
00354
00355 void hitWallPatch
00356 (
00357 const wallPolyPatch&,
00358 molecule::trackData& td
00359 );
00360
00361
00362
00363 void hitWallPatch
00364 (
00365 const wallPolyPatch&,
00366 int&
00367 );
00368
00369
00370 void hitPatch
00371 (
00372 const polyPatch&,
00373 molecule::trackData& td
00374 );
00375
00376
00377
00378 void hitPatch
00379 (
00380 const polyPatch&,
00381 int&
00382 );
00383
00384
00385
00386
00387 static void readFields(Cloud<molecule>& mC);
00388
00389 static void writeFields(const Cloud<molecule>& mC);
00390
00391
00392
00393
00394 friend Ostream& operator<<(Ostream&, const molecule&);
00395 };
00396
00397
00398
00399 }
00400
00401
00402
00403 #include "moleculeI.H"
00404
00405
00406
00407 #endif
00408
00409