5 #ifndef ThermalParticle_H
6 #define ThermalParticle_H
13 template<
class Particle>
67 void write(std::ostream& os)
const override
78 void read(std::istream& is)
override;
87 logger.assert_debug(temperature>0,
"Temperature has to be positive");
131 template<
class Particle>
136 is >> dummy >> temperature_;
139 template<
class Particle>
143 if (timeDependentTemperature_)
145 temperature_ = timeDependentTemperature_(this->getHandler()->getDPMBase()->getTime());
148 if (this->getSpecies()->getTemperatureDependentDensity())
150 const Mdouble density = this->getSpecies()->getTemperatureDependentDensity()(temperature_);
151 this->radius_ = this->getRadius() *
cbrt(this->getMass() / (this->getVolume() *
density));
154 this->getSpecies()->actionsAfterTimeStep(
this);
157 template<
class Particle>
160 timeDependentTemperature_ = timeDependentTemperature;
161 temperature_ = timeDependentTemperature(0);
162 logger(
INFO,
"Setting initial temperature to %", temperature_);
std::string getName(int argc, char *argv[])
Definition: CombineParallelDataFiles.cpp:16
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:165
float * p
Definition: Tutorial_Map_using.cpp:9
Definition: ThermalParticle.h:15
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:36
Thermal * copy() const override
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
Definition: ThermalParticle.h:56
~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:73
const std::function< double(double)> & getTemperatureDependentDensity() const
void actionsAfterTimeStep() override
Definition: ThermalParticle.h:140
Thermal()
Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.
Definition: ThermalParticle.h:21
void addTemperature(Mdouble temperature)
Definition: ThermalParticle.h:91
bool isSphericalParticle() const override
Definition: ThermalParticle.h:110
Mdouble temperature_
Definition: ThermalParticle.h:120
void write(std::ostream &os) const override
Definition: ThermalParticle.h:67
Mdouble getTemperature() const
Definition: ThermalParticle.h:80
const std::function< double(double)> & getTimeDependentTemperature() const
Definition: ThermalParticle.h:101
std::function< double(double temperature)> timeDependentTemperature_
Definition: ThermalParticle.h:117
void setTemperature(Mdouble temperature)
Definition: ThermalParticle.h:85
void setTimeDependentTemperature(const std::function< double(double)> &timeDependentTemperature)
Definition: ThermalParticle.h:158
void read(std::istream &is) override
Definition: ThermalParticle.h:132
#define INFO(i)
Definition: mumps_solver.h:54
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::enable_if_t< dt !=data_source::global_mem, void > write(PacketType &packet_data, DataScalar ptr)
write, a template function used for storing the data to local memory. This function is used to guaran...
Definition: TensorContractionSycl.h:221
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::enable_if_t< PacketLoad, PacketType > read(const TensorMapper &tensorMapper, const StorageIndex &NCIndex, const StorageIndex &CIndex, const StorageIndex &ld)
read, a template function used for loading the data from global memory. This function is used to guar...
Definition: TensorContractionSycl.h:162
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cbrt(const T &x)
Definition: MathFunctions.h:1320
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286