ClumpParticle Class Referencefinal

#include <ClumpParticle.h>

+ Inheritance diagram for ClumpParticle:

Public Member Functions

 ClumpParticle ()
 Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1. More...
 
 ClumpParticle (const ClumpParticle &p)
 Basic Particle constructor (copy-based) More...
 
 ~ClumpParticle () override
 Destructor, needs to be implemented and checked to see if it is the largest or smallest particle currently in its particleHandler. More...
 
ClumpParticlecopy () const override
 
void write (std::ostream &os) const override
 Particle print function, which accepts an std::ostream as input. More...
 
void read (std::istream &is) override
 Particle read function, which accepts an std::istream as input. More...
 
std::string getName () const override
 
bool isSphericalParticle () const override
 
void computeMass (const ParticleSpecies &s) override
 Computes the particle's (inverse) mass and inertia. More...
 
void setInitInertia (MatrixSymmetric3D inertia)
 
void rotateTensorOfInertia ()
 
void addPebble (Vec3D position, Mdouble radius)
 
void setClump ()
 
void setPrincipalDirections (Matrix3D directions)
 
void setInitPrincipalDirections (Matrix3D directions)
 
Vec3D getPrincipalDirections_e1 () const
 
Vec3D getPrincipalDirections_e2 () const
 
Vec3D getPrincipalDirections_e3 () const
 
Vec3D getInitPrincipalDirections_e1 () const
 
Vec3D getInitPrincipalDirections_e2 () const
 
Vec3D getInitPrincipalDirections_e3 () const
 
int NPebble () const
 
void actionsAfterAddObject () override
 
void updatePebblesVelPos ()
 
void integrateBeforeForceComputation (double time, double timeStep) override
 
void integrateAfterForceComputation (double time, double timeStep) override
 
void angularAccelerateClumpIterative (double timeStep)
 
void rotatePrincipalDirections (Vec3D rotation)
 
void setPrincipalDirections_e1 (Vec3D e)
 
void setPrincipalDirections_e2 (Vec3D e)
 
void setPrincipalDirections_e3 (Vec3D e)
 
std::vector< MdoublegetPebbleRadius () const
 
void setPebble (int kPebble, ClumpParticle *pPebble)
 
void setClump (ClumpParticle *master)
 
void setClumpMass (Mdouble mass)
 
void setDamping (Mdouble damp)
 
Mdouble getKineticEnergy () const override
 
Mdouble getRotationalEnergy () const override
 Calculates the particle's rotational kinetic energy. More...
 
std::vector< Vec3DgetPebblePositions ()
 
std::vector< MdoublegetPebbleRadii ()
 
bool getDzhanibekovParticle ()
 
bool getVerticallyOriented ()
 
void setDzhanibekovParticle (bool d)
 
void setVerticallyOriented (bool d)
 
unsigned getNumberOfFieldsVTK () const override
 
std::string getTypeVTK (unsigned i) const override
 
std::string getNameVTK (unsigned i) const override
 
std::vector< MdoublegetFieldVTK (unsigned i) const override
 
void updateExtraQuantities ()
 
- Public Member Functions inherited from NonSphericalParticle
 NonSphericalParticle ()=default
 
 NonSphericalParticle (const NonSphericalParticle &p)=default
 
 NonSphericalParticle (const BaseParticle &p)
 Base class copy constructor. Creates a NonSphericalParticle particle from a BaseParticle. More...
 
 ~NonSphericalParticle () override=default
 
bool isSphericalParticle () const override
 
- Public Member Functions inherited from BaseParticle
 BaseParticle ()
 Basic Particle constructor, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1. More...
 
 BaseParticle (const BaseParticle &p)
 Particle copy constructor, which accepts as input a reference to a Particle. It creates a copy of this Particle and all it's information. Usually it is better to use the copy() function for polymorphism. More...
 
 BaseParticle (const ParticleSpecies *s)
 
 ~BaseParticle () override
 Particle destructor, needs to be implemented and checked if it removes tangential spring information. More...
 
virtual Mdouble getVolume () const
 Get Particle volume function, which required a reference to the Species vector. It returns the volume of the Particle. More...
 
void fixParticle ()
 Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to zero. More...
 
bool isFixed () const override
 Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Mass. More...
 
bool isMPIParticle () const
 Indicates if this particle is a ghost in the MPI domain. More...
 
void setMPIParticle (bool flag)
 Flags the mpi particle status. More...
 
bool isInMPIDomain ()
 Indicates if the particle is in the communication zone of the mpi domain. More...
 
void setInMPIDomain (bool flag)
 Flags the status of the particle if wether it is in the communication zone or not. More...
 
bool isInPeriodicDomain () const
 Indicates if the particle is in the periodic boundary communication zone. More...
 
void setInPeriodicDomain (bool flag)
 Flags the status of the particle whether it is in the periodic communication zone or not. More...
 
bool isPeriodicGhostParticle () const
 Indicates if this particle is a ghost in the periodic boundary. More...
 
void setPeriodicGhostParticle (bool flag)
 Flags the status of the particle to be a ghost in periodic boundary or not. More...
 
bool isMaserParticle () const
 Indicates if this particle belongs to the maser boundary. More...
 
void setMaserParticle (bool flag)
 Flags the status of the particle if it belongs to the maser boundary or not. More...
 
void setCommunicationComplexity (unsigned complexity)
 Set the communication complexity of the particle. More...
 
unsigned getCommunicationComplexity ()
 Obtains the communication complexity of the particle. More...
 
void setPeriodicComplexity (std::vector< int > complexity)
 Set the periodic communication complexity of the particle. More...
 
void setPeriodicComplexity (int index, int value)
 Set the periodic communication complexity of the particle. More...
 
const std::vector< int > & getPeriodicComplexity ()
 Obtains the periodic communication complexity of the particle. More...
 
void setPreviousPeriodicComplexity (std::vector< int > complexity)
 Set the previous periodic communication complexity of the paritcle. More...
 
const std::vector< int > & getPreviousPeriodicComplexity () const
 Sets the previous periodic communication complexity of the particle. More...
 
int getPeriodicComplexity (int index)
 Gets the periodic communication complexity of a certain boundary. More...
 
void unfix ()
 Unfix Particle function, which required a reference to the Species vector. It unfixes a Particle by computing the Particles mass and inertia. More...
 
virtual void oldRead (std::istream &is)
 
virtual void setInfo (Mdouble info)
 Sets some user-defined information about this object (by default, species ID). More...
 
virtual Mdouble getInfo () const
 Returns some user-defined information about this object (by default, species ID). More...
 
void printHGrid (std::ostream &os) const
 Adds particle's HGrid level and cell coordinates to an ostream. More...
 
unsigned int getHGridLevel () const
 Returns particle's HGrid level. More...
 
BaseParticlegetHGridNextObject () const
 Returns pointer to next object in particle's HGrid level & cell. More...
 
BaseParticlegetHGridPrevObject () const
 Returns pointer to previous object in particle's HGrid level & cell. More...
 
int getHGridX () const
 Returns particle's HGrid cell X-coordinate. More...
 
