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.
mpm_particle_base_condition.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Bodhinanda Chandra
11 //
12 
13 
14 #if !defined(KRATOS_MPM_PARTICLE_BASE_CONDITION_3D_H_INCLUDED )
15 #define KRATOS_MPM_PARTICLE_BASE_CONDITION_3D_H_INCLUDED
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/define.h"
23 #include "includes/condition.h"
25 
26 namespace Kratos
27 {
28 
31 
35 
39 
43 
47 
49  : public Condition
50 {
51 
52 protected:
53 
59  {
60  public:
61 
62  // For axisymmetric use only
63  double CurrentRadius;
65 
66  // General variables for large displacement use
67  double detF0;
68  double detF;
69  double detFT;
76 
77  // Variables including all integration points
79  };
80 
81 public:
82 
84  typedef std::size_t SizeType;
86 
87  // Counted pointer of MPMParticleBaseCondition
89 
93 
94  // Constructor void
96  : m_area(1.0)
97  {};
98 
99  // Constructor using an array of nodes
100  MPMParticleBaseCondition( IndexType NewId, GeometryType::Pointer pGeometry )
101  : Condition(NewId,pGeometry)
102  , m_area(1.0)
103  {};
104 
105  // Constructor using an array of nodes with properties
106  MPMParticleBaseCondition( IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties )
107  : Condition(NewId,pGeometry,pProperties)
108  , m_area(1.0)
109  {};
110 
111  // Destructor
113  {};
114 
118 
119 
123 
129  void EquationIdVector(
130  EquationIdVectorType& rResult,
131  const ProcessInfo& rCurrentProcessInfo
132  ) const override;
133 
139  void GetDofList(
140  DofsVectorType& ElementalDofList,
141  const ProcessInfo& rCurrentProcessInfo
142  ) const override;
143 
149  void GetValuesVector(
150  Vector& rValues,
151  int Step = 0
152  ) const override;
153 
160  Vector& rValues,
161  int Step = 0
162  ) const override;
163 
170  Vector& rValues,
171  int Step = 0
172  ) const override;
173 
183  MatrixType& rLeftHandSideMatrix,
184  VectorType& rRightHandSideVector,
185  const ProcessInfo& rCurrentProcessInfo
186  ) override;
187 
194  VectorType& rRightHandSideVector,
195  const ProcessInfo& rCurrentProcessInfo
196  ) override;
197 
203  void CalculateMassMatrix(
204  MatrixType& rMassMatrix,
205  const ProcessInfo& rCurrentProcessInfo
206  ) override;
207 
215  MatrixType& rDampingMatrix,
216  const ProcessInfo& rCurrentProcessInfo
217  ) override;
218 
226  int Check( const ProcessInfo& rCurrentProcessInfo ) const override;
227 
231  bool HasRotDof(){return (GetGeometry()[0].HasDofFor(ROTATION_X) && GetGeometry().size() == 2);};
232 
233  unsigned int GetBlockSize()
234  {
235  unsigned int dimension = GetGeometry().WorkingSpaceDimension();
236  if( HasRotDof() ) // if it has rotations
237  {
238  if(dimension == 2)
239  return 3;
240  else if(dimension == 3)
241  return 6;
242  else
243  KRATOS_ERROR << "the conditions only works for 2D and 3D elements";
244  }
245  else
246  {
247  return dimension;
248  }
249  }
250 
254 
255  void CalculateOnIntegrationPoints(const Variable<double>& rVariable,
256  std::vector<double>& rValues,
257  const ProcessInfo& rCurrentProcessInfo) override;
258 
260  std::vector<array_1d<double, 3 > >& rValues,
261  const ProcessInfo& rCurrentProcessInfo) override;
262 
266 
268  const Variable<double>& rVariable,
269  const std::vector<double>& rValues,
270  const ProcessInfo& rCurrentProcessInfo) override;
271 
273  const Variable<array_1d<double, 3 > >& rVariable,
274  const std::vector<array_1d<double, 3 > >& rValues,
275  const ProcessInfo& rCurrentProcessInfo) override;
276 
280 
281 
285 
289 
290 protected:
291 
294 
298 
304  double m_area;
305 
309 
313 
322  virtual void CalculateAll(
323  MatrixType& rLeftHandSideMatrix,
324  VectorType& rRightHandSideVector,
325  const ProcessInfo& rCurrentProcessInfo,
326  const bool CalculateStiffnessMatrixFlag,
327  const bool CalculateResidualVectorFlag
328  );
329 
333  virtual double GetIntegrationWeight();
334 
339  virtual void MPMShapeFunctionPointValues(Vector& rResult) const;
340 
344  Matrix& CalculateCurrentDisp(Matrix & rCurrentDisp, const ProcessInfo& rCurrentProcessInfo);
345 
349 
353 
357 
358 private:
361 
362 
366 
367 
371 
375 
376 
380 
381 
385 
389 
390  friend class Serializer;
391 
392  void save( Serializer& rSerializer ) const override
393  {
395  rSerializer.save("xg",m_xg);
396  rSerializer.save("displacement",m_displacement);
397  rSerializer.save("acceleration",m_acceleration);
398  rSerializer.save("velocity",m_velocity);
399  rSerializer.save("normal",m_normal);
400  rSerializer.save("area",m_area);
401 
402  }
403 
404  void load( Serializer& rSerializer ) override
405  {
407  rSerializer.load("xg",m_xg);
408  rSerializer.load("displacement",m_displacement);
409  rSerializer.load("acceleration",m_acceleration);
410  rSerializer.load("velocity",m_velocity);
411  rSerializer.load("normal",m_normal);
412  rSerializer.load("area",m_area);
413  }
414 
415 }; // class MPMParticleBaseCondition.
416 
420 
421 
425 
426 } // namespace Kratos.
427 
428 #endif // KRATOS_MPM_PARTICLE_BASE_DIRICHLET_CONDITION_3D_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
Matrix MatrixType
Definition: condition.h:90
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
std::size_t IndexType
Definition: flags.h:74
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
SizeType WorkingSpaceDimension() const
Definition: geometry.h:1287
Definition: mpm_particle_base_condition.h:50
void CalculateOnIntegrationPoints(const Variable< double > &rVariable, std::vector< double > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: mpm_particle_base_condition.cpp:303
MPMParticleBaseCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: mpm_particle_base_condition.h:106
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Definition: mpm_particle_base_condition.cpp:29
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: mpm_particle_base_condition.cpp:187
std::size_t SizeType
Definition: mpm_particle_base_condition.h:84
array_1d< double, 3 > m_acceleration
Definition: mpm_particle_base_condition.h:301
void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: mpm_particle_base_condition.cpp:213
~MPMParticleBaseCondition() override
Definition: mpm_particle_base_condition.h:112
array_1d< double, 3 > m_displacement
Definition: mpm_particle_base_condition.h:300
Matrix & CalculateCurrentDisp(Matrix &rCurrentDisp, const ProcessInfo &rCurrentProcessInfo)
Definition: mpm_particle_base_condition.cpp:278
void GetDofList(DofsVectorType &ElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Definition: mpm_particle_base_condition.cpp:59
array_1d< double, 3 > m_velocity
Definition: mpm_particle_base_condition.h:302
MPMParticleBaseCondition()
Definition: mpm_particle_base_condition.h:95
virtual double GetIntegrationWeight()
Definition: mpm_particle_base_condition.cpp:394
unsigned int GetBlockSize()
Definition: mpm_particle_base_condition.h:233
void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: mpm_particle_base_condition.cpp:199
virtual void CalculateAll(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo, const bool CalculateStiffnessMatrixFlag, const bool CalculateResidualVectorFlag)
Definition: mpm_particle_base_condition.cpp:227
void GetFirstDerivativesVector(Vector &rValues, int Step=0) const override
Definition: mpm_particle_base_condition.cpp:117
void GetValuesVector(Vector &rValues, int Step=0) const override
Definition: mpm_particle_base_condition.cpp:88
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: mpm_particle_base_condition.cpp:175
void SetValuesOnIntegrationPoints(const Variable< double > &rVariable, const std::vector< double > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: mpm_particle_base_condition.cpp:346
bool HasRotDof()
Definition: mpm_particle_base_condition.h:231
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: mpm_particle_base_condition.cpp:240
double m_area
Definition: mpm_particle_base_condition.h:304
array_1d< double, 3 > m_xg
Definition: mpm_particle_base_condition.h:299
void GetSecondDerivativesVector(Vector &rValues, int Step=0) const override
Definition: mpm_particle_base_condition.cpp:146
virtual void MPMShapeFunctionPointValues(Vector &rResult) const
Definition: mpm_particle_base_condition.cpp:264
MPMParticleBaseCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: mpm_particle_base_condition.h:100
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MPMParticleBaseCondition)
array_1d< double, 3 > m_normal
Definition: mpm_particle_base_condition.h:303
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
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
def load(f)
Definition: ode_solve.py:307
Definition: mpm_particle_base_condition.h:59
double detF0
Definition: mpm_particle_base_condition.h:67
double ReferenceRadius
Definition: mpm_particle_base_condition.h:64
Matrix DN_DX
Definition: mpm_particle_base_condition.h:74
Matrix FT
Definition: mpm_particle_base_condition.h:73
double detF
Definition: mpm_particle_base_condition.h:68
Vector N
Definition: mpm_particle_base_condition.h:70
Matrix DN_De
Definition: mpm_particle_base_condition.h:75
Matrix CurrentDisp
Definition: mpm_particle_base_condition.h:78
Matrix F
Definition: mpm_particle_base_condition.h:72
double detFT
Definition: mpm_particle_base_condition.h:69
double CurrentRadius
Definition: mpm_particle_base_condition.h:63
Matrix F0
Definition: mpm_particle_base_condition.h:71