This tutorial presents five particles positioned on a irregular base made from five fixed particles. The system is nondimensionalised such that particle diameter d = 1, particle mass m = 1 and gravity g = 1. The code can be found in FiveParticles.cpp.
{
public:
const Mdouble collisionTime = 0.005;
species->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(collisionTime, restitution, restitution, species->getMassFromRadius(particleRadius));
species->setSlidingFrictionCoefficient(0.5);
p0.setRadius(particleRadius);
p0.setPosition(
Vec3D(0.5,0.5,0.1));
p0.setPosition(
Vec3D(1.5,0.5,-.2));
p0.setPosition(
Vec3D(2.5,0.5,0.0));
p0.setPosition(
Vec3D(3.5,0.5,0.1));
p0.setPosition(
Vec3D(4.5,0.5,0.05));
p0.setPosition(
Vec3D(2.0,0.5,1.0));
p0.setPosition(
Vec3D(3.0,0.5,1.0));
p0.setPosition(
Vec3D(4.0,0.5,1.0));
p0.setPosition(
Vec3D(1.5,0.5,2.0));
}
};
double Mdouble
Definition: GeneralDefine.h:13
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
Definition: LinearViscoelasticSlidingFrictionSpecies.h:12
Vector3f p0
Definition: MatrixBase_all.cpp:2
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
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1438
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
[FP:headers]
Definition: FiveParticles.cpp:14
void setupInitialConditions() override
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: FiveParticles.cpp:16
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:16
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:123
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
const Mdouble pi
Definition: ExtendedMath.h:23
int main(
int argc,
char *argv[])
{
fiveParticles.
setName(
"FiveParticles");
fiveParticles.
solve(argc,argv);
logger(
INFO,
"Execute 'source FiveParticles.sh' to get coarse-grained statistics of the last time step");
helpers::writeToFile(
"FiveParticles.sh",
"../MercuryCG/fstatistics FiveParticles -stattype XZ -w 0.1 -h 0.05 -tmin 1 -tmax 30");
logger(
INFO,
"Run 'FiveParticles.m' in MATLAB/octave to visualise the statistical output");
"data = loadstatistics('FiveParticles.stat');\n"
"colormap(1-gray)\n"
"contourf(data.x,data.z,data.Density,20,'EdgeColor','none')\n"
"c = colorbar\n"
"c.Label.String = '\\rho';\n"
"title('Density')\n"
"xlabel('x')\n"
"ylabel('z');\n"
"axis equal\n"
"%%\n"
"particles=importdata('FiveParticles.data',' ',12);\n"
"x=particles.data(:,1);\n"
"z=particles.data(:,3);\n"
"r=particles.data(:,7);\n"
"a=linspace(0,2*pi,40);\n"
"xCircle = sin(a);\n"
"zCircle = cos(a);\n"
"hold on;\n"
"for i=1:length(x)\n"
" plot(x(i)+r(i)*xCircle,z(i)+r(i)*zCircle,'Color',.8*[1 1 1])\n"
"end\n"
"hold off");
}
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
int main(int argc, char *argv[])
Definition: T_protectiveWall.cpp:194
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
#define max(a, b)
Definition: datatypes.h:23
#define INFO(i)
Definition: mumps_solver.h:54
bool writeToFile(const std::string &filename, const std::string &filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:29