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

22  {
23  temperature_ = 0;
24  //temperatureDependentDensity_
25  }
Mdouble temperature_
Definition: ThermalParticle.h:120

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.
36  : Particle(p)
37  {
38  temperature_ = p.temperature_;
39  timeDependentTemperature_ = p.timeDependentTemperature_;
40  }
float * p
Definition: Tutorial_Map_using.cpp:9
std::function< double(double temperature)> timeDependentTemperature_
Definition: ThermalParticle.h:117

References p, 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
141 {
142  // reset temperature_ if timeDependentTemperature_ function is provided
144  {
145  temperature_ = timeDependentTemperature_(this->getHandler()->getDPMBase()->getTime());
146  }
147  // reset density and radius if getTemperatureDependentDensity function is provided
148  if (this->getSpecies()->getTemperatureDependentDensity())
149  {
150  const Mdouble density = this->getSpecies()->getTemperatureDependentDensity()(temperature_);
151  this->radius_ = this->getRadius() * cbrt(this->getMass() / (this->getVolume() * density));
152  }
153  /* Compute temperature change due to heat convection with the ambient fluid */
154  this->getSpecies()->actionsAfterTimeStep(this);
155 }
const std::function< double(double)> & getTemperatureDependentDensity() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cbrt(const T &x)
Definition: MathFunctions.h:1320
density
Definition: UniformPSDSelfTest.py:19

References Eigen::numext::cbrt(), and UniformPSDSelfTest::density.

◆ addTemperature()

template<class Particle >
void Thermal< Particle >::addTemperature ( Mdouble  temperature)
inline
92  {
93  temperature_ += temperature;
94  logger.assert_debug(temperature_>0, "Temperature has to be positive");
95  }
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 MeltableParticle::actionsAfterTimeStep(), and 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
57  {
58  return new Thermal(*this);
59  }
Thermal()
Basic Particle constructor, creates a particle at (0,0,0) with radius, mass and inertia equal to 1.
Definition: ThermalParticle.h:21

References Thermal< Particle >::Thermal().

◆ getName()

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

References getName().

◆ getTemperature()

◆ 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
110 {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.
133 {
134  Particle::read(is);
135  std::string dummy;
136  is >> dummy >> temperature_;
137 }
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
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References Eigen::TensorSycl::internal::read(), and oomph::Global_string_for_annotation::string().

◆ setTemperature()

template<class Particle >
void Thermal< Particle >::setTemperature ( Mdouble  temperature)
inline
86  {
87  logger.assert_debug(temperature>0, "Temperature has to be positive");
88  temperature_ = temperature;
89  }

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

Referenced by HeatTransferUnitTest::setupInitialConditions().

◆ 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)
159 {
160  timeDependentTemperature_ = timeDependentTemperature;
161  temperature_ = timeDependentTemperature(0);
162  logger(INFO, "Setting initial temperature to %", temperature_);
163 }
@ 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
68  {
69  Particle::write(os);
70  os << " temperature " << temperature_;
71  }
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

References Thermal< Particle >::temperature_, and Eigen::TensorSycl::internal::write().

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: