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");
96 chuteAngle_(other.chuteAngle_),
97 fixedParticleRadius_(other.fixedParticleRadius_),
98 minInflowParticleRadius_(other.minInflowParticleRadius_),
99 maxInflowParticleRadius_(other.maxInflowParticleRadius_),
100 inflowVelocity_(other.inflowVelocity_),
101 inflowVelocityVariance_(other.inflowVelocityVariance_),
102 inflowHeight_(other.inflowHeight_),
103 roughBottomType_(other.roughBottomType_),
104 maxFailed_(other.maxFailed_),
105 insertionBoundary_(other.insertionBoundary_),
106 isChutePeriodic_(other.isChutePeriodic_)
108 logger(
DEBUG,
"[Chute::Chute(const Chute& other)] copy constructor finished");
138 std::string line_string;
139 getline(is, line_string);
140 std::cout <<
"Chuteline=" << line_string << std::endl;
141 std::stringstream line(std::stringstream::in | std::stringstream::out);
147 unsigned int roughBottomType;
156 unsigned int roughBottomType;
160 >> dummy >> roughBottomType
188 <<
", max_failed:" <<
maxFailed_ <<
", num_created:" << std::endl;
197 os <<
"," << std::endl
218 std::cout <<
"\rt=" << std::setprecision(3) << std::left << std::setw(6) <<
getTime()
219 <<
", tmax=" << std::setprecision(3) << std::left << std::setw(6) <<
getTimeMax()
231 logger(
FATAL,
"[Chute::setupInitialConditions()] Chute % cannot complete because no species have been "
243 b1.
set(p,
maxFailed_,
Vec3D(
getXMin(),
getYMin(),
getZMin()),
Vec3D(
getXMax(),
getYMax(),
getZMax()),
minInflowParticleRadius_,
maxInflowParticleRadius_,
fixedParticleRadius_,
inflowVelocity_,
inflowVelocityVariance_);
294 logger(
INFO,
"[Chute::createBottom()] create perfectly flat chute bottom");
317 logger(
INFO,
"[Chute::createBottom()] create monolayered, ordered rough chute bottom");
324 unsigned int nx =
static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((
getXMax() -
getXMin()) / dx))));
325 unsigned int ny =
static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((
getYMax() -
getYMin()) / dy))));
332 for (
unsigned int i = 0; i < nx; i++)
334 for (
unsigned int j = 0; j < ny; j++)
345 logger(
INFO,
"[Chute::createBottom()] create monolayered disordered rough chute bottom");
386 logger(
INFO,
"[Chute::createBottom()] create multilayered rough chute bottom");
399 (*it)->fixParticle();
412 static int count = 0, maxcount = 100;
415 if (count > maxcount)
446 if (!strcmp(argv[i],
"-inflowHeight"))
451 else if (!strcmp(argv[i],
"-inflowVelocity"))
455 else if (!strcmp(argv[i],
"-chuteAngle"))
459 else if (!strcmp(argv[i],
"-chuteLength"))
463 else if (!strcmp(argv[i],
"-chuteWidth"))
467 else if (!strcmp(argv[i],
"-fixedParticleRadius"))
471 else if (!strcmp(argv[i],
"-max_failed"))
473 setMaxFailed(static_cast<unsigned int>(atoi(argv[i + 1])));
475 else if (!strcmp(argv[i],
"-inflowParticleRadiusRange"))
480 else if (!strcmp(argv[i],
"-inflowParticleRadius"))
484 else if (!strcmp(argv[i],
"-roughBottomType"))
486 std::string str(argv[i + 1]);
542 if (fixedParticleRadius >= 0.0)
545 logger(
WARN,
"[Chute::setFixedParticleRadius()] Fixed particle radius must be greater than or equal to zero.");
578 if (!roughBottomTypeString.compare(
"MONOLAYER_ORDERED"))
582 else if (!roughBottomTypeString.compare(
"MONOLAYER_DISORDERED"))
586 else if (!roughBottomTypeString.compare(
"MULTILAYER"))
590 else if (roughBottomTypeString ==
"FLAT")
596 logger(
FATAL,
"[Chute::setRoughBottomType(std::string)] Invalid "
597 "argument in setRoughBottomType. Given: %", roughBottomTypeString);
622 logger(
WARN,
"[Chute::setChuteAngle()] zero gravity");
639 if (chuteAngle >= -90.0 && chuteAngle <= 90.0)
645 logger(
WARN,
"[Chute::setChuteAngleAndMagnitudeOfGravity()] Chute angle "
646 "must be within [-90,90]");
693 if (inflowParticleRadius >= 0.0)
700 logger(
WARN,
"[Chute::setInflowParticleRadius(Mdouble)] Inflow "
701 "particle must be greater than or equal to zero");
712 if (minInflowParticleRadius >= 0.0)
718 logger(
WARN,
"[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Min."
719 "inflow particle radius must be nonnegative");
721 if (maxInflowParticleRadius >= minInflowParticleRadius)
727 logger(
WARN,
"[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Max."
728 " inflow particle radius must be >= min. inflow particle "
745 logger(
WARN,
"[Chute::setMinInflowParticleRadius()] Min. inflow particle"
746 " radius must be <= max. inflow particle radius");
762 logger(
WARN,
"[Chute::setMaxInflowParticleRadius()] Max. inflow particle"
763 " radius must be >= min. inflow particle radius");
827 if (inflowVelocity >= 0.0)
833 logger(
WARN,
"[Chute::setInflowVelocity()] Inflow velocity not changed, "
834 "value must be greater than or equal to zero");
854 if (inflowVelocityVariance >= 0.0 && inflowVelocityVariance <= 1.0)
860 logger(
ERROR,
"[Chute::setInflowVelocityVariance()] Inflow velocity "
861 "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)
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
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...
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
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)
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
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.
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
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.
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.
virtual void removeObject(unsigned const int id)
Removes a BaseParticle from the ParticleHandler.
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)
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