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.
analytic_spheric_particle.h
Go to the documentation of this file.
1 //
2 // Author: Guillermo Casas gcasas@cimne.upc.edu
3 //
4 
5 
6 #if !defined(KRATOS_ANALYTIC_SPHERIC_PARTICLE_H_INCLUDED)
7 #define KRATOS_ANALYTIC_SPHERIC_PARTICLE_H_INCLUDED
8 
9 // System includes
10 #include <string>
11 #include <iostream>
12 #include "spheric_particle.h"
13 
14 
15 namespace Kratos
16 {
17 
18 class KRATOS_API(DEM_APPLICATION) AnalyticSphericParticle : public SphericParticle
19 {
20 public:
21 
24 
27 
32 typedef BaseType::ParticleDataBuffer BaseBufferType;
33 typedef std::unique_ptr<BaseType::ParticleDataBuffer> BaseBufferPointerType;
34 
37 AnalyticSphericParticle( IndexType NewId, GeometryType::Pointer pGeometry);
38 AnalyticSphericParticle( IndexType NewId, NodesArrayType const& ThisNodes);
39 AnalyticSphericParticle( IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
40 AnalyticSphericParticle(Element::Pointer p_spheric_particle);
41 
42 Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override;
43 
46 
48 
50 std::string Info() const override
51 {
52 std::stringstream buffer;
53 buffer << "AnalyticSphericParticle" ;
54 return buffer.str();
55 }
56 
58 void PrintInfo(std::ostream& rOStream) const override {rOStream << "AnalyticSphericParticle";}
59 
61 void PrintData(std::ostream& rOStream) const override {}
62 
63 int GetNumberOfCollisions();
64 int GetNumberOfCollisionsWithFaces();
65 int GetNumberOfCollisionsWithEdges();
66 
67 static const unsigned int mMaxCollidingSpheres = 4;
68 static const unsigned int mMaxCollidingFaceSpheres = 4;
69 
70 array_1d<int, 4> &GetCollidingIds();
71 array_1d<double, 4> &GetCollidingNormalRelativeVelocity();
72 array_1d<double, 4> &GetCollidingTangentialRelativeVelocity();
73 array_1d<int, 4> &GetCollidingFaceIds();
74 array_1d<double, 4> &GetCollidingFaceNormalRelativeVelocity();
75 array_1d<double, 4> &GetCollidingFaceTangentialRelativeVelocity();
76 array_1d<double, 4> &GetCollidingLinearImpulse();
77 
78 /*
79 void GetCollidingNormalRelativeVelocity(array_1d<double, 4>& colliding_normal_vel);
80 void GetCollidingTangentialRelativeVelocity(array_1d<double, 4>& colliding_tangential_vel);
81 void GetCollidingFaceIds(array_1d<int, 4>& colliding_ids);
82 void GetCollidingFaceNormalRelativeVelocity(array_1d<double, 4>& colliding_normal_vel);
83 void GetCollidingFaceTangentialRelativeVelocity(array_1d<double, 4>& colliding_tangential_vel);
84 void GetCollidingLinearImpulse(array_1d<double, 4>& colliding_linear_impulse);
85 */
86 
87 protected:
88 
90 {
91 public:
92 
94 
96 
99 };
100 
101 std::unique_ptr<SphericParticle::ParticleDataBuffer> CreateParticleDataBuffer(SphericParticle* p_this_particle) override
102 {
103  ClearImpactMemberVariables();
104  return std::unique_ptr<SphericParticle::ParticleDataBuffer>(new ParticleDataBuffer(p_this_particle));
105 }
106 
107 void PushBackIdToContactingNeighbours(BaseBufferType &data_buffer, int id);
108 
109 void PushBackIdToContactingFaceNeighbours(BaseBufferType & data_buffer, int p_wall_id);
110 
111 
112 void ClearNeighbours(BaseBufferType & data_buffer);
113 
114 private:
115 
116 friend class Serializer;
117 std::vector<bool> NeighboursContactStatus;
118 unsigned int mNumberOfCollidingSpheres;
119 unsigned int mNumberOfCollidingSpheresWithFaces;
120 unsigned int mNumberOfCollidingSpheresWithEdges;
121 /*
122 4 is taken as the maximum number of particles simultaneously coming into contact
123 with this sphere. Whenever more than 4 particles happen to come into contact at
124 the same time step, which should be extremely rare in collisional regime, the extra
125 collisions will not be recorded in the present step, but will in forecomming steps
126 (with the corresponding slightly increased error in measurement) unless an
127 extraordinarily short contact time (of only 1 time step) takes place.
128 */
129 array_1d<int, 4> mCollidingIds;
130 array_1d<double, 4> mCollidingRadii;
131 array_1d<double, 4> mCollidingNormalVelocities;
132 array_1d<double, 4> mCollidingTangentialVelocities;
133 array_1d<double, 4> mCollidingLinearImpulse;
134 std::vector<int> mContactingNeighbourIds;
135 //std::unique_ptr<ParticleDataBuffer> mpDataBuffer;
136 
137 array_1d<int, 4> mCollidingFaceIds;
138 array_1d<double, 4> mCollidingFaceNormalVelocities;
139 array_1d<double, 4> mCollidingFaceTangentialVelocities;
140 array_1d<double, 4> mCollidingFaceSecondTangentialVelocities;
141 array_1d<char, 4> mCollidingFaceCollisionTypes;
142 std::vector<int> mContactingFaceNeighbourIds;
143 
144 
145 ParticleDataBuffer* GetPointerToDerivedDataBuffer(BaseBufferType& data_buffer)
146 {
147  BaseBufferType *p_raw_data_buffer = &data_buffer;
148  return static_cast<ParticleDataBuffer*>(p_raw_data_buffer);
149 }
150 
151 void ClearImpactMemberVariables();
152 
153 void FinalizeForceComputation(BaseBufferType & data_buffer) override;
154 
155 void EvaluateBallToBallForcesForPositiveIndentiations(SphericParticle::ParticleDataBuffer & data_buffer,
156  const ProcessInfo& r_process_info,
157  double LocalElasticContactForce[3],
158  double DeltDisp[3],
159  double LocalDeltDisp[3],
160  double RelVel[3],
161  const double indentation,
162  double ViscoDampingLocalContactForce[3],
163  double& cohesive_force,
164  SphericParticle* p_neighbour_element,
165  bool& sliding,
166  double LocalCoordSystem[3][3],
167  double OldLocalCoordSystem[3][3],
168  array_1d<double, 3>& neighbour_elastic_contact_force) override;
169 
170 void ComputeBallToRigidFaceContactForceAndMoment(SphericParticle::ParticleDataBuffer & data_buffer,
171  array_1d<double, 3>& r_elastic_force,
172  array_1d<double, 3>& r_contact_force,
173  array_1d<double, 3>& rigid_element_force,
174  const ProcessInfo& r_process_info) override;
175 
176 
177 bool IsNewNeighbour(const int neighbour_id);
178 
179 bool IsNewFaceNeighbour(const int neighbour_id);
180 
181 void RecordNewImpact(BaseType::ParticleDataBuffer & data_buffer);
182 
183 void RecordNewFaceImpact(BaseType::ParticleDataBuffer & data_buffer);
184 
185 void save(Serializer& rSerializer) const override
186 {
188 }
189 
190 void load(Serializer& rSerializer) override
191 {
192  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, SphericParticle);
193 }
194 
195 }; // Class AnalyticSphericParticle
196 
198 inline std::istream& operator >> (std::istream& rIStream,
199  AnalyticSphericParticle& rThis){ return rIStream;}
200 
202 inline std::ostream& operator << (std::ostream& rOStream,
203  const AnalyticSphericParticle& rThis)
204 {
205 rThis.PrintInfo(rOStream);
206 rOStream << std::endl;
207 rThis.PrintData(rOStream);
208 
209 return rOStream;
210 }
211 
212 } // namespace Kratos.
213 
214 #endif // KRATOS_ANALYTIC_SPHERIC_PARTICLE_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: analytic_spheric_particle.h:90
std::vector< int > mCurrentContactingFaceNeighbourIds
Definition: analytic_spheric_particle.h:98
ParticleDataBuffer(SphericParticle *p_this_particle)
Definition: analytic_spheric_particle.h:93
std::vector< int > mCurrentContactingNeighbourIds
Definition: analytic_spheric_particle.h:97
virtual ~ParticleDataBuffer()
Definition: analytic_spheric_particle.h:95
Definition: analytic_spheric_particle.h:19
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: analytic_spheric_particle.h:61
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: analytic_spheric_particle.h:58
SphericParticle BaseType
Definition: analytic_spheric_particle.h:31
GlobalPointersVector< Condition > ConditionWeakVectorType
Definition: analytic_spheric_particle.h:25
std::unique_ptr< SphericParticle::ParticleDataBuffer > CreateParticleDataBuffer(SphericParticle *p_this_particle) override
Definition: analytic_spheric_particle.h:101
GlobalPointersVector< Element > ParticleWeakVectorType
Definition: analytic_spheric_particle.h:28
std::unique_ptr< BaseType::ParticleDataBuffer > BaseBufferPointerType
Definition: analytic_spheric_particle.h:33
virtual ~AnalyticSphericParticle()
Destructor.
Definition: analytic_spheric_particle.h:45
GlobalPointersVector< Element >::iterator ParticleWeakIteratorType
Definition: analytic_spheric_particle.h:30
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(AnalyticSphericParticle)
Pointer definition of AnalyticSphericParticle.
BaseType::ParticleDataBuffer BaseBufferType
Definition: analytic_spheric_particle.h:32
ParticleWeakVectorType::ptr_iterator ParticleWeakIteratorType_ptr
Definition: analytic_spheric_particle.h:29
GlobalPointersVector< Condition >::iterator ConditionWeakIteratorType
Definition: analytic_spheric_particle.h:26
std::string Info() const override
Turn back information as a string.
Definition: analytic_spheric_particle.h:50
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
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
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
#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
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
def load(f)
Definition: ode_solve.py:307