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.
spheric_particle.h
Go to the documentation of this file.
1 //
2 // Author: Miquel Santasusana msantasusana@cimne.upc.edu
3 //
4 
5 #if !defined(KRATOS_SPHERIC_PARTICLE_H_INCLUDED)
6 #define KRATOS_SPHERIC_PARTICLE_H_INCLUDED
7 
8 // System includes
9 #include <string>
10 #include <iostream>
11 
12 // Project includes
13 #include "includes/define.h"
14 #include "discrete_element.h"
15 #include "custom_utilities/AuxiliaryFunctions.h"
23 #include "includes/kratos_flags.h"
24 
25 namespace Kratos
26 {
27 
28 class DEMWall;
29 
30 class KRATOS_API(DEM_APPLICATION) SphericParticle : public DiscreteElement
31 {
32 
33 public:
34 
37 
40 
47 SphericParticle( IndexType NewId, GeometryType::Pointer pGeometry );
48 SphericParticle( IndexType NewId, NodesArrayType const& ThisNodes);
49 SphericParticle( IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties );
50 
51 Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override;
52 
54 virtual ~SphericParticle();
55 
57 
59 {
60 public:
61  ParticleDataBuffer(SphericParticle* p_this_particle): mpThisParticle(p_this_particle)
62  {}
63 
64  virtual ~ParticleDataBuffer(){}
65 
66 virtual bool SetNextNeighbourOrExit(int& i)
67 {
68  if (i < int(mpThisParticle->mNeighbourElements.size())){
69  SetCurrentNeighbour(mpThisParticle->mNeighbourElements[i]);
70  mpOtherParticleNode = &(mpOtherParticle->GetGeometry()[0]);
71  return true;
72  }
73 
74  else { // other_neighbour is nullified upon exiting loop
75  mpOtherParticle = NULL;
76  mpOtherParticleNode = NULL;
77  return false;
78  }
79 }
80 
82 {
83  mpOtherParticle = p_neighbour;
84 }
85 
86 void SetBoundingBox(const bool periodicity, const array_1d<double, 3> domain_min, const array_1d<double, 3> domain_max)
87 {
88  mDomainIsPeriodic = periodicity;
89  mDomainMin = domain_min;
90  mDomainMax = domain_max;
91 }
92 
95 double mDistance;
96 double mRadiusSum;
97 double mDt;
98 double mOtherRadius;
99 double mIndentation;
100 double mMyCoors[3];
101 double mOtherCoors[3];
102 double mLocalRelVel[3];
110 double mLocalCoordSystem[3][3];
111 double mOldLocalCoordSystem[3][3];
112 
113 std::vector<DEMWall*> mNeighbourRigidFaces; // why repeated? it is in the sphere as well!
114 
115 };
116 
117 typedef std::unique_ptr<ParticleDataBuffer> BufferPointerType;
118 
119 virtual std::unique_ptr<ParticleDataBuffer> CreateParticleDataBuffer(SphericParticle* p_this_particle)
120 {
121  return std::unique_ptr<ParticleDataBuffer>(new ParticleDataBuffer(p_this_particle));
122 }
123 
124 void TransformNeighbourCoorsToClosestInPeriodicDomain(ParticleDataBuffer & data_buffer);
125 void TransformNeighbourCoorsToClosestInPeriodicDomain(ParticleDataBuffer & data_buffer,
126  const array_1d<double, 3>& coors,
127  array_1d<double, 3>& neighbour_coors);
128 void TransformNeighbourCoorsToClosestInPeriodicDomain(const ProcessInfo& r_process_info,
129  const double coors[3],
130  double neighbour_coors[3]);
131 
132 virtual bool CalculateRelativePositionsOrSkipContact(ParticleDataBuffer & data_buffer);
133 
134 void Initialize(const ProcessInfo& r_process_info) override;
135 virtual void MemberDeclarationFirstStep(const ProcessInfo& r_process_info);
136 using DiscreteElement::CalculateRightHandSide; //To avoid Clang Warning. We tell the compiler that we are aware of the existence of this function, but we overload it still.
137 virtual void CalculateRightHandSide(const ProcessInfo& r_process_info, double dt, const array_1d<double,3>& gravity);
138 virtual void FirstCalculateRightHandSide(const ProcessInfo& r_process_info, double dt);
139 virtual void CollectCalculateRightHandSide(const ProcessInfo& r_process_info);
140 virtual void FinalCalculateRightHandSide(const ProcessInfo& r_process_info, double dt, const array_1d<double,3>& gravity);
141 virtual void InitializeForceComputation(const ProcessInfo& r_process_info);
142 virtual void FinalizeForceComputation(ParticleDataBuffer & data_buffer){}
143 virtual void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& r_process_info) const override;
144 virtual void CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& r_process_info) override;
145 virtual void CalculateDampingMatrix(MatrixType& rDampingMatrix, const ProcessInfo& r_process_info) override;
146 virtual void GetDofList( DofsVectorType& ElementalDofList, const ProcessInfo& r_process_info ) const override;
147 virtual void ComputeNewNeighboursHistoricalData(DenseVector<int>& temp_neighbours_ids, std::vector<array_1d<double, 3> >& temp_neighbour_elastic_contact_forces);
148 virtual void ComputeNewRigidFaceNeighboursHistoricalData();
149 virtual void FinalizeSolutionStep(const ProcessInfo& r_process_info) override;
150 virtual void InitializeSolutionStep(const ProcessInfo& r_process_info) override;
151 virtual void FinalizeStressTensor(const ProcessInfo& r_process_info, double& rRepresentative_Volume){};
152 virtual void SymmetrizeStressTensor();
153 virtual void ComputeStrainTensor(const ProcessInfo& r_process_info);
154 virtual void ComputeDifferentialStrainTensor(const ProcessInfo& r_process_info);
155 virtual void SymmetrizeDifferentialStrainTensor();
156 virtual void CorrectRepresentativeVolume(double& rRepresentative_Volume/*, bool& is_smaller_than_sphere*/);
157 virtual void ComputeReactions();
158 virtual void PrepareForPrinting(const ProcessInfo& r_process_info);
159 virtual void Calculate(const Variable<double>& rVariable, double& Output, const ProcessInfo& r_process_info) override;
160 virtual void Calculate(const Variable<array_1d<double, 3 > >& rVariable, array_1d<double, 3 > & Output, const ProcessInfo& r_process_info) override;
161 virtual void Calculate(const Variable<Vector >& rVariable, Vector& Output, const ProcessInfo& r_process_info) override;
162 virtual void Calculate(const Variable<Matrix >& rVariable, Matrix& Output, const ProcessInfo& r_process_info) override;
163 virtual void CalculateMaxBallToBallIndentation(double& rCurrentMaxIndentation, const ProcessInfo& r_process_info);
164 virtual void CalculateMaxBallToFaceIndentation(double& rCurrentMaxIndentation);
165 
166 virtual void Move(const double delta_t, const bool rotation_option, const double force_reduction_factor, const int StepFlag);
167 virtual void SetIntegrationScheme(DEMIntegrationScheme::Pointer& translational_integration_scheme, DEMIntegrationScheme::Pointer& rotational_integration_scheme);
168 virtual bool SwapIntegrationSchemeToGluedToWall(Condition* p_wall);
169 virtual DEMIntegrationScheme& GetTranslationalIntegrationScheme() { return *mpTranslationalIntegrationScheme; }
170 virtual DEMIntegrationScheme& GetRotationalIntegrationScheme() { return *mpRotationalIntegrationScheme; }
171 
172 virtual void ComputeConditionRelativeData(int rigid_neighbour_index,
173  DEMWall* const wall,
174  double LocalCoordSystem[3][3],
175  double& DistPToB,
176  array_1d<double, 4>& Weight,
177  array_1d<double, 3>& wall_delta_disp_at_contact_point,
178  array_1d<double, 3>& wall_velocity_at_contact_point,
179  int& ContactType
180  );
181 
182 virtual void RenewData();
183 virtual void SendForcesToFEM();
184 int GetClusterId();
185 void SetClusterId(const int Id);
186 double GetInitializationTime() const;
187 double GetProgrammedDestructionTime() const;
188 void SetProgrammedDestructionTime(const double time);
189 virtual double GetRadius();
190 virtual void SetRadius(double radius);
191 virtual void SetRadius();
192 virtual double CalculateVolume();
193 virtual double GetInteractionRadius(const int radius_index = 0);
194 virtual void SetInteractionRadius(const double radius, const int radius_index = 0);
195 virtual double GetSearchRadius();
196 virtual void SetDefaultRadiiHierarchy(const double radius);
197 virtual void SetSearchRadius(const double radius);
198 virtual double GetMass();
199 virtual void SetMass(double real_mass);
200 virtual double CalculateMomentOfInertia();
201 virtual double GetYoung();
202 void SetYoungFromProperties(double* young);
203 virtual double GetPoisson();
204 void SetPoissonFromProperties(double* poisson);
205 virtual double GetDensity();
206 void SetDensityFromProperties(double* density);
207 virtual int GetParticleMaterial();
208 void SetParticleMaterialFromProperties(int* particle_material);
209 
210 
211 array_1d<double, 3>& GetForce();
212 
213 virtual double& GetElasticEnergy();
214 virtual double& GetInelasticFrictionalEnergy();
215 virtual double& GetInelasticViscodampingEnergy();
216 virtual double& GetInelasticRollingResistanceEnergy();
217 
218 PropertiesProxy* GetFastProperties();
219 void SetFastProperties(PropertiesProxy* pProps);
220 void SetFastProperties(std::vector<PropertiesProxy>& list_of_proxies);
221 
222 double SlowGetYoung() const;
223 double SlowGetPoisson() const;
224 double SlowGetDensity() const;
225 int SlowGetParticleMaterial() const;
226 
228 virtual std::string Info() const override
229 {
230 std::stringstream buffer;
231 buffer << "SphericParticle" ;
232 return buffer.str();
233 }
234 
236 virtual void PrintInfo(std::ostream& rOStream) const override {rOStream << "SphericParticle";}
237 
239 //virtual void PrintData(std::ostream& rOStream) const override {}
240 
246 
247 std::vector<ParticleContactElement*> mBondElements;
248 std::vector<SphericParticle*> mNeighbourElements;
249 std::vector<int> mContactingNeighbourIds;
251 std::vector<DEMWall*> mNeighbourRigidFaces;
252 std::vector<DEMWall*> mNeighbourNonContactRigidFaces;
253 std::vector<DEMWall*> mNeighbourPotentialRigidFaces;
254 
255 std::vector<array_1d<double, 4> > mContactConditionWeights;
257 std::vector< array_1d<double,3> > mConditionContactPoints;
258 
259 std::vector<array_1d<double, 3> > mNeighbourRigidFacesTotalContactForce;
260 std::vector<array_1d<double, 3> > mNeighbourRigidFacesElasticContactForce;
261 std::vector<array_1d<double, 3> > mNeighbourElasticContactForces;
262 std::vector<array_1d<double, 3> > mNeighbourElasticExtraContactForces;
263 std::vector<int> mFemOldNeighbourIds;
265 
270 
271 virtual void ComputeAdditionalForces(array_1d<double, 3>& externally_applied_force, array_1d<double, 3>& externally_applied_moment, const ProcessInfo& r_process_info, const array_1d<double,3>& gravity);
272 virtual array_1d<double,3> ComputeWeight(const array_1d<double,3>& gravity, const ProcessInfo& r_process_info);
273 virtual void CalculateOnContactElements(size_t i_neighbour_count, double LocalContactForce[3]);
274 
275 std::unique_ptr<DEMDiscontinuumConstitutiveLaw> pCloneDiscontinuumConstitutiveLawWithNeighbour(SphericParticle* neighbour);
276 
277 std::unique_ptr<DEMDiscontinuumConstitutiveLaw> pCloneDiscontinuumConstitutiveLawWithFEMNeighbour(Condition* neighbour);
278 
279 std::unique_ptr<DEMRollingFrictionModel> pCloneRollingFrictionModel(SphericParticle* element);
280 
281 std::unique_ptr<DEMRollingFrictionModel> pCloneRollingFrictionModelWithNeighbour(SphericParticle* neighbour);
282 
283 std::unique_ptr<DEMRollingFrictionModel> pCloneRollingFrictionModelWithFEMNeighbour(Condition* neighbour);
284 
285 protected:
286 
287 virtual void ComputeBallToRigidFaceContactForceAndMoment(ParticleDataBuffer & data_buffer,
288  array_1d<double, 3>& rElasticForce,
289  array_1d<double, 3>& rContactForce,
290  array_1d<double, 3>& rigid_element_force,
291  const ProcessInfo& r_process_info) ;
292 
293 virtual void CalculateMomentum(array_1d<double, 3>& rMomentum);
294 
295 virtual void CalculateLocalAngularMomentum(array_1d<double, 3>& rAngularMomentum);
296 
297 virtual void ComputeBallToBallContactForceAndMoment(ParticleDataBuffer & data_buffer,
298  const ProcessInfo& r_process_info,
299  array_1d<double, 3>& rElasticForce,
300  array_1d<double, 3>& rContactForce);
301 
302 virtual void EvaluateDeltaDisplacement(ParticleDataBuffer & data_buffer,
303  double DeltDisp[3],
304  double RelVel[3],
305  double LocalCoordSystem[3][3],
306  double OldLocalCoordSystem[3][3],
307  const array_1d<double, 3> &vel,
308  const array_1d<double, 3> &delta_displ);
309 
310 virtual void RelativeDisplacementAndVelocityOfContactPointDueToRotation(const double indentation,
311  double DeltDesp[3],
312  double RelVel[3],
313  const double OldLocalCoordSystem[3][3],
314  const double &other_radius,
315  const double &dt,
316  const array_1d<double, 3> &angl_vel,
317  SphericParticle* neighbour_iterator);
318 
319 virtual void RelativeDisplacementAndVelocityOfContactPointDueToOtherReasons(const ProcessInfo& r_process_info,
320  double DeltDisp[3], //IN GLOBAL AXES
321  double RelVel[3], //IN GLOBAL AXES
322  double OldLocalCoordSystem[3][3],
323  double LocalCoordSystem[3][3],
324  SphericParticle* neighbour_iterator);
325 
326 virtual void RelativeDisplacementAndVelocityOfContactPointDueToRotationMatrix(double DeltDisp[3],
327  double RelVel[3],
328  const double OldLocalCoordSystem[3][3],
329  const double& other_radius,
330  const double& dt,
331  const array_1d<double, 3>& ang_vel,
332  SphericParticle* p_neighbour);
333 
334 virtual void RelativeDisplacementAndVelocityOfContactPointDueToRotationQuaternion(double DeltDesp[3],
335  double RelVel[3],
336  const double OldLocalCoordSystem[3][3],
337  const double &other_radius,
338  const double &dt,
339  const array_1d<double, 3> &angl_vel,
340  SphericParticle* neighbour_iterator);
341 
342 virtual void ComputeMoments(double normalLocalContactForce,
343  double GlobalElasticContactForces[3],
344  double LocalCoordSystem_2[3],
345  SphericParticle* neighbour_iterator,
346  double indentation,
347  unsigned int i);
348 
349 virtual void ComputeMomentsWithWalls(double normalLocalContactForce,
350  double GlobalElasticContactForces[3],
351  double LocalCoordSystem_2[3],
352  Condition* wall,
353  double indentation,
354  unsigned int i);
355 
356 virtual double GetInitialDeltaWithFEM(int index);
357 
358 virtual void ComputeOtherBallToBallForces(array_1d<double, 3>& other_ball_to_ball_forces);
359 
360 virtual void StoreBallToBallContactInfo(const ProcessInfo& r_process_info, SphericParticle::ParticleDataBuffer& data_buffer, double GlobalContactForceTotal[3], double LocalContactForceTotal[3], double LocalContactForceDamping[3], bool sliding);
361 
362 virtual void StoreBallToRigidFaceContactInfo(const ProcessInfo& r_process_info, SphericParticle::ParticleDataBuffer& data_buffer, double GlobalContactForceTotal[3], double LocalContactForceTotal[3], double LocalContactForceDamping[3], bool sliding);
363 
364 virtual void EvaluateBallToBallForcesForPositiveIndentiations(SphericParticle::ParticleDataBuffer & data_buffer,
365  const ProcessInfo& r_process_info,
366  double LocalElasticContactForce[3],
367  double DeltDisp[3],
368  double LocalDeltDisp[3],
369  double RelVel[3],
370  double indentation,
371  double ViscoDampingLocalContactForce[3],
372  double& cohesive_force,
373  SphericParticle* element2,
374  bool& sliding,
375  double LocalCoordSystem[3][3],
376  double OldLocalCoordSystem[3][3],
377  array_1d<double, 3>& neighbour_elastic_contact_force);
378 
379 
380 virtual void AddUpForcesAndProject(double OldCoordSystem[3][3],
381  double LocalCoordSystem[3][3],
382  double LocalContactForce[3],
383  double LocalElasticContactForce[3],
384  double LocalElasticExtraContactForce[3],
385  double GlobalContactForce[3],
386  double GlobalElasticContactForce[3],
387  double GlobalElasticExtraContactForce[3],
388  double TotalGlobalElasticContactForce[3],
389  double ViscoDampingLocalContactForce[3],
390  const double cohesive_force,
391  array_1d<double, 3>& other_ball_to_ball_forces,
392  array_1d<double, 3>& rElasticForce,
393  array_1d<double, 3>& rContactForce,
394  const unsigned int i_neighbour_count,
395  const ProcessInfo& r_process_info) final;
396 
397 virtual void AddUpFEMForcesAndProject(double LocalCoordSystem[3][3],
398  double LocalContactForce[3],
399  double LocalElasticContactForce[3],
400  double GlobalContactForce[3],
401  double GlobalElasticContactForce[3],
402  double ViscoDampingLocalContactForce[3],
403  const double cohesive_force,
404  array_1d<double, 3>& rElasticForce,
405  array_1d<double, 3>& rContactForce,
406  array_1d<double, 3>& elastic_force_backup,
407  array_1d<double, 3>& total_force_backup) final;
408 
409 virtual void AddUpMomentsAndProject(double LocalCoordSystem[3][3],
410  double ElasticLocalRotationalMoment[3],
411  double ViscoLocalRotationalMoment[3]) final;
412 
413 virtual void ComputeWear(double LocalRelVel[3],
414  double mTimeStep,
415  bool sliding,
416  double inverse_of_volume,
417  double LocalElasticContactForce,
418  DEMWall* cast_neighbour);
419 
420 virtual void AdditionalCalculate(const Variable<double>& rVariable, double& Output, const ProcessInfo& r_process_info);
421 
422 virtual void AddNeighbourContributionToStressTensor(const ProcessInfo& r_process_info,
423  const double GlobalElasticContactForce[3],
424  const double other_to_me_vect[3],
425  const double distance,
426  const double radius_sum,
428 
429 virtual void AddWallContributionToStressTensor(const double GlobalElasticContactForce[3],
430  const double other_to_me_vect[3],
431  const double distance,
432  const double contact_area);
433 
434 virtual void RotateOldContactForces(const double LocalCoordSystem[3][3], const double OldLocalCoordSystem[3][3], array_1d<double, 3>& mNeighbourElasticContactForces) final;
435 virtual void ApplyGlobalDampingToContactForcesAndMoments(array_1d<double,3>& total_forces, array_1d<double,3>& total_moment);
436 
437 std::unique_ptr<DEMDiscontinuumConstitutiveLaw> mDiscontinuumConstitutiveLaw;
438 std::unique_ptr<DEMRollingFrictionModel> mRollingFrictionModel;
439 
441 double mProgrammedDestructionTime=-1.0; // set to a negative value, so that when marked TO_ERASE, elimination is by default.
442 double mRadius;
444 double mRealMass;
451 double mBondedScalingFactor[3] = {0.0};
452 
453 private:
454 
455 friend class Serializer;
456 
457 virtual void save(Serializer& rSerializer) const override
458 {
460 
461  // public members
462  rSerializer.save("mpInlet", mpInlet);
463  rSerializer.save("mElasticEnergy", mElasticEnergy);
464  rSerializer.save("mInelasticFrictionalEnergy", mInelasticFrictionalEnergy);
465  rSerializer.save("mInelasticViscodampingEnergy", mInelasticViscodampingEnergy);
466  rSerializer.save("mInelasticRollingResistanceEnergy", mInelasticRollingResistanceEnergy);
467  rSerializer.save("mPartialRepresentativeVolume", mPartialRepresentativeVolume);
468  rSerializer.save("mBondElements", mBondElements);
469  rSerializer.save("mNeighbourElements", mNeighbourElements);
470  rSerializer.save("mContactingNeighbourIds", mContactingNeighbourIds);
471  rSerializer.save("mContactingFaceNeighbourIds", mContactingFaceNeighbourIds);
472  rSerializer.save("mNeighbourRigidFaces", mNeighbourRigidFaces);
473  rSerializer.save("mNeighbourNonContactRigidFaces", mNeighbourNonContactRigidFaces);
474  rSerializer.save("mNeighbourPotentialRigidFaces", mNeighbourPotentialRigidFaces);
475  rSerializer.save("mContactConditionWeights", mContactConditionWeights);
476  rSerializer.save("mContactConditionContactTypes", mContactConditionContactTypes);
477  rSerializer.save("mConditionContactPoints", mConditionContactPoints);
478  rSerializer.save("mNeighbourRigidFacesTotalContactForce", mNeighbourRigidFacesTotalContactForce);
479  rSerializer.save("mNeighbourRigidFacesElasticContactForce", mNeighbourRigidFacesElasticContactForce);
480  rSerializer.save("mNeighbourElasticContactForces", mNeighbourElasticContactForces);
481  rSerializer.save("mNeighbourElasticExtraContactForces", mNeighbourElasticExtraContactForces);
482  rSerializer.save("mFemOldNeighbourIds", mFemOldNeighbourIds);
483  rSerializer.save("mContactMoment", mContactMoment);
484 
485  rSerializer.save("HasStressTensor", (int)this->Is(DEMFlags::HAS_STRESS_TENSOR));
486  if (this->Is(DEMFlags::HAS_STRESS_TENSOR)){
487  rSerializer.save("mStressTensor", mStressTensor);
488  rSerializer.save("mSymmStressTensor", mSymmStressTensor);
489  rSerializer.save("mStrainTensor", mStrainTensor);
490  rSerializer.save("mDifferentialStrainTensor", mDifferentialStrainTensor);
491  }
492 
493  // protected members
494  rSerializer.save("mRadius", mRadius);
495  rSerializer.save("mSearchRadius", mSearchRadius);
496  rSerializer.save("mRealMass", mRealMass);
497  rSerializer.save("mClusterId", mClusterId);
498  rSerializer.save("mGlobalDamping",mGlobalDamping);
499  rSerializer.save("mGlobalViscousDamping",mGlobalViscousDamping);
500 }
501 
502 virtual void load(Serializer& rSerializer) override
503 {
504  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, DiscreteElement );
505  // public members
506  rSerializer.load("mpInlet", mpInlet);
507  rSerializer.load("mElasticEnergy", mElasticEnergy);
508  rSerializer.load("mInelasticFrictionalEnergy", mInelasticFrictionalEnergy);
509  rSerializer.load("mInelasticViscodampingEnergy", mInelasticViscodampingEnergy);
510  rSerializer.load("mInelasticRollingResistanceEnergy", mInelasticRollingResistanceEnergy);
511  rSerializer.load("mPartialRepresentativeVolume", mPartialRepresentativeVolume);
512  rSerializer.load("mBondElements", mBondElements);
513  rSerializer.load("mNeighbourElements", mNeighbourElements);
514  rSerializer.load("mContactingNeighbourIds", mContactingNeighbourIds);
515  rSerializer.load("mContactingFaceNeighbourIds", mContactingFaceNeighbourIds);
516  rSerializer.load("mNeighbourRigidFaces", mNeighbourRigidFaces);
517  rSerializer.load("mNeighbourNonContactRigidFaces", mNeighbourNonContactRigidFaces);
518  rSerializer.load("mNeighbourPotentialRigidFaces", mNeighbourPotentialRigidFaces);
519  rSerializer.load("mContactConditionWeights", mContactConditionWeights);
520  rSerializer.load("mContactConditionContactTypes", mContactConditionContactTypes);
521  rSerializer.load("mConditionContactPoints", mConditionContactPoints);
522  rSerializer.load("mNeighbourRigidFacesTotalContactForce", mNeighbourRigidFacesTotalContactForce);
523  rSerializer.load("mNeighbourRigidFacesElasticContactForce", mNeighbourRigidFacesElasticContactForce);
524  rSerializer.load("mNeighbourElasticContactForces", mNeighbourElasticContactForces);
525  rSerializer.load("mNeighbourElasticExtraContactForces", mNeighbourElasticExtraContactForces);
526  rSerializer.load("mFemOldNeighbourIds", mFemOldNeighbourIds);
527  rSerializer.load("mContactMoment", mContactMoment);
528 
529  int aux_int=0;
530  rSerializer.load("HasStressTensor", aux_int);
531  if(aux_int) this->Set(DEMFlags::HAS_STRESS_TENSOR, true);
532  if (this->Is(DEMFlags::HAS_STRESS_TENSOR)){
533  mStressTensor = new BoundedMatrix<double, 3, 3>(3,3);
534  *mStressTensor = ZeroMatrix(3,3);
535  mSymmStressTensor = new BoundedMatrix<double, 3, 3>(3,3);
536  *mSymmStressTensor = ZeroMatrix(3,3);
537  rSerializer.load("mStressTensor", mStressTensor);
538  rSerializer.load("mSymmStressTensor", mSymmStressTensor);
539  mStrainTensor = new BoundedMatrix<double, 3, 3>(3,3);
540  *mStrainTensor = ZeroMatrix(3,3);
541  rSerializer.load("mStrainTensor", mStrainTensor);
542  mDifferentialStrainTensor = new BoundedMatrix<double, 3, 3>(3,3);
543  *mDifferentialStrainTensor = ZeroMatrix(3,3);
544  rSerializer.load("mDifferentialStrainTensor", mDifferentialStrainTensor);
545  }
546 
547  // protected members
548  rSerializer.load("mRadius", mRadius);
549  rSerializer.load("mSearchRadius", mSearchRadius);
550  rSerializer.load("mRealMass", mRealMass);
551  rSerializer.load("mClusterId", mClusterId);
552  rSerializer.load("mGlobalDamping",mGlobalDamping);
553  rSerializer.load("mGlobalViscousDamping",mGlobalViscousDamping);
554 }
555 
556 }; // Class SphericParticle
557 
559 inline std::istream& operator >> (std::istream& rIStream,
560  SphericParticle& rThis){ return rIStream;}
561 
563 inline std::ostream& operator << (std::ostream& rOStream,
564  const SphericParticle& rThis)
565 {
566 rThis.PrintInfo(rOStream);
567 rOStream << std::endl;
568 rThis.PrintData(rOStream);
569 
570 return rOStream;
571 }
572 
573 } // namespace Kratos.
574 
575 #endif // KRATOS_SPHERIC_PARTICLE_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Conditions.
Definition: condition.h:59
Definition: dem_integration_scheme.h:24
Definition: dem_wall.h:29
Definition: discrete_element.h:38
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:437
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: element.h:1135
std::size_t IndexType
Definition: flags.h:74
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
typename TContainerType::iterator ptr_iterator
Definition: global_pointers_vector.h:85
Definition: amatrix_interface.h:41
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
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
Definition: properties_proxies.h:18
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Definition: spheric_particle.h:59
virtual ~ParticleDataBuffer()
Definition: spheric_particle.h:64
void SetBoundingBox(const bool periodicity, const array_1d< double, 3 > domain_min, const array_1d< double, 3 > domain_max)
Definition: spheric_particle.h:86
virtual bool SetNextNeighbourOrExit(int &i)
Definition: spheric_particle.h:66
bool mDomainIsPeriodic
Definition: spheric_particle.h:94
SphericParticle * mpOtherParticle
Definition: spheric_particle.h:107
array_1d< double, 3 > mOtherToMeVector
Definition: spheric_particle.h:103
std::vector< DEMWall * > mNeighbourRigidFaces
Definition: spheric_particle.h:113
Node * mpOtherParticleNode
Definition: spheric_particle.h:108
array_1d< double, 3 > mDomainMin
Definition: spheric_particle.h:104
SphericParticle * mpThisParticle
Definition: spheric_particle.h:106
double mIndentation
Definition: spheric_particle.h:99
double mDistance
Definition: spheric_particle.h:95
double mOtherRadius
Definition: spheric_particle.h:98
double mRadiusSum
Definition: spheric_particle.h:96
double mDt
Definition: spheric_particle.h:97
ParticleDataBuffer(SphericParticle *p_this_particle)
Definition: spheric_particle.h:61
void SetCurrentNeighbour(SphericParticle *p_neighbour)
Definition: spheric_particle.h:81
bool mMultiStageRHS
Definition: spheric_particle.h:93
DEMWall * mpOtherRigidFace
Definition: spheric_particle.h:109
array_1d< double, 3 > mDomainMax
Definition: spheric_particle.h:105
Definition: spheric_particle.h:31
double mPartialRepresentativeVolume
Definition: spheric_particle.h:245
std::vector< array_1d< double, 3 > > mNeighbourElasticContactForces
Definition: spheric_particle.h:261
std::vector< int > mContactingFaceNeighbourIds
Definition: spheric_particle.h:250
double mRealMass
Definition: spheric_particle.h:444
virtual std::string Info() const override
Turn back information as a string.
Definition: spheric_particle.h:228
std::vector< array_1d< double, 3 > > mNeighbourRigidFacesElasticContactForce
Definition: spheric_particle.h:260
double mInelasticRollingResistanceEnergy
Definition: spheric_particle.h:244
std::vector< array_1d< double, 3 > > mNeighbourElasticExtraContactForces
Definition: spheric_particle.h:262
ModelPart * mpInlet
Default constructor.
Definition: spheric_particle.h:45
std::unique_ptr< DEMRollingFrictionModel > mRollingFrictionModel
Definition: spheric_particle.h:438
std::vector< ParticleContactElement * > mBondElements
Definition: spheric_particle.h:247
double mInelasticFrictionalEnergy
Definition: spheric_particle.h:242
virtual std::unique_ptr< ParticleDataBuffer > CreateParticleDataBuffer(SphericParticle *p_this_particle)
Definition: spheric_particle.h:119
std::vector< int > mContactingNeighbourIds
Definition: spheric_particle.h:249
std::vector< DEMWall * > mNeighbourNonContactRigidFaces
Definition: spheric_particle.h:252
virtual void FinalizeForceComputation(ParticleDataBuffer &data_buffer)
Definition: spheric_particle.h:142
double mGlobalDamping
Definition: spheric_particle.h:449
BoundedMatrix< double, 3, 3 > * mStrainTensor
Definition: spheric_particle.h:268
virtual void FinalizeStressTensor(const ProcessInfo &r_process_info, double &rRepresentative_Volume)
Definition: spheric_particle.h:151
double mGlobalViscousDamping
Definition: spheric_particle.h:450
GlobalPointersVector< Condition >::iterator ConditionWeakIteratorType
Definition: spheric_particle.h:39
std::unique_ptr< ParticleDataBuffer > BufferPointerType
Definition: spheric_particle.h:117
std::vector< array_1d< double, 4 > > mContactConditionWeights
Definition: spheric_particle.h:255
virtual DEMIntegrationScheme & GetTranslationalIntegrationScheme()
Definition: spheric_particle.h:169
ParticleWeakVectorType::ptr_iterator ParticleWeakIteratorType_ptr
Definition: spheric_particle.h:42
DEMIntegrationScheme * mpTranslationalIntegrationScheme
Definition: spheric_particle.h:447
std::vector< DEMWall * > mNeighbourPotentialRigidFaces
Definition: spheric_particle.h:253
std::vector< int > mFemOldNeighbourIds
Definition: spheric_particle.h:263
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: spheric_particle.h:236
GlobalPointersVector< Element >::iterator ParticleWeakIteratorType
Definition: spheric_particle.h:43
array_1d< double, 3 > mContactMoment
Definition: spheric_particle.h:264
double mSearchRadius
Definition: spheric_particle.h:443
double mElasticEnergy
Print object's data.
Definition: spheric_particle.h:241
std::vector< int > mContactConditionContactTypes
Definition: spheric_particle.h:256
BoundedMatrix< double, 3, 3 > * mStressTensor
Definition: spheric_particle.h:266
BoundedMatrix< double, 3, 3 > * mDifferentialStrainTensor
Definition: spheric_particle.h:269
std::vector< array_1d< double, 3 > > mNeighbourRigidFacesTotalContactForce
Definition: spheric_particle.h:259
double mRadius
Definition: spheric_particle.h:442
DEMIntegrationScheme * mpRotationalIntegrationScheme
Definition: spheric_particle.h:448
double mInelasticViscodampingEnergy
Definition: spheric_particle.h:243
int mClusterId
Definition: spheric_particle.h:446
std::vector< array_1d< double, 3 > > mConditionContactPoints
Definition: spheric_particle.h:257
GlobalPointersVector< Element > ParticleWeakVectorType
Definition: spheric_particle.h:41
std::unique_ptr< DEMDiscontinuumConstitutiveLaw > mDiscontinuumConstitutiveLaw
Definition: spheric_particle.h:437
BoundedMatrix< double, 3, 3 > * mSymmStressTensor
Definition: spheric_particle.h:267
PropertiesProxy * mFastProperties
Definition: spheric_particle.h:445
std::vector< SphericParticle * > mNeighbourElements
Definition: spheric_particle.h:248
std::vector< DEMWall * > mNeighbourRigidFaces
Definition: spheric_particle.h:251
GlobalPointersVector< Condition > ConditionWeakVectorType
Definition: spheric_particle.h:38
double mInitializationTime
Definition: spheric_particle.h:440
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(SphericParticle)
Pointer definition of SphericParticle.
virtual DEMIntegrationScheme & GetRotationalIntegrationScheme()
Definition: spheric_particle.h:170
#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
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
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
TDataType Calculate(GeometryType &dummy, const Variable< TDataType > &rVariable)
Definition: add_geometries_to_python.cpp:103
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
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
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
time
Definition: face_heat.py:85
float density
Definition: face_heat.py:56
float radius
Definition: mesh_to_mdpa_converter.py:18
def load(f)
Definition: ode_solve.py:307
vel
Definition: pure_conduction.py:76
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
integer i
Definition: TensorModule.f:17
Definition: mesh_converter.cpp:33