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
 
Matrix3D getRotationMatrix () 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
 
virtual Mdouble getSurfaceArea () 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 setTimeStamp (unsigned timeStamp)
 
unsigned getTimeStamp () const
 
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...
 
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 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 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 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
 
virtual void setSpecies (const ParticleSpecies *species)
 
virtual void actionsBeforeTimeStep ()
 
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 isDzhanibekovParticle_
 
bool isVerticallyOriented_
 
Vec3D angularAcceleration_
 
Mdouble clumpMass_
 
Mdouble viscousDamping_
 
MatrixSymmetric3D clumpInertia_
 
MatrixSymmetric3D clumpInitInertia_
 
std::vector< Vec3DpebblePos_
 
std::vector< MdoublepebbleRadius_
 
Matrix3D principalDirections_
 
Matrix3D initPrincipalDirections_
 
std::vector< ClumpParticle * > pebbleParticles_
 
Matrix3D rotationMatrix_
 

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...
 

Detailed Description

functional of rigid clumps in mercuryDPM

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.

17 {
18  setRadius(1.0);
19  nPebble_ = 0;
20 
21  clumpMass_ = 1.0;
22  viscousDamping_ = 0.0;
23  pebblePos_ = std::vector<Vec3D>(0);
24 
25  pebbleRadius_ = std::vector<Mdouble>(0);
26  pebbleParticles_ = std::vector<ClumpParticle*>(0);
27 
28  principalDirections_ = Matrix3D(1, 0, 0, 0, 1, 0, 0, 0, 1);
29  initPrincipalDirections_ = Matrix3D(1, 0, 0, 0, 1, 0, 0, 0, 1);
30 
31  clumpInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1);
32  clumpInitInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1);
33  rotationMatrix_ = Matrix3D(1, 0, 0, 0, 1, 0, 0, 0, 1);
35 
36  isPebble_ = false; //Assign false by default
37  isClump_ = false; //Assign false by default
38  clumpParticle_ = nullptr;
39 
40 
41  isDzhanibekovParticle_ = false;
42  isVerticallyOriented_ = false;
43 
44  logger(DEBUG, "Clump() created");
45 }
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:717
bool isPebble_
pointer to a clump particle (for a pebble)
Definition: BaseParticle.h:715
BaseParticle * clumpParticle_
Function that updates necessary quantities of a clump particle after adding a pebble.
Definition: BaseParticle.h:713
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:652
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:548
int nPebble_
Definition: ClumpParticle.h:314
MatrixSymmetric3D clumpInitInertia_
Definition: ClumpParticle.h:328
Mdouble clumpMass_
Definition: ClumpParticle.h:322
MatrixSymmetric3D clumpInertia_
Definition: ClumpParticle.h:326
std::vector< Mdouble > pebbleRadius_
Definition: ClumpParticle.h:332
std::vector< Vec3D > pebblePos_
Definition: ClumpParticle.h:330
Matrix3D rotationMatrix_
Definition: ClumpParticle.h:340
Mdouble viscousDamping_
Definition: ClumpParticle.h:324
Matrix3D initPrincipalDirections_
Definition: ClumpParticle.h:336
bool isVerticallyOriented_
Definition: ClumpParticle.h:318
bool isDzhanibekovParticle_
Definition: ClumpParticle.h:316
std::vector< ClumpParticle * > pebbleParticles_
Definition: ClumpParticle.h:338
Matrix3D principalDirections_
Definition: ClumpParticle.h:334
Implementation of a 3D matrix.
Definition: Kernel/Math/Matrix.h:17
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:16
static MatrixSymmetric3D inverse(const MatrixSymmetric3D &A)
Computes the inverse of a matrix; exits if the inverse doesn't exist.
Definition: MatrixSymmetric.cc:267

References clumpInertia_, clumpInitInertia_, clumpMass_, BaseParticle::clumpParticle_, DEBUG, initPrincipalDirections_, MatrixSymmetric3D::inverse(), BaseParticle::invInertia_, BaseParticle::isClump_, isDzhanibekovParticle_, BaseParticle::isPebble_, isVerticallyOriented_, logger, nPebble_, pebbleParticles_, pebblePos_, pebbleRadius_, principalDirections_, rotationMatrix_, BaseParticle::setRadius(), and viscousDamping_.

