5 #ifndef THERMALSPECIES_H
6 #define THERMALSPECIES_H
12 template<
class NormalForceSpecies>
30 void write(std::ostream& os)
const;
33 void read(std::istream& is);
60 logger.assert_always(ambientTemperature >= 0,
"ambientTemperature cannot be negative");
81 logger.assert_always(ambientThermalConductivity>0,
"ambientThermalConductivity has to be positive");
92 logger.assert_always(ambientDynamicViscosity>0,
"ambientDynamicViscosity has to be positive");
103 logger.assert_always(ambientHeatCapacity>0,
"ambientHeatCapacity has to be positive");
114 logger.assert_always(ambientDensity>0,
"ambientDensity has to be positive");
163 template<
class NormalForceSpecies>
177 template<
class NormalForceSpecies>
191 template<
class NormalForceSpecies>
195 template<
class NormalForceSpecies>
199 os <<
" heatCapacity " << heatCapacity_;
200 os <<
" thermalConductivity " << thermalConductivity_;
201 os <<
" ambientTemperature " << ambientTemperature_;
202 os <<
" ambientVelocity " << ambientVelocity_;
203 os <<
" ambientThermalConductivity " << ambientThermalConductivity_;
204 os <<
" ambientDynamicViscosity " << ambientDynamicViscosity_;
205 os <<
" ambientHeatCapacity " << ambientHeatCapacity_;
206 os <<
" ambientDensity " << ambientDensity_;
209 template<
class NormalForceSpecies>
214 is >> dummy >> heatCapacity_;
215 is >> dummy >> thermalConductivity_;
216 helpers::readOptionalVariable<Mdouble>(is,
"ambientTemperature", ambientTemperature_);
217 helpers::readOptionalVariable<Vec3D>(is,
"ambientVelocity", ambientVelocity_);
218 helpers::readOptionalVariable<Mdouble>(is,
"ambientThermalConductivity", ambientThermalConductivity_);
219 helpers::readOptionalVariable<Mdouble>(is,
"ambientDynamicViscosity", ambientDynamicViscosity_);
220 helpers::readOptionalVariable<Mdouble>(is,
"ambientHeatCapacity", ambientHeatCapacity_);
221 helpers::readOptionalVariable<Mdouble>(is,
"ambientDensity", ambientDensity_);
224 template<
class NormalForceSpecies>
227 return "Thermal" + NormalForceSpecies::getBaseName();
231 template<
class NormalForceSpecies>
234 return heatCapacity_;
237 template<
class NormalForceSpecies>
240 logger.assert_always(heatCapacity > 0,
241 "[ThermalSpecies<>::setHeatCapacity(%)] value has to be positive",
243 heatCapacity_ = heatCapacity;
246 template<
class NormalForceSpecies>
249 return thermalConductivity_;
252 template<
class NormalForceSpecies>
255 logger.assert_always(thermalConductivity >= 0,
256 "[ThermalSpecies<>::setThermalConductivity(%)] value has to be positive",
257 thermalConductivity);
258 thermalConductivity_ = thermalConductivity;
262 template<
class NormalForceSpecies>
265 if (getAmbientThermalConductivity()>0)
268 double diameter = 2.0 *
p->getRadius();
269 double prandtl = getAmbientDynamicViscosity() * getAmbientHeatCapacity() /
270 getAmbientThermalConductivity();
271 double reynolds = getAmbientDensity() * (
p->getVelocity() - getAmbientVelocity()).getLength() * diameter / getAmbientDynamicViscosity();
272 double nusselt = 2.0 + 0.4 *
sqrt(reynolds) *
cbrt(prandtl);
273 double heatTransferCoefficient = nusselt * getAmbientThermalConductivity() / diameter;
274 double heatTransferRate = heatTransferCoefficient *
p->getSurfaceArea() *
275 (getAmbientTemperature()-
p->getTemperature());
276 Mdouble temperatureChange = heatTransferRate *
p->getInvMass() / getHeatCapacity()
277 *
p->getHandler()->getDPMBase()->getTimeStep();
278 p->addTemperature(temperatureChange);
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
float * p
Definition: Tutorial_Map_using.cpp:9
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
Definition: BaseParticle.h:33
Defines a contact force parallel to the contact normal.
Definition: ThermalInteraction.h:16
Definition: ThermalSpecies.h:14
Mdouble getAmbientHeatCapacity() const
Allows ambientHeatCapacity_ to be accessed.
Definition: ThermalSpecies.h:97
Mdouble getAmbientThermalConductivity() const
Allows ambientThermalConductivity_ to be accessed.
Definition: ThermalSpecies.h:75
void read(std::istream &is)
Reads the species properties from an input stream.
Definition: ThermalSpecies.h:210
void write(std::ostream &os) const
Writes the species properties to an output stream.
Definition: ThermalSpecies.h:196
void actionsAfterTimeStep(BaseParticle *particle) const override
Computes the heat transfer rate (.
double ambientDynamicViscosity_
The dynamic viscosity of the ambient fluid (kg/m/s=Pa.s).
Definition: ThermalSpecies.h:150
void setAmbientTemperature(Mdouble ambientTemperature)
Definition: ThermalSpecies.h:58
Mdouble getAmbientTemperature() const
Definition: ThermalSpecies.h:53
void setAmbientHeatCapacity(Mdouble ambientHeatCapacity)
Allows ambientHeatCapacity_ to be changed.
Definition: ThermalSpecies.h:102
Mdouble heatCapacity_
The specific heat capacity of the particle/wall.
Definition: ThermalSpecies.h:123
void setAmbientThermalConductivity(Mdouble ambientThermalConductivity)
Allows ambientThermalConductivity_ to be changed.
Definition: ThermalSpecies.h:80
double ambientThermalConductivity_
The thermal conductivity of the ambient fluid (W/m/K).
Definition: ThermalSpecies.h:145
Mdouble thermalConductivity_
The thermal conductivity of the particle/wall.
Definition: ThermalSpecies.h:128
ThermalInteraction< typename NormalForceSpecies::InteractionType > InteractionType
The correct Interaction type for this FrictionForceSpecies.
Definition: ThermalSpecies.h:18
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
Definition: ThermalSpecies.h:225
void setThermalConductivity(Mdouble thermalConductivity)
Allows heatCapacity_ to be changed.
Definition: ThermalSpecies.h:253
double ambientHeatCapacity_
The specific heat capacity of the ambient fluid (J/kg/K).
Definition: ThermalSpecies.h:155
void setHeatCapacity(Mdouble heatCapacity)
Allows heatCapacity_ to be changed.
Definition: ThermalSpecies.h:238
virtual ~ThermalSpecies()
The default destructor.
Definition: ThermalSpecies.h:192
Mdouble getThermalConductivity() const
Allows heatCapacity_ to be accessed.
Definition: ThermalSpecies.h:247
void setAmbientVelocity(Vec3D ambientVelocity)
Allows ambientVelocity_ to be changed.
Definition: ThermalSpecies.h:70
ThermalSpecies()
The default constructor.
Definition: ThermalSpecies.h:164
void setAmbientDynamicViscosity(Mdouble ambientDynamicViscosity)
Allows ambientDynamicViscosity_ to be changed.
Definition: ThermalSpecies.h:91
Vec3D ambientVelocity_
The velocity of the ambient fluid (m/s).
Definition: ThermalSpecies.h:140
double ambientDensity_
The density of the ambient fluid (kg/m^3).
Definition: ThermalSpecies.h:160
Vec3D getAmbientVelocity() const
Allows ambientVelocity_ to be accessed.
Definition: ThermalSpecies.h:65
Mdouble getAmbientDensity() const
Allows ambientDensity_ to be accessed.
Definition: ThermalSpecies.h:108
Mdouble getHeatCapacity() const
Allows heatCapacity_ to be accessed.
Definition: ThermalSpecies.h:232
void setAmbientDensity(Mdouble ambientDensity)
Allows ambientDensity_ to be changed.
Definition: ThermalSpecies.h:113
Mdouble getAmbientDynamicViscosity() const
Allows ambientDynamicViscosity_ to be accessed.
Definition: ThermalSpecies.h:86
Mdouble ambientTemperature_
The ambient temperature (K).
Definition: ThermalSpecies.h:133
Definition: ThermalParticle.h:15
Definition: Kernel/Math/Vector.h:30
RealScalar s
Definition: level1_cplx_impl.h:130
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