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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::moleculeCloud
29
30Description
31
32SourceFiles
33 moleculeCloudI.H
34 moleculeCloud.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef moleculeCloud_H
39#define moleculeCloud_H
40
41#include "Cloud.H"
42#include "molecule.H"
43#include "IOdictionary.H"
44#include "potential.H"
45#include "InteractionLists.H"
46#include "labelVector.H"
47#include "Random.H"
48#include "fileName.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class moleculeCloud Declaration
57\*---------------------------------------------------------------------------*/
59class moleculeCloud
60:
61 public Cloud<molecule>
62{
63 // Private Data
64
65 const polyMesh& mesh_;
66
67 const potential& pot_;
68
69 List<DynamicList<molecule*>> cellOccupancy_;
70
72
74
75 Random rndGen_;
76
77
78 // Private Member Functions
79
80 void buildConstProps();
81
82 void setSiteSizesAndPositions();
83
84 //- Determine which molecules are in which cells
85 void buildCellOccupancy();
86
87 void calculatePairForce();
88
89 inline void evaluatePair
90 (
91 molecule& molI,
92 molecule& molJ
93 );
94
95 inline bool evaluatePotentialLimit
96 (
97 molecule& molI,
98 molecule& molJ
99 ) const;
100
101 void calculateTetherForce();
102
103 void calculateExternalForce();
104
105 void removeHighEnergyOverlaps();
106
107 void initialiseMolecules
108 (
109 const IOdictionary& mdInitialiseDict
110 );
111
112 void createMolecule
113 (
114 const point& position,
115 label cell,
116 label id,
117 bool tethered,
118 scalar temperature,
119 const vector& bulkVelocity
120 );
121
122 label nSites() const;
123
124 inline vector equipartitionLinearVelocity
125 (
126 scalar temperature,
127 scalar mass
128 );
129
130 inline vector equipartitionAngularMomentum
131 (
132 scalar temperature,
134 );
135
136 //- No copy construct
137 moleculeCloud(const moleculeCloud&) = delete;
138
139 //- No copy assignment
140 void operator=(const moleculeCloud&) = delete;
141
142
143public:
144
145 // Constructors
146
147 //- Construct given mesh and potential references
149 (
150 const polyMesh& mesh,
151 const potential& pot,
152 bool readFields = true
153 );
154
155 //- Construct given mesh, potential and mdInitialiseDict
157 (
158 const polyMesh& mesh,
159 const potential& pot,
160 const IOdictionary& mdInitialiseDict,
161 bool readFields = true
162 );
163
164
165 // Member Functions
166
167 //- Evolve the molecules (move, calculate forces, control state etc)
168 void evolve();
169
170 void calculateForce();
171
173 (
174 const scalar targetTemperature,
175 const scalar measuredTemperature
176 );
177
178
179 // Access
180
181 inline const polyMesh& mesh() const;
182
183 inline const potential& pot() const;
184
185 inline const List<DynamicList<molecule*>>& cellOccupancy() const;
186
187 inline const InteractionLists<molecule>& il() const;
188
190
191 inline const molecule::constantProperties& constProps(label id) const;
192
193 inline Random& rndGen();
194
195
196 // Member Operators
197
198 //- Write molecule sites in XYZ format
199 void writeXYZ(const fileName& fName) const;
200};
201
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205} // End namespace Foam
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209#include "moleculeCloudI.H"
210
211// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212
213#endif
214
215// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Builds direct interaction list, specifying which local (real) cells are potentially in range of each ...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
Random number generator.
Definition: Random.H:60
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:57
A class for handling file names.
Definition: fileName.H:76
const potential & pot() const
const List< molecule::constantProperties > constProps() const
const List< DynamicList< molecule * > > & cellOccupancy() const
const polyMesh & mesh() const
void writeXYZ(const fileName &fName) const
Write molecule sites in XYZ format.
const InteractionLists< molecule > & il() const
void evolve()
Evolve the molecules (move, calculate forces, control state etc)
void applyConstraintsAndThermostats(const scalar targetTemperature, const scalar measuredTemperature)
Class to hold molecule constant properties.
Definition: molecule.H:92
Foam::molecule.
Definition: molecule.H:70
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Namespace for OpenFOAM.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.