Referenced by copy().

◆ ClumpParticle() [2/2]

ClumpParticle::ClumpParticle ( const ClumpParticle p)

Basic Particle constructor (copy-based)

48 {
49  nPebble_ = p.nPebble_;
50 
51  clumpMass_ = p.clumpMass_;
52  viscousDamping_ = p.viscousDamping_;
53  pebblePos_ = p.pebblePos_;
54  pebbleRadius_ = p.pebbleRadius_;
55  pebbleParticles_ = p.pebbleParticles_;
56  principalDirections_ = p.principalDirections_;
57  initPrincipalDirections_ = p.initPrincipalDirections_;
58  clumpInertia_ = p.clumpInertia_;
59  clumpInitInertia_ = p.clumpInitInertia_;
60  rotationMatrix_ = p.rotationMatrix_;
62  isDzhanibekovParticle_ = p.isDzhanibekovParticle_;
63  isVerticallyOriented_ = p.isVerticallyOriented_;
64 
65  for (int iPebble = 1; iPebble <= nPebble_; iPebble++) pebbleParticles_[iPebble - 1] = nullptr;
66 
67  // Pebble attributes
68  isPebble_ = p.isPebble_;
69  clumpParticle_ = p.clumpParticle_;
70  // Clump attributes
71  isClump_ = p.isClump_;
72 }
float * p
Definition: Tutorial_Map_using.cpp:9
NonSphericalParticle()=default

References clumpInertia_, clumpInitInertia_, clumpMass_, BaseParticle::clumpParticle_, initPrincipalDirections_, MatrixSymmetric3D::inverse(), BaseParticle::invInertia_, BaseParticle::isClump_, isDzhanibekovParticle_, BaseParticle::isPebble_, isVerticallyOriented_, nPebble_, p, pebbleParticles_, pebblePos_, pebbleRadius_, principalDirections_, rotationMatrix_, and viscousDamping_.

◆ ~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.

168 {
169  //Only attribute features to clump particle.
170  if (isPebble()) return;
171  if (isClump())
172  {
173  ClumpParticle p0; // Instance for the pebbles
174  p0.setSpecies(getSpecies());
175  p0.setClump(this);
176 
177  //Go through the number of pebbles
178  for (int iPebble = 1; iPebble <= NPebble(); iPebble++)
179  {
180  //Set the radius of pebbles:
181  p0.setRadius(getPebbleRadius()[iPebble - 1]);
182  //Store the address of the pebble:
183  setPebble(iPebble - 1, getHandler()->copyAndAddObject(p0));
184  }
185 
186  //Update the pebble positions, velocities.
188  }
189 }
Vector3f p0
Definition: MatrixBase_all.cpp:2
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:87
bool isPebble() const
Checks if particle is a pebble (belongs to a clump)
Definition: BaseParticle.h:639
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
Definition: BaseParticle.cc:650
bool isClump() const
Checks if particle is a clump (container)
Definition: BaseParticle.h:630
Definition: ClumpParticle.h:20
void updatePebblesVelPos()
Definition: ClumpParticle.cc:227
void setPebble(int kPebble, ClumpParticle *pPebble)
Definition: ClumpParticle.h:193
int NPebble() const
Definition: ClumpParticle.cc:90
std::vector< Mdouble > getPebbleRadius() const
Definition: ClumpParticle.h:188

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

◆ addPebble()

void ClumpParticle::addPebble ( Vec3D  position,
Mdouble  radius 
)
105 {
106  nPebble_++; //Counter of pebbles
107  pebblePos_.push_back(position); //Store pebble positions
108  pebbleRadius_.push_back(radius); //Store pebble radius
109  pebbleParticles_.push_back(nullptr);//Store null pointer per pebble.
110 // isClump_ = true;
111 }
radius
Definition: UniformPSDSelfTest.py:15

References nPebble_, pebbleParticles_, pebblePos_, pebbleRadius_, and UniformPSDSelfTest::radius.

◆ angularAccelerateClumpIterative()

