26 #ifndef ThermalParticle_H
27 #define ThermalParticle_H
34 template<
class Particle>
88 void write(std::ostream& os)
const override
99 void read(std::istream& is)
override;
108 logger.assert_debug(temperature>0,
"Temperature has to be positive");
152 template<
class Particle>
157 is >> dummy >> temperature_;
160 template<
class Particle>
163 if (timeDependentTemperature_)
165 temperature_ = timeDependentTemperature_(this->getHandler()->getDPMBase()->getTime());
167 if (this->getSpecies()->getTemperatureDependentDensity())
169 const Mdouble density = this->getSpecies()->getTemperatureDependentDensity()(temperature_);
170 this->radius_ = this->getRadius() * cbrt(this->getMass() / (this->getVolume() * density));
174 template<
class Particle>
177 timeDependentTemperature_ = timeDependentTemperature;
178 temperature_ = timeDependentTemperature(0);
179 logger(
INFO,
"Setting initial temperature to %", temperature_);
std::string getName(int argc, char *argv[])
Definition: CombineParallelDataFiles.cpp:12
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Thermal< SphericalParticle > ThermalParticle
Definition: ThermalParticle.h:182
Definition: ThermalParticle.h:36
Thermal(const Thermal &p)
Particle copy constructor, which accepts as input a reference to a Particle. It creates a copy of thi...
Definition: ThermalParticle.h:57
Thermal * copy() const override
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
Definition: ThermalParticle.h:77
~Thermal() override=default
Particle destructor, needs to be implemented and checked if it removes tangential spring information.
void setTemperatureDependentDensity(const std::function< double(double)> &temperatureDependentDensity)
std::string getName() const override
Definition: ThermalParticle.h:94
const std::function< double(double)> & getTemperatureDependentDensity() const
void actionsAfterTimeStep() override
Definition: ThermalParticle.h:161
Thermal()
Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.
Definition: ThermalParticle.h:42
void addTemperature(Mdouble temperature)
Definition: ThermalParticle.h:112
bool isSphericalParticle() const override
Definition: ThermalParticle.h:131
Mdouble temperature_
Definition: ThermalParticle.h:141
void write(std::ostream &os) const override
Definition: ThermalParticle.h:88
Mdouble getTemperature() const
Definition: ThermalParticle.h:101
const std::function< double(double)> & getTimeDependentTemperature() const
Definition: ThermalParticle.h:122
std::function< double(double temperature)> timeDependentTemperature_
Definition: ThermalParticle.h:138
void setTemperature(Mdouble temperature)
Definition: ThermalParticle.h:106
void setTimeDependentTemperature(const std::function< double(double)> &timeDependentTemperature)
Definition: ThermalParticle.h:175
void read(std::istream &is) override
Definition: ThermalParticle.h:153