Segregation/segregation_with_hopper.cpp File Reference
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "ChuteWithHopper.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <Species/LinearViscoelasticFrictionSpecies.h>

Classes

class  SegregationWithHopper
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
88 {
89  SegregationWithHopper problem;
90 
91  // Problem parameters
92  problem.setName("segregation");
93  //Should be 10 for full length problem, but here I keep it low for a test case
94  problem.setTimeMax(10);
95 
96 
97  // Particle properties
99 
100  species->setDensity(2400.0);
101 
102  problem.setInflowParticleRadius(0.3e-3,0.60e-3);
103  double mass = 0.5*species->getMassFromRadius(0.5*(problem.getMinInflowParticleRadius() + problem.getMaxInflowParticleRadius()));
104  species->setCollisionTimeAndRestitutionCoefficient(4e-4,0.6,mass);
105  species->setSlidingDissipation(species->getDissipation());
106  species->setSlidingFrictionCoefficient(0.8);
107  problem.setFixedParticleRadius(0.3e-3);
109 
110  // Chute properties
111  problem.setChuteAngle(25.0);
112  problem.setChuteLength(600.0e-3);
113  problem.setChuteWidth(3e-3);
114  problem.setMaxFailed(6);
115  problem.makeChutePeriodic();
116  double ExitHeight = 12.0e-3, ExitLength = 1.0 * ExitHeight, hopperAngle_ = 60.0, hopperLength_ = 6.0 * ExitLength;
117  Mdouble hopperLowestPoint_ = ExitHeight - ExitLength * tan(problem.getChuteAngle());
118  Mdouble hopperHeight_ =
119  hopperLowestPoint_ + 1.1 * 0.5 * (hopperLength_ + ExitLength) / tan(hopperAngle_ * constants::pi / 180.0);
120  Mdouble HopperCornerHeight =
121  hopperHeight_ - 0.5 * (hopperLength_ - ExitLength) / tan(hopperAngle_ * constants::pi / 180.0);
122  if (HopperCornerHeight <= 0.0)
123  {
124  hopperHeight_ += -HopperCornerHeight + problem.getMaxInflowParticleRadius();
125  HopperCornerHeight = problem.getMaxInflowParticleRadius();
126  }
127  problem.setHopper(ExitLength, ExitHeight, hopperAngle_, hopperLength_, hopperHeight_);
128 
129  //solve
130  //std::cout << "Maximum allowed speed of particles: " << problem.particleHandler.getSmallestParticle()->calculateMaximumVelocity() << std::endl; // speed allowed before particles move through each other!
131  problem.setTimeStep(0.02 * species->getCollisionTime(mass));
133  problem.getTimeStep()));
134 
135  logger(INFO, "dt=%", problem.getTimeStep());
136 
137  problem.autoNumber();
138  problem.write(std::cout, false);
139  problem.writeRestartFile();
140 
141  //This set to colouring based of size and small vectors
142  problem.setXBallsColourMode(7);
143  problem.setXBallsVectorScale(1);
144  problem.setXBallsScale(20.0);
145  problem.setXBallsAdditionalArguments("-v0 -solidf");
146 
147 
148  problem.solve();
149  problem.write(std::cout);
150  //problem.HGRID_base::write(std::cout);
151 
152 
153  //std::cout << problem << std::endl;
154  problem.writeRestartFile();
155 }
@ MONOLAYER_DISORDERED
Definition: Chute.h:53
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearViscoelasticNormalSpecies, FrictionSpecies > LinearViscoelasticFrictionSpecies
Definition: LinearViscoelasticFrictionSpecies.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
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 write(std::ostream &os, bool writeAllParticles=true) const override
Writes setup properties to an ostream.
Definition: ChuteWithHopper.cc:615
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
Mdouble getMaxInflowParticleRadius() const
Returns the maximum radius of inflow particles.
Definition: Chute.cc:947
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 getMinInflowParticleRadius() const
returns the minimum radius of inflow particles
Definition: Chute.cc:938
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 autoNumber()
The autoNumber() function calls three functions: setRunNumber(), readRunNumberFromFile() and incremen...
Definition: DPMBase.cc:539
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
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1347
virtual void writeRestartFile()
Stores all the particle data for current save time step to a "restart" file, which is a file simply i...
Definition: DPMBase.cc:2942
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 setXBallsScale(Mdouble newScale)
Sets the scale of the view (either normal, zoom in or zoom out) to display in xballs....
Definition: DPMBase.cc:1363
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 setXBallsVectorScale(double newVScale)
Set the scale of vectors in xballs.
Definition: DPMBase.cc:1320
void setXBallsColourMode(int newCMode)
Set the xballs output mode.
Definition: DPMBase.cc:1300
Definition: Chute/segregation_with_hopper.cpp:38
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 DPMBase::autoNumber(), BaseHandler< T >::copyAndAddObject(), Chute::getChuteAngle(), Chute::getMaxInflowParticleRadius(), Chute::getMinInflowParticleRadius(), helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(), DPMBase::getTimeMax(), DPMBase::getTimeStep(), INFO, logger, Chute::makeChutePeriodic(), MONOLAYER_DISORDERED, constants::pi, Chute::setChuteAngle(), ChuteWithHopper::setChuteLength(), Chute::setChuteWidth(), Chute::setFixedParticleRadius(), ChuteWithHopper::setHopper(), Chute::setInflowParticleRadius(), Chute::setMaxFailed(), DPMBase::setName(), Chute::setRoughBottomType(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXBallsColourMode(), DPMBase::setXBallsScale(), DPMBase::setXBallsVectorScale(), DPMBase::solve(), DPMBase::speciesHandler, mathsFunc::tan(), ChuteWithHopper::write(), and DPMBase::writeRestartFile().