KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
thermal_spheric_particle.h
Go to the documentation of this file.
1 // Kratos Multi-Physics - ThermalDEM Application
2 //
3 // License: BSD License
4 // Kratos default license: kratos/license.txt
5 //
6 // Main authors: Rafael Rangel (rrangel@cimne.upc.edu)
7 //
8 
9 #if !defined(KRATOS_THERMAL_SPHERIC_PARTICLE_H_INCLUDED)
10 #define KRATOS_THERMAL_SPHERIC_PARTICLE_H_INCLUDED
11 
12 // System includes
13 #include <string>
14 #include <iostream>
15 #include <limits>
16 
17 // External includes
18 #include "includes/define.h"
19 #include "utilities/openmp_utils.h"
20 #include "custom_utilities/AuxiliaryFunctions.h"
23 
24 // Project includes
26 
27 namespace Kratos
28 {
29  class KRATOS_API(THERMAL_DEM_APPLICATION) ThermalSphericParticle : public SphericParticle
30  {
31  public:
32 
33  // Pointer definition
35 
39 
40  typedef Node NodeType;
42  typedef std::size_t IndexType;
45 
46  // Definitions
47  #define PARTICLE_NEIGHBOR 4 // binary = 100 (to use in bitwise operations)
48  #define WALL_NEIGHBOR 3 // binary = 011 (to use in bitwise operations)
49  #define WALL_NEIGHBOR_NONCONTACT 2 // binary = 010 (to use in bitwise operations)
50  #define WALL_NEIGHBOR_CONTACT 1 // binary = 001 (to use in bitwise operations)
51 
53  {
55  double impact_time;
59  std::vector<double> impact_velocity;
60  };
61 
62  // Constructor
64  ThermalSphericParticle(IndexType NewId, GeometryType::Pointer pGeometry);
65  ThermalSphericParticle(IndexType NewId, NodesArrayType const& ThisNodes);
66  ThermalSphericParticle(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
67 
68  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override;
69 
70  // Destructor
71  virtual ~ThermalSphericParticle();
72 
73  // Initialization methods
74  void Initialize (const ProcessInfo& r_process_info) override;
75  void InitializeSolutionStep (const ProcessInfo& r_process_info) override;
76  void InitializeHeatFluxComputation (const ProcessInfo& r_process_info);
77 
78  // Computation methods
79  void CalculateRightHandSide (const ProcessInfo& r_process_info, double dt, const array_1d<double, 3>& gravity) override;
80  void ComputeHeatFluxes (const ProcessInfo& r_process_info);
81  void ComputeHeatFluxWithNeighbor (const ProcessInfo& r_process_info);
82  void ComputeInteractionProps (const ProcessInfo& r_process_info);
83  void StoreBallToBallContactInfo (const ProcessInfo& r_process_info, SphericParticle::ParticleDataBuffer& data_buffer, double GlobalContactForceTotal[3], double LocalContactForceTotal[3], double LocalContactForceDamping[3], bool sliding) override;
84  void StoreBallToRigidFaceContactInfo (const ProcessInfo& r_process_info, SphericParticle::ParticleDataBuffer& data_buffer, double GlobalContactForceTotal[3], double LocalContactForceTotal[3], double LocalContactForceDamping[3], bool sliding) override;
85  void Move (const double delta_t, const bool rotation_option, const double force_reduction_factor, const int StepFlag) override;
86 
87  // Finalization methods
88  void FinalizeSolutionStep (const ProcessInfo& r_process_info) override;
89  void UpdateTemperatureDependentRadius (const ProcessInfo& r_process_info);
90 
91  // Auxiliary computations
92  void ComputeAddedSearchDistance (const ProcessInfo& r_process_info, double& added_search_distance);
93  double ComputePrandtlNumber (const ProcessInfo& r_process_info);
94  double ComputeReynoldNumber (const ProcessInfo& r_process_info);
95  double ComputeFluidRelativeVelocity (const ProcessInfo& r_process_info);
96  double GetVoronoiCellFaceRadius (const ProcessInfo& r_process_info);
97 
98  // Neighbor interaction computations
99  void CleanContactParameters (const ProcessInfo& r_process_info);
100  bool CheckAdiabaticNeighbor (void);
101  bool CheckSurfaceDistance (const double radius_factor);
102  double ComputeDistanceToNeighbor (void);
103  double ComputeDistanceToNeighborAdjusted (void);
104  double ComputeSeparationToNeighbor (void);
105  double ComputeSeparationToNeighborAdjusted (void);
106  double ComputeFourierNumber (void);
107  double ComputeMaxCollisionTime (void);
108  double ComputeMaxContactRadius (void);
109  double ComputeContactRadius (void);
110  double ComputeEffectiveRadius (void);
111  double ComputeEffectiveMass (void);
112  double ComputeEffectiveYoung (void);
113  double ComputeEffectiveYoungReal (void);
114  double ComputeEffectiveConductivity (void);
115  double ComputeAverageConductivity (void);
116  double ComputeMeanConductivity (void);
117 
118  // Get/Set methods
119  HeatExchangeMechanism& GetDirectConductionModel (void);
120  HeatExchangeMechanism& GetIndirectConductionModel (void);
121  HeatExchangeMechanism& GetConvectionModel (void);
122  HeatExchangeMechanism& GetRadiationModel (void);
123  HeatGenerationMechanism& GetGenerationModel (void);
124  RealContactModel& GetRealContactModel (void);
125  ThermalDEMIntegrationScheme& GetThermalIntegrationScheme (void);
126  NumericalIntegrationMethod& GetNumericalIntegrationMethod (void);
127 
128  double GetYoung (void) override;
129  double GetPoisson (void) override;
130  double GetDensity (void) override;
131 
132  array_1d<double,3> GetParticleCoordinates (void);
133  array_1d<double,3> GetParticleVelocity (void);
134  array_1d<double,3> GetParticleAngularVelocity (void);
135  double GetParticleTemperature (void);
136  double GetParticleRadius (void);
137  double GetParticleCharacteristicLength (void);
138  double GetParticleVolume (void);
139  double GetParticleYoung (void);
140  double GetParticlePoisson (void);
141  double GetParticleDensity (void);
142  double GetParticleMass (void);
143  double GetParticleHeatCapacity (void);
144  double GetParticleConductivity (void);
145  double GetParticleDiffusivity (void);
146  double GetParticleEmissivity (void);
147  double GetParticleExpansionCoefficient (void);
148 
149  array_1d<double,3> GetWallCoordinates (void);
150  double GetWallTemperature (void);
151  double GetWallRadius (void);
152  double GetWallSurfaceArea (void);
153  double GetWallYoung (void);
154  double GetWallPoisson (void);
155  double GetWallDensity (void);
156  double GetWallMass (void);
157  double GetWallHeatCapacity (void);
158  double GetWallConductivity (void);
159  double GetWallEmissivity (void);
160 
161  array_1d<double,3> GetNeighborCoordinates (void);
162  double GetNeighborTemperature (void);
163  double GetNeighborRadius (void);
164  double GetNeighborSurfaceArea (void);
165  double GetNeighborYoung (void);
166  double GetNeighborPoisson (void);
167  double GetNeighborDensity (void);
168  double GetNeighborMass (void);
169  double GetNeighborHeatCapacity (void);
170  double GetNeighborConductivity (void);
171  double GetNeighborEmissivity (void);
172 
173  double GetContactDynamicFrictionCoefficient (void);
174  double GetContactRollingFrictionCoefficient (void);
175  ContactParams GetContactParameters (void);
176 
177  void SetDirectConductionModel (HeatExchangeMechanism::Pointer& model);
178  void SetIndirectConductionModel (HeatExchangeMechanism::Pointer& model);
179  void SetConvectionModel (HeatExchangeMechanism::Pointer& model);
180  void SetRadiationModel (HeatExchangeMechanism::Pointer& model);
181  void SetGenerationModel (HeatGenerationMechanism::Pointer& model);
182  void SetRealContactModel (RealContactModel::Pointer& model);
183  void SetThermalIntegrationScheme (ThermalDEMIntegrationScheme::Pointer& scheme);
184  void SetNumericalIntegrationMethod (NumericalIntegrationMethod::Pointer& method);
185  void SetParticleTemperature (const double temperature);
186  void SetParticleHeatFlux (const double heat_flux);
187  void SetParticlePrescribedHeatFluxSurface (const double heat_flux);
188  void SetParticlePrescribedHeatFluxVolume (const double heat_flux);
189  void SetParticleRadius (const double radius);
190  void SetParticleMass (const double mass);
191  void SetParticleMomentInertia (const double moment_inertia);
192  void SetParticleRealYoungRatio (const double ratio);
193 
194  // DIMENSION DEPENDENT METHODS (DIFFERENT FOR 2D AND 3D)
195  // ATTENTION:
196  // METHODS INEHERITED IN CYLINDER PARTICLE (2D) FROM SPEHRIC PARTICLE ARE REIMPLEMENTED HERE
197  // THIS IS TO AVOID MAKING THERMAL PARTICLE A TEMPALTE CLASS TO INHERIT FROM CYLINDER PARTICLE
198  double CalculateVolume (void) override;
199  double CalculateMomentOfInertia (void) override;
200  double GetParticleSurfaceArea (void);
201 
202  // Pointers to auxiliary objects
211 
212  // General properties
213  unsigned int mDimension; // dimension (2D or 3D)
214  unsigned int mNumStepsEval; // number of steps passed since last thermal evaluation
215  double mPreviousTemperature; // temperature from the beginning of the step
216  bool mIsTimeToSolve; // flag to solve thermal problem in current step
217  bool mHasMotion; // flag to solve mechanical behavior (forces and displacements)
218  bool mHasFixedTemperature; // flag for constant temperature
219  bool mHasVariableRadius; // flag for temperature-dependent radius
220  bool mStoreContactParam; // flag to store contact parameters with neighbors when solving the mechanical problem
221 
222  // Heat flux components
238 
239  // Energy properties
240  double mPreviousViscodampingEnergy; // accumulated energy dissipation from previous interaction: viscodamping
241  double mPreviousFrictionalEnergy; // accumulated energy dissipation from previous interaction: frictional
242  double mPreviousRollResistEnergy; // accumulated energy dissipation from previous interaction: rolling resistance
243 
244  // Heat maps
245  std::vector<std::vector<std::vector<double>>> mHeatMapGenerationDampingPP; // Local heat map matrix for heat generaion by damping between particle-particle
246  std::vector<std::vector<std::vector<double>>> mHeatMapGenerationDampingPW; // Local heat map matrix for heat generaion by damping between particle-wall
247  std::vector<std::vector<std::vector<double>>> mHeatMapGenerationSlidingPP; // Local heat map matrix for heat generaion by sliding between particle-particle
248  std::vector<std::vector<std::vector<double>>> mHeatMapGenerationSlidingPW; // Local heat map matrix for heat generaion by sliding between particle-wall
249  std::vector<std::vector<std::vector<double>>> mHeatMapGenerationRollingPP; // Local heat map matrix for heat generaion by rolling between particle-particle
250  std::vector<std::vector<std::vector<double>>> mHeatMapGenerationRollingPW; // Local heat map matrix for heat generaion by rolling between particle-wall
251 
252  // Interaction properties
253  bool mNeighborInContact; // flag for contact interaction
254  double mRealYoungRatio; // real value of Young modulus
255  double mContactRadius; // simulation contact radius
256  double mNeighborDistance; // simulation neighbor distance
257  double mNeighborSeparation; // simulation neighbor separation (negative value indicates an indentation)
258  double mContactRadiusAdjusted; // adjusted contact radius from real Young modulus
259  double mNeighborDistanceAdjusted; // adjusted neighbor distance from adjusted contact radius
260  double mNeighborSeparationAdjusted; // adjusted neighbor separation (negative value indicates an indentation)
261 
262  // Radiation environment-related
263  unsigned int mRadiativeNeighbors;
266 
267  // Neighboring data
271  unsigned int mNeighborIndex;
273  std::map<SphericParticle*, ContactParams> mContactParamsParticle;
274  std::map<DEMWall*, ContactParams> mContactParamsWall;
275 
276  // Tesselation data
278  std::map<int,double> mNeighborVoronoiRadius;
279 
280  // Turn back information as a string
281  virtual std::string Info() const override {
282  std::stringstream buffer;
283  buffer << "ThermalSphericParticle";
284  return buffer.str();
285  }
286 
287  // Print object information
288  virtual void PrintInfo(std::ostream& rOStream) const override {rOStream << "ThermalSphericParticle";}
289  virtual void PrintData(std::ostream& rOStream) const override {}
290 
291  private:
292 
293  // Serializer
294  friend class Serializer;
295 
296  virtual void save(Serializer& rSerializer) const override {
298  }
299 
300  virtual void load(Serializer& rSerializer) override {
302  }
303 
304  }; // Class ThermalSphericParticle
305 
306  // input stream function
307  inline std::istream& operator >> (std::istream& rIStream, ThermalSphericParticle& rThis) {
308  return rIStream;
309  }
310 
311  // output stream function
312  inline std::ostream& operator << (std::ostream& rOStream, const ThermalSphericParticle& rThis) {
313  rThis.PrintInfo(rOStream);
314  rOStream << std::endl;
315  rThis.PrintData(rOStream);
316  return rOStream;
317  }
318 
319 } // namespace Kratos
320 
321 #endif // KRATOS_THERMAL_SPHERIC_PARTICLE_H_INCLUDED defined
Definition: dem_wall.h:29
std::size_t IndexType
Definition: flags.h:74
Geometry base class.
Definition: geometry.h:71
typename TContainerType::iterator ptr_iterator
Definition: global_pointers_vector.h:85
Definition: heat_exchange_mechanism.h:28
Definition: heat_generation_mechanism.h:28
This class defines the node.
Definition: node.h:65
Definition: numerical_integration_method.h:23
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Definition: real_contact_model.h:28
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Definition: spheric_particle.h:59
Definition: spheric_particle.h:31
Definition: thermal_dem_integration_scheme.h:25
Definition: thermal_spheric_particle.h:30
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(ThermalSphericParticle)
double mGenerationHeatFlux_slid_wall
Definition: thermal_spheric_particle.h:230
HeatGenerationMechanism * mpGenerationModel
Definition: thermal_spheric_particle.h:207
ParticleWeakVectorType::ptr_iterator ParticleWeakIteratorType_ptr
Definition: thermal_spheric_particle.h:37
double mPreviousFrictionalEnergy
Definition: thermal_spheric_particle.h:241
double mPrescribedHeatFlux
Definition: thermal_spheric_particle.h:236
double mGenerationHeatFlux
Definition: thermal_spheric_particle.h:226
double mPrescribedHeatFluxVolume
Definition: thermal_spheric_particle.h:235
NumericalIntegrationMethod * mpNumericalIntegrationMethod
Definition: thermal_spheric_particle.h:210
RealContactModel * mpRealContactModel
Definition: thermal_spheric_particle.h:208
unsigned int mNumberOfContactParticleNeighbor
Definition: thermal_spheric_particle.h:272
double mContactRadiusAdjusted
Definition: thermal_spheric_particle.h:258
Node NodeType
Definition: thermal_spheric_particle.h:40
Properties PropertiesType
Definition: thermal_spheric_particle.h:44
std::size_t IndexType
Definition: thermal_spheric_particle.h:42
double mGenerationHeatFlux_damp_wall
Definition: thermal_spheric_particle.h:228
double mNeighborSeparation
Definition: thermal_spheric_particle.h:257
unsigned int mNumStepsEval
Definition: thermal_spheric_particle.h:214
double mGenerationHeatFlux_slid_particle
Definition: thermal_spheric_particle.h:229
bool mNeighborInContact
Definition: thermal_spheric_particle.h:253
bool mStoreContactParam
Definition: thermal_spheric_particle.h:220
double mTotalHeatFlux
Definition: thermal_spheric_particle.h:237
std::vector< std::vector< std::vector< double > > > mHeatMapGenerationRollingPW
Definition: thermal_spheric_particle.h:250
double mNeighborSeparationAdjusted
Definition: thermal_spheric_particle.h:260
double mGenerationHeatFlux_roll_particle
Definition: thermal_spheric_particle.h:231
double mRealYoungRatio
Definition: thermal_spheric_particle.h:254
double mNeighborDistanceAdjusted
Definition: thermal_spheric_particle.h:259
double mConvectionHeatFlux
Definition: thermal_spheric_particle.h:233
std::vector< std::vector< std::vector< double > > > mHeatMapGenerationDampingPW
Definition: thermal_spheric_particle.h:246
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: thermal_spheric_particle.h:288
DEMWall * mNeighbor_w
Definition: thermal_spheric_particle.h:269
double mContactRadius
Definition: thermal_spheric_particle.h:255
bool mHasFixedTemperature
Definition: thermal_spheric_particle.h:218
double mConductionIndirectHeatFlux
Definition: thermal_spheric_particle.h:224
bool mIsTimeToSolve
Definition: thermal_spheric_particle.h:216
ThermalSphericParticle * mNeighbor_p
Definition: thermal_spheric_particle.h:268
double mGenerationHeatFlux_roll_wall
Definition: thermal_spheric_particle.h:232
double mRadiationHeatFlux
Definition: thermal_spheric_particle.h:225
double mEnvironmentTempAux
Definition: thermal_spheric_particle.h:265
double mPreviousViscodampingEnergy
Definition: thermal_spheric_particle.h:240
bool mHasVariableRadius
Definition: thermal_spheric_particle.h:219
std::map< int, double > mNeighborVoronoiRadius
Definition: thermal_spheric_particle.h:278
std::map< SphericParticle *, ContactParams > mContactParamsParticle
Definition: thermal_spheric_particle.h:273
int mNeighborType
Definition: thermal_spheric_particle.h:270
double mEnvironmentTemperature
Definition: thermal_spheric_particle.h:264
HeatExchangeMechanism * mpConvectionModel
Definition: thermal_spheric_particle.h:205
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: thermal_spheric_particle.h:289
unsigned int mNeighborIndex
Definition: thermal_spheric_particle.h:271
HeatExchangeMechanism * mpDirectConductionModel
Definition: thermal_spheric_particle.h:203
unsigned int mRadiativeNeighbors
Definition: thermal_spheric_particle.h:263
std::vector< std::vector< std::vector< double > > > mHeatMapGenerationRollingPP
Definition: thermal_spheric_particle.h:249
Geometry< Node > GeometryType
Definition: thermal_spheric_particle.h:43
unsigned int mDimension
Definition: thermal_spheric_particle.h:213
ThermalDEMIntegrationScheme * mpThermalIntegrationScheme
Definition: thermal_spheric_particle.h:209
double mGenerationHeatFlux_damp_particle
Definition: thermal_spheric_particle.h:227
double mNeighborDistance
Definition: thermal_spheric_particle.h:256
HeatExchangeMechanism * mpIndirectConductionModel
Definition: thermal_spheric_particle.h:204
GlobalPointersVector< Element >::iterator ParticleWeakIteratorType
Definition: thermal_spheric_particle.h:38
HeatExchangeMechanism * mpRadiationModel
Definition: thermal_spheric_particle.h:206
virtual std::string Info() const override
Turn back information as a string.
Definition: thermal_spheric_particle.h:281
std::vector< std::vector< std::vector< double > > > mHeatMapGenerationDampingPP
Definition: thermal_spheric_particle.h:245
std::map< DEMWall *, ContactParams > mContactParamsWall
Definition: thermal_spheric_particle.h:274
std::vector< std::vector< std::vector< double > > > mHeatMapGenerationSlidingPP
Definition: thermal_spheric_particle.h:247
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: thermal_spheric_particle.h:41
std::vector< std::vector< std::vector< double > > > mHeatMapGenerationSlidingPW
Definition: thermal_spheric_particle.h:248
double mPreviousRollResistEnergy
Definition: thermal_spheric_particle.h:242
double mPrescribedHeatFluxSurface
Definition: thermal_spheric_particle.h:234
double mPreviousTemperature
Definition: thermal_spheric_particle.h:215
bool mHasMotion
Definition: thermal_spheric_particle.h:217
GlobalPointersVector< Element > ParticleWeakVectorType
Definition: thermal_spheric_particle.h:36
unsigned int mDelaunayPointListIndex
Definition: thermal_spheric_particle.h:277
double mConductionDirectHeatFlux
Definition: thermal_spheric_particle.h:223
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
dt
Definition: DEM_benchmarks.py:173
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
double GetDensity(const Properties &rProps, const IndexType Index)
Definition: shell_utilities.cpp:223
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
float temperature
Definition: face_heat.py:58
model
Definition: fluid_chimera_analysis.py:37
float radius
Definition: mesh_to_mdpa_converter.py:18
def load(f)
Definition: ode_solve.py:307
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
Definition: thermal_spheric_particle.h:53
double impact_time
Definition: thermal_spheric_particle.h:55
int updated_step
Definition: thermal_spheric_particle.h:54
std::vector< double > impact_velocity
Definition: thermal_spheric_particle.h:59
double viscodamping_energy
Definition: thermal_spheric_particle.h:56
double rollresist_energy
Definition: thermal_spheric_particle.h:58
double frictional_energy
Definition: thermal_spheric_particle.h:57