int getHGridY () const
 Returns particle's HGrid cell Y-coordinate. More...
 
int getHGridZ () const
 Returns particle's HGrid cell Z-coordinate. More...
 
MatrixSymmetric3D getInvInertia () const
 Returns the inverse of the particle's inertia tensor. More...
 
Mdouble getInvMass () const override
 Returns the inverse of the particle's mass. More...
 
Mdouble getCurvature (const Vec3D &labFixedCoordinates) const override
 
Mdouble getGravitationalEnergy () const
 Calculates the particle's gravitational energy. More...
 
Mdouble getMass () const
 Returns the particle's mass. More...
 
Mdouble getSurfaceArea () const
 
Vec3D getMomentum () const
 
MatrixSymmetric3D getInertia () const
 
Vec3D getAngularMomentum () const
 
BaseParticlegetPeriodicFromParticle () const
 Returns the 'original' particle this one's a periodic copy of. More...
 
Mdouble getRadius () const
 Returns the particle's radius. More...
 
Mdouble getMaxInteractionRadius () const
 Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles) More...
 
Mdouble getInteractionDistance (const BaseInteractable *i) const
 Returns the interactionDistance_ of the mixed species of this particle and the particle or wall i. More...
 
Mdouble getSumOfInteractionRadii (const BaseParticle *particle) const
 returns the sum of the radii plus the interactionDistance More...
 
Mdouble getWallInteractionRadius (const BaseWall *wall) const
 returns the radius plus the interactionDistance More...
 
const Vec3DgetDisplacement () const
 Returns the particle's displacement relative to the previous time step. More...
 
const Vec3DgetPreviousPosition () const
 Returns the particle's position in the previous time step. More...
 
const Vec3D getDisplacement2 (Mdouble xmin, Mdouble xmax, Mdouble ymin, Mdouble ymax, Mdouble zmin, Mdouble zmax, Mdouble t) const
 
virtual void setInertia ()
 
void setInertia (MatrixSymmetric3D inertia)
 Sets the particle's inertia_ (and adjusts invInertia_ accordingly) More...
 
void setInverseInertia (MatrixSymmetric3D inverseInertia)
 Sets the particle's inertia_ (and adjusts invInertia_ accordingly) More...
 
void setInfiniteInertia ()
 Sets the particle's inertia_ to 'infinite' (1e20) and its invInertia_ to 0. More...
 
void setPeriodicFromParticle (BaseParticle *p)
 Assigns the pointer to the 'original' particle this one's a periodic copy of (used in periodic boundary condition implementations). More...
 
void setHGridX (const int x)
 Sets the particle's HGrid cell X-coordinate. More...
 
void setHGridY (const int y)
 Sets the particle's HGrid cell Y-coordinate. More...
 
void setHGridZ (const int z)
 Sets the particle's HGrid cell Z-coordinate. More...
 
void setHGridLevel (const unsigned int level)
 Sets the particle's HGrid level. More...
 
void setHGridNextObject (BaseParticle *p)
 Sets the pointer to the next object in the particle's HGrid cell & level. More...
 
void setHGridPrevObject (BaseParticle *p)
 Sets the pointer to the previous object in the particle's HGrid cell & level. More...
 
virtual void setRadius (Mdouble radius)
 Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) More...
 
virtual Vec3D getAxes () const
 Only ustilised in case of superquadric particles. Had to create a virtual function to allow function access in writeVTK function in the particle handler. More...
 
virtual Mdouble getExponentEps1 () const
 Only ustilised in case of superquadric particles. Had to create a virtual function to allow function access in writeVTK function in the particle handler. More...
 
virtual Mdouble getExponentEps2 () const
 Only ustilised in case of superquadric particles. Had to create a virtual function to allow function access in writeVTK function in the particle handler. More...
 
virtual void setAxes (const Vec3D &axes)
 Only ustilised in case of superquadric particles. More...
 
virtual void setExponents (const Mdouble &eps1, const Mdouble &eps2)
 Only ustilised in case of superquadric particles. More...
 
MERCURYDPM_DEPRECATED void setMass (Mdouble mass)
 Sets the particle's mass. More...
 
void setMassForP3Statistics (Mdouble mass)
 Sets the particle's mass This function should not be used, but is necessary to extend the CG toolbox to non-spherical particles. More...
 
void setDisplacement (const Vec3D &disp)
 Sets the particle's displacement (= difference between current position and that of the previous time step) More...
 
void setPreviousPosition (const Vec3D &pos)
 Sets the particle's position in the previous time step. More...
 
void movePrevious (const Vec3D &posMove)
 Adds a vector to the particle's previousPosition_. More...
 
void accelerate (const Vec3D &vel)
 Increases the particle's velocity_ by the given vector. More...
 
void angularAccelerate (const Vec3D &angVel)
 Increases the particle's angularVelocity_ by the given vector. More...
 
void addDisplacement (const Vec3D &addDisp)
 Adds a vector to the particle's displacement_. More...
 
void setHandler (ParticleHandler *handler)
 Sets the pointer to the particle's ParticleHandler. More...
 
ParticleHandlergetHandler () const
 Returns pointer to the particle's ParticleHandler. More...
 
BaseInteractiongetInteractionWith (BaseParticle *P, unsigned timeStamp, InteractionHandler *interactionHandler) override
 Checks if particle is in interaction with given particle P, and if so, returns vector of pointer to the associated BaseInteraction object (else returns empty vector). More...
 
virtual bool isInContactWith (const BaseParticle *P) const
 Get whether or not this particle is in contact with the given particle. More...
 
unsigned int getParticleDimensions () const
 Returns the particle's dimensions (either 2 or 3). More...
 
MERCURYDPM_DEPRECATED void setIndSpecies (unsigned int indSpecies) override
 
void setSpecies (const ParticleSpecies *species)
 
virtual void actionsAfterTimeStep ()
 
const HGridCellgetHGridCell () const
 
BaseParticlegetClump () const
 
bool isClump () const
 Checks if particle is a clump (container) More...
 
bool isPebble () const
 Checks if particle is a pebble (belongs to a clump) More...
 
virtual Vec3D getCenterOfMass ()
 
- Public Member Functions inherited from BaseInteractable
 BaseInteractable ()
 Default BaseInteractable constructor. More...
 
 BaseInteractable (const BaseInteractable &p)
 Copy constructor. More...
 
 ~BaseInteractable () override
 Destructor, it simply destructs the BaseInteractable and all the objects it contains. More...
 
unsigned int getIndSpecies () const
 Returns the index of the species associated with the interactable object. More...
 
const ParticleSpeciesgetSpecies () const
 Returns a pointer to the species of this BaseInteractable. More...
 
void setSpecies (const ParticleSpecies *species)
 Sets the species of this BaseInteractable. More...
 
const Vec3DgetForce () const
 Returns the force on this BaseInteractable. More...
 
const Vec3DgetTorque () const
 Returns the torque on this BaseInteractable. More...
 
void setForce (const Vec3D &force)
 Sets the force on this BaseInteractable. More...
 