void ClumpParticle::angularAccelerateClumpIterative ( double  timeStep)
335 {
336  Mdouble Ixx_ = getInertia().XX;
337  Mdouble Iyy_ = getInertia().YY;
338  Mdouble Izz_ = getInertia().ZZ;
339  Mdouble Ixy_ = getInertia().XY;
340  Mdouble Ixz_ = getInertia().XZ;
341  Mdouble Iyz_ = getInertia().YZ;
342 
344 
345  Vec3D angularVelocity_0 = getAngularVelocity();
346  Vec3D angularVelocity_n = angularVelocity_0;
347  for (int n = 0; n<N_ITER; n++) //
348  {
349  Mdouble wx = angularVelocity_n.X;
350  Mdouble wy = angularVelocity_n.Y;
351  Mdouble wz = angularVelocity_n.Z;
352 
353  Vec3D W = Vec3D(wy*wz*(Izz_-Iyy_) - wz*wz*Iyz_ + wy*wy*Iyz_ + wx*wy*Ixz_ - wz*wx*Ixy_,
354  wz*wx*(Ixx_-Izz_) - wx*wx*Ixz_ + wz*wz*Ixz_ + wy*wz*Ixy_ - wx*wy*Iyz_,
355  wx*wy*(Iyy_-Ixx_) - wy*wy*Ixy_ + wx*wx*Ixy_ + wz*wx*Iyz_ - wy*wz*Ixz_);
356 
357  Vec3D angularAcceleration_n = invInertia_ * (M-W);
358  angularAcceleration_ = angularAcceleration_n;
359  angularAcceleration_ = angularAcceleration_n;
360  angularVelocity_n = angularVelocity_0 + 0.5 * timeStep * angularAcceleration_n;
361  }
362 
363  setAngularVelocity(angularVelocity_n);
364 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define N_ITER
Definition: ClumpParticle.cc:11
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
Definition: BaseInteractable.cc:319
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Definition: BaseInteractable.cc:338
const Vec3D & getTorque() const
Returns the torque on this BaseInteractable.
Definition: BaseInteractable.h:117
MatrixSymmetric3D getInertia() const
Definition: BaseParticle.h:314
Vec3D angularAcceleration_
Definition: ClumpParticle.h:320
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Mdouble ZZ
Definition: MatrixSymmetric.h:21
Mdouble YY
Definition: MatrixSymmetric.h:21
Mdouble XZ
Definition: MatrixSymmetric.h:21
Mdouble XY
Definition: MatrixSymmetric.h:21
Mdouble XX
The six distinctive matrix elements.
Definition: MatrixSymmetric.h:21
Mdouble YZ
Definition: MatrixSymmetric.h:21
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble Z
Definition: Kernel/Math/Vector.h:45
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
@ W
Definition: quadtree.h:63

References angularAcceleration_, BaseInteractable::getAngularVelocity(), BaseParticle::getInertia(), BaseInteractable::getTorque(), BaseParticle::invInertia_, n, N_ITER, BaseInteractable::setAngularVelocity(), viscousDamping_, oomph::QuadTreeNames::W, 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.

368 {
369  if (isFixed()) return;
370  if (isPebble()) return;
371 
372  if (isClump())
373  {
374  invMass_ = 1.0 / clumpMass_;
376 
377  }
378 }
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:72
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:651

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.

79 {
80  return new ClumpParticle(*this);
81 }
ClumpParticle()
Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.
Definition: ClumpParticle.cc:16

References ClumpParticle().

◆ getDzhanibekovParticle()

bool ClumpParticle::getDzhanibekovParticle ( )
inline
259  {
260  return isDzhanibekovParticle_;
261  }

References isDzhanibekovParticle_.

Referenced by ChangingTOIParticle::actionsAfterTimeStep().

◆ getFieldVTK()

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

Reimplemented from BaseParticle.

302  {
303  if (i==0)
304  return std::vector<Mdouble>(1, isDzhanibekovParticle_);
305  else
306  return std::vector<Mdouble>(1, isVerticallyOriented_);
307  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9

References i, isDzhanibekovParticle_, and isVerticallyOriented_.

◆ getInitPrincipalDirections_e1()

Vec3D ClumpParticle::getInitPrincipalDirections_e1 ( ) const
inline
137  {
139  }
Mdouble YX
Definition: Kernel/Math/Matrix.h:22
Mdouble ZX
Definition: Kernel/Math/Matrix.h:22
Mdouble XX
all nine matrix elements
Definition: Kernel/Math/Matrix.h:22

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

Referenced by rotateTensorOfInertia().

◆ getInitPrincipalDirections_e2()

Vec3D ClumpParticle::getInitPrincipalDirections_e2 ( ) const
inline
141  {
143  }
Mdouble XY
Definition: Kernel/Math/Matrix.h:22
Mdouble YY
Definition: Kernel/Math/Matrix.h:22
Mdouble ZY
Definition: Kernel/Math/Matrix.h:22

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

Referenced by rotateTensorOfInertia().

◆ getInitPrincipalDirections_e3()

Vec3D ClumpParticle::getInitPrincipalDirections_e3 ( ) const
inline
145  {
147  }
Mdouble ZZ
Definition: Kernel/Math/Matrix.h:22
Mdouble YZ
Definition: Kernel/Math/Matrix.h:22
Mdouble XZ
Definition: Kernel/Math/Matrix.h:22

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.

216  {
217  Mdouble res = 0;
218  if (isClump_) {
219  Vec3D v = getVelocity();
220  res = 0.5 * clumpMass_ * (v.X * v.X + v.Y * v.Y + v.Z * v.Z );
221  }
222  return res;
223  }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:307

References clumpMass_, BaseInteractable::getVelocity(), BaseParticle::isClump_, res, and v.

◆ 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.

85 {
86  return "ClumpParticle";
87 }

◆ getNameVTK()

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

Reimplemented from BaseParticle.

293  {
294  if (i==0)
295  return "DzhanibekovParticle";
296  else
297  return "VerticallyOriented";
298  }

References i.

◆ getNumberOfFieldsVTK()

unsigned ClumpParticle::getNumberOfFieldsVTK ( ) const
inlineoverridevirtual

Reimplemented from BaseParticle.

282  {
283  return 2;
284  }

◆ getPebblePositions()

std::vector<Vec3D> ClumpParticle::getPebblePositions ( )
inline
242  {
243  std::vector <Vec3D> globalPos;
247  for (int i = 1; i <= NPebble(); i++){
248  globalPos.push_back(getPosition() + e1 * pebblePos_[i - 1].X + e2 * pebblePos_[i - 1].Y + e3 * pebblePos_[i - 1].Z);
249  }
250  return globalPos;
251  }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
Vec3D getPrincipalDirections_e2() const
Definition: ClumpParticle.h:126
Vec3D getPrincipalDirections_e3() const
Definition: ClumpParticle.h:130
Vec3D getPrincipalDirections_e1() const
Definition: ClumpParticle.h:121

References BaseInteractable::getPosition(), getPrincipalDirections_e1(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), 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
188  {
189  return pebbleRadius_;
190  }

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.

225  {
226  Mdouble res = 0;
227  if (isClump_) {
228  Vec3D nn = getAngularVelocity();
229  Mdouble nl = nn.getLength();
230  Mdouble tol = 1e-10;
231  if (nl > tol) {
232  nn /= nl;
234  Mdouble II = Vec3D::dot(nn, (getInertia() * nn));
235  res = 0.5 * II * ww;
236  }
237  }
238  return res;
239 
240  }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static Mdouble getLengthSquared(const Vec3D &a)
Calculates the squared length of a Vec3D: .
Definition: Kernel/Math/Vector.h:324
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:350
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:56

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

◆ getRotationMatrix()

Matrix3D ClumpParticle::getRotationMatrix ( ) const
inline
150  {
151  return rotationMatrix_;
152  }

References rotationMatrix_.

Referenced by ChangingTOIParticle::actionsAfterTimeStep().

◆ getTypeVTK()

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

Reimplemented from BaseParticle.

287  {
288  return "Int8";
289  }

◆ getVerticallyOriented()

bool ClumpParticle::getVerticallyOriented ( )
inline
265  {
266  return isVerticallyOriented_;
267  }

References isVerticallyOriented_.

◆ 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.

311 {
312  if (isPebble()) return;
313  if (getInvMass() == 0.0)
314  {
316  }
317  else
318  {
319  // Translational acceleration
320  accelerate((getForce() - viscousDamping_ * getVelocity()) * getInvMass() * 0.5 * timeStep);
321 
322  // PFC4 style angular acceleration of Clumps
324 
325  // Rotate pebbles
327 
328  // Updates extra quantities
330  }
331 }
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
Definition: BaseInteractable.h:105
void integrateAfterForceComputation(double time, double timeStep)
This is part of the integration routine for objects with infinite mass.
Definition: BaseInteractable.cc:589
void accelerate(const Vec3D &vel)
Increases the particle's velocity_ by the given vector.
Definition: BaseParticle.cc:620
Mdouble getInvMass() const override
Returns the inverse of the particle's mass.
Definition: BaseParticle.h:276
void angularAccelerateClumpIterative(double timeStep)
Definition: ClumpParticle.cc:334
void updateExtraQuantities()
Definition: ClumpParticle.cc:381

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.

264 {
265  if (isPebble()) return;
266  if (getInvMass() == 0.0)
267  {
269  }
270  else
271  {
272 #ifdef MERCURY_USE_MPI
273  //For periodic particles in parallel the previous position is required
275 #endif
276  accelerate((getForce() - viscousDamping_ * getVelocity()) * getInvMass() * 0.5 * timeStep); // V(t+0.5dt)
277  const Vec3D displacement = getVelocity() * timeStep;
278  move(displacement); // X(t+dt)
279 
280  DPMBase* const dpm = getHandler()->getDPMBase();
281  if (!dpm->getHGridUpdateEachTimeStep())
282  {
283  dpm->hGridUpdateMove(this, displacement.getLengthSquared());
284  }
285 
286  // PFC4 style acceleration of Clumps
287  angularAccelerateClumpIterative(timeStep); //W(t+0.5dt)
288 
289  //apply to rotation quaternion q: q = normalise(q + \tilde{C}\omega*timeStep) (see Wouter's notes)
290  rotate(getAngularVelocity() * timeStep);
291 
292  // Rotate
294 
295  // Update pebble nodes
297 
298  // Update TOI
300 
301  }
302 }
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:733
void integrateBeforeForceComputation(double time, double timeStep)
This is part of integrate routine for objects with infinite mass.
Definition: BaseInteractable.cc:516
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
Definition: BaseInteractable.cc:193
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
Definition: BaseInteractable.cc:208
void setPreviousPosition(const Vec3D &pos)
Sets the particle's position in the previous time step.
Definition: BaseParticle.cc:600
void rotatePrincipalDirections(Vec3D rotation)
Definition: ClumpParticle.cc:126
void rotateTensorOfInertia()
Definition: ClumpParticle.cc:199
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
virtual bool getHGridUpdateEachTimeStep() const
Definition: DPMBase.cc:1707
virtual void hGridUpdateMove(BaseParticle *, Mdouble)
Definition: DPMBase.cc:1922

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.

103  {
104  return true;
105  }

◆ MtoS()

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

Referenced by rotateTensorOfInertia().

◆ NPebble()

◆ read()

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

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.

70  {
72  std::string dummy;
73  is >> dummy >> nPebble_;
74  is >> dummy >> nPebble_;
75  is >> dummy >> clumpMass_;
76  is >> dummy >> viscousDamping_;
77  is >> dummy;
78  for (int i = 0; i<nPebble_; i++) {is >> pebblePos_[i];}
79  is >> dummy;
80  for (int i = 0; i<nPebble_; i++) {is >> pebbleRadius_[i];}
81  //is >> dummy;
82  //for (int i = 0; i<nPebble_; i++) {is >> pebbleParticles_[i];}
83  is >> dummy;
85  is >> dummy;
87  is >> dummy >> clumpInitInertia_;
88  is >> dummy >> clumpInertia_;
89  is >> dummy;
90  is >> rotationMatrix_;
91  is >> dummy >> isPebble_;
92  //is >> dummy >> clumpParticle_;
93  is >> dummy >> isPebble_;
94  is >> dummy >> isDzhanibekovParticle_;
95  is >> dummy >> isVerticallyOriented_;
96 
97 
98  }
void read(std::istream &is) override
Particle read function, which accepts an std::istream as input.
Definition: BaseParticle.cc:368
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References clumpInertia_, clumpInitInertia_, clumpMass_, i, initPrincipalDirections_, isDzhanibekovParticle_, BaseParticle::isPebble_, isVerticallyOriented_, nPebble_, pebblePos_, pebbleRadius_, principalDirections_, BaseParticle::read(), rotationMatrix_, oomph::Global_string_for_annotation::string(), and viscousDamping_.

◆ rotatePrincipalDirections()

void ClumpParticle::rotatePrincipalDirections ( Vec3D  rotation)
127 {
128  Mdouble tol = 10e-9;
129  Mdouble angle = rotation.getLength();
130  if (angle < tol) return;
131  Mdouble c1, c2, c3, theta, dist;
132  Vec3D e3 = rotation; e3.normalise();
134  if (e2.getLength() < 0.1) e2 = Vec3D::cross(e3, getPrincipalDirections_e2());
135  if (e2.getLength() < 0.1) e2 = Vec3D::cross(e3, getPrincipalDirections_e3());
136  e2.normalise();
137  Vec3D e1 = Vec3D::cross(e2, e3);
138  Vec3D pa;
139  // Rotate principal axis 1
141  c1 = Vec3D::dot(pa, e1);
142  c2 = Vec3D::dot(pa, e2);
143  c3 = Vec3D::dot(pa, e3);
144 
145  dist = sqrt(c1 * c1 + c2 * c2);
146  theta = atan2(c2, c1) + angle;
147  setPrincipalDirections_e1(dist * cos(theta) * e1 + dist*sin(theta) * e2 + c3 * e3);
148  // Rotate principal axis 2
150  c1 = Vec3D::dot(pa, e1);
151  c2 = Vec3D::dot(pa, e2);
152  c3 = Vec3D::dot(pa, e3);
153  dist = sqrt(c1 * c1 + c2 * c2);
154  theta = atan2(c2, c1) + angle;
155  setPrincipalDirections_e2(dist * cos(theta) * e1 + dist*sin(theta) * e2 + c3 * e3);
156  // Rotate principal axis 3
158  c1 = Vec3D::dot(pa, e1);
159  c2 = Vec3D::dot(pa, e2);
160  c3 = Vec3D::dot(pa, e3);
161  dist = sqrt(c1 * c1 + c2 * c2);
162  theta = atan2(c2, c1) + angle;
163  setPrincipalDirections_e3(dist * cos(theta) * e1 + dist*sin(theta) * e2 + c3 * e3);
164 }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar atan2(const AnnoyingScalar &y, const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:139
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
void setPrincipalDirections_e1(Vec3D e)
Definition: ClumpParticle.h:169
void setPrincipalDirections_e3(Vec3D e)
Definition: ClumpParticle.h:181
void setPrincipalDirections_e2(Vec3D e)
Definition: ClumpParticle.h:175
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:143
void normalise()
Makes this Vec3D unit length.
Definition: Vector.cc:103
const char const int const RealScalar const RealScalar * pa
Definition: level2_cplx_impl.h:20
double theta
Definition: two_d_biharmonic.cc:236
double angle(const double &t)
Angular position as a function of time t.
Definition: jeffery_orbit.cc:98

References Jeffery_Solution::angle(), atan2(), cos(), Vec3D::cross(), Vec3D::dot(), e(), Vec3D::getLength(), getPrincipalDirections_e1(), getPrincipalDirections_e2(), getPrincipalDirections_e3(), Vec3D::normalise(), pa, setPrincipalDirections_e1(), setPrincipalDirections_e2(), setPrincipalDirections_e3(), sin(), sqrt(), and BiharmonicTestFunctions2::theta.

Referenced by integrateBeforeForceComputation().

◆ rotateTensorOfInertia()

void ClumpParticle::rotateTensorOfInertia ( )
200 {
201  // Initial and current principal directions
205 
209 
210  // Rotation matrix from initial and current principal directions
211  Matrix3D Q(Vec3D::dot(e10, e1), Vec3D::dot(e10, e2), Vec3D::dot(e10, e3),
212  Vec3D::dot(e20, e1), Vec3D::dot(e20, e2), Vec3D::dot(e20, e3),
213  Vec3D::dot(e30, e1), Vec3D::dot(e30, e2), Vec3D::dot(e30, e3));
214 
215  Matrix3D Qt = transpose(Q);
216 
217  MatrixSymmetric3D inertia = MtoS(Q * (StoM(clumpInitInertia_) * Qt));
218  // inertia = clumpInitInertia_; // uncomment to turn off rotation of toi
219  clumpInertia_ = inertia;
221  rotationMatrix_ = Q;
222 
223 }
MatrixXf Q
Definition: HouseholderQR_householderQ.cpp:1
Vec3D getInitPrincipalDirections_e1() const
Definition: ClumpParticle.h:136
MatrixSymmetric3D MtoS(Matrix3D M)
Definition: ClumpParticle.h:345
Vec3D getInitPrincipalDirections_e2() const
Definition: ClumpParticle.h:140
Matrix3D StoM(MatrixSymmetric3D M)
Definition: ClumpParticle.h:348
Matrix3D transpose(Matrix3D M)
Definition: ClumpParticle.h:351
Vec3D getInitPrincipalDirections_e3() const
Definition: ClumpParticle.h:144

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

Referenced by integrateBeforeForceComputation().

◆ setClump() [1/2]

void ClumpParticle::setClump ( )
96 {
97  isClump_ = true;
98  isPebble_ = false;
99 
100 
101 }

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

◆ setClump() [2/2]

void ClumpParticle::setClump ( ClumpParticle master)
inline
198  {
199  isClump_ = false;
200  isPebble_ = true;
201  clumpParticle_ = master;
202  }

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

◆ setClumpMass()

void ClumpParticle::setClumpMass ( Mdouble  mass)
inline
205  {
206  clumpMass_ = mass;
207  invMass_ = 1 / clumpMass_;
208  }

References clumpMass_, and BaseParticle::invMass_.

◆ setDamping()

void ClumpParticle::setDamping ( Mdouble  damp)
inline
212  {
213  viscousDamping_ = damp;
214  }

References viscousDamping_.

◆ setDzhanibekovParticle()

void ClumpParticle::setDzhanibekovParticle ( bool  d)
inline
271  {
273  }

References isDzhanibekovParticle_.

Referenced by updateExtraQuantities().

◆ setInitInertia()

void ClumpParticle::setInitInertia ( MatrixSymmetric3D  inertia)

◆ setInitPrincipalDirections()

void ClumpParticle::setInitPrincipalDirections ( Matrix3D  directions)
121 {
122  initPrincipalDirections_ = directions;
123 }

References initPrincipalDirections_.

◆ setPebble()

void ClumpParticle::setPebble ( int  kPebble,
ClumpParticle pPebble 
)
inline
193  {
194  pebbleParticles_[kPebble] = pPebble;
195  }

References pebbleParticles_.

Referenced by actionsAfterAddObject().

◆ setPrincipalDirections()

void ClumpParticle::setPrincipalDirections ( Matrix3D  directions)
115 {
116  principalDirections_ = directions;
117 }

References principalDirections_.

◆ 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
277  {
279  }

References isVerticallyOriented_.

Referenced by updateExtraQuantities().

◆ StoM()

Matrix3D ClumpParticle::StoM ( MatrixSymmetric3D  M)
inlineprivate
348 { 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
351 { 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 ( )
382 {
383  Mdouble ANG_TOL = 0.1; // 5.7 degrees - tolerance to misalignment
384  Mdouble ACC_TOL = 0.1; // Tolerance for angular acceleration magnitude
385 
386  Mdouble TOL = 10e-8; // External force tolerance
387  ClumpParticle* pPebble;
389  Vec3D v = Vec3D(0,0,1);
390 
391  // Check for vertical alignment
392  if (acos(Vec3D::dot(n3, v))<ANG_TOL)
393  {
394  setVerticallyOriented(true);
395  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
396  {
397  pPebble = pebbleParticles_[iPebble - 1];
398  pPebble->setVerticallyOriented(true);
399  }
400  }
401  else {
402  setVerticallyOriented(false);
403  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
404  {
405  pPebble = pebbleParticles_[iPebble - 1];
406  pPebble->setVerticallyOriented(false);
407  }
408  }
409 
410  // Check for Dzhanibekov States
411 
415 
416  if ((acos(Vec3D::dot(n2, w))<ANG_TOL) || (acc<TOL))
417  {
419  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
420  {
421  pPebble = pebbleParticles_[iPebble - 1];
422  pPebble->setDzhanibekovParticle(true);
423  }
424  }
425 
426  // Any contact force/torques break D state
427  if ( (getForce().getLength() > TOL)||(getTorque().getLength() > TOL) )
428  {
429  setDzhanibekovParticle(false);
430  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
431  {
432  pPebble = pebbleParticles_[iPebble - 1];
433  pPebble->setDzhanibekovParticle(false);
434  }
435  }
436 
437  return;
438 }
AnnoyingScalar acos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:138
RowVector3d w
Definition: Matrix_resize_int.cpp:3
void setVerticallyOriented(bool d)
Definition: ClumpParticle.h:276
void setDzhanibekovParticle(bool d)
Definition: ClumpParticle.h:270

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

Referenced by integrateAfterForceComputation().

◆ updatePebblesVelPos()

void ClumpParticle::updatePebblesVelPos ( )
228 {
229  BaseParticle* pPebble;
230  Vec3D position = getPosition();
231  Vec3D angularVelocity = getAngularVelocity();
232  Quaternion orientation = getOrientation();
233 
237 
238  Vec3D velocityDueToRotation;
239 
240  for (int iPebble = 1; iPebble <= nPebble_; iPebble++)
241  {
242  pPebble = pebbleParticles_[iPebble - 1];
243  // pPebble->setMass(clumpMass_);
244  pPebble->invMass_ = 1. / clumpMass_;
245  pPebble->setAngularVelocity(angularVelocity);
246  pPebble->setOrientation(orientation);
247  pPebble->setPosition(position + e1 * pebblePos_[iPebble - 1].X + e2 * pebblePos_[iPebble - 1].Y + e3 * pebblePos_[iPebble - 1].Z);
248 
249 
250  velocityDueToRotation = Vec3D::cross(angularVelocity, pPebble->getPosition() - position);
251 
252  pPebble->setVelocity(getVelocity());
253  pPebble->addVelocity(velocityDueToRotation);
254  }
255 }
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:209
virtual void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: BaseInteractable.h:239
void addVelocity(const Vec3D &velocity)
adds an increment to the velocity.
Definition: BaseInteractable.h:291
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:328
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:218
Definition: BaseParticle.h:33
This class contains the 4 components of a quaternion and the standard operators and functions needed ...
Definition: Kernel/Math/Quaternion.h:42
#define X
Definition: icosphere.cpp:20
#define Z
Definition: icosphere.cpp:21
const char Y
Definition: test/EulerAngles.cpp:32

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.

43  {
45  os << " nPebble_ " << nPebble_;
46  os << " clumpMass_ " << clumpMass_;
47  os << " viscousDamping_ " << viscousDamping_;
48  os << " pebblePos_ ";
49  for (const auto & pebbleP : pebblePos_) {os << pebbleP;}
50  os << " pebbleRadius_ ";
51  for (double pebbleRad : pebbleRadius_) {os << pebbleRad;}
52  //os << " pebbleParticles_ ";
53  //for (auto pebblePart : pebbleParticles_) {os << pebblePart;}
54  os << " principalDirections_ ";
56  os << " initPrincipalDirections_ ";
58  os << " clumpInitInertia_ " << clumpInitInertia_;
59  os << " clumpInertia_ " << clumpInertia_;
60  os << " rotationMatrix_ ";
61  os << rotationMatrix_;
62  os << " isPebble_ " << isPebble_;
63  //os << " clumpParticle_ " << clumpParticle_;
64  os << " isPebble_ " << isPebble_;
65  os << " isDzhanibekovParticle_ " << isDzhanibekovParticle_;
66  os << " isVerticallyOriented_ " << isVerticallyOriented_;
67  }
void write(std::ostream &os) const override
Particle print function, which accepts an std::ostream as input.
Definition: BaseParticle.cc:319

References clumpInertia_, clumpInitInertia_, clumpMass_, initPrincipalDirections_, isDzhanibekovParticle_, BaseParticle::isPebble_, isVerticallyOriented_, nPebble_, pebblePos_, pebbleRadius_, principalDirections_, rotationMatrix_, viscousDamping_, 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

◆ initPrincipalDirections_

◆ isDzhanibekovParticle_

bool ClumpParticle::isDzhanibekovParticle_
private

◆ isVerticallyOriented_

bool ClumpParticle::isVerticallyOriented_
private

◆ 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_

◆ rotationMatrix_

Matrix3D ClumpParticle::rotationMatrix_
private

◆ viscousDamping_


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