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-2016 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 
70  List<DynamicList<molecule*>> cellOccupancy_;
71 
73 
75 
76  Random rndGen_;
77 
78 
79  // Private Member Functions
80 
81  void buildConstProps();
82 
83  void setSiteSizesAndPositions();
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 
106  void removeHighEnergyOverlaps();
107 
108  void initialiseMolecules
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 
127  inline vector equipartitionLinearVelocity
128  (
129  scalar temperature,
130  scalar mass
131  );
132 
133  inline vector equipartitionAngularMomentum
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 // ************************************************************************* //
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
A class for handling file names.
Definition: fileName.H:69
const polyMesh & mesh() const
Builds direct interaction list, specifying which local (real) cells are potentially in range of each ...
Class to hold molecule constant properties.
Definition: molecule.H:89
void writeXYZ(const fileName &fName) const
Write molecule sites in XYZ format.
void evolve()
Evolve the molecules (move, calculate forces, control state etc)
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
const potential & pot() const
const InteractionLists< molecule > & il() const
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
void applyConstraintsAndThermostats(const scalar targetTemperature, const scalar measuredTemperature)
const List< molecule::constantProperties > constProps() const
Simple random number generator.
Definition: Random.H:49
Base cloud calls templated on particle type.
Definition: Cloud.H:52
virtual void readFields()
Read the field data for the cloud of particles. Dummy at.
Definition: CloudIO.C:251
const List< DynamicList< molecule * > > & cellOccupancy() const
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
Foam::molecule.
Definition: molecule.H:64
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.