DensitySizeSeg_Belt_WarreJan_25_75.cpp File Reference
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "Chute.h"
#include "Boundaries/PeriodicBoundary.h"
#include "Walls/InfiniteWall.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <Species/LinearViscoelasticFrictionSpecies.h>

Classes

class  SegregationPeriodic
 This class does segregation problems in a periodic chute. More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  UNUSED,
char *argv[]  UNUSED 
)
Todo:
TW:should be lightest particle, but computeMass has to be automated first
379 {
380  SegregationPeriodic problem;
381  //problem.setParticlesWriteVTK(true);
382 
383  if (argc < 5)
384  {
385  logger(ERROR,"Wrong amount of command line inputs; Use ./fileName -sr ... -dr ...");
386  }
387 
388  Mdouble sizeRatio = helpers::readFromCommandLine(argc,argv,"-sr",1.0);
389  Mdouble densityRatio = helpers::readFromCommandLine(argc,argv,"-dr",1.0);
390  problem.setSizeRatio(sizeRatio);
391  problem.setDensityRatio(densityRatio);
392 
393  std::stringstream dirNameBase;
394  std::string directoryName = "Segregation_";
395  dirNameBase << directoryName << "sizeRatio_" << problem.getSizeRatio() << "_densityRatio_" << problem.getDensityRatio();
396 
397  std::stringstream fileNameStream;
398  std::string nameBase = "Segregation_";
399  fileNameStream << nameBase << "sizeRatio_" << problem.getSizeRatio() << "_densityRatio_" << problem.getDensityRatio();
400  std::stringstream saveTo;
401  saveTo << dirNameBase.str() << "/" << fileNameStream.str();
402 
403  std::stringstream com;
404  com << "mkdir " << dirNameBase.str();
405  int status = system(com.str().c_str());
406 
407  problem.setName(saveTo.str());
408 
409  // Problem parameters, name tmax and two types of particles
410  //This should be set to 100 for full problems.
411  problem.setTimeMax(1);
412  //problem.speciesHandler.copyAndAddObject(problem.speciesHandler.getObject(0));
413  //problem.speciesHandler.copyAndAddObject(problem.speciesHandler.getObject(0));
414 
415 
416 
417  // Chute properties
418  problem.setFixedParticleRadius(0.5);
420  problem.setChuteAngleAndMagnitudeOfGravity(26.0, 1.0);
421  problem.setChuteLength(20);
422  problem.setChuteWidth(10);
423  problem.setZMax(70);
424  problem.setMaxFailed(6);
425  problem.makeChutePeriodic();
426 
427  //solve
429  //std::cout << "Maximum allowed speed of particles: " << problem.particleHandler.getSmallestParticle()->calculateMaximumVelocity() << std::endl; // speed allowed before particles move through each other!
430  problem.setTimeStep(5.e-3 / 50.0);//initially it was auto-set
431  //This is based on the fact in general you get too much data, so prob at worst you want to turn it into a 20 at 60fps (which is its self overkill)
433  //problem.setSaveCount(helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(20*60,getTimeMax(),getTimeStep()));
434  //problem.setSaveCount(1);
435  logger(INFO, "dt=%", problem.getTimeStep());
436 
437  //problem.autoNumber();
438 
439 
440  //This set to colouring based of size and small vectors
441  problem.setXBallsColourMode(7);
442  problem.setXBallsVectorScale(1);
443  problem.setXBallsAdditionalArguments("-v0 -solidf");
444 
445 
446  //solves the problems
447  problem.solve();
448 
449  //Make sure the restart data is upto date at the end
450  problem.writeRestartFile();
451 }
@ MULTILAYER
Definition: Chute.h:53
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.
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:1039
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:714
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:1059
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
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:789
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
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 setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1217
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 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
This class does segregation problems in a periodic chute.
Definition: Chute/segregation.cpp:39
double getDensityRatio()
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:362
void setDensityRatio(double densityRatio)
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:360
void setSizeRatio(double sizeRatio)
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:359
double getSizeRatio()
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:361
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
bool readFromCommandLine(int argc, char *argv[], std::string varName)
Returns true if command line arguments contain varName, false else.
Definition: CommandLineHelpers.cc:103

References ERROR, SegregationPeriodic::getDensityRatio(), helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(), SegregationPeriodic::getSizeRatio(), DPMBase::getTimeMax(), DPMBase::getTimeStep(), INFO, logger, Chute::makeChutePeriodic(), MULTILAYER, helpers::readFromCommandLine(), Chute::setChuteAngleAndMagnitudeOfGravity(), Chute::setChuteLength(), Chute::setChuteWidth(), SegregationPeriodic::setDensityRatio(), Chute::setFixedParticleRadius(), Chute::setMaxFailed(), DPMBase::setName(), Chute::setRoughBottomType(), DPMBase::setSaveCount(), SegregationPeriodic::setSizeRatio(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXBallsColourMode(), DPMBase::setXBallsVectorScale(), DPMBase::setZMax(), DPMBase::solve(), and DPMBase::writeRestartFile().