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.
small_strain_plane_stress_2D_law.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosConstitutiveModelsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: April 2017 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_SMALL_STRAIN_PLANE_STRESS_2D_LAW_H_INCLUDED )
11 #define KRATOS_SMALL_STRAIN_PLANE_STRESS_2D_LAW_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 
20 namespace Kratos
21 {
24 
27 
31 
35 
39 
43 
45 
47  class KRATOS_API(CONSTITUTIVE_MODELS_APPLICATION) SmallStrainPlaneStress2DLaw : public SmallStrain3DLaw
48  {
49  public:
52 
55 
59 
62 
65 
68 
71  {
73  return *this;
74  }
75 
77  ConstitutiveLaw::Pointer Clone() const override
78  {
79  return Kratos::make_shared<SmallStrainPlaneStress2DLaw>(*this);
80  }
81 
84 
85 
89 
91  SizeType WorkingSpaceDimension() override { return 2; }
92 
94  SizeType GetStrainSize() const override { return 3; }
95 
97  void GetLawFeatures(Features& rFeatures) override
98  {
100 
101  //Set the type of law
102  rFeatures.mOptions.Set( PLANE_STRESS_LAW );
103  rFeatures.mOptions.Set( INFINITESIMAL_STRAINS );
104  rFeatures.mOptions.Set( ISOTROPIC );
105 
106  //Get model features
107  GetModelFeatures(rFeatures);
108 
109  //Set strain measure required by the consitutive law
110  rFeatures.mStrainMeasures.push_back(StrainMeasure_Infinitesimal);
111  rFeatures.mStrainMeasures.push_back(StrainMeasure_Deformation_Gradient);
112 
113  //Set the strain size
114  rFeatures.mStrainSize = GetStrainSize();
115 
116  //Set the spacedimension
117  rFeatures.mSpaceDimension = WorkingSpaceDimension();
118 
119  KRATOS_CATCH(" ")
120  }
121 
125 
127  {
128  KRATOS_TRY
129 
130  //0.- Check if the constitutive parameters are passed correctly to the law calculation
131  //CheckParameters(rValues);
132 
133  const Flags& rOptions = rValues.GetOptions();
134 
135  const Properties& rProperties = rValues.GetMaterialProperties();
136 
137  Vector& rStrainVector = rValues.GetStrainVector();
138  Vector& rStressVector = rValues.GetStressVector();
139 
140  // Calculate total Kirchhoff stress
141 
142  if( rOptions.Is( ConstitutiveLaw::COMPUTE_STRESS ) ){
143 
144  Matrix& rConstitutiveMatrix = rValues.GetConstitutiveMatrix();
145 
146  this->CalculateConstitutiveMatrix( rConstitutiveMatrix, rProperties);
147 
148  this->CalculateStress( rStrainVector, rConstitutiveMatrix, rStressVector );
149 
150  }
151  else if( rOptions.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ){
152 
153  Matrix& rConstitutiveMatrix = rValues.GetConstitutiveMatrix();
154  this->CalculateConstitutiveMatrix(rConstitutiveMatrix, rProperties);
155 
156  }
157 
158  // std::cout<<" StrainVector "<<rValues.GetStrainVector()<<std::endl;
159  // std::cout<<" StressVector "<<rValues.GetStressVector()<<std::endl;
160  // std::cout<<" ConstitutiveMatrix "<<rValues.GetConstitutiveMatrix()<<std::endl;
161 
162  KRATOS_CATCH(" ")
163 
164  }
165 
169 
170 
174 
175 
179 
181  std::string Info() const override
182  {
183  std::stringstream buffer;
184  buffer << "SmallStrainPlaneStress2DLaw" ;
185  return buffer.str();
186  }
187 
189  void PrintInfo(std::ostream& rOStream) const override {rOStream << "SmallStrainPlaneStress2DLaw";}
190 
192  void PrintData(std::ostream& rOStream) const override {}
193 
194 
198 
199 
201 
202  protected:
205 
206 
210 
211 
215 
216 
224  void CalculateConstitutiveMatrix(Matrix& rConstitutiveMatrix,
225  const Properties& rProperties) override
226  {
227  KRATOS_TRY
228 
229  // Lame constants
230  const double& rYoungModulus = rProperties[YOUNG_MODULUS];
231  const double& rPoissonCoefficient = rProperties[POISSON_RATIO];
232 
233  // Plane stress constitutive matrix
234  rConstitutiveMatrix ( 0 , 0 ) = (rYoungModulus)/(1.0-rPoissonCoefficient*rPoissonCoefficient);
235  rConstitutiveMatrix ( 1 , 1 ) = rConstitutiveMatrix ( 0 , 0 );
236 
237  rConstitutiveMatrix ( 2 , 2 ) = rConstitutiveMatrix ( 0 , 0 )*(1.0-rPoissonCoefficient)*0.5;
238 
239  rConstitutiveMatrix ( 0 , 1 ) = rConstitutiveMatrix ( 0 , 0 )*rPoissonCoefficient;
240  rConstitutiveMatrix ( 1 , 0 ) = rConstitutiveMatrix ( 0 , 1 );
241 
242  rConstitutiveMatrix ( 0 , 2 ) = 0.0;
243  rConstitutiveMatrix ( 2 , 0 ) = 0.0;
244  rConstitutiveMatrix ( 1 , 2 ) = 0.0;
245  rConstitutiveMatrix ( 2 , 1 ) = 0.0;
246 
247  KRATOS_CATCH(" ")
248  }
249 
250 
254 
255 
259 
260 
264 
265 
269 
270 
272 
273  private:
276 
277 
281 
282 
286 
287 
291 
292 
296 
297 
301 
302 
306  friend class Serializer;
307 
308  void save(Serializer& rSerializer) const override
309  {
311  }
312 
313  void load(Serializer& rSerializer) override
314  {
316  }
317 
318 
322 
324 
325  }; // Class SmallStrainPlaneStress2DLaw
326 
328 
331 
332 
336 
337 
339 
341 
342 } // namespace Kratos.
343 
344 #endif // KRATOS_SMALL_STRAIN_PLANE_STRESS_2D_LAW_H_INCLUDED defined
std::size_t SizeType
Definition: constitutive_law.h:82
Definition: flags.h:58
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
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: small_strain_3D_law.hpp:33
SmallStrain3DLaw & operator=(const SmallStrain3DLaw &rOther)
Assignment operator.
Definition: small_strain_3D_law.cpp:59
ModelType::Pointer ModelTypePointer
Definition: small_strain_3D_law.hpp:40
Short class definition.
Definition: small_strain_plane_stress_2D_law.hpp:48
void CalculateConstitutiveMatrix(Matrix &rConstitutiveMatrix, const Properties &rProperties) override
Definition: small_strain_plane_stress_2D_law.hpp:224
ConstitutiveLaw::Pointer Clone() const override
Clone.
Definition: small_strain_plane_stress_2D_law.hpp:77
~SmallStrainPlaneStress2DLaw() override
Destructor.
Definition: small_strain_plane_stress_2D_law.hpp:83
SizeType GetStrainSize() const override
Law Voigt Strain Size.
Definition: small_strain_plane_stress_2D_law.hpp:94
SmallStrainPlaneStress2DLaw(const SmallStrainPlaneStress2DLaw &rOther)
Copy constructor.
Definition: small_strain_plane_stress_2D_law.hpp:67
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: small_strain_plane_stress_2D_law.hpp:192
SmallStrainPlaneStress2DLaw()
Default constructor.
Definition: small_strain_plane_stress_2D_law.hpp:61
KRATOS_CLASS_POINTER_DEFINITION(SmallStrainPlaneStress2DLaw)
Pointer definition of SmallStrainPlaneStress2DLaw.
std::string Info() const override
Turn back information as a string.
Definition: small_strain_plane_stress_2D_law.hpp:181
SmallStrainPlaneStress2DLaw & operator=(SmallStrainPlaneStress2DLaw const &rOther)
Assignment operator.
Definition: small_strain_plane_stress_2D_law.hpp:70
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: small_strain_plane_stress_2D_law.hpp:189
void GetLawFeatures(Features &rFeatures) override
Law Features.
Definition: small_strain_plane_stress_2D_law.hpp:97
void CalculateMaterialResponseKirchhoff(Parameters &rValues) override
Definition: small_strain_plane_stress_2D_law.hpp:126
SizeType WorkingSpaceDimension() override
Law Dimension.
Definition: small_strain_plane_stress_2D_law.hpp:91
SmallStrainPlaneStress2DLaw(ModelTypePointer pModel)
Constructor.
Definition: small_strain_plane_stress_2D_law.hpp:64
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
def load(f)
Definition: ode_solve.py:307
Definition: constitutive_law.h:137
SizeType mStrainSize
Definition: constitutive_law.h:152
std::vector< StrainMeasure > mStrainMeasures
Definition: constitutive_law.h:154
SizeType mSpaceDimension
Definition: constitutive_law.h:153
Flags mOptions
Definition: constitutive_law.h:151
Definition: constitutive_law.h:189
Flags & GetOptions()
Definition: constitutive_law.h:412
StrainVectorType & GetStrainVector()
Definition: constitutive_law.h:435
const Properties & GetMaterialProperties()
Definition: constitutive_law.h:457
VoigtSizeMatrixType & GetConstitutiveMatrix()
Definition: constitutive_law.h:446
StressVectorType & GetStressVector()
Definition: constitutive_law.h:440