MercuryDPM  Alpha
 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(DEBUG,"[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 
96 Chute::Chute(const Chute& other)
97  : DPMBase(other), Mercury3D(other),
98  chuteAngle_(other.chuteAngle_),
99  fixedParticleRadius_(other.fixedParticleRadius_),
100  minInflowParticleRadius_(other.minInflowParticleRadius_),
101  maxInflowParticleRadius_(other.maxInflowParticleRadius_),
102  inflowVelocity_(other.inflowVelocity_),
103  inflowVelocityVariance_(other.inflowVelocityVariance_),
104  inflowHeight_(other.inflowHeight_),
105  roughBottomType_(other.roughBottomType_),
106  maxFailed_(other.maxFailed_),
107  insertionBoundary_(other.insertionBoundary_),
108  isChutePeriodic_(other.isChutePeriodic_)
109 {
110  logger(DEBUG,"[Chute::Chute(const Chute& other)] copy constructor finished");
111 }
112 
119 {
120  insertionBoundary_ = nullptr;
121  isChutePeriodic_ = false;
122  setFixedParticleRadius(0.001);
124  setChuteAngle(0.0);
125 
126  setMaxFailed(1);
128  setInflowVelocity(0.1);
130  setInflowHeight(0.02);
131 }
132 
139 void Chute::read(std::istream& is)
140 {
141  MercuryBase::read(is);
142  //read out the full line first, so if there is an error it does not affect
143  //the read of the next line
144  std::string line_string;
145  std::getline(is, line_string);
146  std::cout << "Chuteline=" << line_string << std::endl;
147  std::stringstream line(std::stringstream::in | std::stringstream::out);
148  line << line_string;
149 
150  if (getRestartVersion() != "1") //Other versions..
151  {
152  std::string dummy;
153  unsigned int roughBottomType;
154  line >> fixedParticleRadius_
155  >> roughBottomType >> chuteAngle_
158  >> maxFailed_
159  >> dummy
160  >> inflowVelocity_
162  >> inflowHeight_;
163  setRoughBottomType(static_cast<RoughBottomType>(roughBottomType));
164  //if the Chute Angle is given in degrees, move to radians;
165  if (chuteAngle_ > 1.0) {
166  logger(WARN, "Restartfile angle converted into radians from degrees! (% rad -> % deg)", chuteAngle_, chuteAngle_ * constants::pi / 180.);
167  chuteAngle_ *= constants::pi / 180.;
168 
169  }
170  }
171  else //Version 1
172  {
173  std::string dummy;
174  unsigned int roughBottomType;
175  line >> dummy >> fixedParticleRadius_
176  >> dummy >> minInflowParticleRadius_
177  >> dummy >> maxInflowParticleRadius_
178  >> dummy >> roughBottomType
179  >> dummy >> chuteAngle_
180  >> dummy >> maxFailed_
181  >> dummy >> dummy
182  >> dummy >> inflowVelocity_
183  >> dummy >> inflowVelocityVariance_
184  >> dummy >> inflowHeight_;
185  setRoughBottomType(static_cast<RoughBottomType>(roughBottomType));
186  //This version always writes radians
187  }
188 
189 }
190 
204 void Chute::write(std::ostream& os, bool writeAllParticles) const
205 {
206  MercuryBase::write(os, writeAllParticles);
207  os << "FixedParticleRadius " << fixedParticleRadius_
208  << " MinInflowParticleRadius " << minInflowParticleRadius_
209  << " MaxInflowParticleRadius " << maxInflowParticleRadius_
210  << " RoughBottomType " << roughBottomType_
211  << " ChuteAngle " << chuteAngle_
212  << " MaxFailed " << maxFailed_
214  << " InflowVelocity " << inflowVelocity_
215  << " InflowVelocityVariance " << inflowVelocityVariance_
216  << " InflowHeight " << inflowHeight_ << std::endl;
217 }
218 
224 {
225  cleanChute();
226 }
227 
233 void Chute::printTime() const
234 {
235  std::cout << "\rt=" << std::setprecision(3) << std::left << std::setw(6)
236  << getTime()
237  << ", tmax=" << std::setprecision(3) << std::left << std::setw (6) << getTimeMax()
238  << ", N=" << std::setprecision(3) << std::left << std::setw(6)
240  << std::endl;
241  std::cout.flush();
242 }
243 
248 {
250  {
251  logger(FATAL, "[Chute::setupInitialConditions()] Chute % cannot "
252  "complete because no species have been defined.", getName());
253  }
254 
255  // create the chute's side walls in Y-direction
256  // (which are solid if the chute is not periodic)
257  setupSideWalls();
258 
259  // create a particle of which (altered) copies will fill the chute insertion
260  // boundary
261  BaseParticle* p = new BaseParticle;
262  // by default, insert particles of species 0
264 
265  // set up the insertion boundary and add to handler
267  b1.set(p, maxFailed_, Vec3D(getXMin(), getYMin(), getZMin()),
268  Vec3D(getXMax(), getYMax(), getZMax()),
272 
273  //creates the bottom of the chute
274  createBottom();
275 }
276 
282 {
283  // check if walls should be periodic or solid
284  if (isChutePeriodic_)
285  {
286  // create a periodic boundary with walls at yMin_ and yMax_.
287  PeriodicBoundary b0;
288  b0.set(Vec3D(0.0, 1.0, 0.0), getYMin(), getYMax());
290  }
291  else
292  {
293  // create two infinite solid walls; one at yMin_...
294  InfiniteWall w0;
296  w0.set(Vec3D(0.0,-1.0, 0.0), Vec3D(0, getYMin(), 0));
298  // ... and one at yMax_.
299  w0.set(Vec3D(0.0, 1.0, 0.0), Vec3D(0, getYMax(), 0));
301  }
302 }
303 
317 {
318  // smooth bottom:
319  if (fabs(getFixedParticleRadius()) < 1e-12 || roughBottomType_ == FLAT)
320  {
321  // flat wall as bottom
322  logger(INFO,"[Chute::createBottom()] create perfectly flat chute bottom");
323 
324  //bottom wall
325  InfiniteWall w0;
327  w0.set(Vec3D(0.0, 0.0, -1.0), Vec3D(0, 0, getZMin()));
329  }
330  else //rough bottom
331  {
332  // Define standard fixed particle
338  BaseParticle F0;
342  F0.setPosition(Vec3D(0.0, 0.0, 0.0));
343  F0.setVelocity(Vec3D(0.0, 0.0, 0.0));
344 
346  {
347  // grid-like fixed-particle bottom
348  logger(INFO,"[Chute::createBottom()] create monolayered, ordered rough chute bottom");
349 
350  // allowed space for each particle in each direction
351  Mdouble dx = 2.0 * F0.getRadius();
352  Mdouble dy = 2.0 * F0.getRadius();
353 
354  // number of particles that fit in each direction
355  unsigned int nx = static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((getXMax() - getXMin()) / dx))));
356  unsigned int ny = static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((getYMax() - getYMin()) / dy))));
357 
358  // adjust particle spacing (in case total space available in given direction
359  // is not a multiple of 2*F0.getRadius() )
360  dx = (getXMax() - getXMin()) / nx;
361  dy = (getYMax() - getYMin()) / ny;
362 
363  for (unsigned int i = 0; i < nx; i++)
364  {
365  for (unsigned int j = 0; j < ny; j++)
366  {
367  // placing of particles on rectangular grid points
368  F0.setPosition(Vec3D(F0.getRadius() + dx * i, F0.getRadius() + dy * j, 0.0));
370  }
371  }
372  }
374  {
375  // random fixed-particle bottom
376  logger(INFO,"[Chute::createBottom()] create monolayered disordered rough chute bottom");
377 
378  Vec3D position;
379  position.X = random.getRandomNumber(F0.getRadius(), getXMax() - F0.getRadius());
380  position.Y = random.getRandomNumber(getYMin() + F0.getRadius(), getYMax() - F0.getRadius());
381  F0.setPosition(position);
383 
386 
387  //now add more particles
388  int failed = 0;
389  while (failed < 500)
390  {
391  //The position components are first stored in a Vec3D, because
392  //if you pass them directly into setPosition the compiler is
393  //allowed to change the order in which the numbers are generated
394  position.X = random.getRandomNumber(F0.getRadius(), getXMax() - F0.getRadius());
395  position.Y = random.getRandomNumber(getYMin() + F0.getRadius(), getYMax() - F0.getRadius());
396  F0.setPosition(position);
398  {
400  failed = 0;
401  }
402  else
403  {
404  failed++;
405  }
406  }
407 
408  //bottom wall (create after particle creation, as
409  //checkParticleForInteraction also checks against walls)
410  InfiniteWall w0;
412  w0.set(Vec3D(0.0, 0.0, -1.0), Vec3D(0, 0, getZMin() - .5 * F0.getRadius()));
414  }
415  else //if (roughBottomType_ == MULTILAYER)
416  {
417  // multilayered particle bottom
418  logger(INFO,"[Chute::createBottom()] create multilayered rough chute bottom");
419 
420  //'this' points to the current Chute object, the class of which is inherited
421  // by the ChuteBottom class. I.e., the bottom is created with the particle
422  // properties from the current class.
423  // ChuteBottom::makeRoughBottom() creates a randomly filled, multilayered
424  // chute bottom.
425  ChuteBottom bottom(*this);
427  bottom.makeRoughBottom(*this);
428  }
429  //finally, fix particles to the bottom
430  for (BaseParticle* p : particleHandler)
431  {
432  p->fixParticle();
433  }
434  }
435 }
436 
444 {
445  //clean outflow every 100 timesteps
446  static int count = 0, maxcount = 100; // please note: static variables are only initialised once, and their values
447  // are stored even after the method returns. I.e., next time the method is
448  // called, the initialisation is ignored and the previously assigned value is used.
449  if (count > maxcount)
450  {
451  // reset counter
452  count = 0;
453 
454  // check all particles
455  for (unsigned int i = 0; i < particleHandler.getNumberOfObjects();)
456  {
457  // check if particle is outside the problem window
458  if (particleHandler.getObject(i)->getPosition().X > getXMax() || particleHandler.getObject(i)->getPosition().X < getXMin()) //||particleHandler.getObject(i)->Position.Z+particleHandler.getObject(i)->Radius<zMin_)
459  {
460  // if so, delete the particle
461  logger(DEBUG,"[Chute::cleanChute()] erased: %", particleHandler.getObject(i));
463  }
464  else
465  {
466  i++;
467  }
468  }
469  }
470  else
471  {
472  count++;
473  }
474 }
475 
487 bool Chute::readNextArgument(int& i, int argc, char* argv[])
488 {
489  if (!strcmp(argv[i], "-inflowHeight"))
490  {
491  setInflowHeight(atof(argv[i + 1]));
492  setZMax(atof(argv[i + 1]));
493  }
494  else if (!strcmp(argv[i], "-inflowVelocity"))
495  {
496  setInflowVelocity(atof(argv[i + 1]));
497  }
498  else if (!strcmp(argv[i], "-chuteAngle"))
499  {
500  setChuteAngle(atof(argv[i + 1]));
501  }
502  else if (!strcmp(argv[i], "-chuteLength"))
503  {
504  setChuteLength(atof(argv[i + 1]));
505  }
506  else if (!strcmp(argv[i], "-chuteWidth"))
507  {
508  setChuteWidth(atof(argv[i + 1]));
509  }
510  else if (!strcmp(argv[i], "-fixedParticleRadius"))
511  {
512  setFixedParticleRadius(atof(argv[i + 1]));
513  }
514  else if (!strcmp(argv[i], "-max_failed"))
515  {
516  setMaxFailed(static_cast<unsigned int>(atoi(argv[i + 1])));
517  }
518  else if (!strcmp(argv[i], "-inflowParticleRadiusRange"))
519  {
520  setInflowParticleRadius(atof(argv[i + 1]), atof(argv[i + 2]));
521  i++;
522  }
523  else if (!strcmp(argv[i], "-inflowParticleRadius"))
524  {
525  setInflowParticleRadius(atof(argv[i + 1]));
526  }
527  else if (!strcmp(argv[i], "-roughBottomType"))
528  {
529  std::string str(argv[i + 1]);
530  setRoughBottomType(str);
531  }
532 // else if (!strcmp(argv[i], "-k_eps"))
533 // {
534 // Mdouble Mass = getLightestParticleMass();
535 // //~ Mdouble Mass = particleHandler.get_LightestParticle()->getMass();
536 // speciesHandler.getObject(0)->setStiffnessAndRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), Mass);
537 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << speciesHandler.getObject(0)->getStiffness() << " and dissipation_=" << speciesHandler.getObject(0)->getDissipation() << std::endl;
538 // i += 1;
539 // }
540 // else if (!strcmp(argv[i], "-tc_eps"))
541 // {
542 // Mdouble Mass = getLightestParticleMass();
543 // speciesHandler.getObject(0)->setCollisionTimeAndRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), Mass);
544 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << speciesHandler.getObject(0)->getStiffness() << " and dissipation_=" << speciesHandler.getObject(0)->getDissipation() << std::endl;
545 // i += 1;
546 // }
547 // else if (!strcmp(argv[i], "-tc_eps_beta"))
548 // {
549 // Mdouble Mass = getLightestParticleMass();
550 // FrictionalSpecies* S = dynamic_cast<FrictionalSpecies*>(speciesHandler.getObject(0));
551 // S->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), atof(argv[i + 3]), Mass);
552 // 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;
553 // i += 2;
554 // }
555  else
556  return Mercury3D::readNextArgument(i, argc, argv); //if argv[i] is not found, check the commands in Mercury3D
557  return true; //returns true if argv[i] is found
558 }
559 
565 {
566  isChutePeriodic_ = true;
567 }
568 
575 {
576  return isChutePeriodic_;
577 }
578 
585 void Chute::setFixedParticleRadius(Mdouble fixedParticleRadius)
586 {
587  if (fixedParticleRadius >= 0.0)
588  {
589  fixedParticleRadius_ = fixedParticleRadius;
590  }
591  else
592  {
593  logger(WARN, "[Chute::setFixedParticleRadius()] Fixed particle radius "
594  "must be greater than or equal to zero.");
595  }
596 }
597 
604 {
605  return fixedParticleRadius_;
606 }
607 
619 {
620  roughBottomType_ = roughBottomType;
621 }
622 
627 void Chute::setRoughBottomType(std::string roughBottomTypeString)
628 {
629  if (!roughBottomTypeString.compare("MONOLAYER_ORDERED"))
630  {
632  }
633  else if (!roughBottomTypeString.compare("MONOLAYER_DISORDERED"))
634  {
636  }
637  else if (!roughBottomTypeString.compare("MULTILAYER"))
638  {
640  }
641  else if (roughBottomTypeString == "FLAT")
642  {
644  }
645  else
646  {
647  logger(FATAL, "[Chute::setRoughBottomType(std::string)] Invalid "
648  "argument in setRoughBottomType. Given: %",
649  roughBottomTypeString);
650  }
651 }
652 
659 {
660  return roughBottomType_;
661 }
662 
673 {
674  // retrieve the magnitude of gravity
675  Mdouble gravity = getGravity().getLength();
676  if (gravity == 0)
677  {
678  logger(WARN, "[Chute::setChuteAngle()] zero gravity");
679  }
680 
681  // reset the gravity vector, with the given angle
682  setChuteAngleAndMagnitudeOfGravity(chuteAngle, gravity);
683 }
684 
694 {
695  if (chuteAngle >= -90.0 && chuteAngle <= 90.0)
696  {
697  chuteAngle_ = chuteAngle * constants::pi / 180.0;
698  setGravity(Vec3D(sin(chuteAngle_), 0.0, -cos(chuteAngle_)) * gravity);
699  }
700  else
701  {
702  logger(WARN, "[Chute::setChuteAngleAndMagnitudeOfGravity()] Chute "
703  "angle must be within [-90,90]");
704  }
705 }
706 
712 {
713  return chuteAngle_;
714 }
715 
721 {
722  return chuteAngle_ * 180.0 / constants::pi;
723 }
724 
731 void Chute::setMaxFailed(unsigned int maxFailed)
732 {
733  maxFailed_ = maxFailed;
734 }
735 
741 unsigned int Chute::getMaxFailed() const
742 {
743  return maxFailed_;
744 }
745 
752 void Chute::setInflowParticleRadius(Mdouble inflowParticleRadius)
753 {
754  if (inflowParticleRadius >= 0.0)
755  {
756  minInflowParticleRadius_ = inflowParticleRadius;
757  maxInflowParticleRadius_ = inflowParticleRadius;
758  }
759  else
760  {
761  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble)] Inflow "
762  "particle must be greater than or equal to zero");
763  }
764 }
765 
771 void Chute::setInflowParticleRadius(Mdouble minInflowParticleRadius,
772  Mdouble maxInflowParticleRadius)
773 {
774  if (minInflowParticleRadius >= 0.0)
775  {
776  minInflowParticleRadius_ = minInflowParticleRadius;
777  }
778  else
779  {
780  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Min."
781  "inflow particle radius must be nonnegative");
782  }
783  if (maxInflowParticleRadius >= minInflowParticleRadius)
784  {
785  maxInflowParticleRadius_ = maxInflowParticleRadius;
786  }
787  else
788  {
789  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Max."
790  " inflow particle radius must be >= min. inflow particle "
791  "radius");
792  }
793 }
794 
799 void Chute::setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
800 {
801  if (minInflowParticleRadius <= maxInflowParticleRadius_)
802  {
803  minInflowParticleRadius_ = minInflowParticleRadius;
804  }
805  else
806  {
807  logger(WARN,"[Chute::setMinInflowParticleRadius()] Min. inflow particle"
808  " radius must be <= max. inflow particle radius");
809  }
810 }
811 
816 void Chute::setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
817 {
818  if (maxInflowParticleRadius >= minInflowParticleRadius_)
819  {
820  maxInflowParticleRadius_ = maxInflowParticleRadius;
821  }
822  else
823  {
824  logger(WARN,"[Chute::setMaxInflowParticleRadius()] Max. inflow particle"
825  " radius must be >= min. inflow particle radius");
826  }
827 }
828 
834 {
836 }
837 
843 {
845 }
846 
852 {
854 }
855 
861 void Chute::setInflowHeight(Mdouble inflowHeight)
862 {
863  //if (inflowHeight >= minInflowParticleRadius_ + maxInflowParticleRadius_)
864  {
865  inflowHeight_ = inflowHeight;
866  setZMax(1.2 * inflowHeight_);
867  }
868 // else
869 // {
870 // std::cerr << "WARNING : Inflow height not changed to " << inflowHeight << ", value must be greater than or equal to diameter of inflow particle" << std::endl;
871 // }
872 }
873 
879 {
880  return inflowHeight_;
881 }
882 
887 void Chute::setInflowVelocity(Mdouble inflowVelocity)
888 {
889  if (inflowVelocity >= 0.0)
890  {
891  inflowVelocity_ = inflowVelocity;
892  }
893  else
894  {
895  logger(WARN,"[Chute::setInflowVelocity()] Inflow velocity not changed, "
896  "value must be greater than or equal to zero");
897  }
898 }
899 
905 {
906  return inflowVelocity_;
907 }
908 
914 void Chute::setInflowVelocityVariance(Mdouble inflowVelocityVariance)
915 {
916  if (inflowVelocityVariance >= 0.0 && inflowVelocityVariance <= 1.0)
917  {
918  inflowVelocityVariance_ = inflowVelocityVariance;
919  }
920  else
921  {
922  logger(ERROR, "[Chute::setInflowVelocityVariance()] Inflow velocity "
923  "variance not changed, value must be within [0,1]");
924  exit(-1);
925  }
926 }
927 
934 {
936 }
937 
944 {
945  setYMax(chuteWidth);
946 }
947 
954 {
955  return getYMax();
956 }
957 
964 {
965  setXMax(chuteLength);
966 }
967 
974 {
975  return getXMax();
976 }
977 
983 {
984  insertionBoundary_ = insertionBoundary;
985 }
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
Definition: Chute.cc:887
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:861
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:415
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:65
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:693
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:357
virtual void removeObject(unsigned const int index)
Removes a BaseParticle from the ParticleHandler.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:943
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:331
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:366
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:731
Mdouble getInflowVelocityVariance() const
Returns the inflow velocity variance.
Definition: Chute.cc:933
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:295
double Mdouble
void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
Sets the maximum radius of inflow particles.
Definition: Chute.cc:816
Mdouble getChuteLength() const
Returns the chute length (X-direction)
Definition: Chute.cc:973
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:439
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:672
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:537
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:414
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:618
Mdouble getChuteAngleDegrees() const
Returns the chute angle (in degrees)
Definition: Chute.cc:720
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:60
Defines a pair of periodic walls. Inherits from BaseBoundary.
Mdouble getInflowVelocity() const
Returns the average inflow velocity.
Definition: Chute.cc:904
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
Mdouble getInflowParticleRadius() const
Returns the average radius of inflow particles.
Definition: Chute.cc:833
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:204
RoughBottomType getRoughBottomType() const
Returns the type of (rough) bottom of the chute.
Definition: Chute.cc:658
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:427
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:127
Mdouble getMaxInflowParticleRadius() const
Returns the maximum radius of inflow particles.
Definition: Chute.cc:851
void makeRoughBottom(Chute &chute)
Makes a multilayered rough bottom with thickness thickness_.
Definition: ChuteBottom.cc:132
bool getIsPeriodic() const
Returns whether the chute is periodic in Y.
Definition: Chute.cc:574
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:42
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
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:1011
Mdouble getChuteWidth() const
Returns the chute width (Y-direction)
Definition: Chute.cc:953
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:603
void actionsBeforeTimeStep()
Calls Chute::cleanChute().
Definition: Chute.cc:223
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:281
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:1001
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
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:352
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:545
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:295
bool readNextArgument(int &i, int argc, char *argv[])
This method can be used for reading object properties from a string.
Definition: Chute.cc:487
void setInsertionBoundary(InsertionBoundary *insertionBoundary)
Sets the chute insertion boundary.
Definition: Chute.cc:982
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
Definition: Chute.cc:752
void setInflowVelocityVariance(Mdouble inflowVelocityVariance)
Sets the inflow velocity variance.
Definition: Chute.cc:914
Mdouble getRadius() const
Returns the particle's radius_.
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
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:247
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:118
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
Mdouble Y
Definition: Vector.h:52
Mdouble getChuteAngle() const
Returns the chute angle (in radians)
Definition: Chute.cc:711
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:585
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
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:316
void cleanChute()
Deletes all outflow particles once every 100 time steps.
Definition: Chute.cc:443
void setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
sets the minimum radius of inflow particles
Definition: Chute.cc:799
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:842
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:79
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:963
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:339
Used for modeling chute inflow. Inherits from InsertionBoundary.
This is a class defining walls.
Definition: InfiniteWall.h:47
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:139
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:347
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:361
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:323
void printTime() const
prints time, max time and number of particles
Definition: Chute.cc:233
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:327
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:343
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:132
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:214
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:564
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:101
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
Definition: Chute.cc:878
void setSpecies(const ParticleSpecies *species)
Define the species of this wall.
Definition: BaseWall.cc:113
unsigned int getMaxFailed() const
Returns the number of times a particle will be tried to be added to the insertion boundary...
Definition: Chute.cc:741
std::string getRestartVersion() const
This is to take into account for different Mercury versions. Returns the version of the restart file...
Definition: DPMBase.cc:608
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:335