MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseParticle Class Referenceabstract

#include <BaseParticle.h>

+ Inheritance diagram for BaseParticle:

Public Member Functions

 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 polymorfism. More...
 
 BaseParticle (const ParticleSpecies *s)
 
 ~BaseParticle () override
 Particle destructor, needs to be implemented and checked if it removes tangential spring information. More...
 
virtual BaseParticlecopy () const =0
 Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism. 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 wether 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...
 
void read (std::istream &is) override
 Particle read function, which accepts an std::istream as input. More...
 
virtual void oldRead (std::istream &is)
 
void write (std::ostream &os) const override
 Particle print function, which accepts an std::ostream as input. More...
 
std::string getName () const override
 Returns the name of the object. More...
 
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 getKineticEnergy () const
 Calculates the particle's translational kinetic energy. More...
 
Mdouble getRotationalEnergy () const
 Calculates the particle's rotational kinetic energy. More...
 
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 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...
 
MERCURY_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...
 
void integrateBeforeForceComputation (double time, double timeStep)
 First step of Velocity Verlet integration. More...
 
void integrateAfterForceComputation (double time, double timeStep)
 Second step of Velocity Verlet integration. More...
 
unsigned int getParticleDimensions () const
 Returns the particle's dimensions (either 2 or 3). More...
 
MERCURY_DEPRECATED void setIndSpecies (unsigned int indSpecies) override
 
void setSpecies (const ParticleSpecies *species)
 
virtual unsigned getNumberOfFieldsVTK () const
 
virtual std::string getTypeVTK (unsigned i) const
 
virtual std::string getNameVTK (unsigned i) const
 
virtual std::vector< MdoublegetFieldVTK (unsigned i) const
 
virtual void actionsAfterTimeStep ()
 
virtual bool isSphericalParticle () const
 
const HGridCellgetHGridCell () const
 
virtual void computeMass (const ParticleSpecies &s)
 Computes the particle's (inverse) mass and inertia. More...
 
- 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...
 
const Vec3DgetPosition () const
 Returns the position of this BaseInteractable. More...
 
const QuaterniongetOrientation () const
 Returns the orientation of this BaseInteractable. More...
 
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...
 
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...
 
- 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
 

Protected Attributes

Mdouble radius_
 
Mdouble invMass_
 Particle radius_. More...
 
MatrixSymmetric3D invInertia_
 Inverse Particle mass (for computation optimization) More...
 

Private Attributes

ParticleHandlerhandler_
 Inverse Particle inverse inertia (for computation optimization) More...
 
HGridCell hGridCell
 All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compared to this particle. More...
 
BaseParticlehGridNextObject_
 
BaseParticlehGridPrevObject_
 Pointer to the next Particle in the same HGrid cell. More...
 
BaseParticleperiodicFromParticle_
 Pointer to the previous Particle in the same HGrid cell. More...
 
bool isMPIParticle_
 Pointer to originating Particle. More...
 
bool isInMPIDomain_
 returns true if the particle acts as an MPI particle instead of a real particle More...
 
unsigned communicationComplexity_
 returns true if it flagged as being in MPI domain More...
 
bool isInPeriodicDomain_
 
bool isPeriodicGhostParticle_
 bool that indicates if a particle is in the periodic domain of any boundary More...
 
std::vector< int > previousPeriodicComplexity_
 Indicates if the particle is a ghost particle of a periodic particle. More...
 
std::vector< int > periodicComplexity_
 Indicates the periodic complexity at previous time step. More...
 
bool isMaserParticle_
 Indicates the periodic complexity at current time step. Used to update periodic status. More...
 
Vec3D displacement_
 Indicates if this particle belongs to the maser boundary or is released into the wide open world. More...
 
Vec3D previousPosition_
 Displacement (only used in StatisticsVector, StatisticsPoint) More...
 
Mdouble info_
 

Friends

void ParticleSpecies::computeMass (BaseParticle *) const
 Particle's position at previous time step. More...
 

Detailed Description

Since r3648, BaseParticle is an abstract class. Use SphericalParticle for a 'basic' particle.

Definition at line 53 of file BaseParticle.h.

Constructor & Destructor Documentation

BaseParticle::BaseParticle ( )

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

default constructor, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1

Definition at line 33 of file BaseParticle.cc.

References communicationComplexity_, DEBUG, displacement_, handler_, hGridCell, hGridNextObject_, hGridPrevObject_, info_, invInertia_, invMass_, isInMPIDomain_, isInPeriodicDomain_, isMaserParticle_, isMPIParticle_, isPeriodicGhostParticle_, logger, periodicComplexity_, periodicFromParticle_, previousPeriodicComplexity_, radius_, HGridCell::setHGridLevel(), HGridCell::setHGridX(), HGridCell::setHGridY(), HGridCell::setHGridZ(), and Vec3D::setZero().

35 {
36  handler_ = nullptr;
38  radius_ = 1.0;
39  invMass_ = 1.0;
40  invInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1);
41 
42  periodicFromParticle_ = nullptr;
43  isMPIParticle_ = false;
44  isInMPIDomain_ = false;
45  isInPeriodicDomain_ = false;
47  isMaserParticle_ = false;
49  periodicComplexity_ = std::vector<int>(0);
50  previousPeriodicComplexity_ = std::vector<int>(0);
51 #ifdef CONTACT_LIST_HGRID
52  firstPossibleContact = nullptr;
53 #endif
54  hGridNextObject_ = nullptr;
55  hGridPrevObject_ = nullptr;
56 
57  hGridCell.setHGridLevel(99999);
58  hGridCell.setHGridX(99999);
59  hGridCell.setHGridY(99999);
60  hGridCell.setHGridZ(99999);
61 
62  info_ = std::numeric_limits<double>::quiet_NaN();
63 
64  logger(DEBUG, "BaseParticle::BaseParticle() finished");
65 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
bool isInMPIDomain_
returns true if the particle acts as an MPI particle instead of a real particle
Definition: BaseParticle.h:683
Mdouble info_
Definition: BaseParticle.h:702
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
bool isPeriodicGhostParticle_
bool that indicates if a particle is in the periodic domain of any boundary
Definition: BaseParticle.h:688
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
Vec3D displacement_
Indicates if this particle belongs to the maser boundary or is released into the wide open world...
Definition: BaseParticle.h:693
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
unsigned communicationComplexity_
returns true if it flagged as being in MPI domain
Definition: BaseParticle.h:684
bool isInPeriodicDomain_
Definition: BaseParticle.h:687
BaseParticle * hGridPrevObject_
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:676
void setHGridZ(int HGridZ)
Definition: HGridCell.h:81
BaseParticle * hGridNextObject_
Definition: BaseParticle.h:675
void setHGridY(int HGridY)
Definition: HGridCell.h:71
void setHGridX(int HGridX)
Definition: HGridCell.h:61
Mdouble radius_
Definition: BaseParticle.h:652
bool isMaserParticle_
Indicates the periodic complexity at current time step. Used to update periodic status.
Definition: BaseParticle.h:691
std::vector< int > periodicComplexity_
Indicates the periodic complexity at previous time step.
Definition: BaseParticle.h:690
bool isMPIParticle_
Pointer to originating Particle.
Definition: BaseParticle.h:682
void setHGridLevel(unsigned int HGridLevel)
Definition: HGridCell.h:91
BaseParticle * periodicFromParticle_
Pointer to the previous Particle in the same HGrid cell.
Definition: BaseParticle.h:679
std::vector< int > previousPeriodicComplexity_
Indicates if the particle is a ghost particle of a periodic particle.
Definition: BaseParticle.h:689
Implementation of a 3D symmetric matrix.
BaseInteractable()
Default BaseInteractable constructor.
BaseParticle::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 polymorfism.

Constructor that copies most of the properties of the given particle. Please note that not everything is copied, for example the position in the HGrid is not determined yet by the end of this constructor. It also does not copy the interactions and the pointer to the handler that handles this particle. Use with care.

Parameters
[in,out]pReference to the BaseParticle this one should become a copy of.

Definition at line 75 of file BaseParticle.cc.

References communicationComplexity_, DEBUG, displacement_, getHGridLevel(), getInvInertia(), getInvMass(), handler_, hGridCell, hGridNextObject_, hGridPrevObject_, info_, invInertia_, invMass_, isInMPIDomain_, isInPeriodicDomain_, isMaserParticle_, isMPIParticle_, isPeriodicGhostParticle_, logger, periodicFromParticle_, radius_, HGridCell::setHGridLevel(), HGridCell::setHGridX(), HGridCell::setHGridY(), and HGridCell::setHGridZ().

76  : BaseInteractable(p)
77 {
78  handler_ = nullptr;
80  radius_ = p.radius_;
81  invMass_ = p.getInvMass();
83 
84  hGridNextObject_ = nullptr;
85  hGridPrevObject_ = nullptr;
86 
88  hGridCell.setHGridX(99999);
89  hGridCell.setHGridY(99999);
90  hGridCell.setHGridZ(99999);
91 
99  //periodicComplexity_ = p.periodicComplexity_;
100  //previousPeriodicComplexity_ = p.previousPeriodicComplexity_;
101 #ifdef CONTACT_LIST_HGRID
102  firstPossibleContact = nullptr;
103 #endif
104 
105  info_ = p.info_;
106  logger(DEBUG, "BaseParticle::BaseParticle(BaseParticle &p) finished");
107 }
MatrixSymmetric3D getInvInertia() const
Returns the inverse of the particle's inertia tensor.
Definition: BaseParticle.h:286
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
bool isInMPIDomain_
returns true if the particle acts as an MPI particle instead of a real particle
Definition: BaseParticle.h:683
Mdouble info_
Definition: BaseParticle.h:702
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
bool isPeriodicGhostParticle_
bool that indicates if a particle is in the periodic domain of any boundary
Definition: BaseParticle.h:688
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
Mdouble getInvMass() const override
Returns the inverse of the particle's mass.
Definition: BaseParticle.h:293
Vec3D displacement_
Indicates if this particle belongs to the maser boundary or is released into the wide open world...
Definition: BaseParticle.h:693
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
unsigned communicationComplexity_
returns true if it flagged as being in MPI domain
Definition: BaseParticle.h:684
bool isInPeriodicDomain_
Definition: BaseParticle.h:687
BaseParticle * hGridPrevObject_
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:676
void setHGridZ(int HGridZ)
Definition: HGridCell.h:81
BaseParticle * hGridNextObject_
Definition: BaseParticle.h:675
void setHGridY(int HGridY)
Definition: HGridCell.h:71
void setHGridX(int HGridX)
Definition: HGridCell.h:61
Mdouble radius_
Definition: BaseParticle.h:652
bool isMaserParticle_
Indicates the periodic complexity at current time step. Used to update periodic status.
Definition: BaseParticle.h:691
bool isMPIParticle_
Pointer to originating Particle.
Definition: BaseParticle.h:682
void setHGridLevel(unsigned int HGridLevel)
Definition: HGridCell.h:91
BaseParticle * periodicFromParticle_
Pointer to the previous Particle in the same HGrid cell.
Definition: BaseParticle.h:679
unsigned int getHGridLevel() const
Returns particle's HGrid level.
Definition: BaseParticle.h:234
BaseInteractable()
Default BaseInteractable constructor.
BaseParticle::BaseParticle ( const ParticleSpecies s)
explicit

