Loading...
Searching...
No Matches
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 Foam_moleculeCloud_H
39#define Foam_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{
55/*---------------------------------------------------------------------------*\
56 Class moleculeCloud Declaration
57\*---------------------------------------------------------------------------*/
58
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
137public:
138
139 //- Type of parcel within the cloud
140 typedef molecule parcelType;
141
142 //- No copy construct
143 moleculeCloud(const moleculeCloud&) = delete;
145 //- No copy assignment
146 void operator=(const moleculeCloud&) = delete;
147
148
149 // Constructors
150
151 //- Read construct given mesh and potential references
153 (
154 const polyMesh& mesh,
155 const potential& pot,
156 bool readFields = true
157 );
158
159 //- Read construct given mesh, potential and mdInitialiseDict
161 (
162 const polyMesh& mesh,
163 const potential& pot,
164 const IOdictionary& mdInitialiseDict,
165 bool readFields = true
166 );
167
168
169 // Member Functions
170
171 //- Evolve the molecules (move, calculate forces, control state etc)
172 void evolve();
173
174 void calculateForce();
175
177 (
178 const scalar targetTemperature,
179 const scalar measuredTemperature
180 );
181
182
183 // Access
184
185 // Same as pMesh()
186 const polyMesh& mesh() const noexcept { return mesh_; }
187
188 const potential& pot() const { return pot_; }
189
190 const List<DynamicList<molecule*>>& cellOccupancy() const
191 {
192 return cellOccupancy_;
193 }
194
196 {
197 return il_;
198 }
201 {
202 return constPropList_;
203 }
205 const molecule::constantProperties& constProps(label id) const
206 {
207 return constPropList_[id];
208 }
210 Random& rndGen() { return rndGen_; }
211
212
213 // Member Operators
215 //- Write molecule sites in XYZ format
216 void writeXYZ(const fileName& fName) const;
217};
218
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222} // End namespace Foam
223
224// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225
226#include "moleculeCloudI.H"
227
228// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229
230#endif
231
232// ************************************************************************* //
Cloud(const polyMesh &mesh, const Foam::zero, const word &cloudName)
Definition Cloud.C:57
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
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:72
Random number generator.
Definition Random.H:56
A cell is defined as a list of faces with extra functionality.
Definition cell.H:56
A class for handling file names.
Definition fileName.H:75
const potential & pot() const
void writeXYZ(const fileName &fName) const
Write molecule sites in XYZ format.
const List< molecule::constantProperties > & constProps() const
const InteractionLists< molecule > & il() const
const molecule::constantProperties & constProps(label id) const
void operator=(const moleculeCloud &)=delete
No copy assignment.
void evolve()
Evolve the molecules (move, calculate forces, control state etc).
void applyConstraintsAndThermostats(const scalar targetTemperature, const scalar measuredTemperature)
const polyMesh & mesh() const noexcept
molecule parcelType
Type of parcel within the cloud.
moleculeCloud(const moleculeCloud &)=delete
No copy construct.
const List< DynamicList< molecule * > > & cellOccupancy() const
Class to hold molecule constant properties.
Definition molecule.H:91
Foam::molecule.
Definition molecule.H:65
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Namespace for OpenFOAM.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
Vector< scalar > vector
Definition vector.H:57