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.
U_Pw_base_element.hpp
Go to the documentation of this file.
1 // KRATOS___
2 // // ) )
3 // // ___ ___
4 // // ____ //___) ) // ) )
5 // // / / // // / /
6 // ((____/ / ((____ ((___/ / MECHANICS
7 //
8 // License: geo_mechanics_application/license.txt
9 //
10 // Main authors: Ignasi de Pouplana,
11 // Vahid Galavi
12 //
13 
14 #pragma once
15 
16 // Project includes
17 #include "containers/array_1d.h"
20 #include "geometries/geometry.h"
22 #include "includes/define.h"
23 #include "includes/element.h"
24 #include "includes/serializer.h"
25 #include "utilities/math_utils.h"
26 
27 // Application includes
28 #include "custom_utilities/element_utilities.hpp"
30 
31 namespace Kratos
32 {
33 
34 template <unsigned int TDim, unsigned int TNumNodes>
35 class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwBaseElement : public Element
36 {
37 public:
38  using SizeType = std::size_t;
39 
41 
42  explicit UPwBaseElement(IndexType NewId = 0) : Element(NewId) {}
43 
45  UPwBaseElement(IndexType NewId, const NodesArrayType& ThisNodes) : Element(NewId, ThisNodes) {}
46 
48  UPwBaseElement(IndexType NewId, GeometryType::Pointer pGeometry) : Element(NewId, pGeometry) {}
49 
51  UPwBaseElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
52  : Element(NewId, pGeometry, pProperties)
53  {
54  // this is needed for interface elements
55  mThisIntegrationMethod = this->GetIntegrationMethod();
56  }
57 
58  ~UPwBaseElement() override = default;
59  UPwBaseElement(const UPwBaseElement&) = delete;
61  UPwBaseElement(UPwBaseElement&&) noexcept = delete;
62  UPwBaseElement& operator=(UPwBaseElement&&) noexcept = delete;
63 
64  Element::Pointer Create(IndexType NewId,
65  NodesArrayType const& ThisNodes,
66  PropertiesType::Pointer pProperties) const override;
67 
68  Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override;
69 
70  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
71 
72  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
73 
74  void GetDofList(DofsVectorType& rElementalDofList, const ProcessInfo& rCurrentProcessInfo) const override;
75 
76  void ResetConstitutiveLaw() override;
77 
78  GeometryData::IntegrationMethod GetIntegrationMethod() const override;
79 
80  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
81  VectorType& rRightHandSideVector,
82  const ProcessInfo& rCurrentProcessInfo) override;
83 
84  void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix, const ProcessInfo& rCurrentProcessInfo) override;
85 
86  void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
87 
88  void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& rCurrentProcessInfo) const override;
89 
90  void CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& rCurrentProcessInfo) override;
91 
92  void CalculateDampingMatrix(MatrixType& rDampingMatrix, const ProcessInfo& rCurrentProcessInfo) override;
93 
94  void GetValuesVector(Vector& rValues, int Step = 0) const override;
95 
96  void GetFirstDerivativesVector(Vector& rValues, int Step = 0) const override;
97 
98  void GetSecondDerivativesVector(Vector& rValues, int Step = 0) const override;
99 
101  std::vector<ConstitutiveLaw::Pointer>& rValues,
102  const ProcessInfo& rCurrentProcessInfo) override;
103 
104  void CalculateOnIntegrationPoints(const Variable<array_1d<double, 3>>& rVariable,
105  std::vector<array_1d<double, 3>>& rValues,
106  const ProcessInfo& rCurrentProcessInfo) override;
107 
109  std::vector<Matrix>& rValues,
110  const ProcessInfo& rCurrentProcessInfo) override;
111 
112  void CalculateOnIntegrationPoints(const Variable<double>& rVariable,
113  std::vector<double>& rValues,
114  const ProcessInfo& rCurrentProcessInfo) override;
115 
117  std::vector<Vector>& rValues,
118  const ProcessInfo& rCurrentProcessInfo) override;
119 
121 
122  void SetValuesOnIntegrationPoints(const Variable<double>& rVariable,
123  const std::vector<double>& rValues,
124  const ProcessInfo& rCurrentProcessInfo) override;
125 
127  const std::vector<Vector>& rValues,
128  const ProcessInfo& rCurrentProcessInfo) override;
129 
131  const std::vector<Matrix>& rValues,
132  const ProcessInfo& rCurrentProcessInfo) override;
133 
135 
136  std::string Info() const override
137  {
138  return "U-Pw Base class Element #" + std::to_string(Id()) +
139  "\nConstitutive law: " + mConstitutiveLawVector[0]->Info();
140  }
141 
142  void PrintInfo(std::ostream& rOStream) const override { rOStream << Info(); }
143 
144 protected:
147 
148  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLawVector;
149  std::vector<RetentionLaw::Pointer> mRetentionLawVector;
150 
151  std::vector<Vector> mStressVector;
152  std::vector<Vector> mStateVariablesFinalized;
153  bool mIsInitialised = false;
154 
155  virtual void CalculateMaterialStiffnessMatrix(MatrixType& rStiffnessMatrix, const ProcessInfo& CurrentProcessInfo);
156 
157  virtual void CalculateAll(MatrixType& rLeftHandSideMatrix,
158  VectorType& rRightHandSideVector,
159  const ProcessInfo& CurrentProcessInfo,
160  bool CalculateStiffnessMatrixFlag,
161  bool CalculateResidualVectorFlag);
162 
163  virtual double CalculateIntegrationCoefficient(const GeometryType::IntegrationPointsArrayType& IntegrationPoints,
164  unsigned int PointNumber,
165  double detJ);
166 
167  void CalculateDerivativesOnInitialConfiguration(
168  double& detJ, Matrix& J0, Matrix& InvJ0, Matrix& DN_DX, unsigned int PointNumber) const;
169 
170  void CalculateJacobianOnCurrentConfiguration(double& detJ, Matrix& rJ, Matrix& rInvJ, unsigned int GPoint) const;
171 
181  void CalculateJacobianOnCurrentConfiguration(
182  double& detJ, Matrix& J0, Matrix& InvJ0, Matrix& DN_DX, unsigned int PointNumber) const;
183 
193  double CalculateDerivativesOnCurrentConfiguration(Matrix& rJ,
194  Matrix& rInvJ,
195  Matrix& rDN_DX,
196  const IndexType& PointNumber,
197  IntegrationMethod ThisIntegrationMethod) const;
198 
199  virtual unsigned int GetNumberOfDOF() const;
200 
201 private:
202  friend class Serializer;
203 
204  void save(Serializer& rSerializer) const override
205  {
207  }
208 
209  void load(Serializer& rSerializer) override
210  {
212  }
213 
214 }; // Class UPwBaseElement
215 
216 } // namespace Kratos
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: constitutive_law.h:47
Base class for all Elements.
Definition: element.h:60
std::size_t SizeType
Definition: element.h:94
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
Definition: geometry_data.h:60
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
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
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Definition: U_Pw_base_element.hpp:36
UPwBaseElement(UPwBaseElement &&) noexcept=delete
UPwBaseElement(const UPwBaseElement &)=delete
UPwBaseElement & operator=(const UPwBaseElement &)=delete
std::vector< Vector > mStateVariablesFinalized
Definition: U_Pw_base_element.hpp:152
UPwBaseElement(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: U_Pw_base_element.hpp:45
std::vector< RetentionLaw::Pointer > mRetentionLawVector
Definition: U_Pw_base_element.hpp:149
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: U_Pw_base_element.hpp:142
std::vector< Vector > mStressVector
Definition: U_Pw_base_element.hpp:151
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(UPwBaseElement)
~UPwBaseElement() override=default
UPwBaseElement(IndexType NewId=0)
Definition: U_Pw_base_element.hpp:42
GeometryData::IntegrationMethod mThisIntegrationMethod
Member Variables.
Definition: U_Pw_base_element.hpp:146
UPwBaseElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using Properties.
Definition: U_Pw_base_element.hpp:51
std::vector< ConstitutiveLaw::Pointer > mConstitutiveLawVector
Definition: U_Pw_base_element.hpp:148
UPwBaseElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: U_Pw_base_element.hpp:48
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
Short class definition.
Definition: array_1d.h:61
#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
void SetValuesOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const std::vector< TDataType > &values, const ProcessInfo &rCurrentProcessInfo)
Definition: add_mesh_to_python.cpp:185
pybind11::list CalculateOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const ProcessInfo &rProcessInfo)
Definition: add_mesh_to_python.cpp:142
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Kratos::PeriodicInterfaceProcess Process operator(std::istream &rIStream, PeriodicInterfaceProcess &rThis)
input stream function
def load(f)
Definition: ode_solve.py:307
tuple const
Definition: ode_solve.py:403
namespace
Definition: array_1d.h:793