void setTorque (const Vec3D &torque)
 Sets the torque on this BaseInteractable. More...
 
void addForce (const Vec3D &addForce)
 Adds an amount to the force on this BaseInteractable. More...
 
void addTorque (const Vec3D &addTorque)
 Adds an amount to the torque on this BaseInteractable. More...
 
virtual void resetForceTorque (int numberOfOMPthreads)
 
void sumForceTorqueOMP ()
 
const Vec3DgetPosition () const
 Returns the position of this BaseInteractable. More...
 
const QuaterniongetOrientation () const
 Returns the orientation of this BaseInteractable. More...
 
virtual void setPosition (const Vec3D &position)
 Sets the position of this BaseInteractable. More...
 
void setOrientationViaNormal (Vec3D normal)
 Sets the orientation of this BaseInteractable by defining the vector that results from the rotation of the (1,0,0) vector. More...
 
void setOrientationViaEuler (Vec3D eulerAngle)
 Sets the orientation of this BaseInteractable by defining the euler angles. More...
 
virtual void setOrientation (const Quaternion &orientation)
 Sets the orientation of this BaseInteractable. More...
 
virtual void move (const Vec3D &move)
 Moves this BaseInteractable by adding an amount to the position. More...
 
virtual void rotate (const Vec3D &angularVelocityDt)
 Rotates this BaseInteractable. More...
 
const std::vector< BaseInteraction * > & getInteractions () const
 Returns a list of interactions which belong to this interactable. More...
 
void addInteraction (BaseInteraction *I)
 Adds an interaction to this BaseInteractable. More...
 
bool removeInteraction (BaseInteraction *I)
 Removes an interaction from this BaseInteractable. More...
 
void copyInteractionsForPeriodicParticles (const BaseInteractable &p)
 Copies interactions to this BaseInteractable whenever a periodic copy made. More...
 
void setVelocity (const Vec3D &velocity)
 set the velocity of the BaseInteractable. More...
 
void setAngularVelocity (const Vec3D &angularVelocity)
 set the angular velocity of the BaseInteractble. More...
 
void addVelocity (const Vec3D &velocity)
 adds an increment to the velocity. More...
 
void addAngularVelocity (const Vec3D &angularVelocity)
 add an increment to the angular velocity. More...
 
virtual const Vec3DgetVelocity () const
 Returns the velocity of this interactable. More...
 
virtual const Vec3DgetAngularVelocity () const
 Returns the angular velocity of this interactable. More...
 
void setPrescribedPosition (const std::function< Vec3D(double)> &prescribedPosition)
 Allows the position of an infinite mass interactable to be prescribed. More...
 
void applyPrescribedPosition (double time)
 Computes the position from the user defined prescribed position function. More...
 
void setPrescribedVelocity (const std::function< Vec3D(double)> &prescribedVelocity)
 Allows the velocity of an infinite mass interactable to be prescribed. More...
 
void applyPrescribedVelocity (double time)
 Computes the velocity from the user defined prescribed velocity function. More...
 
void setPrescribedOrientation (const std::function< Quaternion(double)> &prescribedOrientation)
 Allows the orientation of the infinite mass interactbale to be prescribed. More...
 
void applyPrescribedOrientation (double time)
 Computes the orientation from the user defined prescribed orientation function. More...
 
void setPrescribedAngularVelocity (const std::function< Vec3D(double)> &prescribedAngularVelocity)
 Allows the angular velocity of the infinite mass interactable to be prescribed. More...
 
void applyPrescribedAngularVelocity (double time)
 Computes the angular velocity from the user defined prescribed angular velocity. More...
 
virtual const Vec3D getVelocityAtContact (const Vec3D &contact) const
 Returns the velocity at the contact point, use by many force laws. More...
 
void integrateBeforeForceComputation (double time, double timeStep)
 This is part of integrate routine for objects with infinite mass. More...
 
void integrateAfterForceComputation (double time, double timeStep)
 This is part of the integration routine for objects with infinite mass. More...
 
virtual bool isFaceContact (const Vec3D &normal) const
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Private Member Functions

MatrixSymmetric3D MtoS (Matrix3D M)
 
Matrix3D StoM (MatrixSymmetric3D M)
 
Matrix3D transpose (Matrix3D M)
 

Private Attributes

int nPebble_
 
bool DzhanibekovParticle_
 
bool VerticallyOriented_
 
Vec3D angularAcceleration_
 
Mdouble clumpMass_
 
Mdouble viscousDamping_
 
MatrixSymmetric3D clumpInertia_
 
MatrixSymmetric3D clumpInitInertia_
 
std::vector< Vec3DpebblePos_
 
std::vector< MdoublepebbleRadius_
 
Matrix3D principalDirections_
 
Matrix3D initPrincipalDirections_
 
std::vector< ClumpParticle * > pebbleParticles_
 

Additional Inherited Members

- Public Attributes inherited from BaseParticle
Mdouble radius_
 
Mdouble invMass_
 Particle radius_. More...
 
MatrixSymmetric3D invInertia_
 Inverse Particle mass (for computation optimization) More...
 
BaseParticleclumpParticle
 Function that updates necessary quantities of a clump particle after adding a pebble. More...
 
bool isPebble_
 pointer to a clump particle (for a pebble) More...
 
bool isClump_
 The particle is pebble. More...
 

Constructor & Destructor Documentation

◆ ClumpParticle() [1/2]

ClumpParticle::ClumpParticle ( )

Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.

38 {
39  setRadius(1.0);
40  nPebble_ = 0;
41 
42  clumpMass_ = 1.0;
43  viscousDamping_ = 0.0;
44  pebblePos_ = std::vector<Vec3D>(0);
45 
46  pebbleRadius_ = std::vector<Mdouble>(0);
47  pebbleParticles_ = std::vector<ClumpParticle*>(0);
48 
49  principalDirections_ = Matrix3D(1, 0, 0, 0, 1, 0, 0, 0, 1);
50  initPrincipalDirections_ = Matrix3D(1, 0, 0, 0, 1, 0, 0, 0, 1);
51 
52  clumpInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1);
53  clumpInitInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1);
55 
56  isPebble_ = false; //Assign false by default
57  isClump_ = false; //Assign false by default
58  clumpParticle = nullptr;
59 
60 
61  DzhanibekovParticle_ = false;
62  VerticallyOriented_ = false;
63 
64  logger(DEBUG, "Clump() created");
65 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ DEBUG
bool isClump_
The particle is pebble.
Definition: BaseParticle.h:748
BaseParticle * clumpParticle
Function that updates necessary quantities of a clump particle after adding a pebble.
Definition: BaseParticle.h:744
bool isPebble_
pointer to a clump particle (for a pebble)
Definition: BaseParticle.h:746
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:686
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:553
int nPebble_
Definition: ClumpParticle.h:283
MatrixSymmetric3D clumpInitInertia_
Definition: ClumpParticle.h:297
bool DzhanibekovParticle_
Definition: ClumpParticle.h:285
Mdouble clumpMass_
Definition: ClumpParticle.h:291
MatrixSymmetric3D clumpInertia_
Definition: ClumpParticle.h:295
std::vector< Mdouble > pebbleRadius_
Definition: ClumpParticle.h:301
bool VerticallyOriented_
Definition: ClumpParticle.h:287
std::vector< Vec3D > pebblePos_
Definition: ClumpParticle.h:299
Mdouble viscousDamping_
Definition: ClumpParticle.h:293
Matrix3D initPrincipalDirections_
Definition: ClumpParticle.h:305
std::vector< ClumpParticle * > pebbleParticles_
Definition: ClumpParticle.h:307
Matrix3D principalDirections_
Definition: ClumpParticle.h:303
Implementation of a 3D matrix.
Definition: Matrix.h:38
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:37
static MatrixSymmetric3D inverse(const MatrixSymmetric3D &A)
Computes the inverse of a matrix; exits if the inverse doesn't exist.
Definition: MatrixSymmetric.cc:288