Definition at line 109 of file BaseParticle.cc.

References DEBUG, logger, and setSpecies().

110  : BaseParticle()
111 {
112  setSpecies(s);
113 #ifdef CONTACT_LIST_HGRID
114  firstPossibleContact = nullptr;
115 #endif
116  logger(DEBUG, "BaseParticle::BaseParticle(BaseSpecies &s) finished");
117 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setSpecies(const ParticleSpecies *species)
BaseParticle()
Basic Particle constructor, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1...
Definition: BaseParticle.cc:33
BaseParticle::~BaseParticle ( )
override

Particle destructor, needs to be implemented and checked if it removes tangential spring information.

Destructor. It asks the ParticleHandler to check if this was the smallest or largest particle and adjust itself accordingly.

Definition at line 123 of file BaseParticle.cc.

References ParticleHandler::checkExtremaOnDelete(), DEBUG, getHandler(), BaseObject::getId(), isFixed(), logger, and ParticleHandler::removedFixedParticle().

124 {
125 
126  if (getHandler() != nullptr)
127  {
129  if (isFixed())
131  }
132  logger(DEBUG, "BaseParticle::~BaseParticle() of particle % finished.", getId());
133 
134 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
void removedFixedParticle()
Decrement of the number of fixed particles.
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

Member Function Documentation

void BaseParticle::accelerate ( const Vec3D vel)

Increases the particle's velocity_ by the given vector.

increases the the particle's velocity_ (BaseInteractable member) by adding the given vector.

Parameters
[in]velvector to be added to the velocity_

Definition at line 622 of file BaseParticle.cc.

References BaseInteractable::addVelocity().

Referenced by integrateAfterForceComputation(), integrateBeforeForceComputation(), and AngledPeriodicBoundary::shiftPosition().

623 {
624  addVelocity(vel);
625 }
void addVelocity(const Vec3D &velocity)
adds an increment to the velocity.
virtual void BaseParticle::actionsAfterTimeStep ( )
inlinevirtual

Reimplemented in ThermalParticle.

Definition at line 639 of file BaseParticle.h.

640  {};
void BaseParticle::addDisplacement ( const Vec3D addDisp)

Adds a vector to the particle's displacement_.

Lets you add a vector to the particle's displacement_ vector.

Parameters
[in]addDispvector to be added.

Definition at line 641 of file BaseParticle.cc.

References displacement_.

642 {
643  displacement_ += addDisp;
644 }
Vec3D displacement_
Indicates if this particle belongs to the maser boundary or is released into the wide open world...
Definition: BaseParticle.h:693
void BaseParticle::angularAccelerate ( const Vec3D angVel)

Increases the particle's angularVelocity_ by the given vector.

increases the particle's angularVelocity_ (BaseInteractable member) by adding the given vector.

Parameters
[in]angVelvector to be added to the angularVelocity_

Definition at line 632 of file BaseParticle.cc.

References BaseInteractable::addAngularVelocity().

Referenced by integrateAfterForceComputation(), integrateBeforeForceComputation(), and AngledPeriodicBoundary::shiftPosition().

633 {
634  addAngularVelocity(angVel);
635 }
void addAngularVelocity(const Vec3D &angularVelocity)
add an increment to the angular velocity.
void BaseParticle::computeMass ( const ParticleSpecies s)
virtual

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

Reimplemented in SuperQuadricParticle.

Definition at line 863 of file BaseParticle.cc.

References ParticleSpecies::getDensity(), getMass(), getParticleDimensions(), getRadius(), invInertia_, invMass_, isFixed(), constants::pi, and mathsFunc::square().

Referenced by ParticleSpecies::computeMass().

863  {
864  if (isFixed()) return;
865  if (getParticleDimensions()==3) {
866  invMass_ = 1.0 / (4.0 / 3.0 * constants::pi * getRadius() * getRadius() * getRadius() * s.getDensity());
867  invInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1) / (.4 * getMass() * mathsFunc::square(getRadius()));
868  } else {
869  invMass_ = 1.0 / (constants::pi * getRadius() * getRadius() * s.getDensity());
870  invInertia_ = MatrixSymmetric3D(1, 0, 0, 1, 0, 1) / (.5 * getMass() * mathsFunc::square(getRadius()));
871  }
872 };
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
Mdouble getMass() const
Returns the particle's mass.
Definition: BaseParticle.h:322
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
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 getDensity() const
Allows density_ to be accessed.
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
unsigned int getParticleDimensions() const
Returns the particle's dimensions (either 2 or 3).
Implementation of a 3D symmetric matrix.
virtual BaseParticle* BaseParticle::copy ( ) const
pure virtual

Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.

Implemented in SuperQuadricParticle, SphericalParticle, LiquidFilmParticle, and ThermalParticle.

Referenced by PolydisperseInsertionBoundary::addGenerandum(), CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), SubcriticalMaserBoundaryTEST::checkBoundaryAfterParticleMoved(), SubcriticalMaserBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), DPMBase::checkParticleForInteractionLocalPeriodic(), SubcriticalMaserBoundary::createGhostCopy(), ConstantMassFlowMaserBoundary::createGhostCopy(), PeriodicBoundary::createGhostParticle(), ShearBoxBoundary::createHorizontalPeriodicParticles(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticle(), AngledPeriodicBoundary::createPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticles(), LeesEdwardsBoundary::createVerticalPeriodicParticles(), ChuteInsertionBoundary::generateParticle(), InsertionBoundary::generateParticle(), BidisperseCubeInsertionBoundary::generateParticle(), HopperInsertionBoundary::generateParticle(), FixedClusterInsertionBoundary::generateParticle(), CubeInsertionBoundary::generateParticle(), BaseClusterInsertionBoundary::generateParticle(), InsertionBoundary::InsertionBoundary(), PeriodicBoundaryHandler::processLocalGhostParticles(), DPMBase::readNextDataFile(), InsertionBoundary::set(), PolydisperseInsertionBoundary::setGenerandum(), and InsertionBoundary::setParticleToCopy().

void BaseParticle::fixParticle ( )

Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to zero.

Fixes a BaseParticle by setting its inverse mass and inertia and velocities to zero.

Definition at line 165 of file BaseParticle.cc.

References ParticleHandler::addedFixedParticle(), getHandler(), invInertia_, invMass_, BaseInteractable::setAngularVelocity(), and BaseInteractable::setVelocity().

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), DPMBase::readNextDataFile(), and DPMBase::setFixedParticles().

166 {
167  invMass_ = 0.0;
168  invInertia_ = MatrixSymmetric3D(0, 0, 0, 0, 0, 0);
169  setVelocity(Vec3D(0.0, 0.0, 0.0));
170  setAngularVelocity(Vec3D(0.0, 0.0, 0.0));
171  if (getHandler())
173 }
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
void addedFixedParticle()
Increment of the number of fixed particles.
Definition: Vector.h:49
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Implementation of a 3D symmetric matrix.
Vec3D BaseParticle::getAngularMomentum ( ) const

Definition at line 567 of file BaseParticle.cc.

References Vec3D::cross(), BaseInteractable::getAngularVelocity(), BaseInteractable::getPosition(), BaseInteractable::getVelocity(), MatrixSymmetric3D::inverse(), invInertia_, and invMass_.

568 {
570 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:212
static MatrixSymmetric3D inverse(const MatrixSymmetric3D &A)
Computes the inverse of a matrix; exits if the inverse doesn't exist.
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Vec3D BaseParticle::getAxes ( ) const
virtual

Only ustilised in case of superquadric particles. Had to create a virtual function to allow function access in writeVTK function in the particle handler.

Reimplemented in SuperQuadricParticle.

Definition at line 843 of file BaseParticle.cc.

Referenced by MPISuperQuadric::copyDataFromParticleToMPIParticle(), and BaseWall::getInteractionWith().

844 { return Vec3D(0, 0, 0); }
Definition: Vector.h:49
unsigned BaseParticle::getCommunicationComplexity ( )

Obtains the communication complexity of the particle.

Definition at line 195 of file BaseParticle.cc.

References communicationComplexity_.

Referenced by MPISphericalParticle::copyDataFromParticleToMPIParticle(), and Domain::updateParticles().

196 {
198 }
unsigned communicationComplexity_
returns true if it flagged as being in MPI domain
Definition: BaseParticle.h:684
Mdouble BaseParticle::getCurvature ( const Vec3D labFixedCoordinates) const
inlineoverridevirtual

returns the inverse radius, or curvature, of the surface. This value is zero for walls and gets overridden for particles that have finite radius

Todo:
should be wall-type dependent

Reimplemented from BaseInteractable.

Reimplemented in SuperQuadricParticle.

Definition at line 296 of file BaseParticle.h.

References radius_.

297  { return 1.0/radius_; }
Mdouble radius_
Definition: BaseParticle.h:652
const Vec3D& BaseParticle::getDisplacement ( ) const
inline

Returns the particle's displacement relative to the previous time step.

Returns the particle's displacement_, which is the difference between the current particle's position and its position in the previous time step.

Returns
(reference to) the particle displacement vector

Definition at line 392 of file BaseParticle.h.

References displacement_.

Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), and FluxBoundary::checkBoundaryAfterParticleMoved().

393  { return displacement_; }
Vec3D displacement_
Indicates if this particle belongs to the maser boundary or is released into the wide open world...
Definition: BaseParticle.h:693
const Vec3D BaseParticle::getDisplacement2 ( Mdouble  xmin,
Mdouble  xmax,
Mdouble  ymin,
Mdouble  ymax,
Mdouble  zmin,
Mdouble  zmax,
Mdouble  t 
) const
Todo:
see .cc file.
Todo:
Rewrite, redefine (TW). Is only used in StatisticsVector.hcc, consider moving to that class.

Definition at line 465 of file BaseParticle.cc.

