MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Chute.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, 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 "Chute.h"
27 #include "ChuteBottom.h"
28 #include "Particles/BaseParticle.h"
31 #include "Walls/InfiniteWall.h"
32 #include <string>
33 #include <string.h>
34 #include <iomanip>
36 
37 #include <Logger.h>
38 
43 {
44  constructor();
45  logger(VERBOSE,"[Chute::Chute()] constructor finished");
46 }
47 
55 Chute::Chute(const DPMBase& other)
56  : DPMBase(other), Mercury3D(other)
57 {
58  constructor();
59  logger(DEBUG,"[Chute::Chute(const DPMBase& other)] copy constructor finished");
60 }
61 
70  : DPMBase(other), Mercury3D(other)
71 {
72  constructor();
73  logger(DEBUG,"[Chute::Chute(const MercuryBase& other)] copy constructor finished");
74 }
75 
83 Chute::Chute(const Mercury3D& other)
84  : DPMBase(other), Mercury3D(other)
85 {
86  constructor();
87  logger(DEBUG,"[Chute::Chute(const Mercury3D& other) copy constructor finished");
88 }
89 
94 Chute::Chute(const Chute& other)
95  : DPMBase(other), Mercury3D(other),
96  chuteAngle_(other.chuteAngle_),
97  fixedParticleRadius_(other.fixedParticleRadius_),
98  minInflowParticleRadius_(other.minInflowParticleRadius_),
99  maxInflowParticleRadius_(other.maxInflowParticleRadius_),
100  inflowVelocity_(other.inflowVelocity_),
101  inflowVelocityVariance_(other.inflowVelocityVariance_),
102  inflowHeight_(other.inflowHeight_),
103  roughBottomType_(other.roughBottomType_),
104  maxFailed_(other.maxFailed_),
105  insertionBoundary_(other.insertionBoundary_),
106  isChutePeriodic_(other.isChutePeriodic_)
107 {
108  logger(DEBUG,"[Chute::Chute(const Chute& other)] copy constructor finished");
109 }
110 
115 {
116  insertionBoundary_ = nullptr;
117  isChutePeriodic_ = false;
118  setFixedParticleRadius(0.001);
120  setChuteAngle(0.0);
121 
122  setMaxFailed(1);
124  setInflowVelocity(0.1);
126  setInflowHeight(0.02);
127 }
128 
133 void Chute::read(std::istream& is)
134 {
135  MercuryBase::read(is);
136  //read out the full line first, so if there is an error it does not affect
137  //the read of the next line
138  std::string line_string;
139  getline(is, line_string);
140  std::cout << "Chuteline=" << line_string << std::endl;
141  std::stringstream line(std::stringstream::in | std::stringstream::out);
142  line << line_string;
143 
144  if (getRestartVersion().compare("1"))
145  {
146  std::string dummy;
147  unsigned int roughBottomType;
148  line >> fixedParticleRadius_ >> roughBottomType >> chuteAngle_
151  setRoughBottomType(static_cast<RoughBottomType>(roughBottomType));
152  }
153  else
154  {
155  std::string dummy;
156  unsigned int roughBottomType;
157  line >> dummy >> fixedParticleRadius_
158  >> dummy >> minInflowParticleRadius_
159  >> dummy >> maxInflowParticleRadius_
160  >> dummy >> roughBottomType
161  >> dummy >> chuteAngle_ >> dummy >> maxFailed_ >> dummy >> dummy
162  >> dummy >> inflowVelocity_ >> dummy >> inflowVelocityVariance_
163  >> dummy >> inflowHeight_;
164  setRoughBottomType(static_cast<RoughBottomType>(roughBottomType));
165  }
166  //if the Chute Angle is given in degrees, move to radians;
167  if (chuteAngle_ > 1.0)
168  chuteAngle_ *= constants::pi / 180.;
169 }
170 
180 void Chute::write(std::ostream& os, bool writeAllParticles) const
181 {
182  MercuryBase::write(os, writeAllParticles);
183  os << " FixedParticleRadius:" << fixedParticleRadius_
184  << ", InflowParticleRadius: [" << minInflowParticleRadius_ << ","
185  << maxInflowParticleRadius_ << "]," << std::endl
186  << " RandomisedBottom:" << roughBottomType_
187  << ", ChuteAngle:" << chuteAngle_ / constants::pi * 180.
188  << ", max_failed:" << maxFailed_ << ", num_created:" << std::endl;
189  if (insertionBoundary_)
190  {
192  }
193  else
194  {
195  os << 0;
196  }
197  os << "," << std::endl
198  << " InflowVelocity:" << inflowVelocity_
199  << ", InflowVelocityVariance:" << inflowVelocityVariance_
200  << ", InflowHeight:" << inflowHeight_ << std::endl;
201 }
202 
208 {
209  cleanChute();
210 }
211 
216 void Chute::printTime() const
217 {
218  std::cout << "\rt=" << std::setprecision(3) << std::left << std::setw(6) << getTime()
219  << ", tmax=" << std::setprecision(3) << std::left << std::setw(6) << getTimeMax()
220  << ", N=" << std::setprecision(3) << std::left << std::setw(6) << particleHandler.getNumberOfObjects()
221  << std::endl;
222  std::cout.flush();
223 }
224 
229 {
231  logger(FATAL, "[Chute::setupInitialConditions()] Chute % cannot complete because no species have been "
232  "defined.", getName());
233 
234  // create the chute's side walls in Y-direction (which are solid if the chute is not periodic)
235  setupSideWalls();
236 
237  // create a particle of which (altered) copies will fill the chute insertion boundary
238  BaseParticle* p = new BaseParticle;
239  p->setSpecies(speciesHandler.getObject(0)); // by default, insert particles of species 0
240 
241  // set up the insertion boundary and add to handler
245 
246  //creates the bottom of the chute
247  createBottom();
248 }
249 
255 {
256  // check if walls should be periodic or solid
257  if (isChutePeriodic_)
258  {
259  // create a periodic boundary with walls at yMin_ and yMax_.
260  PeriodicBoundary b0;
261  b0.set(Vec3D(0.0, 1.0, 0.0), getYMin(), getYMax());
263  }
264  else
265  {
266  // create two infinite solid walls; one at yMin_...
267  InfiniteWall w0;
268  w0.set(Vec3D(0.0,-1.0, 0.0), Vec3D(0, getYMin(), 0));
270  // ... and one at yMax_.
271  w0.set(Vec3D(0.0, 1.0, 0.0), Vec3D(0, getYMax(), 0));
273  }
274 }
275 
289 {
290 
291  if (fabs(getFixedParticleRadius()) < 1e-12 || roughBottomType_ == FLAT) // smooth bottom
292  {
293  // flat wall as bottom
294  logger(INFO,"[Chute::createBottom()] create perfectly flat chute bottom");
295 
296  //bottom wall
297  InfiniteWall w0;
298  w0.set(Vec3D(0.0, 0.0, -1.0), Vec3D(0, 0, getZMin()));
300  }
301  else //rough bottom
302  {
303  // Define standard fixed particle
309  BaseParticle F0;
312  F0.setPosition(Vec3D(0.0, 0.0, 0.0));
313 
315  {
316  // grid-like fixed-particle bottom
317  logger(INFO,"[Chute::createBottom()] create monolayered, ordered rough chute bottom");
318 
319  // allowed space for each particle in each direction
320  Mdouble dx = 2.0 * F0.getRadius();
321  Mdouble dy = 2.0 * F0.getRadius();
322 
323  // number of particles that fit in each direction
324  unsigned int nx = static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((getXMax() - getXMin()) / dx))));
325  unsigned int ny = static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((getYMax() - getYMin()) / dy))));
326 
327  // adjust particle spacing (in case total space available in given direction
328  // is not a multiple of 2*F0.getRadius() )
329  dx = (getXMax() - getXMin()) / nx;
330  dy = (getYMax() - getYMin()) / ny;
331 
332  for (unsigned int i = 0; i < nx; i++)
333  {
334  for (unsigned int j = 0; j < ny; j++)
335  {
336  // placing of particles on rectangular grid points
337  F0.setPosition(Vec3D(F0.getRadius() + dx * i, F0.getRadius() + dy * j, 0.0));
339  }
340  }
341  }
343  {
344  // random fixed-particle bottom
345  logger(INFO,"[Chute::createBottom()] create monolayered disordered rough chute bottom");
346 
347  Vec3D position;
348  position.X = random.getRandomNumber(F0.getRadius(), getXMax() - F0.getRadius());
349  position.Y = random.getRandomNumber(getYMin() + F0.getRadius(), getYMax() - F0.getRadius());
350  F0.setPosition(position);
352 
355 
356  //now add more particles
357  int failed = 0;
358  while (failed < 500)
359  {
360  //The position components are first stored in a Vec3D, because
361  //if you pass them directly into setPosition the compiler is
362  //allowed to change the order in which the numbers are generated
363  position.X = random.getRandomNumber(F0.getRadius(), getXMax() - F0.getRadius());
364  position.Y = random.getRandomNumber(getYMin() + F0.getRadius(), getYMax() - F0.getRadius());
365  F0.setPosition(position);
367  {
369  failed = 0;
370  }
371  else
372  {
373  failed++;
374  }
375  }
376 
377  //bottom wall (create after particle creation, as
378  //checkParticleForInteraction also checks against walls)
379  InfiniteWall w0;
380  w0.set(Vec3D(0.0, 0.0, -1.0), Vec3D(0, 0, getZMin() - .5 * F0.getRadius()));
382  }
383  else //if (roughBottomType_ == MULTILAYER)
384  {
385  // multilayered particle bottom
386  logger(INFO,"[Chute::createBottom()] create multilayered rough chute bottom");
387 
388  //'this' points to the current Chute object, the class of which is inherited
389  // by the ChuteBottom class. I.e., the bottom is created with the particle
390  // properties from the current class.
391  // ChuteBottom::makeRoughBottom() creates a randomly filled, multilayered
392  // chute bottom.
393  ChuteBottom bottom(*this);
395  bottom.makeRoughBottom(*this);
396  }
397  //finally, fix particles to the floor
398  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
399  (*it)->fixParticle();
400  }
401 }
402 
410 {
411  //clean outflow every 100 timesteps
412  static int count = 0, maxcount = 100; // please note: static variables are only initialised once, and their values
413  // are stored even after the method returns. I.e., next time the method is
414  // called, the initialisation is ignored and the previously assigned value is used.
415  if (count > maxcount)
416  {
417  // reset counter
418  count = 0;
419 
420  // check all particles
421  for (unsigned int i = 0; i < particleHandler.getNumberOfObjects();)
422  {
423  // check if particle is outside the problem window
424  if (particleHandler.getObject(i)->getPosition().X > getXMax() || particleHandler.getObject(i)->getPosition().X < getXMin()) //||particleHandler.getObject(i)->Position.Z+particleHandler.getObject(i)->Radius<zMin_)
425  {
426  // if so, delete the particle
427  logger(DEBUG,"[Chute::cleanChute()] erased: %", particleHandler.getObject(i));
429  }
430  else
431  i++;
432  }
433  }
434  else
435  count++;
436 }
437 
444 bool Chute::readNextArgument(int& i, int argc, char* argv[])
445 {
446  if (!strcmp(argv[i], "-inflowHeight"))
447  {
448  setInflowHeight(atof(argv[i + 1]));
449  setZMax(atof(argv[i + 1]));
450  }
451  else if (!strcmp(argv[i], "-inflowVelocity"))
452  {
453  setInflowVelocity(atof(argv[i + 1]));
454  }
455  else if (!strcmp(argv[i], "-chuteAngle"))
456  {
457  setChuteAngle(atof(argv[i + 1]));
458  }
459  else if (!strcmp(argv[i], "-chuteLength"))
460  {
461  setChuteLength(atof(argv[i + 1]));
462  }
463  else if (!strcmp(argv[i], "-chuteWidth"))
464  {
465  setChuteWidth(atof(argv[i + 1]));
466  }
467  else if (!strcmp(argv[i], "-fixedParticleRadius"))
468  {
469  setFixedParticleRadius(atof(argv[i + 1]));
470  }
471  else if (!strcmp(argv[i], "-max_failed"))
472  {
473  setMaxFailed(static_cast<unsigned int>(atoi(argv[i + 1])));
474  }
475  else if (!strcmp(argv[i], "-inflowParticleRadiusRange"))
476  {
477  setInflowParticleRadius(atof(argv[i + 1]), atof(argv[i + 2]));
478  i++;
479  }
480  else if (!strcmp(argv[i], "-inflowParticleRadius"))
481  {
482  setInflowParticleRadius(atof(argv[i + 1]));
483  }
484  else if (!strcmp(argv[i], "-roughBottomType"))
485  {
486  std::string str(argv[i + 1]);
487  setRoughBottomType(str);
488  }
489 // else if (!strcmp(argv[i], "-k_eps"))
490 // {
491 // Mdouble Mass = getLightestParticleMass();
492 // //~ Mdouble Mass = particleHandler.get_LightestParticle()->getMass();
493 // speciesHandler.getObject(0)->setStiffnessAndRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), Mass);
494 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << speciesHandler.getObject(0)->getStiffness() << " and dissipation_=" << speciesHandler.getObject(0)->getDissipation() << std::endl;
495 // i += 1;
496 // }
497 // else if (!strcmp(argv[i], "-tc_eps"))
498 // {
499 // Mdouble Mass = getLightestParticleMass();
500 // speciesHandler.getObject(0)->setCollisionTimeAndRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), Mass);
501 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << speciesHandler.getObject(0)->getStiffness() << " and dissipation_=" << speciesHandler.getObject(0)->getDissipation() << std::endl;
502 // i += 1;
503 // }
504 // else if (!strcmp(argv[i], "-tc_eps_beta"))
505 // {
506 // Mdouble Mass = getLightestParticleMass();
507 // FrictionalSpecies* S = dynamic_cast<FrictionalSpecies*>(speciesHandler.getObject(0));
508 // S->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), atof(argv[i + 3]), Mass);
509 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << S->getStiffness() << ", dissipation_=" << S->getDissipation() << ", kt=" << S->getSlidingStiffness() << " and dispt=" << S->getSlidingDissipation() << std::endl;
510 // i += 2;
511 // }
512  else
513  return Mercury3D::readNextArgument(i, argc, argv); //if argv[i] is not found, check the commands in Mercury3D
514  return true; //returns true if argv[i] is found
515 }
516 
522 {
523  isChutePeriodic_ = true;
524 }
525 
532 {
533  return isChutePeriodic_;
534 }
535 
540 void Chute::setFixedParticleRadius(Mdouble fixedParticleRadius)
541 {
542  if (fixedParticleRadius >= 0.0)
543  fixedParticleRadius_ = fixedParticleRadius;
544  else
545  logger(WARN,"[Chute::setFixedParticleRadius()] Fixed particle radius must be greater than or equal to zero.");
546 }
547 
553 {
554  return fixedParticleRadius_;
555 }
556 
568 {
569  roughBottomType_ = roughBottomType;
570 }
571 
576 void Chute::setRoughBottomType(std::string roughBottomTypeString)
577 {
578  if (!roughBottomTypeString.compare("MONOLAYER_ORDERED"))
579  {
581  }
582  else if (!roughBottomTypeString.compare("MONOLAYER_DISORDERED"))
583  {
585  }
586  else if (!roughBottomTypeString.compare("MULTILAYER"))
587  {
589  }
590  else if (roughBottomTypeString == "FLAT")
591  {
593  }
594  else
595  {
596  logger(FATAL, "[Chute::setRoughBottomType(std::string)] Invalid "
597  "argument in setRoughBottomType. Given: %", roughBottomTypeString);
598  }
599 }
600 
606 {
607  return roughBottomType_;
608 }
609 
617 {
618  // retrieve the magnitude of gravity
619  Mdouble gravity = getGravity().getLength();
620  if (gravity == 0)
621  {
622  logger(WARN, "[Chute::setChuteAngle()] zero gravity");
623  }
624 
625  // reset the gravity vector, with the given angle
626  setChuteAngleAndMagnitudeOfGravity(chuteAngle, gravity);
627 }
628 
638 {
639  if (chuteAngle >= -90.0 && chuteAngle <= 90.0)
640  {
641  chuteAngle_ = chuteAngle * constants::pi / 180.0;
642  setGravity(Vec3D(sin(chuteAngle_), 0.0, -cos(chuteAngle_)) * gravity);
643  }
644  else
645  logger(WARN,"[Chute::setChuteAngleAndMagnitudeOfGravity()] Chute angle "
646  "must be within [-90,90]");
647 }
648 
654 {
655  return chuteAngle_;
656 }
657 
663 {
664  return chuteAngle_ * 180.0 / constants::pi;
665 }
666 
671 void Chute::setMaxFailed(unsigned int maxFailed)
672 {
673  maxFailed_ = maxFailed;
674 }
675 
680 unsigned int Chute::getMaxFailed() const
681 {
682  return maxFailed_;
683 }
684 
691 void Chute::setInflowParticleRadius(Mdouble inflowParticleRadius)
692 {
693  if (inflowParticleRadius >= 0.0)
694  {
695  minInflowParticleRadius_ = inflowParticleRadius;
696  maxInflowParticleRadius_ = inflowParticleRadius;
697  }
698  else
699  {
700  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble)] Inflow "
701  "particle must be greater than or equal to zero");
702  }
703 }
704 
710 void Chute::setInflowParticleRadius(Mdouble minInflowParticleRadius, Mdouble maxInflowParticleRadius)
711 {
712  if (minInflowParticleRadius >= 0.0)
713  {
714  minInflowParticleRadius_ = minInflowParticleRadius;
715  }
716  else
717  {
718  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Min."
719  "inflow particle radius must be nonnegative");
720  }
721  if (maxInflowParticleRadius >= minInflowParticleRadius)
722  {
723  maxInflowParticleRadius_ = maxInflowParticleRadius;
724  }
725  else
726  {
727  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Max."
728  " inflow particle radius must be >= min. inflow particle "
729  "radius");
730  }
731 }
732 
737 void Chute::setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
738 {
739  if (minInflowParticleRadius <= maxInflowParticleRadius_)
740  {
741  minInflowParticleRadius_ = minInflowParticleRadius;
742  }
743  else
744  {
745  logger(WARN,"[Chute::setMinInflowParticleRadius()] Min. inflow particle"
746  " radius must be <= max. inflow particle radius");
747  }
748 }
749 
754 void Chute::setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
755 {
756  if (maxInflowParticleRadius >= minInflowParticleRadius_)
757  {
758  maxInflowParticleRadius_ = maxInflowParticleRadius;
759  }
760  else
761  {
762  logger(WARN,"[Chute::setMaxInflowParticleRadius()] Max. inflow particle"
763  " radius must be >= min. inflow particle radius");
764  }
765 }
766 
772 {
774 }
775 
781 {
783 }
784 
790 {
792 }
793 
799 void Chute::setInflowHeight(Mdouble inflowHeight)
800 {
801  //if (inflowHeight >= minInflowParticleRadius_ + maxInflowParticleRadius_)
802  {
803  inflowHeight_ = inflowHeight;
804  setZMax(1.2 * inflowHeight_);
805  }
806 // else
807 // {
808 // std::cerr << "WARNING : Inflow height not changed to " << inflowHeight << ", value must be greater than or equal to diameter of inflow particle" << std::endl;
809 // }
810 }
811 
817 {
818  return inflowHeight_;
819 }
820 
825 void Chute::setInflowVelocity(Mdouble inflowVelocity)
826 {
827  if (inflowVelocity >= 0.0)
828  {
829  inflowVelocity_ = inflowVelocity;
830  }
831  else
832  {
833  logger(WARN,"[Chute::setInflowVelocity()] Inflow velocity not changed, "
834  "value must be greater than or equal to zero");
835  }
836 }
837 
843 {
844  return inflowVelocity_;
845 }
846 
852 void Chute::setInflowVelocityVariance(Mdouble inflowVelocityVariance)
853 {
854  if (inflowVelocityVariance >= 0.0 && inflowVelocityVariance <= 1.0)
855  {
856  inflowVelocityVariance_ = inflowVelocityVariance;
857  }
858  else
859  {
860  logger(ERROR, "[Chute::setInflowVelocityVariance()] Inflow velocity "
861  "variance not changed, value must be within [0,1]");
862  exit(-1);
863  }
864 }
865 
872 {
874 }
875 
882 {
883  setYMax(chuteWidth);
884 }
885 
892 {
893  return getYMax();
894 }
895 
902 {
903  setXMax(chuteLength);
904 }
905 
912 {
913  return getXMax();
914 }
915 
921 {
922  insertionBoundary_ = insertionBoundary;
923 }
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
Definition: Chute.cc:825
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:799
RoughBottomType
enum for determining the type of rough bottom (if any) of the chute. Either of the enum options can b...
Definition: Chute.h:50
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a periodic wall.
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:309
bool checkParticleForInteraction(const BaseParticle &P) override
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
Definition: MercuryBase.cc:609
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:61
Mdouble X
the vector components
Definition: Vector.h:52
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:637
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:881
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:259
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:224
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:364
void setMaxFailed(unsigned int maxFailed)
Sets the number of times a particle will be tried to be added to the insertion boundary.
Definition: Chute.cc:671
Mdouble getInflowVelocityVariance() const
Returns the inflow velocity variance.
Definition: Chute.cc:871
Used by Chute::createBottom to create an unordered particle layer.
Definition: ChuteBottom.h:39
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:238
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:494
double Mdouble
void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
Sets the maximum radius of inflow particles.
Definition: Chute.cc:754
Mdouble getChuteLength() const
Returns the chute length (X-direction)
Definition: Chute.cc:911
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:338
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:616
void setSpecies(const ParticleSpecies *species)
void hGridActionsBeforeTimeStep() override
Performs all necessary actions before a time-step, like updating the particles and resetting all the ...
Definition: MercuryBase.cc:324
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:431
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
Definition: Chute.h:52
Boundary structure for boundaries used for insertion of particles.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:427
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:567
Mdouble getChuteAngleDegrees() const
Returns the chute angle (in degrees)
Definition: Chute.cc:662
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:482
Defines a pair of periodic walls. Inherits from BaseBoundary.
Mdouble getInflowVelocity() const
Returns the average inflow velocity.
Definition: Chute.cc:842
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:231
Mdouble getInflowParticleRadius() const
Returns the average radius of inflow particles.
Definition: Chute.cc:771
void write(std::ostream &os, bool writeAllParticles=true) const
This function writes the Chute properties to an ostream, and adds the properties of ALL chute particl...
Definition: Chute.cc:180
RoughBottomType getRoughBottomType() const
Returns the type of (rough) bottom of the chute.
Definition: Chute.cc:605
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:324
Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase)...
Definition: Chute.h:62
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Definition: MercuryBase.h:74
Mdouble getMaxInflowParticleRadius() const
Returns the maximum radius of inflow particles.
Definition: Chute.cc:789
void makeRoughBottom(Chute &chute)
Makes a multilayered rough bottom with thickness thickness_.
Definition: ChuteBottom.cc:131
bool getIsPeriodic() const
Returns whether the chute is periodic in Y.
Definition: Chute.cc:531
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes the MercuryBase to an output stream, for example a restart file.
Definition: MercuryBase.cc:132
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:268
const Mdouble pi
Definition: ExtendedMath.h:42
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:888
Mdouble getChuteWidth() const
Returns the chute width (Y-direction)
Definition: Chute.cc:891
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:552
void actionsBeforeTimeStep()
Calls Chute::cleanChute().
Definition: Chute.cc:207
unsigned int getNumberOfParticlesInserted() const
Gets the number of particles inserted by the boundary.
void setupSideWalls()
Creates chute side walls (either solid or periodic)
Definition: Chute.cc:254
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:35
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:415
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
Definition: MercuryBase.cc:419
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:438
bool readNextArgument(int &i, int argc, char *argv[])
This method can be used for reading object properties from a string.
Definition: Chute.cc:444
void setInsertionBoundary(InsertionBoundary *insertionBoundary)
Sets the chute insertion boundary.
Definition: Chute.cc:920
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
Definition: Chute.cc:691
void setInflowVelocityVariance(Mdouble inflowVelocityVariance)
Sets the inflow velocity variance.
Definition: Chute.cc:852
Mdouble getRadius() const
Returns the particle's radius_.
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:868
void hGridActionsBeforeTimeLoop() override
This sets up the broad phase information, has to be done at this stage because it requires the partic...
Definition: MercuryBase.cc:95
void setupInitialConditions()
Creates bottom, side walls and a particle insertion boundary.
Definition: Chute.cc:228
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:114
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:245
Mdouble Y
Definition: Vector.h:52
Mdouble getChuteAngle() const
Returns the chute angle (in radians)
Definition: Chute.cc:653
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:883
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:540
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:873
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
virtual void createBottom()
Creates the chute bottom, which can be either flat or one of three flavours of rough.
Definition: Chute.cc:288
void cleanChute()
Deletes all outflow particles once every 100 time steps.
Definition: Chute.cc:409
void setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
sets the minimum radius of inflow particles
Definition: Chute.cc:737
Chute()
This is the default constructor. All it does is set sensible defaults.
Definition: Chute.cc:42
Mdouble getMinInflowParticleRadius() const
returns the minimum radius of inflow particles
Definition: Chute.cc:780
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:70
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:252
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:901
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
Used for modeling chute inflow. Inherits from InsertionBoundary.
This is a class defining walls.
Definition: InfiniteWall.h:43
void read(std::istream &is) override
Reads the MercuryBase from an input stream, for example a restart file.
Definition: MercuryBase.cc:105
void read(std::istream &is)
Reads all chute properties from an istream.
Definition: Chute.cc:133
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:345
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:359
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
void printTime() const
prints time, max time and number of particles
Definition: Chute.cc:216
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, double radMin, double radMax, double fixedParticleRadius, double inflowVelocity, double inflowVelocityVariance)
Sets all boundary properties at once.
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:158
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:131
virtual void removeObject(unsigned const int id)
Removes a BaseParticle from the ParticleHandler.
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:194
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:521
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:69
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
Definition: Chute.cc:816
unsigned int getMaxFailed() const
Returns the number of times a particle will be tried to be added to the insertion boundary...
Definition: Chute.cc:680
std::string getRestartVersion() const
This is to take into account for different Mercury versions. Returns the version of the restart file...
Definition: DPMBase.cc:501
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333