References clumpInertia_, clumpInitInertia_, clumpMass_, BaseParticle::clumpParticle, DEBUG, DzhanibekovParticle_, initPrincipalDirections_, MatrixSymmetric3D::inverse(), BaseParticle::invInertia_, BaseParticle::isClump_, BaseParticle::isPebble_, logger, nPebble_, pebbleParticles_, pebblePos_, pebbleRadius_, principalDirections_, BaseParticle::setRadius(), VerticallyOriented_, and viscousDamping_.

Referenced by copy().

◆ ClumpParticle() [2/2]

◆ ~ClumpParticle()

ClumpParticle::~ClumpParticle ( )
overridedefault

Destructor, needs to be implemented and checked to see if it is the largest or smallest particle currently in its particleHandler.

Member Function Documentation

◆ actionsAfterAddObject()

void ClumpParticle::actionsAfterAddObject ( )
overridevirtual

Methods and attributes necessary for clumped particles

Reimplemented from BaseParticle.

193 {
194  //Only attribute features to clump particle.
195  if (isPebble()) return;
196  if (isClump())
197  {
198  ClumpParticle p0; // Instance for the pebbles
199  p0.setSpecies(getSpecies());
200  p0.setClump(this);
201 
202  //Go through the number of pebbles
203  for (int iPebble = 1; iPebble <= NPebble(); iPebble++)
204  {
205  //Set the radius of pebbles:
206  p0.setRadius(getPebbleRadius()[iPebble - 1]);
207  //Store the address of the pebble:
208  setPebble(iPebble - 1, getHandler()->copyAndAddObject(p0));
209  }
210 
211  //Update the pebble positions, velocities.
213  }
214 }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:108
bool isPebble() const
Checks if particle is a pebble (belongs to a clump)
Definition: BaseParticle.h:673
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
Definition: BaseParticle.cc:673
bool isClump() const
Checks if particle is a clump (container)
Definition: BaseParticle.h:664
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:818
Definition: ClumpParticle.h:41
void updatePebblesVelPos()
Definition: ClumpParticle.cc:251
void setPebble(int kPebble, ClumpParticle *pPebble)
Definition: ClumpParticle.h:162
int NPebble() const
Definition: ClumpParticle.cc:115
void setClump()
Definition: ClumpParticle.cc:120
std::vector< Mdouble > getPebbleRadius() const
Definition: ClumpParticle.h:157

References BaseParticle::getHandler(), getPebbleRadius(), BaseInteractable::getSpecies(), BaseParticle::isClump(), BaseParticle::isPebble(), NPebble(), setClump(), setPebble(), BaseParticle::setRadius(), BaseParticle::setSpecies(), and updatePebblesVelPos().

◆ addPebble()

void ClumpParticle::addPebble ( Vec3D  position,
Mdouble  radius 
)
130 {
131  nPebble_++; //Counter of pebbles
132  pebblePos_.push_back(position); //Store pebble positions
133  pebbleRadius_.push_back(radius); //Store pebble radius
134  pebbleParticles_.push_back(nullptr);//Store null pointer per pebble.
135 // isClump_ = true;
136 }

References nPebble_, pebbleParticles_, pebblePos_, and pebbleRadius_.

Referenced by multiParticleT1::setupInitialConditions(), and clumpTest::setupInitialConditions().

◆ angularAccelerateClumpIterative()