References BaseInteractable::getPosition(), getPreviousPosition(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

467 {
469  if (xmax > xmin && fabs(disp.X) > .5 * (xmax - xmin))
470  {
471  if (disp.X > 0)
472  disp.X -= xmax - xmin;
473  else
474  disp.X += xmax - xmin;
475  }
476  if (ymax > ymin && fabs(disp.Y) > .5 * (ymax - ymin))
477  {
478  if (disp.Y > 0)
479  disp.Y -= ymax - ymin;
480  else
481  disp.Y += ymax - ymin;
482  }
483  if (zmax > zmin && fabs(disp.Z) > .5 * (zmax - zmin))
484  {
485  if (disp.Z > 0)
486  disp.Z -= zmax - zmin;
487  else
488  disp.Z += zmax - zmin;
489  }
490  disp /= t;
491  return disp;
492 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
Definition: Vector.h:65
Mdouble Y
Definition: Vector.h:65
const Vec3D & getPreviousPosition() const
Returns the particle's position in the previous time step.
Definition: BaseParticle.h:400
Definition: Vector.h:49
Mdouble Z
Definition: Vector.h:65
double BaseParticle::getExponentEps1 ( ) const
virtual

Only ustilised in case of superquadric particles. Had to create a virtual function to allow function access in writeVTK function in the particle handler.

Reimplemented in SuperQuadricParticle.

Definition at line 846 of file BaseParticle.cc.

Referenced by MPISuperQuadric::copyDataFromParticleToMPIParticle(), and BaseWall::getInteractionWith().

847 { return 0; }
double BaseParticle::getExponentEps2 ( ) const
virtual

Only ustilised in case of superquadric particles. Had to create a virtual function to allow function access in writeVTK function in the particle handler.

Reimplemented in SuperQuadricParticle.

Definition at line 849 of file BaseParticle.cc.

Referenced by MPISuperQuadric::copyDataFromParticleToMPIParticle(), and BaseWall::getInteractionWith().

850 { return 0; }
std::vector< Mdouble > BaseParticle::getFieldVTK ( unsigned  i) const
virtual

Reimplemented in LiquidFilmParticle.

Definition at line 838 of file BaseParticle.cc.

839 {
840  return std::vector<Mdouble>();
841 }
Mdouble BaseParticle::getGravitationalEnergy ( ) const

Calculates the particle's gravitational energy.

Gravitational energy is the potential energy stored in teh particles position due to the gravity field. This is a relative term, so we need to define what zero energy means: The gravitational energy of a particle is zero when its center of mass is at the origin.

Returns
the particle's gravitational energy
ParticleHandler * BaseParticle::getHandler ( ) const

Returns pointer to the particle's ParticleHandler.

Returns the particle's ParticleHandler

Returns
pointer to the particle's ParticleHandler; null if handler not yet specified

Definition at line 661 of file BaseParticle.cc.

References handler_.

Referenced by ThermalParticle::actionsAfterTimeStep(), copyDataFromMPIParticleToParticle(), fixParticle(), getParticleDimensions(), getPeriodicComplexity(), SuperQuadricParticle::getVolume(), integrateAfterForceComputation(), integrateBeforeForceComputation(), setHandler(), setPeriodicComplexity(), setRadius(), unfix(), ~BaseParticle(), and SuperQuadricParticle::~SuperQuadricParticle().

662 {
663  return handler_;
664 }
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
unsigned int BaseParticle::getHGridLevel ( ) const
inline
BaseParticle* BaseParticle::getHGridPrevObject ( ) const
inline

Returns pointer to previous object in particle's HGrid level & cell.

Returns the previous object in the particle's HGrid cell

Returns
pointer to the previous object in the particle's HGrid cell

Definition at line 250 of file BaseParticle.h.

References hGridPrevObject_.

Referenced by Mercury2D::hGridRemoveParticle(), and Mercury3D::hGridRemoveParticle().

251  { return hGridPrevObject_; }
BaseParticle * hGridPrevObject_
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:676
int BaseParticle::getHGridX ( ) const
inline

Returns particle's HGrid cell X-coordinate.

Returns
the particle's HGrid cell's X-coordinate

Definition at line 265 of file BaseParticle.h.

References HGridCell::getHGridX(), and hGridCell.

Referenced by Mercury2D::computeInternalForces(), Mercury3D::computeInternalForces(), Mercury2D::hGridRemoveParticle(), Mercury2D::hGridUpdateParticle(), and Mercury3D::hGridUpdateParticle().

266  { return hGridCell.getHGridX(); }
int getHGridX() const
Definition: HGridCell.h:56
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
int BaseParticle::getHGridY ( ) const
inline

Returns particle's HGrid cell Y-coordinate.

Returns
the particle's HGrid cell's Y-coordinate

Definition at line 272 of file BaseParticle.h.

References HGridCell::getHGridY(), and hGridCell.

Referenced by Mercury2D::computeInternalForces(), Mercury3D::computeInternalForces(), Mercury2D::hGridRemoveParticle(), Mercury2D::hGridUpdateParticle(), and Mercury3D::hGridUpdateParticle().

273  { return hGridCell.getHGridY(); }
int getHGridY() const
Definition: HGridCell.h:66
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
int BaseParticle::getHGridZ ( ) const
inline

Returns particle's HGrid cell Z-coordinate.

Returns
the particle's HGrid cell's Z-coordinate

Definition at line 279 of file BaseParticle.h.

References HGridCell::getHGridZ(), and hGridCell.

Referenced by Mercury3D::computeInternalForces(), and Mercury3D::hGridUpdateParticle().

280  { return hGridCell.getHGridZ(); }
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
int getHGridZ() const
Definition: HGridCell.h:76
MatrixSymmetric3D BaseParticle::getInertia ( ) const
inline

Definition at line 328 of file BaseParticle.h.

References MatrixSymmetric3D::inverse(), and invInertia_.

Referenced by getRotationalEnergy().

329  { return invInertia_.inverse(); }
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
static MatrixSymmetric3D inverse(const MatrixSymmetric3D &A)
Computes the inverse of a matrix; exits if the inverse doesn't exist.
Mdouble BaseParticle::getInfo ( ) const
virtual

Returns some user-defined information about this object (by default, species ID).

Definition at line 352 of file BaseParticle.cc.

References BaseObject::getId(), BaseInteractable::getSpecies(), and info_.

Referenced by DPMBase::getInfo().

353 {
354  if (std::isnan(info_))
355  return getSpecies()->getId();
356  else
357  return info_;
358 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Mdouble info_
Definition: BaseParticle.h:702
Mdouble BaseParticle::getInteractionDistance ( const BaseInteractable i) const
inline

Returns the interactionDistance_ of the mixed species of this particle and the particle or wall i.

Definition at line 366 of file BaseParticle.h.

References ParticleSpecies::getMixedSpecies(), and BaseInteractable::getSpecies().

Referenced by getSumOfInteractionRadii(), and getWallInteractionRadius().

367  {
368  //const auto mixedSpecies = getSpecies()->getHandler()->getMixedObject(getSpecies(),particle->getSpecies());
369  //return mixedSpecies->getInteractionDistance();
371  }
Mdouble getInteractionDistance(const BaseInteractable *i) const
Returns the interactionDistance_ of the mixed species of this particle and the particle or wall i...
Definition: BaseParticle.h:366
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
const BaseSpecies * getMixedSpecies(const ParticleSpecies *s) const
BaseInteraction * BaseParticle::getInteractionWith ( BaseParticle P,
unsigned  timeStamp,
InteractionHandler interactionHandler 
)
overridevirtual

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

Creates/updates a BaseInteraction object, treating the interaction between this particle and a given one, in case there is an overlap between the two.

Parameters
[in]Pparticle to check the interaction with
[in]timeStamptime stamp to be assigned to the interaction object (i.e., the current time)
[in,out]interactionHandlerBaseInteraction container from where the interaction is retrieved, and to which it is assigned (if it is a new interaction).
Returns
the pointer to the interaction object (if the particles overlap), or 0 (if they don't overlap).
Todo:
We should consider setting the contact point to
Author
weinhartt

Implements BaseInteractable.

Reimplemented in SuperQuadricParticle.

Definition at line 678 of file BaseParticle.cc.

References InteractionHandler::getInteraction(), Vec3D::getLengthSquared(), BaseInteraction::getNormal(), BaseInteraction::getOverlap(), BaseInteractable::getPosition(), getRadius(), getSumOfInteractionRadii(), BaseInteraction::setContactPoint(), BaseInteraction::setDistance(), BaseInteraction::setNormal(), and BaseInteraction::setOverlap().

Referenced by DPMBase::computeInternalForce(), PeriodicBoundaryHandler::processLocalInteractionData(), PeriodicBoundaryHandler::processReceivedInteractionData(), Domain::processReceivedInteractionData(), and FileReader::read().

680 {
681  //get the normal (from P away from the contact)
682  const Vec3D branchVector = P->getPosition() - getPosition();
683  //Get the square of the distance between particle i and particle j
684  const Mdouble distanceSquared = Vec3D::getLengthSquared(branchVector);
685  //const auto species = interactionHandler->getDPMBase()->speciesHandler.getMixedObject(getSpecies(),P->getSpecies());
686  const Mdouble sumOfInteractionRadii = getSumOfInteractionRadii(P);
687  if (distanceSquared < (sumOfInteractionRadii * sumOfInteractionRadii))
688  {
689  BaseInteraction* const C = interactionHandler->getInteraction(P, this, timeStamp);
690  const Mdouble distance = std::sqrt(distanceSquared);
691  C->setNormal(branchVector / distance);
692  C->setOverlap(P->getRadius() + getRadius() - distance);
693  C->setDistance(distance);
694  C->setContactPoint(P->getPosition() - (P->getRadius() - 0.5 * C->getOverlap()) * C->getNormal());
696  //Mdouble ratio=P->getRadius()/(getRadius()+P->getRadius());
697  //C->setContactPoint(P->getPosition() - (P->getRadius() - ratio * C->getOverlap()) * C->getNormal());
698  return C;
699  }
700  return nullptr;
701 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
double Mdouble
Definition: GeneralDefine.h:34
Mdouble getSumOfInteractionRadii(const BaseParticle *particle) const
returns the sum of the radii plus the interactionDistance
Definition: BaseParticle.h:376
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
Mdouble getLengthSquared() const
Calculates the squared length of this Vec3D: .
Definition: Vector.cc:246
Stores information about interactions between two interactable objects; often particles but could be ...
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: Vector.h:49
MatrixSymmetric3D BaseParticle::getInvInertia ( ) const
inline

Returns the inverse of the particle's inertia tensor.

Returns
the inverse of the particle's inertia tensor

Definition at line 286 of file BaseParticle.h.

References invInertia_.

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

287  { return invInertia_; }
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
Mdouble BaseParticle::getInvMass ( ) const
inlineoverridevirtual

Returns the inverse of the particle's mass.

Returns
the inverse of the particle's mass

Reimplemented from BaseInteractable.

Definition at line 293 of file BaseParticle.h.

References invMass_.

Referenced by BaseParticle(), ThermalInteraction< NormalForceInteraction >::computeNormalForce(), integrateAfterForceComputation(), and integrateBeforeForceComputation().

294  { return invMass_; }
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
Mdouble BaseParticle::getKineticEnergy ( ) const

Calculates the particle's translational kinetic energy.

Returns
the particle's translational kinetic energy

Calculates the particle's kinetic energy

Returns
the particle's kinetic energy

Definition at line 444 of file BaseParticle.cc.

References Vec3D::getLengthSquared(), getMass(), BaseInteractable::getVelocity(), and isFixed().

445 {
446  if (isFixed())
447  return 0.0;
448  else
449  return 0.5 * getMass() * getVelocity().getLengthSquared();
450 }
Mdouble getMass() const
Returns the particle's mass.
Definition: BaseParticle.h:322
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
static Mdouble getLengthSquared(const Vec3D &a)
Calculates the squared length of a Vec3D: .
Definition: Vector.h:257
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Mdouble BaseParticle::getMaxInteractionRadius ( ) const
inline

Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)

Calculates the interaction radius of the particle (when it comes to interaction with other particles), including the effect of a possible additional 'interaction distance' besides the 'normal' radius. The interaction radius differs from the radius_, for example, when dealing with wet particles (i.e. particles with an additional liquid layer, which is dealt with in the particle's species).

Returns
the particle's interaction radius for particle-particle interaction

Definition at line 359 of file BaseParticle.h.

References ParticleSpecies::getMaxInteractionDistance(), getRadius(), and BaseInteractable::getSpecies().

Referenced by ParticleHandler::checkExtrema(), DPMBase::checkParticleForInteractionLocalPeriodic(), Mercury2D::computeInternalForces(), Mercury3D::computeInternalForces(), ParticleHandler::computeLargestParticle(), ParticleHandler::computeSmallestParticle(), ShearBoxBoundary::createHorizontalPeriodicParticles(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticle(), SubcriticalMaserBoundaryTEST::createPeriodicParticle(), SubcriticalMaserBoundary::createPeriodicParticle(), AngledPeriodicBoundary::createPeriodicParticle(), ConstantMassFlowMaserBoundary::createPeriodicParticle(), PeriodicBoundary::createPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticles(), LeesEdwardsBoundary::createVerticalPeriodicParticles(), SuperQuadricParticle::getInteractionWith(), ParticleHandler::getLargestInteractionRadiusLocal(), ParticleHandler::getSmallestInteractionRadiusLocal(), Mercury2D::hGridFindParticleContacts(), Mercury3D::hGridFindParticleContacts(), Mercury2D::hGridGetInteractingParticleList(), Mercury3D::hGridGetInteractingParticleList(), Mercury2D::hGridHasParticleContacts(), MercuryBase::hGridNeedsRebuilding(), HGridOptimiser::initialise(), HGrid::insertParticleToHgrid(), and DPMBase::updateGhostGrid().

359  {
360  return getRadius() + getSpecies()->getMaxInteractionDistance() * 0.5;
361  }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Mdouble getMaxInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Vec3D BaseParticle::getMomentum ( ) const
inline

Definition at line 325 of file BaseParticle.h.

References BaseInteractable::getVelocity(), and invMass_.

326  { return getVelocity() / invMass_; }
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
std::string BaseParticle::getName ( ) const
overridevirtual

Returns the name of the object.

Returns the name of the object; in this case 'BaseParticle'.

Returns
The object name.

Implements BaseObject.

Reimplemented in SuperQuadricParticle, SphericalParticle, LiquidFilmParticle, and ThermalParticle.

Definition at line 342 of file BaseParticle.cc.

Referenced by isInContactWith().

343 {
344  return "BaseParticle";
345 }
std::string BaseParticle::getNameVTK ( unsigned  i) const
virtual

Reimplemented in LiquidFilmParticle.

Definition at line 833 of file BaseParticle.cc.

Referenced by ParticleVtkWriter::writeExtraFields().

834 {
835  return "";
836 }
unsigned BaseParticle::getNumberOfFieldsVTK ( ) const
virtual

Reimplemented in LiquidFilmParticle.

Definition at line 823 of file BaseParticle.cc.

Referenced by ParticleVtkWriter::writeExtraFields().

824 {
825  return 0;
826 }
unsigned int BaseParticle::getParticleDimensions ( ) const

Returns the particle's dimensions (either 2 or 3).

Returns the amount of dimensions of the particle (2 or 3, basically)

Returns
the number of dimension of the particle

Definition at line 771 of file BaseParticle.cc.

References BaseHandler< T >::getDPMBase(), getHandler(), and DPMBase::getParticleDimensions().

Referenced by SuperQuadricParticle::computeMass(), computeMass(), and getVolume().

772 {
774 }
unsigned int getParticleDimensions() const
Returns the particle dimensionality.
Definition: DPMBase.cc:1321
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
const std::vector< int > & BaseParticle::getPeriodicComplexity ( )

Obtains the periodic communication complexity of the particle.

Definition at line 225 of file BaseParticle.cc.

References BaseHandler< T >::getDPMBase(), getHandler(), BaseHandler< T >::getSize(), DPMBase::periodicBoundaryHandler, and periodicComplexity_.

Referenced by PeriodicBoundaryHandler::findNewParticle(), SubcriticalMaserBoundaryTEST::modifyGhostAfterCreation(), PeriodicBoundaryHandler::processLocalGhostParticles(), PeriodicBoundaryHandler::shiftParticle(), PeriodicBoundaryHandler::updateMaserParticle(), PeriodicBoundaryHandler::updateParticles(), and PeriodicBoundaryHandler::updateParticleStatus().

226 {
227  //TODO resolve this hack
228  //hack: generally you'd add particles after declaring the boundaries
229  //but no official programming guildelines rules have been setup for that
230  //So incase that doesnt happen we need to resize this periodicComplexity
231  if (periodicComplexity_.empty())
232  {
233  const unsigned numberOfPeriodicBoundaries = getHandler()->getDPMBase()->periodicBoundaryHandler.getSize();
234  if (numberOfPeriodicBoundaries > 0)
235  {
236  periodicComplexity_.resize(numberOfPeriodicBoundaries, 0);
237  }
238  }
239  return periodicComplexity_;
240 }
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
PeriodicBoundaryHandler periodicBoundaryHandler
Internal handler that deals with periodic boundaries, especially in a parallel build.
Definition: DPMBase.h:1316
std::vector< int > periodicComplexity_
Indicates the periodic complexity at previous time step.
Definition: BaseParticle.h:690
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
int BaseParticle::getPeriodicComplexity ( int  index)

Gets the periodic communication complexity of a certain boundary.

Todo:
TW , this is indeed a hack; you should call a setter every time you add a value to the periodic boundary handler (this function takes 0.5% cpu time in the speedtest)

Definition at line 242 of file BaseParticle.cc.

References BaseHandler< T >::getDPMBase(), getHandler(), BaseHandler< T >::getSize(), DPMBase::periodicBoundaryHandler, and periodicComplexity_.

243 {
244  //hack: generally you'd add particles after declaring the boundaries
245  //but no official programming guildelines rules have been setup for that
246  //So incase that doesnt happen we need to resize this periodicComplexity
248  if (periodicComplexity_.empty())
249  {
250  const unsigned numberOfPeriodicBoundaries = getHandler()->getDPMBase()->periodicBoundaryHandler.getSize();
251  if (numberOfPeriodicBoundaries > 0)
252  {
253  periodicComplexity_.resize(numberOfPeriodicBoundaries, 0);
254  }
255  }
256 
257  return periodicComplexity_[index];
258 }
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
PeriodicBoundaryHandler periodicBoundaryHandler
Internal handler that deals with periodic boundaries, especially in a parallel build.
Definition: DPMBase.h:1316
std::vector< int > periodicComplexity_
Indicates the periodic complexity at previous time step.
Definition: BaseParticle.h:690
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
const std::vector< int > & BaseParticle::getPreviousPeriodicComplexity ( ) const

Sets the previous periodic communication complexity of the particle.

Definition at line 265 of file BaseParticle.cc.

References previousPeriodicComplexity_.

Referenced by PeriodicBoundaryHandler::updateParticles(), and PeriodicBoundaryHandler::updateParticleStatus().

266 {
268 }
std::vector< int > previousPeriodicComplexity_
Indicates if the particle is a ghost particle of a periodic particle.
Definition: BaseParticle.h:689
const Vec3D& BaseParticle::getPreviousPosition ( ) const
inline

Returns the particle's position in the previous time step.

Returns the particle's position in the previous time step.

Returns
(reference to) the previous position of the particle

Definition at line 400 of file BaseParticle.h.

References previousPosition_.

Referenced by getDisplacement2(), and PeriodicBoundaryHandler::updateParticles().

401  { return previousPosition_; }
Vec3D previousPosition_
Displacement (only used in StatisticsVector, StatisticsPoint)
Definition: BaseParticle.h:694
Mdouble BaseParticle::getRadius ( ) const
inline

Returns the particle's radius.

Returns
the particle's radius

Definition at line 345 of file BaseParticle.h.

References radius_.

Referenced by ThermalParticle::actionsAfterTimeStep(), ConstantMassFlowMaserBoundary::activateMaser(), DeletionBoundary::checkBoundaryAfterParticleMoved(), CGHandler::computeContactPoints(), computeMass(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), Chute::createBottom(), Chute::createFlowParticle(), HopperInsertionBoundary::generateParticle(), ParabolaChute::getDistanceAndNormal(), SineWall::getDistanceAndNormal(), CylindricalWall::getDistanceAndNormal(), NurbsWall::getDistanceAndNormal(), Screw::getDistanceAndNormal(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), InfiniteWallWithHole::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), BaseWall::getDistanceNormalOverlap(), SuperQuadricParticle::getInteractionRadius(), VChute::getInteractionWith(), Combtooth::getInteractionWith(), SineWall::getInteractionWith(), ArcWall::getInteractionWith(), TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), SuperQuadricParticle::getInteractionWith(), getInteractionWith(), getMaxInteractionRadius(), getSumOfInteractionRadii(), getWallInteractionRadius(), SuperQuadricParticle::isInContactWith(), BaseCluster::particleInsertionSuccessful(), ChuteInsertionBoundary::placeParticle(), FileReader::read(), CGFields::StandardFields::setFields(), BaseInteraction::setFStatData(), ChuteBottom::setupInitialConditions(), SuperQuadricParticle::SuperQuadricParticle(), and DPMBase::writeFstatHeader().

346  { return radius_; }
Mdouble radius_
Definition: BaseParticle.h:652
Mdouble BaseParticle::getRotationalEnergy ( ) const

Calculates the particle's rotational kinetic energy.

Returns
the particle's rotational kinetic energy

Definition at line 452 of file BaseParticle.cc.

References Vec3D::dot(), BaseInteractable::getAngularVelocity(), getInertia(), and isFixed().

453 {
454  if (isFixed())
455  return 0.0;
456  else
458 }
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:125
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
MatrixSymmetric3D getInertia() const
Definition: BaseParticle.h:328
Mdouble BaseParticle::getSumOfInteractionRadii ( const BaseParticle particle) const
inline

returns the sum of the radii plus the interactionDistance

Definition at line 376 of file BaseParticle.h.

References getInteractionDistance(), and getRadius().

Referenced by DPMBase::checkParticleForInteractionLocal(), Domain::findNewMPIInteractions(), SuperQuadricParticle::getInitialGuessForContact(), getInteractionWith(), and isInContactWith().

376  {
377  return getRadius() + particle->getRadius() + getInteractionDistance((const BaseInteractable*)particle);
378  }
Mdouble getInteractionDistance(const BaseInteractable *i) const
Returns the interactionDistance_ of the mixed species of this particle and the particle or wall i...
Definition: BaseParticle.h:366
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Defines the basic properties that a interactable object can have.
std::string BaseParticle::getTypeVTK ( unsigned  i) const
virtual

Reimplemented in LiquidFilmParticle.

Definition at line 828 of file BaseParticle.cc.

Referenced by ParticleVtkWriter::writeExtraFields().

829 {
830  return "";
831 }
Mdouble BaseParticle::getVolume ( ) const
virtual

Get Particle volume function, which required a reference to the Species vector. It returns the volume of the Particle.

Returns the volume of the BaseParticle, which is calculated using its number of dimensions and radius.

Returns
The actual volume of this BaseParticle.

Reimplemented in SuperQuadricParticle.

Definition at line 141 of file BaseParticle.cc.

References ERROR, getParticleDimensions(), handler_, logger, constants::pi, and radius_.

Referenced by ThermalParticle::actionsAfterTimeStep(), FluxBoundary::checkBoundaryAfterParticleMoved(), DeletionBoundary::checkBoundaryAfterParticleMoved(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), and CGFields::StandardFields::setFields().

142 {
143  if (handler_ == nullptr)
144  {
145  logger(ERROR, "[BaseParticle::getVolume] no particle handler specified");
146  return 0;
147  }
148  switch (getParticleDimensions())
149  {
150  case 3:
151  return (4.0 / 3.0 * constants::pi * radius_ * radius_ * radius_);
152  case 2:
153  return (constants::pi * radius_ * radius_);
154  case 1:
155  return (2.0 * radius_);
156  default:
157  logger(ERROR, "[BaseParticle::getVolume] dimension of the particle is not set");
158  return 0;
159  }
160 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble radius_
Definition: BaseParticle.h:652
unsigned int getParticleDimensions() const
Returns the particle's dimensions (either 2 or 3).
Mdouble BaseParticle::getWallInteractionRadius ( const BaseWall wall) const
inline

returns the radius plus the interactionDistance

Definition at line 383 of file BaseParticle.h.

References getInteractionDistance(), and getRadius().

Referenced by VChute::getDistanceAndNormal(), ParabolaChute::getDistanceAndNormal(), Combtooth::getDistanceAndNormal(), SineWall::getDistanceAndNormal(), HorizontalScrew::getDistanceAndNormal(), ArcWall::getDistanceAndNormal(), HorizontalBaseScrew::getDistanceAndNormal(), Coil::getDistanceAndNormal(), BasicIntersectionOfWalls::getDistanceAndNormal(), RestrictedWall::getDistanceAndNormal(), LevelSetWall::getDistanceAndNormal(), SphericalWall::getDistanceAndNormal(), InfiniteWall::getDistanceAndNormal(), TriangulatedWall::getDistanceAndNormal(), TriangleWall::getDistanceAndNormal(), AxisymmetricIntersectionOfWalls::getDistanceAndNormal(), ScrewsymmetricIntersectionOfWalls::getDistanceAndNormal(), InfiniteWall::getDistanceNormalOverlapSuperquadric(), RestrictedWall::getInteractionWith(), and TriangulatedWall::getInteractionWith().

383  {
384  return getRadius() + getInteractionDistance((const BaseInteractable*)wall);
385  }
Mdouble getInteractionDistance(const BaseInteractable *i) const
Returns the interactionDistance_ of the mixed species of this particle and the particle or wall i...
Definition: BaseParticle.h:366
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Defines the basic properties that a interactable object can have.
void BaseParticle::integrateAfterForceComputation ( double  time,
double  timeStep 
)

Second step of Velocity Verlet integration.

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

Definition at line 749 of file BaseParticle.cc.

References accelerate(), angularAccelerate(), BaseInteractable::getForce(), getHandler(), getInvInertia(), getInvMass(), BaseInteractable::getOrientation(), BaseInteractable::getTorque(), and BaseInteractable::integrateAfterForceComputation().

750 {
751  if (getInvMass() == 0.0)
752  {
753  //Updates a baseParticle with a prescribed motion
755  }
756  else
757  {
758  accelerate(getForce() * getInvMass() * 0.5 * timeStep);
759  if (getHandler()->getDPMBase()->getRotation())
760  {
762  getOrientation().rotateInverseInertiaTensor(getInvInertia()) * getTorque() * 0.5 * timeStep);
763  }
764  }
765 }
MatrixSymmetric3D getInvInertia() const
Returns the inverse of the particle's inertia tensor.
Definition: BaseParticle.h:286
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
void accelerate(const Vec3D &vel)
Increases the particle's velocity_ by the given vector.
Mdouble getInvMass() const override
Returns the inverse of the particle's mass.
Definition: BaseParticle.h:293
const Vec3D & getTorque() const
Returns the torque on this BaseInteractable.
void angularAccelerate(const Vec3D &angVel)
Increases the particle's angularVelocity_ by the given vector.
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
void integrateAfterForceComputation(double time, double timeStep)
This is part of the integration routine for objects with infinite mass.
void BaseParticle::integrateBeforeForceComputation ( double  time,
double  timeStep 
)

First step of Velocity Verlet integration.

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
Todo:
If the position is described by the user, one should also call BaseInteractable::integrateBeforeForceComputation. To check if it works correctly, remove the p0.fixParticle() line from the DrivenParticleUnitTest
Author
irana

Definition at line 709 of file BaseParticle.cc.

References accelerate(), angularAccelerate(), BaseInteractable::getAngularVelocity(), BaseHandler< T >::getDPMBase(), BaseInteractable::getForce(), getHandler(), DPMBase::getHGridUpdateEachTimeStep(), getInvInertia(), getInvMass(), Vec3D::getLengthSquared(), BaseInteractable::getOrientation(), BaseInteractable::getPosition(), DPMBase::getRotation(), BaseInteractable::getTorque(), BaseInteractable::getVelocity(), DPMBase::hGridUpdateMove(), BaseInteractable::integrateBeforeForceComputation(), BaseInteractable::move(), BaseInteractable::rotate(), and setPreviousPosition().

710 {
715  if (getInvMass() == 0.0)
716  {
718  }
719  else
720  {
721 #ifdef MERCURY_USE_MPI
722  //For periodic particles in parallel the previous position is required
724 #endif
725  accelerate(getForce() * getInvMass() * 0.5 * timeStep);
726  const Vec3D displacement = getVelocity() * timeStep;
727  move(displacement);
728  DPMBase* const dpm = getHandler()->getDPMBase();
729  if (!dpm->getHGridUpdateEachTimeStep())
730  {
731  dpm->hGridUpdateMove(this, displacement.getLengthSquared());
732  }
733  if (dpm->getRotation())
734  {
736  getOrientation().rotateInverseInertiaTensor(getInvInertia()) * getTorque() * 0.5 * timeStep);
737  //apply to rotation quaternion q: q = normalise(q + \tilde{C}\omega*timeStep) (see Wouter's notes)
738  rotate(getAngularVelocity() * timeStep);
739  }
740  }
741 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
MatrixSymmetric3D getInvInertia() const
Returns the inverse of the particle's inertia tensor.
Definition: BaseParticle.h:286
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:70
void integrateBeforeForceComputation(double time, double timeStep)
This is part of integrate routine for objects with infinite mass.
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
void accelerate(const Vec3D &vel)
Increases the particle's velocity_ by the given vector.
virtual bool getHGridUpdateEachTimeStep() const
Definition: DPMBase.cc:1572
Mdouble getInvMass() const override
Returns the inverse of the particle's mass.
Definition: BaseParticle.h:293
void setPreviousPosition(const Vec3D &pos)
Sets the particle's position in the previous time step.
const Vec3D & getTorque() const
Returns the torque on this BaseInteractable.
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
static Mdouble getLengthSquared(const Vec3D &a)
Calculates the squared length of a Vec3D: .
Definition: Vector.h:257
void angularAccelerate(const Vec3D &angVel)
Increases the particle's angularVelocity_ by the given vector.
virtual void hGridUpdateMove(BaseParticle *, Mdouble)
Definition: DPMBase.cc:1787
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: Vector.h:49
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
bool getRotation() const
Indicates whether particle rotation is enabled or disabled.
Definition: DPMBase.h:522
bool BaseParticle::isFixed ( ) const
inlineoverridevirtual

Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Mass.

Checks whether a BaseParticle is fixed or not, by checking its inverse Mass.

Returns
TRUE if particle is fixed, i.e. if the inverse mass (invMass_) is 0.

Implements BaseInteractable.

Definition at line 93 of file BaseParticle.h.

References invMass_.

Referenced by HeaterBoundary::checkBoundaryAfterParticleMoved(), DPMBase::computeExternalForces(), DPMBase::computeInternalForce(), SuperQuadricParticle::computeMass(), computeMass(), Mercury3D::computeWallForces(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), getKineticEnergy(), ParticleHandler::getNumberOfFixedObjectsLocal(), getRotationalEnergy(), DPMBase::readNextDataFile(), setMass(), setMassForP3Statistics(), and ~BaseParticle().

94  { return (invMass_ == 0.0); }
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
bool BaseParticle::isInContactWith ( const BaseParticle P) const
virtual

Get whether or not this particle is in contact with the given particle.

Reimplemented in SuperQuadricParticle.

Definition at line 852 of file BaseParticle.cc.

References Vec3D::getDistanceSquared(), getName(), BaseInteractable::getPosition(), getSumOfInteractionRadii(), isInContactWith(), and mathsFunc::square().

Referenced by DPMBase::areInContact(), and isInContactWith().

853 {
854  if (P->getName() != "Superquadric")
855  {
858  }
859  return P->isInContactWith(this);
860 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
virtual bool isInContactWith(const BaseParticle *P) const
Get whether or not this particle is in contact with the given particle.
Mdouble getSumOfInteractionRadii(const BaseParticle *particle) const
returns the sum of the radii plus the interactionDistance
Definition: BaseParticle.h:376
std::string getName() const override
Returns the name of the object.
static Mdouble getDistanceSquared(const Vec3D &a, const Vec3D &b)
Calculates the squared distance between two Vec3D: .
Definition: Vector.cc:237
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
bool BaseParticle::isInMPIDomain ( )

Indicates if the particle is in the communication zone of the mpi domain.

Definition at line 270 of file BaseParticle.cc.

References isInMPIDomain_.

Referenced by DeletionBoundary::checkBoundaryAfterParticleMoved(), Domain::findNewMPIInteractions(), Domain::findNewMPIParticle(), and PeriodicBoundaryHandler::updateParticleStatus().

271 {
272  return isInMPIDomain_;
273 }
bool isInMPIDomain_
returns true if the particle acts as an MPI particle instead of a real particle
Definition: BaseParticle.h:683
bool BaseParticle::isInPeriodicDomain ( ) const

Indicates if the particle is in the periodic boundary communication zone.

Definition at line 281 of file BaseParticle.cc.

References isInPeriodicDomain_.

Referenced by PeriodicBoundaryHandler::checkIfAddNewParticle().

282 {
283  return isInPeriodicDomain_;
284 }
bool isInPeriodicDomain_
Definition: BaseParticle.h:687
bool BaseParticle::isMaserParticle ( ) const
bool BaseParticle::isMPIParticle ( ) const

Indicates if this particle is a ghost in the MPI domain.

Definition at line 175 of file BaseParticle.cc.

References isMPIParticle_.

Referenced by ParticleHandler::addObject(), DPMBase::mpiInsertParticleCheck(), DPMBase::outputXBallsData(), ParticleVtkWriter::particleMustBeWritten(), PeriodicBoundaryHandler::updateParticleStatus(), and ParticleHandler::write().

176 {
177  //make mpi-dependent so the compiler can optimise
178 #ifdef MERCURY_USE_MPI
179  return isMPIParticle_;
180 #else
181  return false;
182 #endif
183 }
bool isMPIParticle_
Pointer to originating Particle.
Definition: BaseParticle.h:682
bool BaseParticle::isPeriodicGhostParticle ( ) const

Indicates if this particle is a ghost in the periodic boundary.

Definition at line 291 of file BaseParticle.cc.

References isPeriodicGhostParticle_.

Referenced by ParticleHandler::addObject(), PeriodicBoundaryHandler::checkIfAddNewParticle(), Domain::findNewMPIParticle(), DPMBase::outputXBallsData(), ParticleVtkWriter::particleMustBeWritten(), and ParticleHandler::write().

292 {
294 }
bool isPeriodicGhostParticle_
bool that indicates if a particle is in the periodic domain of any boundary
Definition: BaseParticle.h:688
virtual bool BaseParticle::isSphericalParticle ( ) const
inlinevirtual
void BaseParticle::movePrevious ( const Vec3D posMove)

Adds a vector to the particle's previousPosition_.

Lets you add a vector to the particle's previousPosition_ vector.

Parameters
[in]posMovethe vector to be added to the current previousPosition_ vector.

Definition at line 612 of file BaseParticle.cc.

References previousPosition_.

613 {
614  previousPosition_ += posMove;
615 }
Vec3D previousPosition_
Displacement (only used in StatisticsVector, StatisticsPoint)
Definition: BaseParticle.h:694
void BaseParticle::oldRead ( std::istream &  is)
virtual

Should NOT BE USED by any user, only used to read old restart files! Is expected to be obsolete by Mercury 2.0. Please use BaseParticle::read() instead.

This is the previously used version of the read function. Now just kept for legacy purposes.

Deprecated:
Should be gone in Mercury 2.0. Use BaseParticle::read() instead.
Todo:
incorporate contact information

Definition at line 380 of file BaseParticle.cc.

References DEBUG, constants::i, invInertia_, invMass_, logger, radius_, BaseInteractable::setAngularVelocity(), Quaternion::setEuler(), BaseObject::setId(), BaseObject::setIndex(), BaseInteractable::setIndSpecies(), BaseInteractable::setOrientation(), BaseInteractable::setPosition(), BaseInteractable::setVelocity(), MatrixSymmetric3D::XX, MatrixSymmetric3D::YY, and MatrixSymmetric3D::ZZ.

Referenced by ParticleHandler::readAndCreateObject().

381 {
382  logger(DEBUG, "reading particle old-style");
383  static unsigned int id = 0;
384  unsigned int indSpecies = 0;
385  unsigned int numberOfContacts = 0;
386  Vec3D orientation;
387  Vec3D position;
388  Vec3D velocity;
389  Vec3D angularVelocity;
390  double invInertiaScalar;
391  double dummy = 0;
392  is >> position >> velocity >> radius_ >> orientation >> angularVelocity;
393  is >> invMass_ >> invInertiaScalar >> numberOfContacts;
395  for (unsigned int i = 0; i < 12 * numberOfContacts; ++i)
396  {
397  is >> dummy;
398  }
399  is >> indSpecies;
400  setPosition(position);
401  setVelocity(velocity);
402  Quaternion q;
403  q.setEuler(orientation);
404  setOrientation(q);
405  setAngularVelocity(angularVelocity);
406  invInertia_.XX = invInertiaScalar;
407  invInertia_.YY = invInertiaScalar;
408  invInertia_.ZZ = invInertiaScalar;
410  setId(id);
411  setIndex(id);
412  id++;
413 }
Implementation of a 3D quaternion (by Vitaliy).
Definition: Quaternion.h:62
void setIndex(unsigned int index)
Allows one to assign an index to an object in the handler/container.
Definition: BaseObject.cc:63
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
void setEuler(const Vec3D &e)
Convert Euler angles to a quaternion. See Wikipedia for details.
Definition: Quaternion.cc:460
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Mdouble radius_
Definition: BaseParticle.h:652
void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: Vector.h:49
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
void setId(unsigned long id)
Assigns a unique identifier to each object in the handler (container) which remains constant even aft...
Definition: BaseObject.cc:71
Mdouble XX
The six distinctive matrix elements.
virtual void setIndSpecies(unsigned int indSpecies)
Sets the index of the Species of this BaseInteractable.
void BaseParticle::printHGrid ( std::ostream &  os) const

Adds particle's HGrid level and cell coordinates to an ostream.

Adds the particle's HGridLevel_ and HGRid x/y/z positions to an std::ostream.

Parameters
[in,out]osthe ostream which has the mentioned properties added.

Definition at line 420 of file BaseParticle.cc.

References HGridCell::getHGridLevel(), HGridCell::getHGridX(), HGridCell::getHGridY(), HGridCell::getHGridZ(), and hGridCell.

421 {
422  os << "Particle( HGRID_Level:" << hGridCell.getHGridLevel()
423  << ", HGRID_x:" << hGridCell.getHGridX()
424  << ", HGRID_y:" << hGridCell.getHGridY()
425  << ", HGRID_z:" << hGridCell.getHGridZ()
426  << ")";
427 }
int getHGridX() const
Definition: HGridCell.h:56
int getHGridY() const
Definition: HGridCell.h:66
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
int getHGridZ() const
Definition: HGridCell.h:76
unsigned int getHGridLevel() const
Definition: HGridCell.h:86
void BaseParticle::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 BaseInteractable.

Reimplemented in SuperQuadricParticle, LiquidFilmParticle, and ThermalParticle.

Definition at line 368 of file BaseParticle.cc.

References invMass_, radius_, and BaseInteractable::read().

Referenced by LiquidFilmParticle::read(), ThermalParticle::read(), SuperQuadricParticle::read(), and ParticleHandler::readAndCreateObject().

369 {
371  std::string dummy;
372  is >> dummy >> radius_ >> dummy >> invMass_;// >> dummy >> invInertia_;
373 }
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
Mdouble radius_
Definition: BaseParticle.h:652
void read(std::istream &is) override
Reads a BaseInteractable from an input stream.
virtual void BaseParticle::setAxes ( const Vec3D axes)
inlinevirtual

Only ustilised in case of superquadric particles.

Reimplemented in SuperQuadricParticle.

Definition at line 524 of file BaseParticle.h.

Referenced by MPISuperQuadric::copyDataFromMPIParticleToParticle().

524 { }
void BaseParticle::setCommunicationComplexity ( unsigned  complexity)

Set the communication complexity of the particle.

Definition at line 190 of file BaseParticle.cc.

References communicationComplexity_.

Referenced by Domain::addParticlesToLists(), MPISphericalParticle::copyDataFromMPIParticleToParticle(), and Domain::updateParticles().

191 {
192  communicationComplexity_ = complexity;
193 }
unsigned communicationComplexity_
returns true if it flagged as being in MPI domain
Definition: BaseParticle.h:684
void BaseParticle::setDisplacement ( const Vec3D disp)

Sets the particle's displacement (= difference between current position and that of the previous time step)

This is used to set the particle displacement_

Parameters
[in]dispthe displacement vector

Definition at line 593 of file BaseParticle.cc.

References displacement_.

Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved().

594 {
595  displacement_ = disp;
596 }
Vec3D displacement_
Indicates if this particle belongs to the maser boundary or is released into the wide open world...
Definition: BaseParticle.h:693
virtual void BaseParticle::setExponents ( const Mdouble eps1,
const Mdouble eps2 
)
inlinevirtual

Only ustilised in case of superquadric particles.

Reimplemented in SuperQuadricParticle.

Definition at line 529 of file BaseParticle.h.

Referenced by MPISuperQuadric::copyDataFromMPIParticleToParticle().

529 {}
void BaseParticle::setHandler ( ParticleHandler handler)

Sets the pointer to the particle's ParticleHandler.

Assigns the particle to a ParticleHandler, and assigns a species to it based on the particles indSpecies_ (BaseInteractable data member).

Parameters
[in]handlerpointer to the ParticleHandler

Definition at line 651 of file BaseParticle.cc.

References getHandler(), BaseInteractable::getIndSpecies(), BaseHandler< T >::getObject(), handler_, and setSpecies().

Referenced by ParticleHandler::addExistingObject(), ParticleHandler::addGhostObject(), ParticleHandler::addObject(), copyDataFromMPIParticleToParticle(), Chute::createBottom(), ParticleHandler::readAndCreateObject(), setSpecies(), and ChuteBottom::setupInitialConditions().

652 {
653  handler_ = handler;
654  setSpecies(getHandler()->getDPMBase()->speciesHandler.getObject(getIndSpecies()));
655 }
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
void setSpecies(const ParticleSpecies *species)
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
unsigned int getIndSpecies() const
Returns the index of the species associated with the interactable object.
void BaseParticle::setHGridLevel ( const unsigned int  level)
inline

Sets the particle's HGrid level.

Parameters
[in]levelthe particle's HGrid level

Definition at line 469 of file BaseParticle.h.

References hGridCell, and HGridCell::setHGridLevel().

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), and HGrid::insertParticleToHgrid().

470  { hGridCell.setHGridLevel(level); }
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
void setHGridLevel(unsigned int HGridLevel)
Definition: HGridCell.h:91
void BaseParticle::setHGridNextObject ( BaseParticle p)
inline

Sets the pointer to the next object in the particle's HGrid cell & level.

Parameters
[in]ppointer to the next object

Definition at line 477 of file BaseParticle.h.

References hGridNextObject_.

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), Mercury2D::hGridRemoveParticle(), Mercury3D::hGridRemoveParticle(), Mercury2D::hGridUpdateParticle(), and Mercury3D::hGridUpdateParticle().

478  { hGridNextObject_ = p; }
BaseParticle * hGridNextObject_
Definition: BaseParticle.h:675
void BaseParticle::setHGridPrevObject ( BaseParticle p)
inline

Sets the pointer to the previous object in the particle's HGrid cell & level.

Parameters
[in]ppointer to the previous object

Definition at line 485 of file BaseParticle.h.

References hGridPrevObject_.

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), Mercury2D::hGridRemoveParticle(), Mercury3D::hGridRemoveParticle(), Mercury2D::hGridUpdateParticle(), and Mercury3D::hGridUpdateParticle().

486  { hGridPrevObject_ = p; }
BaseParticle * hGridPrevObject_
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:676
void BaseParticle::setHGridX ( const int  x)
inline

Sets the particle's HGrid cell X-coordinate.

Set the x-index of the particle's hGrid cell position

Parameters
[in]xx-index of particle's HGrid cell

Definition at line 446 of file BaseParticle.h.

References hGridCell, and HGridCell::setHGridX().

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), Mercury2D::hGridUpdateParticle(), and Mercury3D::hGridUpdateParticle().

447  { hGridCell.setHGridX(x); }
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
void setHGridX(int HGridX)
Definition: HGridCell.h:61
void BaseParticle::setHGridY ( const int  y)
inline

Sets the particle's HGrid cell Y-coordinate.

Set the y-index of the particle's hGrid cell position

Parameters
[in]yy-index of particle's HGrid cell

Definition at line 454 of file BaseParticle.h.

References hGridCell, and HGridCell::setHGridY().

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), Mercury2D::hGridUpdateParticle(), and Mercury3D::hGridUpdateParticle().

455  { hGridCell.setHGridY(y); }
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
void setHGridY(int HGridY)
Definition: HGridCell.h:71
void BaseParticle::setHGridZ ( const int  z)
inline

Sets the particle's HGrid cell Z-coordinate.

Set the y-index of the particle's hGrid cell position

Parameters
[in]zz-index of particle's HGrid cell

Definition at line 462 of file BaseParticle.h.

References hGridCell, and HGridCell::setHGridZ().

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), and Mercury3D::hGridUpdateParticle().

463  { hGridCell.setHGridZ(z); }
HGridCell hGridCell
All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compar...
Definition: BaseParticle.h:673
void setHGridZ(int HGridZ)
Definition: HGridCell.h:81
void BaseParticle::setIndSpecies ( unsigned int  indSpecies)
overridevirtual
Deprecated:
Please use setSpecies(const ParticleSpecies*) instead.
Todo:
MX: this index is used in the MPI transmission. This should be "undeprecated"

Set the particle's species and species' index. Logs a warning if no ParticleHandler is assigned.

Parameters
[in]indSpeciesThe index of the species in the SpeciesHandler.
Todo:
TW do we have to update the species stored in the interactions here?

Reimplemented from BaseInteractable.

Definition at line 781 of file BaseParticle.cc.

References ERROR, BaseHandler< T >::getDPMBase(), BaseObject::getId(), BaseHandler< T >::getObject(), handler_, logger, BaseInteractable::setIndSpecies(), setSpecies(), and DPMBase::speciesHandler.

