Parameter study using a protective wall

Problem description

Particles are released from a specific height, roll through a slope and then a protective wall retains them. The user controls the number of particles inserted, the height of release, slope angle, grain size. The output data contain the .fstat file, which includes the information of numbers of grains contained by the wall and overflowing the wall, total force on the wall, volume fraction, stress inside the retained material. An illustrative description is presented in the figure below.

Schematic representation of the parameter study including a protective wall, h: height of release, l: length, w: width, s: slope angle.

Quick explanation:

There are two ways to run the tutorial. First, input parameters set directly in the main file: ProtectiveWall.cpp. Second, input parameters are read from the command line after the compilation, for instance: ./protectiveWall -Np 500 -r 0.01 -h 0.1 -w 0.25 -l 1.0 -s 15.0 -t 20.0, where -Np: Number of particles, -r: particle radius.

Some initial setups:

Three different examples changing the initial setup.

Simulation:

Particles are released from a specific height, roll through a slope, and they are retained by a protective wall.

Headers

The following headers are included:

These are the headers needed for this tutorial. Further explanation can be found in Beginner tutorials.

Main class:

The main class contains the constructor and member functions.

class protectiveWall : public Mercury3D
{
public:
protectiveWall(int Nump, Mdouble pRadius, Mdouble height, Mdouble width,Mdouble Length, Mdouble slopeAngle)
{
setNumParticles = Nump; //Number of particles
setGlobalRadius = pRadius; //Particle radius
setParticleHeight = height; //Height of release
setSlopeAngle = constants::pi / 180.0 * slopeAngle; //Slope angle
setParticlesWriteVTK(true); //For visualization
setGravity(Vec3D(0.0, 0.0, -9.81)); //Set gravity
Mdouble Hipo = Length/cos(setSlopeAngle); //Slope length
setXMax(Length); //Boundary length
setYMax(width); //Boundary width
setZMax(Hipo*sin(setSlopeAngle)); //Boundary height using slope length
slopeSpecies->setDensity(2500.0); //set the species density
slopeSpecies->setStiffness(20058.5);//set the spring stiffness.
slopeSpecies->setDissipation(0.01); //set the dissipation.
particleSpecies->setDensity(2500.0); //set the species density
particleSpecies->setStiffness(258.5);//set the spring stiffness.
particleSpecies->setDissipation(0.5); //set the dissipation.
speciesHandler.getMixedObject(0,1)->mixAll(slopeSpecies,slopeSpecies); //Particle-wall interactions
SphericalParticle particles;
&particles,
1,
Vec3D(0.9 * getXMax(), 0.45 * getYMax(), getZMax() + 0.97 * setParticleHeight), //Minimum position
Vec3D(getXMax(), 0.55 * getYMax(), getZMax() + setParticleHeight), //Maximum position
Vec3D(0, 0, 0), //Minimum velocity
Vec3D(0, 0, 0));
//To delete particles
delb->set(Vec3D(-1,0,0), getXMin());
}
void setupInitialConditions() override
{
InfiniteWall slope,lateralwall1, lateralwall2, lateralwall3;
lateralwall1.setSpecies(slopeSpecies);
lateralwall1.set(Vec3D(0.0, 1.0, 0.0), Vec3D(0.0,getYMax(),0.0));
lateralwall2.setSpecies(slopeSpecies);
lateralwall2.set(Vec3D(0.0, -1.0, 0.0), Vec3D(0.0,getYMin(),0.0));
IntersectionOfWalls roarWall, proctWall;
//Rear wall.
roarWall.addObject(Vec3D(1.0, 0.0, 0.0), Vec3D(getXMax(), 0.0, 0.0));
roarWall.addObject(Vec3D(0.0, 0.0, -1.0), Vec3D(getXMax(), 0.0, getZMax()+setParticleHeight));
//Protective wall
proctWall.addObject(Vec3D(-1.0, 0.0, 0.0), Vec3D(getXMin(), 0.0, 0.0));
proctWall.addObject(Vec3D(0.0, 0.0, -1.0), Vec3D(getXMin(), 0.0, heightProtWall));
}
void actionsAfterTimeStep() override {
//Specific number of particles
//Stop inserting particles
removed_insb = true;
}
//Wall force and pressure
}
//Criterion to stop the simulation, otherwise the simulation stops at maxTime.
bool continueSolve() const override
{
static unsigned int counter = 0;
if (++counter>100)
{
counter=0;
return false;
}
return true;
}
//Print varaibles in the console/terminal
void printTime()const override
{
logger(INFO, "t=%3, "
"tmax=%3, "
"# Particles inserted=%3, "
"# Particles deleted=%3, "
"Volume inserted=%3.6, "
"WallForce=%3.6, "
"WallPressure=%3.6",
}
//Write variables in the fstat file
void writeFstatHeader(std::ostream &os) const override {
os<< getTime() //Current time
<< " " << getTimeMax() //MaxTime
<< " " << setNumParticles - partDel //Particles inserted
<< " " << partDel //Partilcles deleted
<< " " << vol_inserted //Volume inserted
<< " " << wallForce //Wall force
<< " " << wallPressure //Wall pressure
<< std::endl;
}
private:
Mdouble setGlobalRadius = 1.0; //By default
Mdouble setParticleHeight = 0.1; //By default
Mdouble setSlopeAngle = 20.0; //By default
Mdouble heightProtWall = 1.0; //By default
int partDel = 0;
bool removed_insb = false;
};
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
@ ONE_FILE
all data will be written into/ read from a single file called name_
double Mdouble
Definition: GeneralDefine.h:13
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:11
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:453
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:360
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
Definition: BaseInteractable.h:105
virtual void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: BaseInteractable.h:239
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:218
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:97
virtual void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:798
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:148
It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been...
Definition: CubeInsertionBoundary.h:21
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin={0, 0, 0}, Vec3D velMax={0, 0, 0})
Sets the properties of the InsertionBoundary for mutliple different particle types.
Definition: CubeInsertionBoundary.cc:86
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:603
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:610
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:616
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1535
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1453
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1458
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:933
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:622
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:879
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1521
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:634
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:628
Used for removing particles from the problem. Inherits from BaseBoundary. By default,...
Definition: DeletionBoundary.h:23
unsigned int getNumberOfParticlesDeleted() const
Gets the number of particles deleted by the boundary.
Definition: DeletionBoundary.cc:277
void set(const Vec3D &normal, Mdouble distance)
Sets boundary position based on a normal and distance.
Definition: DeletionBoundary.cc:65
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:27
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...
Definition: InfiniteWall.cc:97
Mdouble getVolumeOfParticlesInserted() const
Gets the volume of particles inserted by the boundary.
Definition: InsertionBoundary.cc:323
A IntersectionOfWalls is convex polygon defined as an intersection of InfiniteWall's.
Definition: IntersectionOfWalls.h:38
void addObject(Vec3D normal, Vec3D point)
Adds a wall to the set of infinite walls, given a normal vector pointing into the wall (i....
Definition: IntersectionOfWalls.cc:117
void setSpecies(const ParticleSpecies *species)
sets species of subwalls as well
Definition: IntersectionOfWalls.cc:51
void setDissipation(Mdouble dissipation)
Allows the normal dissipation to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:96
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:72
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:16
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:52
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:445
[AT_PW:headers]
Definition: ProtectiveWall.cpp:19
Mdouble vol_inserted
Definition: ProtectiveWall.cpp:198
Mdouble wallPressure
Definition: ProtectiveWall.cpp:197
DeletionBoundary * delb
Definition: ProtectiveWall.cpp:193
bool continueSolve() const override
A virtual function for deciding whether to continue the simulation, based on a user-specified criteri...
Definition: ProtectiveWall.cpp:145
Mdouble setGlobalRadius
[AT_PW:MemberFunctions]
Definition: ProtectiveWall.cpp:187
void printTime() const override
Displays the current simulation time and the maximum simulation duration.
Definition: ProtectiveWall.cpp:158
int setNumParticles
Definition: ProtectiveWall.cpp:195
int partDel
Definition: ProtectiveWall.cpp:194
Mdouble setVolume
Definition: ProtectiveWall.cpp:199
Mdouble heightProtWall
Definition: ProtectiveWall.cpp:190
void writeFstatHeader(std::ostream &os) const override
Writes a header with a certain format for FStat file.
Definition: ProtectiveWall.cpp:172
void setupInitialConditions() override
[AT_PW:Constructor]
Definition: ProtectiveWall.cpp:82
LinearViscoelasticSpecies * slopeSpecies
Definition: ProtectiveWall.cpp:202
Mdouble setSlopeAngle
Definition: ProtectiveWall.cpp:189
Mdouble setParticleHeight
Definition: ProtectiveWall.cpp:188
CubeInsertionBoundary * insb
Definition: ProtectiveWall.cpp:192
Mdouble wallForce
Definition: ProtectiveWall.cpp:196
LinearViscoelasticSpecies * particleSpecies
Definition: ProtectiveWall.cpp:203
void actionsAfterTimeStep() override
A virtual function which allows to define operations to be executed after time step.
Definition: ProtectiveWall.cpp:123
bool removed_insb
Definition: ProtectiveWall.cpp:200
protectiveWall(int Nump, Mdouble pRadius, Mdouble height, Mdouble width, Mdouble Length, Mdouble slopeAngle)
[AT_PW:Constructor]
Definition: ProtectiveWall.cpp:23
double Length
Length of the pipe.
Definition: pipe.cc:52
double height(const double &x)
Height of domain.
Definition: simple_spine_channel.cc:429
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
const Mdouble pi
Definition: ExtendedMath.h:23

Main function

int main(int argc, char* argv[])
{
//Helper
"Write in the terminal after the compilation'./ProtectiveWall -Np 500 -r 0.01 -h 0.1 -w 0.25 -l 1.0 -s 15.0 -t "
"20.0' to run the program");
int Nump = helpers::readFromCommandLine(argc, argv, "-Np", 50); //50 particles
Mdouble pRadius = helpers::readFromCommandLine(argc, argv, "-r", 0.01); //0.01 [m]
Mdouble height = helpers::readFromCommandLine(argc, argv, "-h", 0.1); //0.1 [m]
Mdouble width = helpers::readFromCommandLine(argc, argv, "-w", 0.25); //0.25 [m]
Mdouble length = helpers::readFromCommandLine(argc, argv, "-l", 1.0); //1.0 [m]
Mdouble slopeAngle = helpers::readFromCommandLine(argc, argv, "-s", 15.0); //15 grades
protectiveWall problem(Nump, pRadius, height, width, length, slopeAngle); //Object
Mdouble simTime = helpers::readFromCommandLine(argc, argv, "-t", 5.0); // 5.0 [s]
problem.setTimeMax(simTime);
std::string simName = helpers::readFromCommandLine(argc,argv,"-name",std::string("protectiveWall"));
problem.setName(simName);
problem.setSaveCount(400);
problem.setTimeStep(0.005 / 50.0); // (collision time)/50.0
problem.removeOldFiles();
problem.solve();
return 0;
}
int main(int argc, char *argv[])
Definition: T_protectiveWall.cpp:194
#define INFO(i)
Definition: mumps_solver.h:54
bool readFromCommandLine(int argc, char *argv[], const std::string &varName)
Returns true if command line arguments contain varName, false else.
Definition: CommandLineHelpers.cc:99
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213