Hopper3dDemo.cpp File Reference
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "ChuteWithHopper.h"
#include "Species/LinearViscoelasticSlidingFrictionSpecies.h"

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

A three-dimensional hopper inflow.

38 {
39  //Print description
40  logger(INFO, "Description: A three-dimensional hopper inflow.\n\n");
41 
42  // Problem parameters
43  ChuteWithHopper problem;
44  problem.setName("hopper_3d_demo");
45  problem.setTimeMax(2.0); //Should be 10 for full length problem, but here I keep it low for a test case
46 
47  // Particle properties
49  species.setDensity(2400.0);
50  species.setCollisionTimeAndRestitutionCoefficient(4e-3, 0.6, 2400);
51  species.setSlidingDissipation(species.getDissipation());
52  species.setSlidingFrictionCoefficient(0.8);
53  problem.speciesHandler.copyAndAddObject(species);
54 
55 
56  // Chute properties
57  problem.setChuteAngle(30.0);
58  problem.setChuteLength(50.0);
59  problem.setChuteWidth(100);
60  problem.setInflowParticleRadius(0.5, 0.5);
61  problem.setFixedParticleRadius(0.0);
63 
64  problem.setMaxFailed(6);
65  problem.makeChutePeriodic();
66  problem.setTimeStep(4e-3 / 50);
67 
68  // Hopper properties
69  problem.setHopperDimension(2);
70  problem.setHopperLift(20);
71  Mdouble ExitHeight = 4.0, ExitLength = 1.0 * ExitHeight, hopperAngle_ = 45.0, hopperLength_ = 3.0 * ExitLength;
72  Mdouble hopperLowestPoint_ = ExitHeight - ExitLength * tan(problem.getChuteAngle());
73  Mdouble hopperHeight_ =
74  hopperLowestPoint_ + 1.1 * 0.5 * (hopperLength_ + ExitLength) / tan(hopperAngle_ * constants::pi / 180.0);
75  Mdouble HopperCornerHeight =
76  hopperHeight_ - 0.5 * (hopperLength_ - ExitLength) / tan(hopperAngle_ * constants::pi / 180.0);
77  if (HopperCornerHeight <= 0.0)
78  {
79  hopperHeight_ += -HopperCornerHeight + problem.getInflowParticleRadius();
80  HopperCornerHeight = problem.getInflowParticleRadius();
81  }
82  problem.setHopper(ExitLength, ExitHeight, hopperAngle_, hopperLength_, hopperHeight_);
83 
84  // Output properties
86  problem.getTimeStep()));
87  problem.restartFile.setSaveCount(problem.getTimeMax() / problem.getTimeStep());
88  problem.setXBallsAdditionalArguments("-sort -v0 -solidf -drotphi 0.05 -v0 -oh -200 -p 20 -noborder 3");
89  problem.setParticlesWriteVTK(true);
90 
91  //solve
92  problem.solve(argc, argv);
93 }
@ MONOLAYER_ORDERED
Definition: Chute.h:53
double Mdouble
Definition: GeneralDefine.h:34
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
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:379
ChuteWithHopper has a hopper as inflow.
Definition: ChuteWithHopper.h:39
void setHopper(Mdouble exitLength, Mdouble exitHeight, Mdouble angle, Mdouble length, Mdouble height)
Sets the hopper's geometrical properties.
Definition: ChuteWithHopper.cc:389
void setChuteLength(Mdouble chuteLength) override
sets xMax to chuteLength+hopperlength_, and thus specifies the length off the runoff chute
Definition: ChuteWithHopper.cc:541
void setHopperDimension(unsigned int hopperDimension)
Sets whether the hopper should have vertical (1) or inclined (2) walls in Y-direction.
Definition: ChuteWithHopper.cc:724
void setHopperLift(Mdouble hopperLift)
This lifts the hopper above the plane of the chute (after rotation)
Definition: ChuteWithHopper.cc:697
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:1039
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow).
Definition: Chute.cc:848
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:714
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:827
Mdouble getInflowParticleRadius() const
Returns the average radius of inflow particles.
Definition: Chute.cc:929
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:768
Mdouble getChuteAngle() const
Returns the chute angle (in radians)
Definition: Chute.cc:807
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:632
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom.
Definition: Chute.cc:653
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1250
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: DPMBase.h:1493
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1347
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:942
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:888
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_.
Definition: File.cc:273
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
Contains material and contact force properties.
Definition: Species.h:35
const Mdouble pi
Definition: ExtendedMath.h:45
unsigned int getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(unsigned int numberOfSaves, Mdouble timeMax, Mdouble timeStep)
Returns the correct saveCount if the total number of saves, the final time and the time step is known...
Definition: FormulaHelpers.cc:96
T tan(T x)
Definition: ExtendedMath.h:178

References BaseHandler< T >::copyAndAddObject(), Chute::getChuteAngle(), Chute::getInflowParticleRadius(), helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(), DPMBase::getTimeMax(), DPMBase::getTimeStep(), INFO, logger, Chute::makeChutePeriodic(), MONOLAYER_ORDERED, constants::pi, DPMBase::restartFile, Chute::setChuteAngle(), ChuteWithHopper::setChuteLength(), Chute::setChuteWidth(), ParticleSpecies::setDensity(), Chute::setFixedParticleRadius(), ChuteWithHopper::setHopper(), ChuteWithHopper::setHopperDimension(), ChuteWithHopper::setHopperLift(), Chute::setInflowParticleRadius(), Chute::setMaxFailed(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), Chute::setRoughBottomType(), DPMBase::setSaveCount(), File::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXBallsAdditionalArguments(), DPMBase::solve(), DPMBase::speciesHandler, and mathsFunc::tan().