45 logger(
DEBUG,
"[Chute::Chute()] constructor finished");
59 logger(
DEBUG,
"[Chute::Chute(const DPMBase& other)] copy constructor finished");
73 logger(
DEBUG,
"[Chute::Chute(const MercuryBase& other)] copy constructor finished");
87 logger(
DEBUG,
"[Chute::Chute(const Mercury3D& other) copy constructor finished");
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_)
110 logger(
DEBUG,
"[Chute::Chute(const Chute& other)] copy constructor finished");
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);
153 unsigned int roughBottomType;
174 unsigned int roughBottomType;
178 >> dummy >> roughBottomType
235 std::cout <<
"\rt=" << std::setprecision(3) << std::left << std::setw(6)
237 <<
", tmax=" << std::setprecision(3) << std::left << std::setw (6) <<
getTimeMax()
238 <<
", N=" << std::setprecision(3) << std::left << std::setw(6)
251 logger(
FATAL,
"[Chute::setupInitialConditions()] Chute % cannot "
252 "complete because no species have been defined.",
getName());
322 logger(
INFO,
"[Chute::createBottom()] create perfectly flat chute bottom");
348 logger(
INFO,
"[Chute::createBottom()] create monolayered, ordered rough chute bottom");
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))));
363 for (
unsigned int i = 0; i < nx; i++)
365 for (
unsigned int j = 0; j < ny; j++)
376 logger(
INFO,
"[Chute::createBottom()] create monolayered disordered rough chute bottom");
418 logger(
INFO,
"[Chute::createBottom()] create multilayered rough chute bottom");
446 static int count = 0, maxcount = 100;
449 if (count > maxcount)
489 if (!strcmp(argv[i],
"-inflowHeight"))
494 else if (!strcmp(argv[i],
"-inflowVelocity"))
498 else if (!strcmp(argv[i],
"-chuteAngle"))
502 else if (!strcmp(argv[i],
"-chuteLength"))
506 else if (!strcmp(argv[i],
"-chuteWidth"))
510 else if (!strcmp(argv[i],
"-fixedParticleRadius"))
514 else if (!strcmp(argv[i],
"-max_failed"))
516 setMaxFailed(static_cast<unsigned int>(atoi(argv[i + 1])));
518 else if (!strcmp(argv[i],
"-inflowParticleRadiusRange"))
523 else if (!strcmp(argv[i],
"-inflowParticleRadius"))
527 else if (!strcmp(argv[i],
"-roughBottomType"))
529 std::string str(argv[i + 1]);
587 if (fixedParticleRadius >= 0.0)
593 logger(
WARN,
"[Chute::setFixedParticleRadius()] Fixed particle radius "
594 "must be greater than or equal to zero.");
629 if (!roughBottomTypeString.compare(
"MONOLAYER_ORDERED"))
633 else if (!roughBottomTypeString.compare(
"MONOLAYER_DISORDERED"))
637 else if (!roughBottomTypeString.compare(
"MULTILAYER"))
641 else if (roughBottomTypeString ==
"FLAT")
647 logger(
FATAL,
"[Chute::setRoughBottomType(std::string)] Invalid "
648 "argument in setRoughBottomType. Given: %",
649 roughBottomTypeString);
678 logger(
WARN,
"[Chute::setChuteAngle()] zero gravity");
695 if (chuteAngle >= -90.0 && chuteAngle <= 90.0)
702 logger(
WARN,
"[Chute::setChuteAngleAndMagnitudeOfGravity()] Chute "
703 "angle must be within [-90,90]");
754 if (inflowParticleRadius >= 0.0)
761 logger(
WARN,
"[Chute::setInflowParticleRadius(Mdouble)] Inflow "
762 "particle must be greater than or equal to zero");
772 Mdouble maxInflowParticleRadius)
774 if (minInflowParticleRadius >= 0.0)
780 logger(
WARN,
"[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Min."
781 "inflow particle radius must be nonnegative");
783 if (maxInflowParticleRadius >= minInflowParticleRadius)
789 logger(
WARN,
"[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Max."
790 " inflow particle radius must be >= min. inflow particle "
807 logger(
WARN,
"[Chute::setMinInflowParticleRadius()] Min. inflow particle"
808 " radius must be <= max. inflow particle radius");
824 logger(
WARN,
"[Chute::setMaxInflowParticleRadius()] Max. inflow particle"
825 " radius must be >= min. inflow particle radius");
889 if (inflowVelocity >= 0.0)
895 logger(
WARN,
"[Chute::setInflowVelocity()] Inflow velocity not changed, "
896 "value must be greater than or equal to zero");
916 if (inflowVelocityVariance >= 0.0 && inflowVelocityVariance <= 1.0)
922 logger(
ERROR,
"[Chute::setInflowVelocityVariance()] Inflow velocity "
923 "variance not changed, value must be within [0,1]");
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
RoughBottomType
enum for determining the type of rough bottom (if any) of the chute. Either of the enum options can b...
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...
bool checkParticleForInteraction(const BaseParticle &P) override
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Mdouble X
the vector components
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
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 ...
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)
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
void setMaxFailed(unsigned int maxFailed)
Sets the number of times a particle will be tried to be added to the insertion boundary.
Mdouble getInflowVelocityVariance() const
Returns the inflow velocity variance.
Used by Chute::createBottom to create an unordered particle layer.
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...
void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
Sets the maximum radius of inflow particles.
Mdouble getChuteLength() const
Returns the chute length (X-direction)
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
void setSpecies(const ParticleSpecies *species)
void hGridActionsBeforeTimeStep() override
Performs all necessary actions before a time-step, like updating the particles and resetting all the ...
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
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: .
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Mdouble getChuteAngleDegrees() const
Returns the chute angle (in degrees)
Defines a pair of periodic walls. Inherits from BaseBoundary.
Mdouble getInflowVelocity() const
Returns the average inflow velocity.
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Mdouble getInflowParticleRadius() const
Returns the average radius of inflow particles.
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...
RoughBottomType getRoughBottomType() const
Returns the type of (rough) bottom of the chute.
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase)...
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Mdouble getMaxInflowParticleRadius() const
Returns the maximum radius of inflow particles.
void makeRoughBottom(Chute &chute)
Makes a multilayered rough bottom with thickness thickness_.
bool getIsPeriodic() const
Returns whether the chute is periodic in Y.
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes the MercuryBase to an output stream, for example a restart file.
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Mdouble getChuteWidth() const
Returns the chute width (Y-direction)
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
void actionsBeforeTimeStep()
Calls Chute::cleanChute().
unsigned int getNumberOfParticlesInserted() const
Gets the number of particles inserted by the boundary.
void setupSideWalls()
Creates chute side walls (either solid or periodic)
This adds on the hierarchical grid code for 3D problems.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Vec3D getGravity() const
Returns the gravity vector.
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.
bool readNextArgument(int &i, int argc, char *argv[])
This method can be used for reading object properties from a string.
void setInsertionBoundary(InsertionBoundary *insertionBoundary)
Sets the chute insertion boundary.
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
void setInflowVelocityVariance(Mdouble inflowVelocityVariance)
Sets the inflow velocity variance.
Mdouble getRadius() const
Returns the particle's radius_.
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
void hGridActionsBeforeTimeLoop() override
This sets up the broad phase information, has to be done at this stage because it requires the partic...
void setupInitialConditions()
Creates bottom, side walls and a particle insertion boundary.
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Mdouble getChuteAngle() const
Returns the chute angle (in radians)
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
RNG random
This is a random generator, often used for setting up the initial conditions etc...
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.
void cleanChute()
Deletes all outflow particles once every 100 time steps.
void setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
sets the minimum radius of inflow particles
Chute()
This is the default constructor. All it does is set sensible defaults.
Mdouble getMinInflowParticleRadius() const
returns the minimum radius of inflow particles
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...
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Used for modeling chute inflow. Inherits from InsertionBoundary.
This is a class defining walls.
void read(std::istream &is) override
Reads the MercuryBase from an input stream, for example a restart file.
void read(std::istream &is)
Reads all chute properties from an istream.
Mdouble inflowHeight_
Height of inflow.
Implementation of a 3D vector (by Vitaliy).
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Mdouble chuteAngle_
chute angle in degrees
void printTime() const
prints time, max time and number of particles
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
Mdouble getTime() const
Access function for the time.
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
void makeChutePeriodic()
This makes the chute periodic in Y.
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
void setSpecies(const ParticleSpecies *species)
Define the species of this wall.
unsigned int getMaxFailed() const
Returns the number of times a particle will be tried to be added to the insertion boundary...
std::string getRestartVersion() const
This is to take into account for different Mercury versions. Returns the version of the restart file...
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles