revision: v0.14
ParticleSpecies.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef ParticleSpecies_H
27 #define ParticleSpecies_H
28 
29 #include "BaseSpecies.h"
30 #include "Math/ExtendedMath.h"
32 
33 class BaseInteractable;
34 
35 //Note the getVelocity can for some Species be dependent on which point on the Species is meant.
37 {
38 public:
41 
44 
47 
48  ParticleSpecies(BaseNormalForce* normalForce, BaseFrictionForce* frictionForce, BaseAdhesiveForce* adhesiveForce);
49 
52 
57  ParticleSpecies* copy() const override = 0;
58 
63  virtual BaseSpecies* copyMixed() const = 0;
64 
66  void read(std::istream& is) override;
67 
69  void write(std::ostream& os) const override;
70 
72  std::string getBaseName() const;
73 
76  void setDensity(Mdouble density);
77 
80  Mdouble getMassFromRadius(Mdouble radius) const;
81 
82  Mdouble getMassFromRadius(const Mdouble radius,SpeciesHandler& speciesHandler);
83 
84  Mdouble getVolumeFromRadius(Mdouble radius) const;
85 
87  Mdouble getDensity() const;
88 
92  void computeMass(BaseParticle* p) const;
93 
94  void setTemperatureDependentDensity(const std::function<double(double)>& temperatureDependentDensity);
95 
96  const std::function<double(double)>& getTemperatureDependentDensity() const;
97 
103 
105 
114 
119  void setMaxInteractionDistance(Mdouble interactionDistance=0);
120 
121  const BaseSpecies* getMixedSpecies(const ParticleSpecies* s) const;
122 
123 private:
124 
130 
135 
140  std::function<double(double temperature)> temperatureDependentDensity_;
141 
146 
147 
148 };
149 
150 #endif
ParticleSpecies::getSmallestParticleMass
Mdouble getSmallestParticleMass() const
Computes mass of the lightest particle (by mass) belonging to this species. This computation calls ge...
Definition: ParticleSpecies.cc:201
ParticleSpecies::copy
ParticleSpecies * copy() const override=0
Creates a deep copy of the object from which it is called.
BaseObject::read
virtual void read(std::istream &is)=0
Definition: BaseObject.cc:81
BaseSpecies.h
DPMBase::getParticleDimensions
unsigned int getParticleDimensions() const
Returns the particle dimensionality.
Definition: DPMBase.cc:1458
constants::pi
const Mdouble pi
Definition: ExtendedMath.h:45
BaseAdhesiveForce
Definition: BaseAdhesiveForce.h:31
BaseSpecies::getHandler
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
ParticleSpecies::write
void write(std::ostream &os) const override
Writes the species properties to an output stream.
Definition: ParticleSpecies.cc:76
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
ParticleSpecies::getMixedSpecies
const BaseSpecies * getMixedSpecies(const ParticleSpecies *s) const
Definition: ParticleSpecies.cc:237
ParticleSpecies::getVolumeFromRadius
Mdouble getVolumeFromRadius(Mdouble radius) const
Definition: ParticleSpecies.cc:134
SpeciesHandler::getMixedObject
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:74
BaseHandler::getSize
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
BaseNormalForce
Definition: BaseNormalForce.h:31
ParticleSpecies
Definition: ParticleSpecies.h:37
BaseInteractable
Defines the basic properties that a interactable object can have.
Definition: BaseInteractable.h:55
ParticleSpecies::getDensity
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:117
BaseSpecies::write
void write(std::ostream &os) const override
Sets the boolean constantRestitution_.
Definition: BaseSpecies.cc:131
ParticleSpecies::getMassFromRadius
Mdouble getMassFromRadius(Mdouble radius) const
Definition: ParticleSpecies.cc:122
BaseInteraction
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
BaseSpecies
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:50
ParticleSpecies::~ParticleSpecies
~ParticleSpecies()
The default destructor.
Definition: ParticleSpecies.cc:66
SuperQuadricParticle.h
BaseObject::write
virtual void write(std::ostream &os) const =0
A purely virtual function which has an implementation which writes the name and the object id_ to the...
Definition: BaseObject.cc:91
ParticleSpecies.h
SpeciesHandler
Container to store all ParticleSpecies.
Definition: SpeciesHandler.h:37
double
ParticleSpecies::InteractionType
BaseInteraction InteractionType
Definition: ParticleSpecies.h:39
ParticleSpecies::ParticleSpecies
ParticleSpecies()
The default constructor.
Definition: ParticleSpecies.cc:36
BaseParticle::computeMass
virtual void computeMass(const ParticleSpecies &s)
Computes the particle's (inverse) mass and inertia.
Definition: BaseParticle.cc:862
ERROR
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
Logger.h
ParticleSpecies::maxInteractionDistance_
Mdouble maxInteractionDistance_
Definition: ParticleSpecies.h:145
ParticleSpecies::copyMixed
virtual BaseSpecies * copyMixed() const =0
Creates a new MixedSpecies with the same force properties as the Species from which it is called....
ParticleSpecies::getTemperatureDependentDensity
const std::function< double(double)> & getTemperatureDependentDensity() const
Definition: ParticleSpecies.cc:171
BaseSpecies::setHandler
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:91
ParticleSpecies::getMaxInteractionDistance
Mdouble getMaxInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Definition: ParticleSpecies.h:113
BaseObject::getIndex
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
DPMBase.h
BaseInteraction.h
constants::i
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
ParticleSpecies::setTemperatureDependentDensity
void setTemperatureDependentDensity(const std::function< double(double)> &temperatureDependentDensity)
Definition: ParticleSpecies.cc:176
BaseSpecies::read
void read(std::istream &is) override
Definition: BaseSpecies.cc:140
BaseHandler::getDPMBase
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
ParticleSpecies::MixedSpeciesType
BaseSpecies MixedSpeciesType
Definition: ParticleSpecies.h:40
BaseParticle
Definition: BaseParticle.h:54
ParticleSpecies::temperatureDependentDensity_
std::function< double(double temperature)> temperatureDependentDensity_
Definition: ParticleSpecies.h:140
BaseFrictionForce
Definition: BaseFrictionForce.h:31
ParticleSpecies::setMaxInteractionDistance
void setMaxInteractionDistance(Mdouble interactionDistance=0)
Sets maxInteractionDistance_.
Definition: ParticleSpecies.cc:220
DPMBase::particleHandler
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1395
ParticleSpecies::getLargestInverseParticleMassLocal
Mdouble getLargestInverseParticleMassLocal() const
Computes inverse mass of the lightest particle (by mass) belonging to this species....
Definition: ParticleSpecies.cc:187
ExtendedMath.h
ParticleSpecies::setDensity
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:107
BaseParticle.h
ParticleSpecies::read
void read(std::istream &is) override
Reads the species properties from an input stream.
Definition: ParticleSpecies.cc:88
ParticleSpecies::getBaseName
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
Definition: ParticleSpecies.cc:99
ParticleHandler::computeAllMasses
void computeAllMasses(unsigned int indSpecies)
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
Definition: ParticleHandler.cc:1205
ParticleSpecies::computeMass
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
Definition: ParticleSpecies.cc:166
MPIContainer::Instance
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:134
ParticleSpecies::density_
Mdouble density_
The mass density.
Definition: ParticleSpecies.h:134