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.
cluster3D.h
Go to the documentation of this file.
1 // Last Modified by: Salva, latorre@cimne.upc.edu
2 
3 #if !defined KRATOS_CLUSTER3D_H_INCLUDED
4 #define KRATOS_CLUSTER3D_H_INCLUDED
5 
6 // System includes
7 #include <string>
8 #include <iostream>
9 
10 // Project includes
11 #include "includes/define.h"
12 #include "includes/node.h"
13 #include "includes/element.h"
14 #include "geometries/geometry.h"
15 #include "includes/properties.h"
16 #include "includes/process_info.h"
20 #include "includes/condition.h"
23 #include "utilities/quaternion.h"
25 
26 namespace Kratos
27 {
28  class Element;
29  class KRATOS_API(DEM_APPLICATION) Cluster3D : public RigidBodyElement3D {
30 
31  public:
34 
35  Cluster3D();
36  Cluster3D(IndexType NewId, GeometryType::Pointer pGeometry);
37  Cluster3D(IndexType NewId, NodesArrayType const& ThisNodes);
38  Cluster3D(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
39  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override;
40 
42  virtual ~Cluster3D();
43 
44  using Element::Initialize;
45  void Initialize(const ProcessInfo& r_process_info) override;
46  virtual void CreateParticles(ParticleCreatorDestructor* p_creator_destructor, ModelPart& dem_model_part, PropertiesProxy* p_fast_properties, const bool continuum_strategy);
47  virtual void GetClustersForce(const array_1d<double,3>& gravity);
48  virtual void CollectForcesAndTorquesFromSpheres();
49  unsigned int GetNumberOfSpheres() { return mListOfSphericParticles.size(); };
50  std::vector<SphericParticle*> GetSpheres() { return mListOfSphericParticles; };
51  virtual void SetContinuumGroupToBreakableClusterSpheres(const int Id);
52  virtual void SetInitialConditionsToSpheres(const array_1d<double,3>& velocity);
53  virtual void SetInitialNeighbours(const double search_increment);
54  virtual void CreateContinuumConstitutiveLaws();
55  virtual void Calculate(const Variable<double>& rVariable, double& Output, const ProcessInfo& r_process_info) override;
56 
57  virtual double SlowGetDensity();
58  virtual int SlowGetParticleMaterial();
59 
60  double GetProgrammedDestructionTime() const {return mProgrammedDestructionTime;}
61  void SetProgrammedDestructionTime(const double destruction_time){mProgrammedDestructionTime = destruction_time;}
62 
63  virtual std::string Info() const override
64  {
65  std::stringstream buffer;
66  buffer << "Discrete Element #" << Id();
67  return buffer.str();
68  }
69 
71  virtual void PrintInfo(std::ostream& rOStream) const override
72  {
73  rOStream << "Discrete Element #" << Id();
74  }
75 
77  virtual void PrintData(std::ostream& rOStream) const override
78  {
79  //mpGeometry->PrintData(rOStream);
80  }
81 
82  protected:
83 
84  std::vector<double> mListOfRadii;
85  std::vector<SphericParticle*> mListOfSphericParticles;
86  double mProgrammedDestructionTime = -1.0; // set to a negative value, so that when marked TO_ERASE, elimination is by default.
87 
88  private:
89 
90  friend class Serializer;
91  virtual void save(Serializer& rSerializer) const override { KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, RigidBodyElement3D); }
92  virtual void load(Serializer& rSerializer) override { KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, RigidBodyElement3D); }
93 
94  }; // Class Cluster3D
95 
97  inline std::istream& operator >> (std::istream& rIStream, Cluster3D& rThis);
98 
100  inline std::ostream& operator << (std::ostream& rOStream, const Cluster3D& rThis)
101  {
102  rThis.PrintInfo(rOStream);
103  rOStream << std::endl;
104  rThis.PrintData(rOStream);
105  return rOStream;
106  }
107 
108 } // namespace Kratos
109 
110 #endif // KRATOS_CLUSTER3D_INCLUDED defined
Definition: cluster3D.h:29
double GetProgrammedDestructionTime() const
Definition: cluster3D.h:60
std::vector< double > mListOfRadii
Definition: cluster3D.h:84
void SetProgrammedDestructionTime(const double destruction_time)
Definition: cluster3D.h:61
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: cluster3D.h:77
std::vector< SphericParticle * > mListOfSphericParticles
Definition: cluster3D.h:85
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: cluster3D.h:71
std::vector< SphericParticle * > GetSpheres()
Definition: cluster3D.h:50
virtual std::string Info() const override
Turn back information as a string.
Definition: cluster3D.h:63
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(Cluster3D)
Pointer definition of Cluster3D.
unsigned int GetNumberOfSpheres()
Definition: cluster3D.h:49
virtual void Initialize(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:341
std::size_t IndexType
Definition: flags.h:74
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Definition: create_and_destroy.h:33
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
Definition: rigid_body_element.h:31
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
TDataType Calculate(GeometryType &dummy, const Variable< TDataType > &rVariable)
Definition: add_geometries_to_python.cpp:103
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 velocity
Definition: PecletTest.py:54
def load(f)
Definition: ode_solve.py:307