moleculeCloud.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::moleculeCloud
26 
27 Description
28 
29 SourceFiles
30  moleculeCloudI.H
31  moleculeCloud.C
32 
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef moleculeCloud_H
37 #define moleculeCloud_H
38 
39 #include "Cloud.H"
40 #include "molecule.H"
41 #include "IOdictionary.H"
42 #include "potential.H"
43 #include "InteractionLists.H"
44 #include "labelVector.H"
45 #include "Random.H"
46 #include "fileName.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class moleculeCloud Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class moleculeCloud
58 :
59  public Cloud<molecule>
60 {
61 
62 private:
63 
64  // Private data
65 
66  const polyMesh& mesh_;
67 
68  const potential& pot_;
69 
71 
73 
75 
77 
78 
79  // Private Member Functions
80 
81  void buildConstProps();
82 
84 
85  //- Determine which molecules are in which cells
86  void buildCellOccupancy();
87 
88  void calculatePairForce();
89 
90  inline void evaluatePair
91  (
92  molecule& molI,
93  molecule& molJ
94  );
95 
96  inline bool evaluatePotentialLimit
97  (
98  molecule& molI,
99  molecule& molJ
100  ) const;
101 
102  void calculateTetherForce();
103 
104  void calculateExternalForce();
105 
107 
109  (
110  const IOdictionary& mdInitialiseDict
111  );
112 
113  void createMolecule
114  (
115  const point& position,
116  label cell,
117  label tetFace,
118  label tetPt,
119  label id,
120  bool tethered,
121  scalar temperature,
122  const vector& bulkVelocity
123  );
124 
125  label nSites() const;
126 
128  (
129  scalar temperature,
130  scalar mass
131  );
132 
134  (
135  scalar temperature,
137  );
138 
139  //- Disallow default bitwise copy construct
141 
142  //- Disallow default bitwise assignment
143  void operator=(const moleculeCloud&);
144 
145 
146 public:
147 
148  // Constructors
149 
150  //- Construct given mesh and potential references
152  (
153  const polyMesh& mesh,
154  const potential& pot,
155  bool readFields = true
156  );
157 
158  //- Construct given mesh, potential and mdInitialiseDict
160  (
161  const polyMesh& mesh,
162  const potential& pot,
163  const IOdictionary& mdInitialiseDict,
164  bool readFields = true
165  );
166 
167 
168  // Member Functions
169 
170  //- Evolve the molecules (move, calculate forces, control state etc)
171  void evolve();
172 
173  void calculateForce();
174 
176  (
177  const scalar targetTemperature,
178  const scalar measuredTemperature
179  );
180 
181 
182  // Access
183 
184  inline const polyMesh& mesh() const;
185 
186  inline const potential& pot() const;
187 
188  inline const List<DynamicList<molecule*> >& cellOccupancy() const;
189 
190  inline const InteractionLists<molecule>& il() const;
191 
192  inline const List<molecule::constantProperties> constProps() const;
193 
194  inline const molecule::constantProperties&
195  constProps(label id) const;
196 
197  inline Random& rndGen();
198 
199 
200  // Member Operators
201 
202  //- Write molecule sites in XYZ format
203  void writeXYZ(const fileName& fName) const;
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #include "moleculeCloudI.H"
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
Foam::moleculeCloud::buildCellOccupancy
void buildCellOccupancy()
Determine which molecules are in which cells.
Definition: moleculeCloud.C:109
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::moleculeCloud::setSiteSizesAndPositions
void setSiteSizesAndPositions()
Definition: moleculeCloud.C:96
Foam::moleculeCloud::cellOccupancy
const List< DynamicList< molecule * > > & cellOccupancy() const
Definition: moleculeCloudI.H:357
Foam::Random
Simple random number generator.
Definition: Random.H:49
Foam::moleculeCloud::il
const InteractionLists< molecule > & il() const
Definition: moleculeCloudI.H:364
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::moleculeCloud::nSites
label nSites() const
Definition: moleculeCloud.C:1087
labelVector.H
Cloud.H
Foam::moleculeCloud::operator=
void operator=(const moleculeCloud &)
Disallow default bitwise assignment.
Foam::moleculeCloud::equipartitionLinearVelocity
vector equipartitionLinearVelocity(scalar temperature, scalar mass)
Definition: moleculeCloudI.H:299
Foam::readFields
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:104
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::moleculeCloud::pot_
const potential & pot_
Definition: moleculeCloud.H:67
Foam::moleculeCloud::constProps
const List< molecule::constantProperties > constProps() const
Definition: moleculeCloudI.H:371
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::moleculeCloud::calculateTetherForce
void calculateTetherForce()
Definition: moleculeCloud.C:216
Foam::molecule
Foam::molecule.
Definition: molecule.H:56
Foam::moleculeCloud::constPropList_
List< molecule::constantProperties > constPropList_
Definition: moleculeCloud.H:73
Foam::InteractionLists
Builds direct interaction list, specifying which local (real) cells are potentially in range of each ...
Definition: InteractionLists.H:79
Foam::moleculeCloud::buildConstProps
void buildConstProps()
Definition: moleculeCloud.C:41
fileName.H
Foam::moleculeCloud::evolve
void evolve()
Evolve the molecules (move, calculate forces, control state etc)
Definition: moleculeCloud.C:1162
Foam::moleculeCloud::mesh
const polyMesh & mesh() const
Definition: moleculeCloudI.H:344
Foam::moleculeCloud::il_
InteractionLists< molecule > il_
Definition: moleculeCloud.H:71
Foam::moleculeCloud::evaluatePotentialLimit
bool evaluatePotentialLimit(molecule &molI, molecule &molJ) const
Definition: moleculeCloudI.H:156
Foam::moleculeCloud::calculatePairForce
void calculatePairForce()
Definition: moleculeCloud.C:128
Foam::moleculeCloud::writeXYZ
void writeXYZ(const fileName &fName) const
Write molecule sites in XYZ format.
Definition: moleculeCloud.C:1231
Foam::moleculeCloud::rndGen
Random & rndGen()
Definition: moleculeCloudI.H:384
Foam::potential
Definition: potential.H:53
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Random.H
potential.H
Foam::moleculeCloud::initialiseMolecules
void initialiseMolecules(const IOdictionary &mdInitialiseDict)
Definition: moleculeCloud.C:476
IOdictionary.H
Foam::moleculeCloud::pot
const potential & pot() const
Definition: moleculeCloudI.H:350
Foam::moleculeCloud::cellOccupancy_
List< DynamicList< molecule * > > cellOccupancy_
Definition: moleculeCloud.H:69
moleculeCloudI.H
Foam::moleculeCloud::calculateExternalForce
void calculateExternalForce()
Definition: moleculeCloud.C:243
Foam::moleculeCloud
Definition: moleculeCloud.H:56
InteractionLists.H
Foam::Vector< scalar >
Foam::moleculeCloud::applyConstraintsAndThermostats
void applyConstraintsAndThermostats(const scalar targetTemperature, const scalar measuredTemperature)
Definition: moleculeCloud.C:1203
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::moleculeCloud::createMolecule
void createMolecule(const point &position, label cell, label tetFace, label tetPt, label id, bool tethered, scalar temperature, const vector &bulkVelocity)
Definition: moleculeCloud.C:996
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Foam::molecule::constantProperties
Class to hold molecule constant properties.
Definition: molecule.H:81
Foam::moleculeCloud::rndGen_
Random rndGen_
Definition: moleculeCloud.H:75
Foam::moleculeCloud::mesh_
const polyMesh & mesh_
Definition: moleculeCloud.H:65
molecule.H
Foam::moleculeCloud::calculateForce
void calculateForce()
Definition: moleculeCloud.C:1180
Foam::moleculeCloud::removeHighEnergyOverlaps
void removeHighEnergyOverlaps()
Definition: moleculeCloud.C:252
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
Foam::moleculeCloud::equipartitionAngularMomentum
vector equipartitionAngularMomentum(scalar temperature, const molecule::constantProperties &cP)
Definition: moleculeCloudI.H:314
Foam::moleculeCloud::moleculeCloud
moleculeCloud(const moleculeCloud &)
Disallow default bitwise copy construct.
Foam::moleculeCloud::evaluatePair
void evaluatePair(molecule &molI, molecule &molJ)
Definition: moleculeCloudI.H:33