32 "We apply a torque T around the z-axis to a motionless\n"
33 "particle of inertia I for a time t using a time step dt.\n"
34 "The result is a final angular velocity omega=T/I*t\n"
35 "and rotation angle alpha=T/I*t^2/2.\n"
37 "The input/output values should be:\n"
38 " T = 0.1*pi*(0 0 1) Nm\n"
42 " omega=pi*(0 0 1) rad/s\n"
43 " alpha = pi/2*(0 0 1) rad\n");
55 P->setForce({1, 0, 0});
59 for (
Mdouble time = 0; time < timeMax; time += timeStep)
61 P->accelerate(
P->getForce() *
P->getInvMass() * timeStep);
62 P->move(
P->getVelocity() * timeStep);
64 P->getOrientation().rotateInverseInertiaTensor(
P->getInvInertia()) *
P->getTorque() * timeStep);
65 P->rotate(
P->getAngularVelocity() * timeStep);
70 " alpha= %",
P->getAngularVelocity(),
P->getOrientation().getEuler());
78 logger(
ERROR,
"angular velocity is %, but should be %",
P->getAngularVelocity(),
pi / 2);
80 if (!
mathsFunc::isEqual(
P->getOrientation().getEuler(), {0, 0, pi / 2 + 4.71241e-05}, 1e-10))
82 logger(
ERROR,
"orientation is %, but should be %",
P->getOrientation().getEuler().Z,
pi / 2);
dominoes D
Definition: Domino.cpp:76
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:33
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
Definition: BaseParticle.h:54
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
Definition: ParticleSpecies.cc:167
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
const Mdouble pi
Definition: ExtendedMath.h:45
bool isEqual(Mdouble v1, Mdouble v2, Mdouble absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
Definition: ExtendedMath.cc:251