MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChuteWithHopper.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 "ChuteWithHopper.h"
29 #include <cstring>
30 #include <cmath>
31 
32 //This is a copy constructor for Chute problems
34 
42  : DPMBase(other), Chute(other)
43 {
44  constructor();
45 }
46 
55  : DPMBase(other), Chute(other)
56 {
57  constructor();
58 }
59 
68  : DPMBase(other), Chute(other)
69 {
70  constructor();
71 }
72 
81  : DPMBase(other), Chute(other)
82 {
83  constructor();
84 }
85 
90 {
91  constructor();
92 }
93 
98 {
100  hopperLift_ = 0.0;
101  setHopper(0.01, 0.01, 60.0, 0.08, 0.04);
102  hopperShift_ = 0.0;
103  hopperDimension_ = 1;
105 
107  isHopperCentred_ = false;
108 
109 }
110 
119 {
120  hopperFillingPercentage_ = hopperFillingPercentage;
121 }
122 
131 {
132 
133  // check time step ratio
135 
136  // create chute side walls (either periodic or solid, based on (the inherited)
137  // boolean Chute::isChutePeriodic_ data member).
138  setupSideWalls();
139 
140  // create insertion boundary for the hopper and set a fill percentage
142  BaseParticle* p1 = new BaseParticle();
148  setInsertionBoundary(dynamic_cast<InsertionBoundary*>(boundaryHandler.getLastObject()));
149 
150  // create the chute bottom
151  createBottom();
152 
153  // create the hopper
154  addHopper();
155 }
156 
162 {
163  //hopper walls
164  //to create the finite hopper walls, we take vector between two wall points in xz-plane, then rotate clockwise and make unit length
165  // A\ /A
166  // \ / A,B,C denote three points on the left and right hopper walls which are used to construct the hopper
167  // \ / shift denotes the space by which the chute has to be shifted to the right such that the hopper is in the domain
168  // B| |B
169  // | |
170  // C| |
171  // |C
172 
173  Vec3D A, B, C, temp, normal;
174 
175  const Mdouble s = mathsFunc::sin(getChuteAngle());
176  const Mdouble c = mathsFunc::cos(getChuteAngle());
177  // height of the lowest part of the hopper (right C in diagram above) as compared to
178  // the vertical position of the start of the chute (left C in diagram above).
180 
181  // "0.5*(hopperLength_+hopperExitLength_) / tan(hopperAngle_)" is the minimum heigth of the hopper, to make sure things should flow down and not to the sides.
182  // hopperHeight_ is now an input variable
183  // hopperHeight_ = hopperLowestPoint_ + 1.1 * 0.5*(hopperLength_+hopperExitLength_) / tan(hopperAngle_);
184 
185  const Mdouble HopperCornerHeight = hopperHeight_ - 0.5 * (hopperLength_ - hopperExitLength_) / mathsFunc::tan(getChuteAngle());
187  //if (HopperCornerHeight<=0.0) { hopperHeight_ += -HopperCornerHeight + P0.getRadius(); HopperCornerHeight = P0.getRadius(); }
188 
189  // first we create the LEFT hopper wall
190 
191  // coordinates of A,B,C in (vertical parallel to flow, vertical normal to flow, horizontal) direction
192  A = Vec3D(-0.5 * (hopperLength_ - hopperExitLength_), 0.0, hopperHeight_);
193  B = Vec3D(0.0, 0.0, HopperCornerHeight);
194  C = Vec3D(0.0, 0.0, 0.0);
195 
196  // now rotate the coordinates of A,B,C to be in (x,y,z) direction
197  A = Vec3D(c * A.X - s * A.Z, 0.0, s * A.X + c * A.Z);
198  B = Vec3D(c * B.X - s * B.Z, 0.0, s * B.X + c * B.Z);
199  C = Vec3D(c * C.X - s * C.Z, 0.0, s * C.X + c * C.Z);
200 
201  // the position of A determines hopper shift and zmax
207  if (isHopperCentred_)
208  {
209  setHopperShift(-A.X + 40);
210  }
211  else
212  {
213  setHopperShift(-A.X);
214  }
215 
216  setZMax(A.Z);
217  A.X += hopperShift_;
218  B.X += hopperShift_;
219  C.X += hopperShift_;
220 
221  //This lifts the hopper a distance above the chute
222  A.Z += hopperLift_;
223  B.Z += hopperLift_;
224  C.Z += hopperLift_;
225 
226  //create a finite wall from B to A and from C to B on the left hand side
227  IntersectionOfWalls w_Left;
229  temp = B - A;
230  normal = Vec3D(temp.Z, 0.0, -temp.X) / std::sqrt(temp.getLengthSquared());
231  w_Left.addObject(normal, A);
232  temp = C - B;
233  normal = Vec3D(temp.Z, 0.0, -temp.X) / std::sqrt(temp.getLengthSquared());
234  w_Left.addObject(normal, B);
235  temp = A - C;
236  normal = Vec3D(temp.Z, 0.0, -temp.X) / std::sqrt(temp.getLengthSquared());
237  w_Left.addObject(normal, C);
239 
240  //next, do the same for the right wall
242  B = Vec3D(0.5 * (hopperLength_ + hopperExitLength_) - 0.5 * (hopperLength_ - hopperExitLength_), 0.0, HopperCornerHeight);
244 
245  //This rotates the right points
246  A = Vec3D(c * A.X - s * A.Z + hopperShift_, 0.0, s * A.X + c * A.Z);
247  B = Vec3D(c * B.X - s * B.Z + hopperShift_, 0.0, s * B.X + c * B.Z);
248  C = Vec3D(c * C.X - s * C.Z + hopperShift_, 0.0, s * C.X + c * C.Z);
249 
250  //This lifts the hopper a distance above the chute
251  A.Z += hopperLift_;
252  B.Z += hopperLift_;
253  C.Z += hopperLift_;
254 
255  //create a finite wall from B to A and from C to B on the right hand side
256  IntersectionOfWalls w_Right;
257  w_Right.setSpecies(speciesHandler.getObject(0));
258  temp = A - B;
259  normal = Vec3D(temp.Z, 0.0, -temp.X) / std::sqrt(temp.getLengthSquared());
260  w_Right.addObject(normal, A);
261  temp = B - C;
262  normal = Vec3D(temp.Z, 0.0, -temp.X) / std::sqrt(temp.getLengthSquared());
263  w_Right.addObject(normal, B);
264  temp = C - A;
265  normal = Vec3D(temp.Z, 0.0, -temp.X) / std::sqrt(temp.getLengthSquared());
266  w_Right.addObject(normal, C);
267  wallHandler.copyAndAddObject(w_Right);
268 
269  setZMax(A.Z);
270 
271  // if hopperDimension_ == 2, create inclined hopper walls (like in the X-direction) also in the Y-direction.
272  // (Else, place vertical (possibly periodic) walls in Y-direction. -> not mentioned here, where is this arranged? (BvdH))
273  if (hopperDimension_ == 2)
274  {
275  //coordinates of A,B,C in (vertical parallel to flow,vertical normal to flow, horizontal) direction
276  A = Vec3D(0.0, (getYMax() - getYMin() - hopperLength_) / 2.0, hopperHeight_);
277  B = Vec3D(0.0, (getYMax() - getYMin() - hopperExitLength_) / 2.0, HopperCornerHeight);
278  C = Vec3D(0.0, (getYMax() - getYMin() - hopperExitLength_) / 2.0, 0.0);
279 
280  //now rotate the coordinates of A,B,C to be in (x,y,z) direction
281  A = Vec3D(c * A.X - s * A.Z, A.Y, s * A.X + c * A.Z);
282  B = Vec3D(c * B.X - s * B.Z, B.Y, s * B.X + c * B.Z);
283  C = Vec3D(c * C.X - s * C.Z, C.Y, s * C.X + c * C.Z);
284  // the position of A determines shift and zmax
285  A.X += hopperShift_;
286  B.X += hopperShift_;
287  C.X += hopperShift_;
288 
289  //This lifts the hopper a distance above the chute
290  A.Z += hopperLift_;
291  B.Z += hopperLift_;
292  C.Z += hopperLift_;
293 
294  //create a finite wall from B to A and from C to B
295  IntersectionOfWalls w_Back;
296  temp = B - A;
297  normal = Vec3D::cross(Vec3D(-c, 0, -s), temp) / std::sqrt(temp.getLengthSquared());
298  //normal = Vec3D(0.0,temp.Z,-temp.Y) / std::sqrt(temp.GetLength2());
299  w_Back.addObject(normal, A);
300  temp = C - B;
301  //normal = Vec3D(0.0,temp.Z,-temp.Y) / std::sqrt(temp.GetLength2());
302  normal = Vec3D::cross(Vec3D(-c, 0, -s), temp) / std::sqrt(temp.getLengthSquared());
303  w_Back.addObject(normal, B);
304  temp = A - C;
305  //normal = Vec3D(0.0,temp.Z,-temp.Y)/std::sqrt(temp.GetLength2());
306  normal = Vec3D::cross(Vec3D(-c, 0, -s), temp) / std::sqrt(temp.getLengthSquared());
307  w_Back.addObject(normal, C);
309 
310  //Now for the right y-wall
311  A = Vec3D(0.0, (getYMax() - getYMin() + hopperLength_) / 2.0, hopperHeight_);
312  B = Vec3D(0.0, (getYMax() - getYMin() + hopperExitLength_) / 2.0, HopperCornerHeight);
313  C = Vec3D(0.0, (getYMax() - getYMin() + hopperExitLength_) / 2.0, 0.0);
314 
315  //now rotate the coordinates of A,B,C to be in (x,y,z) direction
316  A = Vec3D(c * A.X - s * A.Z, A.Y, s * A.X + c * A.Z);
317  B = Vec3D(c * B.X - s * B.Z, B.Y, s * B.X + c * B.Z);
318  C = Vec3D(c * C.X - s * C.Z, C.Y, s * C.X + c * C.Z);
319  // the position of A determines shift and zmax
320  A.X += hopperShift_;
321  B.X += hopperShift_;
322  C.X += hopperShift_;
323 
324  //This lifts the hopper a distance above the chute
325  A.Z += hopperLift_;
326  B.Z += hopperLift_;
327  C.Z += hopperLift_;
328 
329  //create a finite wall from B to A and from C to B
330  IntersectionOfWalls w_Front;
331  temp = A - B;
332  normal = Vec3D::cross(Vec3D(-c, 0, -s), temp) / std::sqrt(temp.getLengthSquared());
333  //normal = Vec3D(0.0,-temp.Z,temp.Y) / std::sqrt(temp.GetLength2());
334  w_Front.addObject(normal, A);
335  temp = B - C;
336  //normal = Vec3D(0.0,-temp.Z,temp.Y) / std::sqrt(temp.GetLength2());
337  normal = Vec3D::cross(Vec3D(-c, 0, -s), temp) / std::sqrt(temp.getLengthSquared());
338  w_Front.addObject(normal, B);
339  temp = C - A;
340  //normal = Vec3D(0.0,-temp.Z,temp.Y)/std::sqrt(temp.GetLength2());
341  normal = Vec3D::cross(Vec3D(-c, 0, -s), temp) / std::sqrt(temp.getLengthSquared());
342  w_Front.addObject(normal, C);
343  wallHandler.copyAndAddObject(w_Front);
344  }
345 
346  //now shift the chute as well, i.e. apply the shift to all the fixed particles
347  // at the bottom of the chute
348  for (BaseParticle* particle : particleHandler)
349  {
350  particle->move(Vec3D(hopperShift_, 0.0, 0.0));
351  }
352 }
353 
360 {
361  hopperLowestPoint_ = hopperLowestPoint;
362 }
363 
365 {
366  return hopperLowestPoint_;
367 }
368 
381 void ChuteWithHopper::setHopper(Mdouble exitLength, Mdouble exitHeight, Mdouble angle, Mdouble length, Mdouble height)
382 {
383  // hopperCornerHeight: helper variable, just here to check some things
384  const Mdouble hopperCornerHeight = height - 0.5 * (length - exitLength) / mathsFunc::tan(angle * constants::pi / 180.0);
385 
386  if (exitLength >= 0.0)
387  {
388  hopperExitLength_ = exitLength;
389  }
390  else
391  {
392  logger(ERROR,"[ChuteWithHopper::setHopper()] Hopper exit length must be greater than or equal to zero");
393  exit(-1);
394  }
395 
396  // hopperExitHeight_
397  if (exitHeight < 0.0)
398  {
399  logger(ERROR,"[ChuteWithHopper::setHopper()] Hopper exit height must be greater than or equal to zero");
400  exit(-1);
401  }
402  else if(exitHeight > hopperCornerHeight + mathsFunc::tan(getChuteAngle()) * exitLength)
403  {
404  logger(ERROR, "[ChuteWithHopper::setHopper()] Hopper exit height (%) may not exceed height of hopper corner above chute bottom (%)",
405  exitHeight, hopperCornerHeight + mathsFunc::tan(getChuteAngle()) * exitLength);
406  exit(-1);
407  }
408  else //(exitHeight >= 0.0) /// \todo write check: exitHeight may NOT exceed vertical distance between chute base and hopper corner!
409  {
410  hopperExitHeight_ = exitHeight;
411  }
412 
414 
415  if (angle > 0.0 && angle < 90.0)
416  {
417  hopperAngle_ = angle * constants::pi / 180.0;
418  }
419  else
420  {
421  logger(ERROR,"[ChuteWithHopper::setHopper()] Hopper angle must in (0,90)");
422  exit(-1);
423  }
424 
425  if (length > exitLength)
426  {
427  hopperLength_ = length;
428  }
429  else
430  {
431  logger(ERROR,"[ChuteWithHopper::setHopper()] Hopper length must be greater than exit length");
432  exit(-1);
433  }
434 
435  // check hopper 'corner height', i.e. the vertical position of point 'B' as compared to the start of the hopper
436  // Mdouble hopperCornerHeight = height - 0.5 * (length - exitLength) / std::tan(hopperAngle_ * constants::pi / 180.0);
437  if (hopperCornerHeight <= 0.0)
438  {
439  // hopperHeight_ += -hopperCornerHeight + problem.getMaxInflowParticleRadius();
440  // hopperCornerHeight = problem.getMaxInflowParticleRadius();
441  logger(ERROR, "[ChuteWithHopper::setHopper()] height of hopper corner (%) may not be below 0. Increase hopper height to fix.",
442  hopperCornerHeight);
443  exit(-1);
444  }
446 
447  logger(VERBOSE, " ");
448  logger(VERBOSE, "[ChuteWithHopper::setHopper()] Setting the following hopper geometrical properties:");
449  logger(VERBOSE, " hopperLowestPoint_: %, ", getHopperLowestPoint());
450  logger(VERBOSE, " hopperLength_: %, ", hopperLength_);
451  logger(VERBOSE, " hopperExitLength_: %, ", hopperExitLength_);
452  logger(VERBOSE, " hopperAngle_: %, ", hopperAngle_);
453  logger(VERBOSE, " height: %, ", height);
454  logger(VERBOSE, " comparing height: % ", heightCompare);
455  logger(VERBOSE, " ");
456 
457  //This a semi-ugly fix to check whether height>=Heightcompare and does not take into account rounding errors
458  if ((height - heightCompare) > -1e-6 * heightCompare)
459  {
460  hopperHeight_ = height;
461  }
462  else
463  {
464  logger(ERROR, "[ChuteWithHopper::setHopper()] For these settings, hopper height must be greater then or equal to %, see drawing",
465  heightCompare);
466  exit(-1);
468  }
469 
470  logger(VERBOSE, " ");
471  logger(VERBOSE, "[ChuteWithHopper::setHopper()] Hopper geometry: ");
472  logger(VERBOSE, "hopperHeight_: \t %", hopperHeight_);
473  logger(VERBOSE, "hopperExitLength_: \t %", hopperExitLength_);
474  logger(VERBOSE, "hopperExitHeight_: \t %", hopperExitHeight_);
475  logger(VERBOSE, "hopperAngle_: \t %", hopperAngle_);
476  logger(VERBOSE, "hopperLength_: \t %", hopperLength_);
477  logger(VERBOSE, " ");
478 
479 }
480 
487 {
489 
490  return std::sqrt(2.0 * getGravity().getLength() * height);
491 }
492 
501 {
503  const Mdouble rmin = getMinInflowParticleRadius();
504 
505  if (rmin/dx < 10.)
506  logger(WARN,"[ChuteWithHopper::getTimeStepRatio()] ratio of minimum particle radius over max distance travelled per time step due to gravity is only %; consider reducing the time step size!",rmin/dx);
507 
508  return rmin/dx;
509 }
510 
517 {
518  return getXMax() - hopperShift_;
519 }
520 
527 {
528  if (chuteLength >= 0.0)
529  {
530  setXMax(chuteLength + hopperShift_);
531  setXMin(0.0);
532  }
533  else
534  {
535  logger(WARN, "[ChuteWithHopper::setChuteLength()] Chute length unchanged, value must be greater than or equal to zero");
536  }
537 }
538 
545 void ChuteWithHopper::setIsHopperCentred(bool isHopperCentred)
546 {
547  isHopperCentred_ = isHopperCentred;
548 }
549 
554 {
555  hopperLowerFillingHeight_ = hopperLowerFillingHeight;
556 }
557 
564 {
565  if (hopperShift >= 0.0)
566  {
567  //keeps the ChuteLength constant
568  setXMax(getXMax() + hopperShift - hopperShift_);
569  hopperShift_ = hopperShift;
570  }
571  else
572  {
573  logger(WARN, "[ChuteWithHopper::setHopperShift()] Shift length unchanged, value must be greater than or equal to zero");
574  }
575 }
576 
581 void ChuteWithHopper::read(std::istream& is)
582 {
583  Chute::read(is);
586 }
587 
588 
598 void ChuteWithHopper::write(std::ostream& os, bool writeAllParticles) const
599 {
600  Chute::write(os, writeAllParticles);
601  os << hopperExitLength_ << " " << hopperExitHeight_ << " " << hopperLength_
602  << " " << hopperAngle_ << " " << hopperHeight_ << " " << hopperShift_ << " " << std::endl;
603 }
604 
609 {
610  return hopperAngle_;
611 }
612 
617 {
618  return hopperLength_;
619 }
620 
625 {
626  return hopperExitLength_;
627 }
628 
633 {
634  return hopperHeight_;
635 }
636 
642 {
643  return hopperExitHeight_;
644 }
645 
652 {
653  return isHopperCentred_;
654 }
655 
663 {
665 }
666 
672 {
673  return hopperDimension_;
674 }
675 
681 {
682  hopperLift_ = hopperLift;
683 }
684 
690 {
691  return hopperLift_;
692 }
693 
699 {
700  return hopperShift_;
701 }
702 
707 void ChuteWithHopper::setHopperDimension(unsigned int hopperDimension)
708 {
709  hopperDimension_ = hopperDimension;
710 }
711 
715 void ChuteWithHopper::setIsHopperAlignedWithBottom(bool isHopperAlignedWithBottom)
716 {
717  isHopperAlignedWithBottom_ = isHopperAlignedWithBottom;
718 }
719 
726 bool ChuteWithHopper::readNextArgument(int& i, int argc, char *argv[])
727 {
728  if (!strcmp(argv[i], "-hopperLength"))
729  {
730  hopperLength_ = (atof(argv[i + 1]));
731  }
732  else if (!strcmp(argv[i], "-hopperHeight"))
733  {
734  hopperHeight_ = (atof(argv[i + 1]));
735  }
736  else if (!strcmp(argv[i], "-hopperAngle"))
737  {
738  hopperAngle_ = (atof(argv[i + 1]));
739  }
740  else if (!strcmp(argv[i], "-hopperExitLength"))
741  {
742  hopperExitLength_ = (atof(argv[i + 1]));
743  }
744  else if (!strcmp(argv[i], "-hopperExitHeight"))
745  {
746  hopperExitHeight_ = (atof(argv[i + 1]));
747  }
748  else if (!strcmp(argv[i], "-hopperLowerFillingHeight_"))
749  {
750  hopperLowerFillingHeight_ = (atof(argv[i + 1]));
751  }
752  else if (!strcmp(argv[i], "-isHopperCentred"))
753  {
754  isHopperCentred_ = (atoi(argv[i + 1]));
755  }
756  else if (!strcmp(argv[i], "-alignBase"))
757  {
758  isHopperAlignedWithBottom_ = (atoi(argv[i + 1]));
759  }
760  else if (!strcmp(argv[i], "-shift"))
761  {
762  hopperShift_ = (atof(argv[i + 1]));
763  }
764  else if (!strcmp(argv[i], "-lift"))
765  {
766  hopperLift_ = (atof(argv[i + 1]));
767  }
768  else
769  return Chute::readNextArgument(i, argc, argv); //if argv[i] is not found, check the commands in Chute
770  return true; //returns true if argv[i] is found
771 }
772 
Mdouble getChuteLength() const
Allows chute length to be accessed.
void setHopperLowerFillingHeight(Mdouble hopperLowerFillingHeight)
Sets the height above which the hopper is filled with new particles.
static Mdouble getLengthSquared(const Vec3D &a)
Calculates the squared length of a Vec3D: .
Definition: Vector.cc:291
unsigned int getHopperDimension() const
Returns whether the hopper has vertical (1) or inclined (2) walls in Y-direction. ...
Mdouble getHopperHeight() const
Returns the height of the hopper relative to the chute start.
Mdouble getHopperExitLength() const
Returns the width of the hopper exit.
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
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 setHopperFillingPercentage(Mdouble hopperFillingPercentage)
Sets the hopper filling percentage.
void addHopper()
This creates the hopper on top of the chute, see diagram in class description for details of the poin...
A IntersectionOfWalls is convex polygon defined as an intersection of InfiniteWall's.
Mdouble hopperExitHeight_
Dimension of the hopper exit in vertical direction.
Mdouble getHopperLift() const
Returns the hopper's lift above the chute bottom plane.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
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
Mdouble hopperLowestPoint_
The NEGATIVE z coordinate of the right C point (when the left C point is in the origin) ...
bool getIsHopperCentred() const
Returns whether the setup is shifted another 40 units in X-direction.
void setHopperLowestPoint(Mdouble hopperLowestPoint)
Sets the vertical distance of the lowest hopper point relative to the start of the chute...
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
Mdouble hopperLowerFillingHeight_
Relative height (in [0,1)) above which the hopper is replenished with new particles.
void setSpecies(const ParticleSpecies *species)
void addObject(Vec3D normal, Vec3D point)
Adds a wall to the set of infinite walls, given an outward normal vector s.t. normal*x=normal*point.
void setHopperShift(Mdouble hopperShift)
Sets the shift in X-direction of the whole setup after rotation.
void setHopperLift(Mdouble hopperLift)
This lifts the hopper above the plane of the chute (after rotation)
bool isHopperCentred_
If this flag is set, the hopper will be constructed in the xy-center of the domain, and not next to the xmin-domain boundary; by default off.
void setSpecies(const ParticleSpecies *species)
sets species of subwalls as well
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:60
Mdouble getHopperLength() const
Returns the width of the hopper entrance.
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 getHopperLowestPoint() const
Returns the vertical distance of the lowest hopper point relative to the start of the chute...
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
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 setHopperDimension(unsigned int hopperDimension)
Sets whether the hopper should have vertical (1) or inclined (2) walls in Y-direction.
Mdouble hopperShift_
The x position where the Chute starts (defined as the beginning of the hopper)
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:42
Mdouble getTimeStepRatio() const
Returns smallest particle radius over maximum gravitational velocity.
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
unsigned int hopperDimension_
This is the dimension of the hopper, my default it is one dimensional and hence does not have side wa...
Mdouble hopperLength_
Dimension of the hopper in vertical direction.
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:603
T tan(T x)
Definition: ExtendedMath.h:146
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
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:359
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble getHopperExitHeight() const
Returns the height of the lowest hopper point above the chute.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
ChuteWithHopper()
This is the default constructor.
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
Mdouble getHopperAngle() const
Returns the angle of the hopper entrance relative to the vertical.
void setInsertionBoundary(InsertionBoundary *insertionBoundary)
Sets the chute insertion boundary.
Definition: Chute.cc:982
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:255
bool readNextArgument(int &i, int argc, char *argv[])
Reads setup properties from a string.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
virtual void read(std::istream &is)
Reads setup properties from an istream.
Mdouble getChuteAngle() const
Returns the chute angle (in radians)
Definition: Chute.cc:711
Mdouble getHopperShift() const
Returns the shift in X-direction of the whole setup after rotation.
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
virtual void createBottom()
Creates the chute bottom, which can be either flat or one of three flavours of rough.
Definition: Chute.cc:316
Mdouble getMinInflowParticleRadius() const
returns the minimum radius of inflow particles
Definition: Chute.cc:842
Inherits from InsertionBoundary Some images are useful to better understand the structure of both the...
void setChuteLength(Mdouble chuteLength)
sets xMax to chuteLength+hopperlength_, and thus specifies the length off the runoff chute ...
bool isHopperAlignedWithBottom_
This is the flag, which sets if the chute bottom is aligned with the hopper, by default it is...
void set(BaseParticle *particleToCopy, int maxFailed, double yMin, double yMax, double radMin, double radMax, double chuteAngle, double fixedParticleRadius, bool isHopperCentred_, int hopperDim, double hopperAngle, double hopperLength, double hopperExitLength, double hopperHeight, double lift, double fillPercent)
Sets all boundary properties at once.
void read(std::istream &is)
Reads all chute properties from an istream.
Definition: Chute.cc:139
Mdouble hopperHeight_
Dimension of the hopper in horizontal direction.
Mdouble getHopperFillingPercentage() const
Returns the vertical percentage of the hopper insertion boundary which is filled. ...
Mdouble hopperAngle_
Angle between the two pieces of the hopper walls.
Mdouble hopperFillingPercentage_
This is which percentage of the hopper is used for creating new partices;.
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:473
void setIsHopperCentred(bool isHopperCentred)
Sets an extra shift in X-direction of the whole system.
virtual void setupInitialConditions()
Sets up the initial conditions for the problem.
void write(std::ostream &os, bool writeAllParticles=true) const
Writes setup properties to an ostream.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
void setHopper(Mdouble exitLength, Mdouble exitHeight, Mdouble angle, Mdouble length, Mdouble height)
Sets the hopper's geometrical properties.
Mdouble hopperLift_
This is the vertical distance the chute is lifted above the plane.
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
void constructor()
This is the actually constructor, get called by all constructors above.
Mdouble Z
Definition: Vector.h:52
void setIsHopperAlignedWithBottom(bool isHopperAlignedWithBottom)
Sets the alignment of hopper with chute bottom.
Mdouble getMaximumVelocityInducedByGravity() const
Returns the theoretical maximum particle velocity due to gravity.
Mdouble hopperExitLength_
Dimension of the hopper exit in vertical direction.
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