MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseClusterInsertionBoundary.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #include <random>
28 #include "Particles/BaseParticle.h"
29 #include "Math/RNG.h"
30 
35 {
36  /*
37  * CLUSTER VALUES
38  */
39 
41 
42  //Position
43  position_ = {0,0,0};
44 
46 
47  // Time
49 
50  // Particles
52  radiusParticle_ = 0;
53  nParticles_ = 0;
54 
55 
56  // Central force
58 
59  // Data analysis
60  nInternalStructurePoints_ = 1000000;
61 
62  // Energy
63  energyRatioTolerance_ = 1.0e-7;
64 
65  // File
66  isCdatOutputOn_ = false;
67  isOverlOutputOn_ = false;
68  isAmatOutputOn_ = false;
69  isIntStrucOutputOn_ = false;
70  isVtkOutputOn_ = false;
71  isRestartOutputOn_ = false;
72  isFStatOutputOn_ = false;
73  isEneOutputOn_ = false;
74 
75  radiusParticle_ = 0;
76 
77 
78  /*
79  * TYPICAL INSERTION BOUNDARY VALUES
80  */
81 
82  posMin_ = Vec3D(0.0, 0.0, 0.0);
83  posMax_ = Vec3D(0.0, 0.0, 0.0);
84  velMin_ = Vec3D(0.0, 0.0, 0.0);
85  velMax_ = Vec3D(0.0, 0.0, 0.0);
86 
88 
89  randomised_ = true;
90 
91  logger(DEBUG, "BaseClusterInsertionBoundary::BaseClusterInsertionBoundary() finished");
92 
93 }
94 
99  : InsertionBoundary(other)
100 {
101  /*
102  * CLUSTER VALUES
103  */
104 
106 
107  //Position
108  position_ = other.position_;
109 
111 
112  // Time
114 
115  // Particles
118  nParticles_ = other.nParticles_;
119 
120  nParticles_ = other.nParticles_;
121 
122 
123  // Central force
125 
126  // Data analysis
128 
129  // Energy
131 
132  // File
141 
142 
143 
145  /*
146  * TYPICAL INSERTION BOUNDARY VALUES
147  */
148 
149  posMin_ = other.posMin_;
150  posMax_ = other.posMax_;
151  velMin_ = other.velMin_;
152  velMax_ = other.velMax_;
153 
155 
156  randomised_=other.randomised_;
157 
158 }
159 
165 = default;
166 
172 {
173 #ifdef DEBUG_CONSTRUCTOR
174  std::cout << "BaseClusterInsertionBoundary::copy() const finished" << std::endl;
175 #endif
176  return new BaseClusterInsertionBoundary(*this);
177 }
178 
181  randomised_ = randomised;
182 }
183 
185  return randomised_;
186 }
187 
189  return nClusterInserted_;
190 }
191 
193 {
194  if (radiusMicroParticle <= 0)
195  logger(ERROR, "radiusParticle must be greater than zero. radiusMicroParticle = %", radiusMicroParticle);
196  else {
197  radiusParticle_ = radiusMicroParticle;
199  }
200 }
201 
203 {
204  radMin_ = radMin;
205  radMax_ = radMax;
206 }
207 
209 {
210  posMin_ = posMin;
211  posMax_ = posMax;
212  velMin_ = velMin;
213  velMax_ = velMax;
214 }
215 
217 {
218  velMin_ = velMin;
219  velMax_ = velMax;
220 }
221 
222 void BaseClusterInsertionBoundary::setAdditionalClusterProperties(Mdouble collisionTimeOverTimeStep, Mdouble velocityDampingModulus, Mdouble energyRatioTolerance)
223 {
224  collisionTimeOverTimeStep_ = collisionTimeOverTimeStep;
225  velocityDampingModulus_ = velocityDampingModulus;
226  energyRatioTolerance_ = energyRatioTolerance;
227 
228 }
229 
230 void BaseClusterInsertionBoundary::setOutputClusterProperties(bool doCdatOutput, bool doOverlOutput, bool doAmatOutput, bool doIntStrucOutput,
231  bool doVtkOutput, bool doRestartOutput, bool doFStatOutput, bool doEneOutput)
232 {
233  isCdatOutputOn_ = doCdatOutput;
234  isOverlOutputOn_ = doOverlOutput;
235  isAmatOutputOn_ = doAmatOutput;
236  isIntStrucOutputOn_ = doIntStrucOutput;
237  isVtkOutputOn_ = doVtkOutput;
238  isRestartOutputOn_ = doRestartOutput;
239  isFStatOutputOn_ = doFStatOutput;
240  isEneOutputOn_ = doEneOutput;
241 
242 }
243 
246 {
247 }
248 
257 {
258 }
259 
265 {
267  std::string dummy;
268 
269  is >> dummy >> posMin_
270  >> dummy >> posMax_;
271  is >> dummy >> velMin_
272  >> dummy >> velMax_;
273  is >> dummy >> radMin_;
274  is >> dummy >> radMax_;
275 
276  is >> dummy >> nClusterInserted_
277  >> dummy >> radiusParticle_;
278  is >> dummy >> sizeDispersityParticle_
279  >> dummy >> velocityDampingModulus_
280  >> dummy >> nInternalStructurePoints_;
281  is >> dummy >> energyRatioTolerance_
282  >> dummy >> collisionTimeOverTimeStep_
284  is >> dummy >> isCdatOutputOn_
285  >> dummy >> isOverlOutputOn_
286  >> dummy >> isAmatOutputOn_
287  >> dummy >> isIntStrucOutputOn_
288  >> dummy >> isVtkOutputOn_
289  >> dummy >> isRestartOutputOn_
290  >> dummy >> isFStatOutputOn_
291  >> dummy >> isEneOutputOn_;
292 
293 }
294 
299 void BaseClusterInsertionBoundary::write(std::ostream& os) const
300 {
302  os << " posMin " << posMin_
303  << " posMax " << posMax_
304  << " velMin " << velMin_
305  << " velMax " << velMax_;
306  os << " radMin " << radMin_
307  << " radMax " << radMax_;
308 
309  os << " nClusterInserted " << nClusterInserted_ <<
310  " radiusParticle " << radiusParticle_ <<
311  " sizeDispersityParticle " << sizeDispersityParticle_ <<
312  " velocityDampingModulus " << velocityDampingModulus_ <<
313  " nInternalStructurePoints " << nInternalStructurePoints_ <<
314  " energyRatioTolerance " << energyRatioTolerance_ <<
315  " collisionTimeOverTimeStep " << collisionTimeOverTimeStep_ <<
316  " setRadiusParticle " << setRadiusParticleAndNotNumberOfParticles_ <<
317  " isCdatOutputOn " << isCdatOutputOn_ <<
318  " isOverlOutputOn " << isOverlOutputOn_ <<
319  " isAmatOutputOn " << isAmatOutputOn_ <<
320  " isIntStrucOutputOn " << isIntStrucOutputOn_ <<
321  " isVtkOutputOn " << isVtkOutputOn_ <<
322  " isRestartOutputOn " << isRestartOutputOn_ <<
323  " isFStatOutputOn " << isFStatOutputOn_ <<
324  " isEneOutputOn " << isEneOutputOn_;
325 
326 }
327 
328 
329 
330 
331 
332 
333 
334 
340 {
341  return "BaseClusterInsertionBoundary";
342 }
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:72
void read(std::istream &is) override
reads boundary properties from istream
Species< LinearPlasticViscoelasticNormalSpecies, FrictionSpecies > LinearPlasticViscoelasticFrictionSpecies
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
Definition: GeneralDefine.h:34
Mdouble radMin_
Minimum and maximum radii of the generated particles.
void checkBoundaryBeforeTimeStep(DPMBase *md) override
Fills the boundary with clusters.
void write(std::ostream &os) const override
writes boundary properties to ostream
bool getRandomised()
this returns a bool which indicates if the process is randomised (true) or not (false).
Boundary structure for boundaries used for insertion of particles.
void setOutputClusterProperties(bool doCdatOutput, bool doOverlOutput, bool doAmatOutput, bool doIntStrucOutput, bool doVtkOutput, bool doRestartOutput, bool doFStatOutput, bool doEneOutput)
sets cluster whether or not cluster output files will be created, for example:
void setRandomised(bool randomised)
this turns off the randomise(): created for UnitTests.
This is a class that generates random numbers i.e. named the Random Number Generator (RNG)...
Definition: RNG.h:52
void setAdditionalClusterProperties(Mdouble collisionTimeOverTimeStep, Mdouble velocityDampingModulus, Mdouble energyRatioTolerance)
sets additional cluster properties as:
void placeParticle(BaseParticle *p, RNG &random) override
Generates a random position, velocity for the cluster p.
void setRadiusMicroParticle(Mdouble rMP)
this sets the radius of the micro particle composing the cluster.
unsigned int getNumberOfClusterInserted()
this returns the number of cluster inserted.
void setRadiusRange(Mdouble radMin, Mdouble radMax)
Sets the range of cluster radius that may be generated.
std::string getName() const override
Returns the name of the object.
BaseClusterInsertionBoundary()
Constructor; sets everything to 0.
void write(std::ostream &os) const override
Writes the boundary's id_ and maxFailed_.
void setVelocityRange(Vec3D velMin, Vec3D velMax)
Sets the velocity range of the ClusterInsertionBoundary.
void setGeometry(Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
Sets the geometry (position and velocity distribution) of the ClusterInsertionBoundary.
LinearPlasticViscoelasticFrictionSpecies * clusterSpecies_
Definition: Vector.h:49
BaseClusterInsertionBoundary * copy() const override
Creates a copy on the heap and returns a pointer.
~BaseClusterInsertionBoundary() override
Destructor: default destructor.
void read(std::istream &is) override
Reads the boundary's id_ and maxFailed_.