void ClumpParticle::angularAccelerateClumpIterative ( double  timeStep)
359 {
360  Mdouble Ixx_ = getInertia().XX;
361  Mdouble Iyy_ = getInertia().YY;
362  Mdouble Izz_ = getInertia().ZZ;
363  Mdouble Ixy_ = getInertia().XY;
364  Mdouble Ixz_ = getInertia().XZ;
365  Mdouble Iyz_ = getInertia().YZ;
366 
368 
369  Vec3D angularVelocity_0 = getAngularVelocity();
370  Vec3D angularVelocity_n = angularVelocity_0;
371  for (int n = 0; n<N_ITER; n++) //
372  {
373  Mdouble wx = angularVelocity_n.X;
374  Mdouble wy = angularVelocity_n.Y;
375  Mdouble wz = angularVelocity_n.Z;
376 
377  Vec3D W = Vec3D(wy*wz*(Izz_-Iyy_) - wz*wz*Iyz_ + wy*wy*Iyz_ + wx*wy*Ixz_ - wz*wx*Ixy_,
378  wz*wx*(Ixx_-Izz_) - wx*wx*Ixz_ + wz*wz*Ixz_ + wy*wz*Ixy_ - wx*wy*Iyz_,
379  wx*wy*(Iyy_-Ixx_) - wy*wy*Ixy_ + wx*wx*Ixy_ + wz*wx*Iyz_ - wy*wz*Ixz_);
380 
381  Vec3D angularAcceleration_n = invInertia_ * (M-W);
382  angularAcceleration_ = angularAcceleration_n;
383  angularAcceleration_ = angularAcceleration_n;
384  angularVelocity_n = angularVelocity_0 + 0.5 * timeStep * angularAcceleration_n;
385  }
386 
387  setAngularVelocity(angularVelocity_n);
388 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
#define N_ITER
Definition: ClumpParticle.cc:32
double Mdouble
Definition: GeneralDefine.h:34
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
Definition: BaseInteractable.cc:341
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Definition: BaseInteractable.cc:360
const Vec3D & getTorque() const
Returns the torque on this BaseInteractable.
Definition: BaseInteractable.h:138
MatrixSymmetric3D getInertia() const
Definition: BaseParticle.h:331
Vec3D angularAcceleration_
Definition: ClumpParticle.h:289
Mdouble ZZ
Definition: MatrixSymmetric.h:42
Mdouble YY
Definition: MatrixSymmetric.h:42
Mdouble XZ
Definition: MatrixSymmetric.h:42
Mdouble XY
Definition: MatrixSymmetric.h:42
Mdouble XX
The six distinctive matrix elements.
Definition: MatrixSymmetric.h:42
Mdouble YZ
Definition: MatrixSymmetric.h:42
Definition: Vector.h:51
Mdouble Y
Definition: Vector.h:66
Mdouble Z
Definition: Vector.h:66
Mdouble X
the vector components
Definition: Vector.h:66

References angularAcceleration_, BaseInteractable::getAngularVelocity(), BaseParticle::getInertia(), BaseInteractable::getTorque(), BaseParticle::invInertia_, n, N_ITER, BaseInteractable::setAngularVelocity(), viscousDamping_, Vec3D::X, MatrixSymmetric3D::XX, MatrixSymmetric3D::XY, MatrixSymmetric3D::XZ, Vec3D::Y, MatrixSymmetric3D::YY, MatrixSymmetric3D::YZ, Vec3D::Z, and MatrixSymmetric3D::ZZ.

Referenced by integrateAfterForceComputation(), and integrateBeforeForceComputation().

◆ computeMass()

void ClumpParticle::computeMass ( const ParticleSpecies s)
overridevirtual

Computes the particle's (inverse) mass and inertia.

Reimplemented from BaseParticle.

392 {
393  if (isFixed()) return;
394  if (isPebble()) return;
395 
396  if (isClump())
397  {
398  invMass_ = 1.0 / clumpMass_;
400 
401  }
402 }
bool isFixed() const override
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
Definition: BaseParticle.h:93
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:685

References clumpInertia_, clumpMass_, MatrixSymmetric3D::inverse(), BaseParticle::invInertia_, BaseParticle::invMass_, BaseParticle::isClump(), BaseParticle::isFixed(), and BaseParticle::isPebble().

◆ copy()

ClumpParticle * ClumpParticle::copy ( ) const
overridevirtual

Particle copy method. Pure virtual as this needs to set in the derived class.

Implements NonSphericalParticle.

98 {
99  return new ClumpParticle(*this);
100 }
ClumpParticle()
Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.
Definition: ClumpParticle.cc:37

References ClumpParticle().

◆ getDzhanibekovParticle()

bool ClumpParticle::getDzhanibekovParticle ( )
inline
228  {
229  return DzhanibekovParticle_;
230  }

References DzhanibekovParticle_.

Referenced by multiParticleT1::actionsAfterTimeStep().

◆ getFieldVTK()

std::vector<Mdouble> ClumpParticle::getFieldVTK ( unsigned  i) const
inlineoverridevirtual

Reimplemented from BaseParticle.

271  {
272  if (i==0)
273  return std::vector<Mdouble>(1, DzhanibekovParticle_);
274  else
275  return std::vector<Mdouble>(1, VerticallyOriented_);
276  }
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References DzhanibekovParticle_, constants::i, and VerticallyOriented_.

◆ getInitPrincipalDirections_e1()

Vec3D ClumpParticle::getInitPrincipalDirections_e1 ( ) const
inline
110  {
112  }
Mdouble YX
Definition: Matrix.h:43
Mdouble ZX
Definition: Matrix.h:43
Mdouble XX
all nine matrix elements
Definition: Matrix.h:43

References initPrincipalDirections_, Matrix3D::XX, Matrix3D::YX, and Matrix3D::ZX.

Referenced by rotateTensorOfInertia().

◆ getInitPrincipalDirections_e2()

Vec3D ClumpParticle::getInitPrincipalDirections_e2 ( ) const
inline
114  {
116  }
Mdouble XY
Definition: Matrix.h:43
Mdouble YY
Definition: Matrix.h:43
Mdouble ZY
Definition: Matrix.h:43

References initPrincipalDirections_, Matrix3D::XY, Matrix3D::YY, and Matrix3D::ZY.

Referenced by rotateTensorOfInertia().

◆ getInitPrincipalDirections_e3()

Vec3D ClumpParticle::getInitPrincipalDirections_e3 ( ) const
inline
118  {
120  }
Mdouble ZZ
Definition: Matrix.h:43
Mdouble YZ
Definition: Matrix.h:43
Mdouble XZ
Definition: Matrix.h:43

References initPrincipalDirections_, Matrix3D::XZ, Matrix3D::YZ, and Matrix3D::ZZ.

Referenced by rotateTensorOfInertia().

◆ getKineticEnergy()

Mdouble ClumpParticle::getKineticEnergy ( ) const
inlineoverridevirtual

The following redefines functions of BaseParticles as virtual to make them available in child Clump class

Reimplemented from NonSphericalParticle.

185  {
186  Mdouble res = 0;
187  if (isClump_) {
188  Vec3D v = getVelocity();
189  res = 0.5 * clumpMass_ * (v.X * v.X + v.Y * v.Y + v.Z * v.Z );
190  }
191  return res;
192  }
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329

References clumpMass_, BaseInteractable::getVelocity(), BaseParticle::isClump_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

◆ getName()

std::string ClumpParticle::getName ( ) const
overridevirtual

Returns the name of the object. Pure virtual as this needs to set in the derived class.

Implements NonSphericalParticle.

104 {
105  return "ClumpParticle";
106 }

◆ getNameVTK()

std::string ClumpParticle::getNameVTK ( unsigned  i) const
inlineoverridevirtual

Reimplemented from BaseParticle.

262  {
263  if (i==0)
264  return "DzhanibekovParticle";
265  else
266  return "VerticallyOriented";
267  }

References constants::i.

◆ getNumberOfFieldsVTK()

unsigned ClumpParticle::getNumberOfFieldsVTK ( ) const
inlineoverridevirtual

Reimplemented from BaseParticle.

251  {
252  return 2;
253  }

◆ getPebblePositions()

std::vector<Vec3D> ClumpParticle::getPebblePositions ( )
inline
211  {
212  std::vector <Vec3D> globalPos;
216  for (int i = 1; i <= NPebble(); i++){
217  globalPos.push_back(getPosition() + e1 * pebblePos_[i - 1].X + e2 * pebblePos_[i - 1].Y + e3 * pebblePos_[i - 1].Z);
218  }
219  return globalPos;
220  }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
Vec3D getPrincipalDirections_e2() const
Definition: ClumpParticle.h:99
Vec3D getPrincipalDirections_e3() const
Definition: ClumpParticle.h:103
Vec3D getPrincipalDirections_e1() const
Definition: ClumpParticle.h:94

References BaseInteractable::getPosition(), getPrincipalDirections_e1(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), constants::i, NPebble(), and pebblePos_.

Referenced by Mercury3Dclump::checkClumpForInteraction(), and Mercury3Dclump::checkClumpForInteractionPeriodic().

◆ getPebbleRadii()

std::vector<Mdouble> ClumpParticle::getPebbleRadii ( )
inline

◆ getPebbleRadius()

std::vector<Mdouble> ClumpParticle::getPebbleRadius ( ) const
inline
157  {
158  return pebbleRadius_;
159  }

References pebbleRadius_.

Referenced by actionsAfterAddObject().

◆ getPrincipalDirections_e1()

◆ getPrincipalDirections_e2()

◆ getPrincipalDirections_e3()

◆ getRotationalEnergy()

Mdouble ClumpParticle::getRotationalEnergy ( ) const
inlineoverridevirtual

Calculates the particle's rotational kinetic energy.

Returns
the particle's rotational kinetic energy

Reimplemented from NonSphericalParticle.

194  {
195  Mdouble res = 0;
196  if (isClump_) {
197  Vec3D nn = getAngularVelocity();
198  Mdouble nl = nn.getLength();
199  Mdouble tol = 1e-10;
200  if (nl > tol) {
201  nn /= nl;
203  Mdouble II = Vec3D::dot(nn, (getInertia() * nn));
204  res = 0.5 * II * ww;
205  }
206  }
207  return res;
208 
209  }
static Mdouble getLengthSquared(const Vec3D &a)
Calculates the squared length of a Vec3D: .
Definition: Vector.h:332
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76

References Vec3D::dot(), BaseInteractable::getAngularVelocity(), BaseParticle::getInertia(), Vec3D::getLength(), Vec3D::getLengthSquared(), and BaseParticle::isClump_.

◆ getTypeVTK()

std::string ClumpParticle::getTypeVTK ( unsigned  i) const
inlineoverridevirtual

Reimplemented from BaseParticle.

256  {
257  return "Int8";
258  }

◆ getVerticallyOriented()

bool ClumpParticle::getVerticallyOriented ( )
inline
234  {
235  return VerticallyOriented_;
236  }

References VerticallyOriented_.

◆ integrateAfterForceComputation()

void ClumpParticle::integrateAfterForceComputation ( double  time,
double  timeStep 
)
overridevirtual

Second step of Velocity Verlet integration (see also http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet).

Parameters
[in]timecurrent time
[in]timeStepcurrent time step

Reimplemented from BaseParticle.

335 {
336  if (isPebble()) return;
337  if (getInvMass() == 0.0)
338  {
340  }
341  else
342  {
343  // Translational acceleration
344  accelerate((getForce() - viscousDamping_ * getVelocity()) * getInvMass() * 0.5 * timeStep);
345 
346  // PFC4 style angular acceleration of Clumps
348 
349  // Rotate pebbles
351 
352  // Updates extra quantities
354  }
355 }
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
Definition: BaseInteractable.h:126
void integrateAfterForceComputation(double time, double timeStep)
This is part of the integration routine for objects with infinite mass.
Definition: BaseInteractable.cc:611
void accelerate(const Vec3D &vel)
Increases the particle's velocity_ by the given vector.
Definition: BaseParticle.cc:634
Mdouble getInvMass() const override
Returns the inverse of the particle's mass.
Definition: BaseParticle.h:293
void angularAccelerateClumpIterative(double timeStep)
Definition: ClumpParticle.cc:358
void updateExtraQuantities()
Definition: ClumpParticle.cc:405

References BaseParticle::accelerate(), angularAccelerateClumpIterative(), BaseInteractable::getForce(), BaseParticle::getInvMass(), BaseInteractable::getVelocity(), BaseInteractable::integrateAfterForceComputation(), BaseParticle::isPebble(), updateExtraQuantities(), updatePebblesVelPos(), and viscousDamping_.

◆ integrateBeforeForceComputation()

void ClumpParticle::integrateBeforeForceComputation ( double  time,
double  timeStep 
)
overridevirtual

First step of Velocity Verlet integration (see also http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet).

Parameters
[in]timecurrent time
[in]timeStepcurrent time step

Reimplemented from BaseParticle.

288 {
289  if (isPebble()) return;
290  if (getInvMass() == 0.0)
291  {
293  }
294  else
295  {
296 #ifdef MERCURY_USE_MPI
297  //For periodic particles in parallel the previous position is required
299 #endif
300  accelerate((getForce() - viscousDamping_ * getVelocity()) * getInvMass() * 0.5 * timeStep); // V(t+0.5dt)
301  const Vec3D displacement = getVelocity() * timeStep;
302  move(displacement); // X(t+dt)
303 
304  DPMBase* const dpm = getHandler()->getDPMBase();
305  if (!dpm->getHGridUpdateEachTimeStep())
306  {
307  dpm->hGridUpdateMove(this, displacement.getLengthSquared());
308  }
309 
310  // PFC4 style acceleration of Clumps
311  angularAccelerateClumpIterative(timeStep); //W(t+0.5dt)
312 
313  //apply to rotation quaternion q: q = normalise(q + \tilde{C}\omega*timeStep) (see Wouter's notes)
314  rotate(getAngularVelocity() * timeStep);
315 
316  // Rotate
318 
319  // Update pebble nodes
321 
322  // Update TOI
324 
325  }
326 }
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
void integrateBeforeForceComputation(double time, double timeStep)
This is part of integrate routine for objects with infinite mass.
Definition: BaseInteractable.cc:538
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
Definition: BaseInteractable.cc:215
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
Definition: BaseInteractable.cc:230
void setPreviousPosition(const Vec3D &pos)
Sets the particle's position in the previous time step.
Definition: BaseParticle.cc:614
void rotatePrincipalDirections(Vec3D rotation)
Definition: ClumpParticle.cc:151
void rotateTensorOfInertia()
Definition: ClumpParticle.cc:224
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
virtual bool getHGridUpdateEachTimeStep() const
Definition: DPMBase.cc:1718
virtual void hGridUpdateMove(BaseParticle *, Mdouble)
Definition: DPMBase.cc:1933

References BaseParticle::accelerate(), angularAccelerateClumpIterative(), BaseInteractable::getAngularVelocity(), BaseHandler< T >::getDPMBase(), BaseInteractable::getForce(), BaseParticle::getHandler(), DPMBase::getHGridUpdateEachTimeStep(), BaseParticle::getInvMass(), Vec3D::getLengthSquared(), BaseInteractable::getPosition(), BaseInteractable::getVelocity(), DPMBase::hGridUpdateMove(), BaseInteractable::integrateBeforeForceComputation(), BaseParticle::isPebble(), BaseInteractable::move(), BaseInteractable::rotate(), rotatePrincipalDirections(), rotateTensorOfInertia(), BaseParticle::setPreviousPosition(), updatePebblesVelPos(), and viscousDamping_.

◆ isSphericalParticle()

bool ClumpParticle::isSphericalParticle ( ) const
inlineoverridevirtual

this flag is used to decide whether to compute orientation, which is not necessary for spherical particles

Todo:
This flag is used badly, and used to determine whether particles are superquadric

Implements BaseParticle.

76  {
77  return true;
78  }

◆ MtoS()

MatrixSymmetric3D ClumpParticle::MtoS ( Matrix3D  M)
inlineprivate
312 { return MatrixSymmetric3D(M.XX, M.XY, M.XZ, M.YY, M.YZ, M.ZZ);}

Referenced by rotateTensorOfInertia().

◆ NPebble()

int ClumpParticle::NPebble ( ) const

◆ read()

void ClumpParticle::read ( std::istream &  is)
overridevirtual

Particle read function, which accepts an std::istream as input.

Particle read function. Has an std::istream as argument, from which it extracts the radius_, invMass_ and invInertia_, respectively. From these the mass and inertia are deduced. An additional set of properties is read through the call to the parent's method BaseInteractable::read().

Parameters
[in,out]isinput stream with particle properties.

Reimplemented from BaseParticle.

109 {
110  BaseParticle::read(is);
111  std::string dummy;
112  is >> dummy >> nPebble_;
113 }
void read(std::istream &is) override
Particle read function, which accepts an std::istream as input.
Definition: BaseParticle.cc:374

References nPebble_, and BaseParticle::read().

◆ rotatePrincipalDirections()

void ClumpParticle::rotatePrincipalDirections ( Vec3D  rotation)
152 {
153  Mdouble tol = 10e-9;
154  Mdouble angle = rotation.getLength();
155  if (angle < tol) return;
156  Mdouble c1, c2, c3, theta, dist;
157  Vec3D e3 = rotation; e3.normalise();
159  if (e2.getLength() < 0.1) e2 = Vec3D::cross(e3, getPrincipalDirections_e2());
160  if (e2.getLength() < 0.1) e2 = Vec3D::cross(e3, getPrincipalDirections_e3());
161  e2.normalise();
162  Vec3D e1 = Vec3D::cross(e2, e3);
163  Vec3D pa;
164  // Rotate principal axis 1
166  c1 = Vec3D::dot(pa, e1);
167  c2 = Vec3D::dot(pa, e2);
168  c3 = Vec3D::dot(pa, e3);
169 
170  dist = sqrt(c1 * c1 + c2 * c2);
171  theta = atan2(c2, c1) + angle;
172  setPrincipalDirections_e1(dist * cos(theta) * e1 + dist*sin(theta) * e2 + c3 * e3);
173  // Rotate principal axis 2
175  c1 = Vec3D::dot(pa, e1);
176  c2 = Vec3D::dot(pa, e2);
177  c3 = Vec3D::dot(pa, e3);
178  dist = sqrt(c1 * c1 + c2 * c2);
179  theta = atan2(c2, c1) + angle;
180  setPrincipalDirections_e2(dist * cos(theta) * e1 + dist*sin(theta) * e2 + c3 * e3);
181  // Rotate principal axis 3
183  c1 = Vec3D::dot(pa, e1);
184  c2 = Vec3D::dot(pa, e2);
185  c3 = Vec3D::dot(pa, e3);
186  dist = sqrt(c1 * c1 + c2 * c2);
187  theta = atan2(c2, c1) + angle;
188  setPrincipalDirections_e3(dist * cos(theta) * e1 + dist*sin(theta) * e2 + c3 * e3);
189 }
void setPrincipalDirections_e1(Vec3D e)
Definition: ClumpParticle.h:138
void setPrincipalDirections_e3(Vec3D e)
Definition: ClumpParticle.h:150
void setPrincipalDirections_e2(Vec3D e)
Definition: ClumpParticle.h:144
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:163
void normalise()
Makes this Vec3D unit length.
Definition: Vector.cc:123
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44

References mathsFunc::cos(), Vec3D::cross(), Vec3D::dot(), Vec3D::getLength(), getPrincipalDirections_e1(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), Vec3D::normalise(), setPrincipalDirections_e1(), setPrincipalDirections_e2(), setPrincipalDirections_e3(), and mathsFunc::sin().

Referenced by integrateBeforeForceComputation().

◆ rotateTensorOfInertia()

void ClumpParticle::rotateTensorOfInertia ( )
225 {
226  // Initial and current principal directions
230 
234 
235  // Rotation matrix from initial and current principal directions
236  Matrix3D Q(Vec3D::dot(e10, e1), Vec3D::dot(e10, e2), Vec3D::dot(e10, e3),
237  Vec3D::dot(e20, e1), Vec3D::dot(e20, e2), Vec3D::dot(e20, e3),
238  Vec3D::dot(e30, e1), Vec3D::dot(e30, e2), Vec3D::dot(e30, e3));
239 
240  Matrix3D Qt = transpose(Q);
241 
242  MatrixSymmetric3D inertia = MtoS(Q * (StoM(clumpInitInertia_) * Qt));
243  // inertia = clumpInitInertia_; // uncomment to turn off rotation of toi
244  clumpInertia_ = inertia;
246 
247 }
Vec3D getInitPrincipalDirections_e1() const
Definition: ClumpParticle.h:109
MatrixSymmetric3D MtoS(Matrix3D M)
Definition: ClumpParticle.h:312
Vec3D getInitPrincipalDirections_e2() const
Definition: ClumpParticle.h:113
Matrix3D StoM(MatrixSymmetric3D M)
Definition: ClumpParticle.h:315
Matrix3D transpose(Matrix3D M)
Definition: ClumpParticle.h:318
Vec3D getInitPrincipalDirections_e3() const
Definition: ClumpParticle.h:117

References clumpInertia_, clumpInitInertia_, Vec3D::dot(), getInitPrincipalDirections_e1(), getInitPrincipalDirections_e2(), getInitPrincipalDirections_e3(), getPrincipalDirections_e1(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), MatrixSymmetric3D::inverse(), BaseParticle::invInertia_, MtoS(), StoM(), and transpose().

Referenced by integrateBeforeForceComputation().

◆ setClump() [1/2]

void ClumpParticle::setClump ( )

◆ setClump() [2/2]

void ClumpParticle::setClump ( ClumpParticle master)
inline
167  {
168  isClump_ = false;
169  isPebble_ = true;
170  clumpParticle = master;
171  }

References BaseParticle::clumpParticle, BaseParticle::isClump_, and BaseParticle::isPebble_.

◆ setClumpMass()

void ClumpParticle::setClumpMass ( Mdouble  mass)
inline

◆ setDamping()

void ClumpParticle::setDamping ( Mdouble  damp)
inline

◆ setDzhanibekovParticle()

void ClumpParticle::setDzhanibekovParticle ( bool  d)
inline
240  {
242  }

References DzhanibekovParticle_.

Referenced by updateExtraQuantities().

◆ setInitInertia()

void ClumpParticle::setInitInertia ( MatrixSymmetric3D  inertia)

◆ setInitPrincipalDirections()

void ClumpParticle::setInitPrincipalDirections ( Matrix3D  directions)
146 {
147  initPrincipalDirections_ = directions;
148 }

References initPrincipalDirections_.

◆ setPebble()

void ClumpParticle::setPebble ( int  kPebble,
ClumpParticle pPebble 
)
inline
162  {
163  pebbleParticles_[kPebble] = pPebble;
164  }

References pebbleParticles_.

Referenced by actionsAfterAddObject().

◆ setPrincipalDirections()

void ClumpParticle::setPrincipalDirections ( Matrix3D  directions)

◆ setPrincipalDirections_e1()

void ClumpParticle::setPrincipalDirections_e1 ( Vec3D  e)
inline

◆ setPrincipalDirections_e2()

void ClumpParticle::setPrincipalDirections_e2 ( Vec3D  e)
inline

◆ setPrincipalDirections_e3()

void ClumpParticle::setPrincipalDirections_e3 ( Vec3D  e)
inline

◆ setVerticallyOriented()

void ClumpParticle::setVerticallyOriented ( bool  d)
inline
246  {
248  }

References VerticallyOriented_.

Referenced by updateExtraQuantities().

◆ StoM()

Matrix3D ClumpParticle::StoM ( MatrixSymmetric3D  M)
inlineprivate
315 { return Matrix3D(M.XX, M.XY, M.XZ, M.XY, M.YY, M.YZ, M.XZ, M.YZ, M.ZZ);}

Referenced by rotateTensorOfInertia().

◆ transpose()

Matrix3D ClumpParticle::transpose ( Matrix3D  M)
inlineprivate
318 { return Matrix3D(M.XX, M.YX, M.ZX, M.XY, M.YY, M.ZY, M.XZ, M.YZ, M.ZZ);}

Referenced by rotateTensorOfInertia().

◆ updateExtraQuantities()

void ClumpParticle::updateExtraQuantities ( )
406 {
407  Mdouble ANG_TOL = 0.1; // 5.7 degrees - tolerance to misalignment
408  Mdouble ACC_TOL = 0.1; // Tolerance for angular acceleration magnitude
409 
410  Mdouble TOL = 10e-8; // External force tolerance
411  ClumpParticle* pPebble;
413  Vec3D v = Vec3D(0,0,1);
414 
415  // Check for vertical alignment
416  if (acos(Vec3D::dot(n3, v))<ANG_TOL)
417  {
418  setVerticallyOriented(true);
419  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
420  {
421  pPebble = pebbleParticles_[iPebble - 1];
422  pPebble->setVerticallyOriented(true);
423  }
424  }
425  else {
426  setVerticallyOriented(false);
427  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
428  {
429  pPebble = pebbleParticles_[iPebble - 1];
430  pPebble->setVerticallyOriented(false);
431  }
432  }
433 
434  // Check for Dzhanibekov States
435 
439 
440  if ((acos(Vec3D::dot(n2, w))<ANG_TOL) || (acc<TOL))
441  {
443  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
444  {
445  pPebble = pebbleParticles_[iPebble - 1];
446  pPebble->setDzhanibekovParticle(true);
447  }
448  }
449 
450  // Any contact force/torques break D state
451  if ( (getForce().getLength() > TOL)||(getTorque().getLength() > TOL) )
452  {
453  setDzhanibekovParticle(false);
454  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
455  {
456  pPebble = pebbleParticles_[iPebble - 1];
457  pPebble->setDzhanibekovParticle(false);
458  }
459  }
460 
461  return;
462 }
void setVerticallyOriented(bool d)
Definition: ClumpParticle.h:245
void setDzhanibekovParticle(bool d)
Definition: ClumpParticle.h:239

References angularAcceleration_, Vec3D::dot(), BaseInteractable::getAngularVelocity(), BaseInteractable::getForce(), Vec3D::getLength(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), BaseInteractable::getTorque(), nPebble_, pebbleParticles_, setDzhanibekovParticle(), and setVerticallyOriented().

Referenced by integrateAfterForceComputation().

◆ updatePebblesVelPos()

void ClumpParticle::updatePebblesVelPos ( )
252 {
253  BaseParticle* pPebble;
254  Vec3D position = getPosition();
255  Vec3D angularVelocity = getAngularVelocity();
256  Quaternion orientation = getOrientation();
257 
261 
262  Vec3D velocityDueToRotation;
263 
264  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
265  {
266  pPebble = pebbleParticles_[iPebble - 1];
267  // pPebble->setMass(clumpMass_);
268  pPebble->invMass_ = 1. / clumpMass_;
269  pPebble->setAngularVelocity(angularVelocity);
270  pPebble->setOrientation(orientation);
271  pPebble->setPosition(position + e1 * pebblePos_[iPebble - 1].X + e2 * pebblePos_[iPebble - 1].Y + e3 * pebblePos_[iPebble - 1].Z);
272 
273 
274  velocityDueToRotation = Vec3D::cross(angularVelocity, pPebble->getPosition() - position);
275 
276  pPebble->setVelocity(getVelocity());
277  pPebble->addVelocity(velocityDueToRotation);
278  }
279 }
@ Y
Definition: StatisticsVector.h:42
@ X
Definition: StatisticsVector.h:42
@ Z
Definition: StatisticsVector.h:42
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:230
virtual void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: BaseInteractable.h:260
void addVelocity(const Vec3D &velocity)
adds an increment to the velocity.
Definition: BaseInteractable.h:312
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
Definition: BaseParticle.h:54
This class contains the 4 components of a quaternion and the standard operators and functions needed ...
Definition: Quaternion.h:63

References BaseInteractable::addVelocity(), clumpMass_, Vec3D::cross(), BaseInteractable::getAngularVelocity(), BaseInteractable::getOrientation(), BaseInteractable::getPosition(), getPrincipalDirections_e1(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), BaseInteractable::getVelocity(), BaseParticle::invMass_, nPebble_, pebbleParticles_, pebblePos_, BaseInteractable::setAngularVelocity(), BaseInteractable::setOrientation(), BaseInteractable::setPosition(), BaseInteractable::setVelocity(), X, Y, and Z.

Referenced by actionsAfterAddObject(), integrateAfterForceComputation(), and integrateBeforeForceComputation().

◆ write()

void ClumpParticle::write ( std::ostream &  os) const
inlineoverridevirtual

Particle print function, which accepts an std::ostream as input.

BaseParticle print method, which accepts an os std::ostream as input. It prints human readable BaseParticle information to the std::ostream.

Parameters
[in,out]osstream to which the info is written

Reimplemented from BaseParticle.

64  {
66  os << " DzhanibekovParticle " << DzhanibekovParticle_;
67  os << " VerticallyOriented " << VerticallyOriented_;
68 
69  }
void write(std::ostream &os) const override
Particle print function, which accepts an std::ostream as input.
Definition: BaseParticle.cc:336

References DzhanibekovParticle_, VerticallyOriented_, and BaseParticle::write().

Member Data Documentation

◆ angularAcceleration_

Vec3D ClumpParticle::angularAcceleration_
private

◆ clumpInertia_

MatrixSymmetric3D ClumpParticle::clumpInertia_
private

◆ clumpInitInertia_

MatrixSymmetric3D ClumpParticle::clumpInitInertia_
private

◆ clumpMass_

Mdouble ClumpParticle::clumpMass_
private

◆ DzhanibekovParticle_

bool ClumpParticle::DzhanibekovParticle_
private

◆ initPrincipalDirections_

◆ nPebble_

int ClumpParticle::nPebble_
private

◆ pebbleParticles_

std::vector<ClumpParticle*> ClumpParticle::pebbleParticles_
private

◆ pebblePos_

std::vector<Vec3D> ClumpParticle::pebblePos_
private

◆ pebbleRadius_

std::vector<Mdouble> ClumpParticle::pebbleRadius_
private

◆ principalDirections_

◆ VerticallyOriented_

bool ClumpParticle::VerticallyOriented_
private

◆ viscousDamping_


The documentation for this class was generated from the following files: