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  posMin_ = posMin;
205  posMax_ = posMax;
206 }
207 
209 {
210  velMin_ = velMin;
211  velMax_ = velMax;
212 }
213 
214 void BaseClusterInsertionBoundary::setAdditionalClusterProperties(Mdouble collisionTimeOverTimeStep, Mdouble velocityDampingModulus, Mdouble energyRatioTolerance)
215 {
216  collisionTimeOverTimeStep_ = collisionTimeOverTimeStep;
217  velocityDampingModulus_ = velocityDampingModulus;
218  energyRatioTolerance_ = energyRatioTolerance;
219 
220 }
221 
222 void BaseClusterInsertionBoundary::setOutputClusterProperties(bool doCdatOutput, bool doOverlOutput, bool doAmatOutput, bool doIntStrucOutput,
223  bool doVtkOutput, bool doRestartOutput, bool doFStatOutput, bool doEneOutput)
224 {
225  isCdatOutputOn_ = doCdatOutput;
226  isOverlOutputOn_ = doOverlOutput;
227  isAmatOutputOn_ = doAmatOutput;
228  isIntStrucOutputOn_ = doIntStrucOutput;
229  isVtkOutputOn_ = doVtkOutput;
230  isRestartOutputOn_ = doRestartOutput;
231  isFStatOutputOn_ = doFStatOutput;
232  isEneOutputOn_ = doEneOutput;
233 
234 }
235 
238 {
239 }
240 
249 {
250 }
251 
257 {
259  std::string dummy;
260 
261  is >> dummy >> posMin_
262  >> dummy >> posMax_;
263  is >> dummy >> velMin_
264  >> dummy >> velMax_;
265 
266  is >> dummy >> nClusterInserted_
267  >> dummy >> radiusParticle_;
268  is >> dummy >> sizeDispersityParticle_
269  >> dummy >> velocityDampingModulus_
270  >> dummy >> nInternalStructurePoints_;
271  is >> dummy >> energyRatioTolerance_
272  >> dummy >> collisionTimeOverTimeStep_
274  is >> dummy >> isCdatOutputOn_
275  >> dummy >> isOverlOutputOn_
276  >> dummy >> isAmatOutputOn_
277  >> dummy >> isIntStrucOutputOn_
278  >> dummy >> isVtkOutputOn_
279  >> dummy >> isRestartOutputOn_
280  >> dummy >> isFStatOutputOn_
281  >> dummy >> isEneOutputOn_;
282 
283 }
284 
289 void BaseClusterInsertionBoundary::write(std::ostream& os) const
290 {
292  os << " posMin " << posMin_
293  << " posMax " << posMax_
294  << " velMin " << velMin_
295  << " velMax " << velMax_;
296 
297  os << " nClusterInserted " << nClusterInserted_ <<
298  " radiusParticle " << radiusParticle_ <<
299  " sizeDispersityParticle " << sizeDispersityParticle_ <<
300  " velocityDampingModulus " << velocityDampingModulus_ <<
301  " nInternalStructurePoints " << nInternalStructurePoints_ <<
302  " energyRatioTolerance " << energyRatioTolerance_ <<
303  " collisionTimeOverTimeStep " << collisionTimeOverTimeStep_ <<
304  " setRadiusParticle " << setRadiusParticleAndNotNumberOfParticles_ <<
305  " isCdatOutputOn " << isCdatOutputOn_ <<
306  " isOverlOutputOn " << isOverlOutputOn_ <<
307  " isAmatOutputOn " << isAmatOutputOn_ <<
308  " isIntStrucOutputOn " << isIntStrucOutputOn_ <<
309  " isVtkOutputOn " << isVtkOutputOn_ <<
310  " isRestartOutputOn " << isRestartOutputOn_ <<
311  " isFStatOutputOn " << isFStatOutputOn_ <<
312  " isEneOutputOn " << isEneOutputOn_;
313 
314 }
315 
316 
317 
318 
319 
320 
321 
322 
328 {
329  return "BaseClusterInsertionBoundary";
330 }
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:75
void setGeometry(Vec3D posMin, Vec3D posMax)
Sets the geometry (position and velocity distribution) of the ClusterInsertionBoundary.
void read(std::istream &is) override
reads boundary properties from istream
Species< LinearPlasticViscoelasticNormalSpecies, FrictionSpecies > LinearPlasticViscoelasticFrictionSpecies
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
double Mdouble
Definition: GeneralDefine.h:34
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.
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.
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_.