782 {
783  if (handler_ != nullptr)
784  {
785  //BaseInteractable::setIndSpecies(indSpecies);
788  }
789  else
790  {
792  logger(ERROR, "setIndSpecies called on a particle with no particle handler.\n"
793  "Therefore I can't request the given species from the species handler.\n"
794  " PartID = %", getId());
795  }
796 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
void setSpecies(const ParticleSpecies *species)
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1286
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
virtual void setIndSpecies(unsigned int indSpecies)
Sets the index of the Species of this BaseInteractable.
void BaseParticle::setInertia ( )
virtual

Reimplemented in SuperQuadricParticle.

Definition at line 497 of file BaseParticle.cc.

Referenced by SuperQuadricParticle::setInertia().

498 {
499 
500 }
void BaseParticle::setInertia ( MatrixSymmetric3D  inertia)

Sets the particle's inertia_ (and adjusts invInertia_ accordingly)

Sets the particle's inertia and invInertia_.

Parameters
[in]newInertiathe new inertia to be set.

Definition at line 506 of file BaseParticle.cc.

References MatrixSymmetric3D::inverse(), and invInertia_.

507 {
509 }
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
MatrixSymmetric3D inverse() const
Computes the inverse of a matrix; exits if the inverse doesn't exist.
void BaseParticle::setInfiniteInertia ( )

Sets the particle's inertia_ to 'infinite' (1e20) and its invInertia_ to 0.

Sets the inertia to 1e20 and the invInertia_ (which is actually used in the calculations) to 0.

Definition at line 520 of file BaseParticle.cc.

References invInertia_, and MatrixSymmetric3D::setZero().

521 {
523 } //> i.e. no rotations
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
void setZero()
Sets all elements to zero.
void BaseParticle::setInfo ( Mdouble  info)
virtual

Sets some user-defined information about this object (by default, species ID).

Definition at line 347 of file BaseParticle.cc.

References info_.

348 {
349  info_ = info;
350 }
Mdouble info_
Definition: BaseParticle.h:702
void BaseParticle::setInMPIDomain ( bool  flag)

Flags the status of the particle if wether it is in the communication zone or not.

Definition at line 275 of file BaseParticle.cc.

References isInMPIDomain_.

Referenced by Domain::processReceivedBoundaryParticleData(), PeriodicBoundaryHandler::setMPIFlags(), Domain::updateParticles(), and PeriodicBoundaryHandler::updateParticleStatus().

276 {
277  isInMPIDomain_ = flag;
278 }
bool isInMPIDomain_
returns true if the particle acts as an MPI particle instead of a real particle
Definition: BaseParticle.h:683
void BaseParticle::setInPeriodicDomain ( bool  flag)
void BaseParticle::setInverseInertia ( MatrixSymmetric3D  inverseInertia)

Sets the particle's inertia_ (and adjusts invInertia_ accordingly)

Definition at line 511 of file BaseParticle.cc.

References invInertia_.

512 {
513  invInertia_ = inverseInertia;
514 }
MatrixSymmetric3D invInertia_
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:654
void BaseParticle::setMaserParticle ( bool  flag)

Flags the status of the particle if it belongs to the maser boundary or not.

Definition at line 306 of file BaseParticle.cc.

References isMaserParticle_.

Referenced by SubcriticalMaserBoundaryTEST::checkBoundaryAfterParticleMoved(), MPISphericalParticle::copyDataFromMPIParticleToParticle(), and PeriodicBoundaryHandler::updateMaserParticle().

307 {
308  isMaserParticle_ = flag;
309 }
bool isMaserParticle_
Indicates the periodic complexity at current time step. Used to update periodic status.
Definition: BaseParticle.h:691
void BaseParticle::setMass ( Mdouble  mass)

Sets the particle's mass.

Deprecated:
Please do not set the mass yourself, but use ParticleSpecies->computeMass instead. That makes sure

Sets the mass of the particle

Parameters
[in]massthe new particle's mass

Definition at line 556 of file BaseParticle.cc.

References invMass_, isFixed(), logger, and WARN.

557 {
558  logger(WARN, "WARNING: Do not use particle->setMass, instead use "
559  "particleSpecies->computeMass, since this function can cause "
560  "inconsistencies between the mass, density and radius of this particle!");
561  logger.assert_always(mass > 0.0 && !isFixed(),
562  "Error in BaseParticle::setMass, the given mass to be set must be positive.");
563 
564  invMass_ = 1.0 / mass;
565 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
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
void BaseParticle::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.

Sets the mass of the particle

Parameters
[in]massthe new particle's mass

Definition at line 577 of file BaseParticle.cc.

References ERROR, invMass_, isFixed(), and logger.

578 {
579  if (mass > 0.0 && !isFixed())
580  {
581  invMass_ = 1.0 / mass;
582  }
583  else
584  {
585  logger(ERROR, "Error in BaseParticle::setMass, the given mass to be set must be positive.");
586  }
587 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
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
void BaseParticle::setMPIParticle ( bool  flag)

Flags the mpi particle status.

Definition at line 185 of file BaseParticle.cc.

References isMPIParticle_.

Referenced by Domain::processReceivedBoundaryParticleData(), DPMBase::readNextDataFile(), PeriodicBoundaryHandler::setMPIFlags(), and Domain::updateParticles().

186 {
187  isMPIParticle_ = flag;
188 }
bool isMPIParticle_
Pointer to originating Particle.
Definition: BaseParticle.h:682
void BaseParticle::setPeriodicComplexity ( std::vector< int >  complexity)

Set the periodic communication complexity of the particle.

Definition at line 200 of file BaseParticle.cc.

References periodicComplexity_.

Referenced by ParticleHandler::addObject(), PeriodicBoundaryHandler::findNewParticle(), SubcriticalMaserBoundaryTEST::modifyGhostAfterCreation(), PeriodicBoundaryHandler::processLocalGhostParticles(), PeriodicBoundaryHandler::processReceivedGhostParticleData(), and PeriodicBoundaryHandler::updateParticles().

201 {
202  periodicComplexity_ = complexity;
203 }
std::vector< int > periodicComplexity_
Indicates the periodic complexity at previous time step.
Definition: BaseParticle.h:690
void BaseParticle::setPeriodicComplexity ( int  index,
int  value 
)

Set the periodic communication complexity of the particle.

Definition at line 206 of file BaseParticle.cc.

References BaseHandler< T >::getDPMBase(), getHandler(), BaseHandler< T >::getSize(), DPMBase::periodicBoundaryHandler, and periodicComplexity_.

207 {
208  //hack: generally you'd add particles after declaring the boundaries
209  //but no official programming guildelines rules have been setup for that
210  //So incase that doesnt happen we need to resize this periodicComplexity
211  if (periodicComplexity_.empty())
212  {
213  int numberOfPeriodicBoundaries = getHandler()->getDPMBase()->periodicBoundaryHandler.getSize();
214  if (numberOfPeriodicBoundaries > 0)
215  {
216  //First initialisation of the periodic complexity assumes the particle is completely
217  //within the real domain
218  periodicComplexity_ = std::vector<int>(numberOfPeriodicBoundaries, 2);
219  }
220  }
221 
222  periodicComplexity_[index] = value;
223 }
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
PeriodicBoundaryHandler periodicBoundaryHandler
Internal handler that deals with periodic boundaries, especially in a parallel build.
Definition: DPMBase.h:1316
std::vector< int > periodicComplexity_
Indicates the periodic complexity at previous time step.
Definition: BaseParticle.h:690
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
void BaseParticle::setPeriodicFromParticle ( BaseParticle p)
inline

Assigns the pointer to the 'original' particle this one's a periodic copy of (used in periodic boundary condition implementations).

Parameters
[in]ppointer to the 'original' particle this one is a periodic copy of.

Definition at line 438 of file BaseParticle.h.

References periodicFromParticle_.

Referenced by MPISphericalParticle::copyDataFromMPIParticleToParticle(), SubcriticalMaserBoundary::createGhostCopy(), ConstantMassFlowMaserBoundary::createGhostCopy(), PeriodicBoundary::createGhostParticle(), ShearBoxBoundary::createHorizontalPeriodicParticles(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticle(), AngledPeriodicBoundary::createPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticles(), and LeesEdwardsBoundary::createVerticalPeriodicParticles().

439  { periodicFromParticle_ = p; };
BaseParticle * periodicFromParticle_
Pointer to the previous Particle in the same HGrid cell.
Definition: BaseParticle.h:679
void BaseParticle::setPeriodicGhostParticle ( bool  flag)

Flags the status of the particle to be a ghost in periodic boundary or not.

Definition at line 296 of file BaseParticle.cc.

References isPeriodicGhostParticle_.

Referenced by PeriodicBoundary::createGhostParticle(), PeriodicBoundaryHandler::processLocalGhostParticles(), PeriodicBoundaryHandler::processReceivedGhostParticleData(), DPMBase::readNextDataFile(), and PeriodicBoundaryHandler::updateParticleStatus().

297 {
299 }
bool isPeriodicGhostParticle_
bool that indicates if a particle is in the periodic domain of any boundary
Definition: BaseParticle.h:688
void BaseParticle::setPreviousPeriodicComplexity ( std::vector< int >  complexity)

Set the previous periodic communication complexity of the paritcle.

Definition at line 260 of file BaseParticle.cc.

References previousPeriodicComplexity_.

Referenced by PeriodicBoundaryHandler::updateParticles().

261 {
262  previousPeriodicComplexity_ = complexity;
263 }
std::vector< int > previousPeriodicComplexity_
Indicates if the particle is a ghost particle of a periodic particle.
Definition: BaseParticle.h:689
void BaseParticle::setPreviousPosition ( const Vec3D pos)

Sets the particle's position in the previous time step.

This is used to set the particle's previous position

Parameters
[in]posthe particle's previous position vector.

Definition at line 602 of file BaseParticle.cc.

References previousPosition_.

Referenced by integrateBeforeForceComputation(), Domain::processReceivedBoundaryParticleData(), and PeriodicBoundaryHandler::updateParticles().

603 {
604  previousPosition_ = pos;
605 }
Vec3D previousPosition_
Displacement (only used in StatisticsVector, StatisticsPoint)
Definition: BaseParticle.h:694
void BaseParticle::setRadius ( Mdouble  radius)
virtual

Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)

Sets the radius of the particle, and from that computes the new mass (using its species) and checks whether it now is either the smallest or biggest particle in its ParticleHandler.

Parameters
[in]radiusthe new radius

Reimplemented in SuperQuadricParticle.

Definition at line 542 of file BaseParticle.cc.

References ParticleHandler::checkExtrema(), ParticleSpecies::computeMass(), getHandler(), BaseInteractable::getSpecies(), and radius_.

Referenced by BaseWall::addParticlesAtWall(), BaseCluster::computeInternalStructure(), MPISphericalParticle::copyDataFromMPIParticleToParticle(), Chute::createBottom(), Chute::createFlowParticle(), ChuteInsertionBoundary::generateParticle(), HopperInsertionBoundary::generateParticle(), CubeInsertionBoundary::generateParticle(), BaseClusterInsertionBoundary::generateParticle(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getVTK(), BasicIntersectionOfWalls::getVTK(), helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), BaseCluster::particleInsertionSuccessful(), FileReader::read(), DPMBase::readNextDataFile(), SuperQuadricParticle::setBoundingRadius(), and ChuteBottom::setupInitialConditions().

543 {
544  radius_ = radius;
545  if (getHandler())
546  {
547  getSpecies()->computeMass(this);
548  getHandler()->checkExtrema(this);
549  }
550 }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
Mdouble radius_
Definition: BaseParticle.h:652
void BaseParticle::setSpecies ( const ParticleSpecies species)

In addition to the functionality of BaseInteractable::setSpecies, this function sets the pointer to the particleHandler, which is needed to retrieve species information.

Todo:
TW: this function should also check if the particle is the correct particle for the species type

Sets the particle's species. If this particle does not have a handler yet, this function also assigns the ParticleHandler in the same DPMBase as the SpeciesHandler of the given species as its handler.

Parameters
[in]speciespointer to the ParticleSpecies object, to be set as the particle's species.
Todo:
TW should we chaeck here if we have the right kind of species for the right kind of particle?

Definition at line 805 of file BaseParticle.cc.

References BaseHandler< T >::getDPMBase(), BaseSpecies::getHandler(), handler_, DPMBase::particleHandler, setHandler(), and BaseInteractable::setSpecies().

Referenced by BaseWall::addParticlesAtWall(), SubcriticalMaserBoundary::addParticleToMaser(), ConstantMassFlowMaserBoundary::addParticleToMaser(), BaseParticle(), SubcriticalMaserBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), BaseCluster::computeInternalStructure(), copyDataFromMPIParticleToParticle(), Chute::createBottom(), Chute::createFlowParticle(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), BasicIntersectionOfWalls::getVTK(), BasicUnionOfWalls::getVTK(), helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), BaseCluster::particleInsertionSuccessful(), FileReader::read(), InsertionBoundary::read(), ParticleHandler::readAndCreateObject(), DPMBase::readNextDataFile(), SubcriticalMaserBoundary::removeParticleFromMaser(), ConstantMassFlowMaserBoundary::removeParticleFromMaser(), setHandler(), setIndSpecies(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), and ChuteWithHopper::setupInitialConditions().

806 {
809  //set pointer to the ParticleHandler handler_, which is needed to retrieve
810  //species information
811  //\todo maybe these if statements should throw warnings
812  if (handler_ == nullptr)
813  {
814  SpeciesHandler* sH = species->getHandler();
815  DPMBase* dB = sH->getDPMBase();
816  if (dB != nullptr)
817  {
819  }
820  }
821 }
Container to store all ParticleSpecies.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:70
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
ParticleHandler * handler_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:662
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:92
void setSpecies(const ParticleSpecies *species)
Sets the species of this BaseInteractable.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1296
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
void BaseParticle::unfix ( )

Unfix Particle function, which required a reference to the Species vector. It unfixes a Particle by computing the Particles mass and inertia.

Unfixes the particle by computing the Particles mass and inertia, using the species and radius.

Definition at line 316 of file BaseParticle.cc.

References ParticleSpecies::computeMass(), getHandler(), BaseInteractable::getSpecies(), invMass_, and ParticleHandler::removedFixedParticle().

317 {
318  invMass_ = 1.0;
319  getSpecies()->computeMass(this);
320  if (getHandler())
322 }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
void removedFixedParticle()
Decrement of the number of fixed particles.
void BaseParticle::write ( std::ostream &  os) const
overridevirtual

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

Reimplemented in SuperQuadricParticle, LiquidFilmParticle, and ThermalParticle.

Definition at line 330 of file BaseParticle.cc.

References invMass_, radius_, and BaseInteractable::write().

Referenced by LiquidFilmParticle::write(), ThermalParticle::write(), and SuperQuadricParticle::write().

331 {
333  os << " radius " << radius_
334  << " invMass " << invMass_;
335  //invMass_ is a computed value, but needs to be stored to see if a particle is fixed
336 }
Mdouble invMass_
Particle radius_.
Definition: BaseParticle.h:653
void write(std::ostream &os) const override
Write a BaseInteractable to an output stream.
Mdouble radius_
Definition: BaseParticle.h:652

Friends And Related Function Documentation

void ParticleSpecies::computeMass ( BaseParticle ) const
friend

Particle's position at previous time step.

Since ParticleSpecies is allowed to set the mass of a BaseParticle, it is a friend of this class.

Member Data Documentation

unsigned BaseParticle::communicationComplexity_
private

returns true if it flagged as being in MPI domain

Definition at line 684 of file BaseParticle.h.

Referenced by BaseParticle(), getCommunicationComplexity(), and setCommunicationComplexity().

Vec3D BaseParticle::displacement_
private

Indicates if this particle belongs to the maser boundary or is released into the wide open world.

Definition at line 693 of file BaseParticle.h.

Referenced by addDisplacement(), BaseParticle(), getDisplacement(), and setDisplacement().

ParticleHandler* BaseParticle::handler_
private

Inverse Particle inverse inertia (for computation optimization)

Pointer to the particle's ParticleHandler container

Definition at line 662 of file BaseParticle.h.

Referenced by BaseParticle(), getHandler(), getVolume(), setHandler(), setIndSpecies(), and setSpecies().

HGridCell BaseParticle::hGridCell
private

All hGrid-information: the cell (x,y,z,level), and the previous and next particle in this cell compared to this particle.

Definition at line 673 of file BaseParticle.h.

Referenced by BaseParticle(), getHGridCell(), getHGridLevel(), getHGridX(), getHGridY(), getHGridZ(), printHGrid(), setHGridLevel(), setHGridX(), setHGridY(), and setHGridZ().

BaseParticle* BaseParticle::hGridNextObject_
private

Definition at line 675 of file BaseParticle.h.

Referenced by BaseParticle(), getHGridNextObject(), and setHGridNextObject().

BaseParticle* BaseParticle::hGridPrevObject_
private

Pointer to the next Particle in the same HGrid cell.

Definition at line 676 of file BaseParticle.h.

Referenced by BaseParticle(), getHGridPrevObject(), and setHGridPrevObject().

Mdouble BaseParticle::info_
private

Definition at line 702 of file BaseParticle.h.

Referenced by BaseParticle(), getInfo(), and setInfo().

MatrixSymmetric3D BaseParticle::invInertia_
protected
bool BaseParticle::isInMPIDomain_
private

returns true if the particle acts as an MPI particle instead of a real particle

Definition at line 683 of file BaseParticle.h.

Referenced by BaseParticle(), isInMPIDomain(), and setInMPIDomain().

bool BaseParticle::isInPeriodicDomain_
private

Definition at line 687 of file BaseParticle.h.

Referenced by BaseParticle(), isInPeriodicDomain(), and setInPeriodicDomain().

bool BaseParticle::isMaserParticle_
private

Indicates the periodic complexity at current time step. Used to update periodic status.

Definition at line 691 of file BaseParticle.h.

Referenced by BaseParticle(), isMaserParticle(), and setMaserParticle().

bool BaseParticle::isMPIParticle_
private

Pointer to originating Particle.

Definition at line 682 of file BaseParticle.h.

Referenced by BaseParticle(), isMPIParticle(), and setMPIParticle().

bool BaseParticle::isPeriodicGhostParticle_
private

bool that indicates if a particle is in the periodic domain of any boundary

Definition at line 688 of file BaseParticle.h.

Referenced by BaseParticle(), isPeriodicGhostParticle(), and setPeriodicGhostParticle().

std::vector<int> BaseParticle::periodicComplexity_
private

Indicates the periodic complexity at previous time step.

Definition at line 690 of file BaseParticle.h.

Referenced by BaseParticle(), getPeriodicComplexity(), and setPeriodicComplexity().

BaseParticle* BaseParticle::periodicFromParticle_
private

Pointer to the previous Particle in the same HGrid cell.

Particle attributes

Definition at line 679 of file BaseParticle.h.

Referenced by BaseParticle(), getPeriodicFromParticle(), and setPeriodicFromParticle().

std::vector<int> BaseParticle::previousPeriodicComplexity_
private

Indicates if the particle is a ghost particle of a periodic particle.

Definition at line 689 of file BaseParticle.h.

Referenced by BaseParticle(), getPreviousPeriodicComplexity(), and setPreviousPeriodicComplexity().

Vec3D BaseParticle::previousPosition_
private

Displacement (only used in StatisticsVector, StatisticsPoint)

Definition at line 694 of file BaseParticle.h.

Referenced by getPreviousPosition(), movePrevious(), and setPreviousPosition().

Mdouble BaseParticle::radius_
protected

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