Thermal< Particle > Class Template Reference

#include <ThermalParticle.h>

+ Inheritance diagram for Thermal< Particle >:

Public Member Functions

 Thermal ()
 Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1. More...
 
 Thermal (const Thermal &p)
 Particle copy constructor, which accepts as input a reference to a Particle. It creates a copy of this Particle and all it's information. Usually it is better to use the copy() function for polymorphism. More...
 
 ~Thermal () override=default
 Particle destructor, needs to be implemented and checked if it removes tangential spring information. More...
 
Thermalcopy () const override
 Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism. More...
 
void write (std::ostream &os) const override
 
std::string getName () const override
 
void read (std::istream &is) override
 
Mdouble getTemperature () const
 
void setTemperature (Mdouble temperature)
 
void addTemperature (Mdouble temperature)
 
void setTemperatureDependentDensity (const std::function< double(double)> &temperatureDependentDensity)
 
const std::function< double(double)> & getTemperatureDependentDensity () const
 
const std::function< double(double)> & getTimeDependentTemperature () const
 
void setTimeDependentTemperature (const std::function< double(double)> &timeDependentTemperature)
 
void actionsAfterTimeStep () override
 
bool isSphericalParticle () const override
 

Protected Attributes

Mdouble temperature_
 

Private Attributes

std::function< double(double temperature)> timeDependentTemperature_
 

Constructor & Destructor Documentation

◆ Thermal() [1/2]

template<class Particle >
Thermal< Particle >::Thermal ( )
inline

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

default constructor

43  {
44  temperature_ = 0;
45  //temperatureDependentDensity_
46  }
Mdouble temperature_
Definition: ThermalParticle.h:141

References Thermal< Particle >::temperature_.

Referenced by Thermal< Particle >::copy().

◆ Thermal() [2/2]

template<class Particle >
Thermal< Particle >::Thermal ( const Thermal< Particle > &  p)
inline

Particle copy constructor, which accepts as input a reference to a Particle. It creates a copy of this Particle and all it's information. Usually it is better to use the copy() function for polymorphism.

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 Thermal this one should become a copy of.
57  : Particle(p)
58  {
61  }
std::function< double(double temperature)> timeDependentTemperature_
Definition: ThermalParticle.h:138

References Thermal< Particle >::temperature_, and Thermal< Particle >::timeDependentTemperature_.

◆ ~Thermal()

template<class Particle >
Thermal< Particle >::~Thermal ( )
overridedefault

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.

Member Function Documentation

◆ actionsAfterTimeStep()

template<class Particle >
void Thermal< Particle >::actionsAfterTimeStep
override
162 {
164  {
165  temperature_ = timeDependentTemperature_(this->getHandler()->getDPMBase()->getTime());
166  }
167  if (this->getSpecies()->getTemperatureDependentDensity())
168  {
169  const Mdouble density = this->getSpecies()->getTemperatureDependentDensity()(temperature_);
170  this->radius_ = this->getRadius() * cbrt(this->getMass() / (this->getVolume() * density));
171  }
172 }
double Mdouble
Definition: GeneralDefine.h:34
const std::function< double(double)> & getTemperatureDependentDensity() const

◆ addTemperature()

template<class Particle >
void Thermal< Particle >::addTemperature ( Mdouble  temperature)
inline
113  {
114  temperature_ += temperature;
115  logger.assert_debug(temperature_>0, "Temperature has to be positive");
116  }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.

References logger, and Thermal< Particle >::temperature_.

Referenced by ThermalInteraction< NormalForceInteraction >::computeNormalForce().

◆ copy()

template<class Particle >
Thermal* Thermal< Particle >::copy ( ) const
inlineoverride

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

Copy method. Uses copy constructor to create a copy on the heap. Useful for polymorphism.

Returns
pointer to the particle's copy
78  {
79  return new Thermal(*this);
80  }
Thermal()
Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.
Definition: ThermalParticle.h:42

References Thermal< Particle >::Thermal().

◆ getName()

template<class Particle >
std::string Thermal< Particle >::getName ( ) const
inlineoverride
95  {
96  return "Thermal" + Particle::getName();
97  }
std::string getName(int argc, char *argv[])
Definition: CombineParallelDataFiles.cpp:12

References getName().

◆ getTemperature()

template<class Particle >
Mdouble Thermal< Particle >::getTemperature ( ) const
inline

◆ getTemperatureDependentDensity()

template<class Particle >
const std::function<double(double)>& Thermal< Particle >::getTemperatureDependentDensity ( ) const

◆ getTimeDependentTemperature()

template<class Particle >
const std::function<double(double)>& Thermal< Particle >::getTimeDependentTemperature ( ) const
inline

◆ isSphericalParticle()

template<class Particle >
bool Thermal< Particle >::isSphericalParticle ( ) const
inlineoverride
131 {return true;}

◆ read()

template<class Particle >
void Thermal< Particle >::read ( std::istream &  is)
override

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 BaseParticle::read().

Parameters
[in,out]isinput stream with particle properties.
154 {
155  Particle::read(is);
156  std::string dummy;
157  is >> dummy >> temperature_;
158 }

◆ setTemperature()

template<class Particle >
void Thermal< Particle >::setTemperature ( Mdouble  temperature)
inline
107  {
108  logger.assert_debug(temperature>0, "Temperature has to be positive");
109  temperature_ = temperature;
110  }

References logger, and Thermal< Particle >::temperature_.

◆ setTemperatureDependentDensity()

template<class Particle >
void Thermal< Particle >::setTemperatureDependentDensity ( const std::function< double(double)> &  temperatureDependentDensity)

◆ setTimeDependentTemperature()

template<class Particle >
void Thermal< Particle >::setTimeDependentTemperature ( const std::function< double(double)> &  timeDependentTemperature)
176 {
177  timeDependentTemperature_ = timeDependentTemperature;
178  temperature_ = timeDependentTemperature(0);
179  logger(INFO, "Setting initial temperature to %", temperature_);
180 }
@ INFO

References INFO, and logger.

◆ write()

template<class Particle >
void Thermal< Particle >::write ( std::ostream &  os) const
inlineoverride

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

Parameters
[in,out]osstream to which the info is written
89  {
90  Particle::write(os);
91  os << " temperature " << temperature_;
92  }

References Thermal< Particle >::temperature_.

Member Data Documentation

◆ temperature_

◆ timeDependentTemperature_

template<class Particle >
std::function<double(double temperature)> Thermal< Particle >::timeDependentTemperature_
private

Change this function to let the temperature be time-dependent.

Referenced by Thermal< Particle >::getTimeDependentTemperature(), and Thermal< Particle >::Thermal().


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