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.
shell_cross_section.hpp
Go to the documentation of this file.
1 // KRATOS ___| | | |
2 // \___ \ __| __| | | __| __| | | __| _` | |
3 // | | | | | ( | | | | ( | |
4 // _____/ \__|_| \__,_|\___|\__|\__,_|_| \__,_|_| MECHANICS
5 //
6 // License: BSD License
7 // license: StructuralMechanicsApplication/license.txt
8 //
9 // Main authors: Massimo Petracca
10 // Philipp Bucher
11 //
12 
13 #pragma once
14 
15 // System includes
16 #include <string>
17 #include <iostream>
18 
19 // Project includes
20 #include "includes/define.h"
21 #include "includes/serializer.h"
23 #include "shell_utilities.h"
24 #include "containers/flags.h"
25 
26 namespace Kratos {
27 
43 class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) ShellCrossSection : public Flags
44 {
45 
46 public:
47 
48  class Ply;
49 
51 
53 
54  typedef std::vector< Ply > PlyCollection;
55 
56  typedef std::size_t SizeType;
57 
60 
65  Thick,
66  Thin
67  };
68 
70 
73 
74  struct Features {
75  Flags mOptions;
76  double mStrainSize;
77  double mSpaceDimension;
78  std::vector< ConstitutiveLaw::StrainMeasure > mStrainMeasures;
79  };
80 
81 
101  {
102 
103  private:
104 
105  Flags mOptions;
106 
107  Vector* mpGeneralizedStrainVector;
108  Vector* mpGeneralizedStressVector;
109  Matrix* mpConstitutiveMatrix;
110 
111  double mStenbergShearStabilization = 1.0;
112  // refer https://doi.org/10.1016/j.cma.2003.12.036 section 3.1
113 
114  const Vector* mpShapeFunctionsValues;
115  const Matrix* mpShapeFunctionsDerivatives;
116  const ProcessInfo* mpCurrentProcessInfo;
117  const Properties* mpMaterialProperties;
118  const GeometryType* mpElementGeometry;
119 
120  public:
121 
123  : mpGeneralizedStrainVector(nullptr)
124  , mpGeneralizedStressVector(nullptr)
125  , mpConstitutiveMatrix(nullptr)
126  , mpShapeFunctionsValues(nullptr)
127  , mpShapeFunctionsDerivatives(nullptr)
128  , mpCurrentProcessInfo(nullptr)
129  , mpMaterialProperties(nullptr)
130  , mpElementGeometry(nullptr)
131  {}
132 
133  SectionParameters(const GeometryType& rElementGeometry,
134  const Properties& rMaterialProperties,
135  const ProcessInfo& rCurrentProcessInfo)
136  : mpGeneralizedStrainVector(nullptr)
137  , mpGeneralizedStressVector(nullptr)
138  , mpConstitutiveMatrix(nullptr)
139  , mpShapeFunctionsValues(nullptr)
140  , mpShapeFunctionsDerivatives(nullptr)
141  , mpCurrentProcessInfo(&rCurrentProcessInfo)
142  , mpMaterialProperties(&rMaterialProperties)
143  , mpElementGeometry(&rElementGeometry)
144  {}
145 
146  SectionParameters(const SectionParameters& rNewParameters)
147  : mOptions(rNewParameters.mOptions)
148  , mpGeneralizedStrainVector(rNewParameters.mpGeneralizedStrainVector)
149  , mpGeneralizedStressVector(rNewParameters.mpGeneralizedStressVector)
150  , mpConstitutiveMatrix(rNewParameters.mpConstitutiveMatrix)
151  , mpShapeFunctionsValues(rNewParameters.mpShapeFunctionsValues)
152  , mpShapeFunctionsDerivatives(rNewParameters.mpShapeFunctionsDerivatives)
153  , mpCurrentProcessInfo(rNewParameters.mpCurrentProcessInfo)
154  , mpMaterialProperties(rNewParameters.mpMaterialProperties)
155  , mpElementGeometry(rNewParameters.mpElementGeometry)
156  {}
157 
158  public:
159 
164  {
165  if (!mpShapeFunctionsValues) {
166  KRATOS_THROW_ERROR(std::invalid_argument,"ShapeFunctionsValues NOT SET","");
167  }
168 
169  if (!mpShapeFunctionsDerivatives) {
170  KRATOS_THROW_ERROR(std::invalid_argument,"ShapeFunctionsDerivatives NOT SET","");
171  }
172 
173  return 1;
174  }
175 
180  {
181  if (!mpCurrentProcessInfo) {
182  KRATOS_THROW_ERROR(std::invalid_argument,"CurrentProcessInfo NOT SET","");
183  }
184 
185  if (!mpMaterialProperties) {
186  KRATOS_THROW_ERROR(std::invalid_argument,"MaterialProperties NOT SET","");
187  }
188 
189  if (!mpElementGeometry) {
190  KRATOS_THROW_ERROR(std::invalid_argument,"ElementGeometry NOT SET","");
191  }
192 
193  return 1;
194  }
195 
200  {
201  if (!mpGeneralizedStrainVector) {
202  KRATOS_THROW_ERROR(std::invalid_argument,"GenralizedStrainVector NOT SET","");
203  }
204 
205  if (!mpGeneralizedStressVector) {
206  KRATOS_THROW_ERROR(std::invalid_argument,"GenralizedStressVector NOT SET","");
207  }
208 
209  if (!mpConstitutiveMatrix) {
210  KRATOS_THROW_ERROR(std::invalid_argument,"ConstitutiveMatrix NOT SET","");
211  }
212 
213  return 1;
214  }
215 
224  void Set(const Flags ThisFlag)
225  {
226  mOptions.Set(ThisFlag);
227  };
228  void Reset(const Flags ThisFlag)
229  {
230  mOptions.Reset(ThisFlag);
231  };
232 
233  void SetOptions(const Flags& rOptions)
234  {
235  mOptions=rOptions;
236  };
237 
238  void SetGeneralizedStrainVector(Vector& rGeneralizedStrainVector)
239  {
240  mpGeneralizedStrainVector=&rGeneralizedStrainVector;
241  };
242  void SetGeneralizedStressVector(Vector& rGeneralizedStressVector)
243  {
244  mpGeneralizedStressVector=&rGeneralizedStressVector;
245  };
246  void SetConstitutiveMatrix(Matrix& rConstitutiveMatrix)
247  {
248  mpConstitutiveMatrix =&rConstitutiveMatrix;
249  };
250 
251  void SetShapeFunctionsValues(const Vector& rShapeFunctionsValues)
252  {
253  mpShapeFunctionsValues=&rShapeFunctionsValues;
254  };
255  void SetShapeFunctionsDerivatives(const Matrix& rShapeFunctionsDerivatives)
256  {
257  mpShapeFunctionsDerivatives=&rShapeFunctionsDerivatives;
258  };
259  void SetProcessInfo(const ProcessInfo& rProcessInfo)
260  {
261  mpCurrentProcessInfo =&rProcessInfo;
262  };
263  void SetMaterialProperties(const Properties& rMaterialProperties)
264  {
265  mpMaterialProperties =&rMaterialProperties;
266  };
267  void SetElementGeometry(const GeometryType& rElementGeometry)
268  {
269  mpElementGeometry =&rElementGeometry;
270  };
271  void SetStenbergShearStabilization(const double& StenbergShearStabilization)
272  {
273  mStenbergShearStabilization = StenbergShearStabilization;
274  };
275 
281  {
282  return mOptions;
283  };
284 
286  {
287  return *mpGeneralizedStrainVector;
288  };
290  {
291  return *mpGeneralizedStressVector;
292  };
294  {
295  return *mpConstitutiveMatrix;
296  };
297 
299  {
300  return *mpShapeFunctionsValues;
301  };
303  {
304  return *mpShapeFunctionsDerivatives;
305  };
307  {
308  return *mpCurrentProcessInfo;
309  };
311  {
312  return *mpMaterialProperties;
313  };
315  {
316  return *mpElementGeometry;
317  };
319  {
320  return mStenbergShearStabilization;
321  };
322  };
323 
324  class IntegrationPoint
325  {
326 
327  private:
328 
329  double mWeight;
330  double mLocation;
331  ConstitutiveLaw::Pointer mConstitutiveLaw;
332 
333  public:
334 
336  : mWeight(0.0)
337  , mLocation(0.0)
338  , mConstitutiveLaw(ConstitutiveLaw::Pointer())
339  {}
340 
341  IntegrationPoint(double location, double weight, const ConstitutiveLaw::Pointer pMaterial)
342  : mWeight(weight)
343  , mLocation(location)
344  , mConstitutiveLaw(pMaterial)
345  {}
346 
347  virtual ~IntegrationPoint() {};
348 
350  : mWeight(other.mWeight)
351  , mLocation(other.mLocation)
352  , mConstitutiveLaw(other.mConstitutiveLaw != NULL ? other.mConstitutiveLaw->Clone() : ConstitutiveLaw::Pointer())
353  {}
354 
356  {
357  if (this != &other) {
358  mWeight = other.mWeight;
359  mLocation = other.mLocation;
360  mConstitutiveLaw = other.mConstitutiveLaw != NULL ? other.mConstitutiveLaw->Clone() : ConstitutiveLaw::Pointer();
361  }
362  return *this;
363  }
364 
365  public:
366 
367  inline double GetWeight()const
368  {
369  return mWeight;
370  }
371  inline void SetWeight(double w)
372  {
373  mWeight = w;
374  }
375 
376  inline double GetLocation()const
377  {
378  return mLocation;
379  }
380  inline void SetLocation(double l)
381  {
382  mLocation = l;
383  }
384 
385  inline const ConstitutiveLaw::Pointer& GetConstitutiveLaw()const
386  {
387  return mConstitutiveLaw;
388  }
389  inline void SetConstitutiveLaw(const ConstitutiveLaw::Pointer& pLaw)
390  {
391  mConstitutiveLaw = pLaw;
392  }
393 
394  private:
395 
396  friend class Serializer;
397 
398  virtual void save(Serializer& rSerializer) const
399  {
400  rSerializer.save("W", mWeight);
401  rSerializer.save("L", mLocation);
402  rSerializer.save("CLaw", mConstitutiveLaw);
403  }
404 
405  virtual void load(Serializer& rSerializer)
406  {
407  rSerializer.load("W", mWeight);
408  rSerializer.load("L", mLocation);
409  rSerializer.load("CLaw", mConstitutiveLaw);
410  }
411  };
412 
413  class Ply
414  {
415 
416  public:
417 
418  typedef std::vector< IntegrationPoint > IntegrationPointCollection;
419 
420  private:
421 
422  int mPlyIndex;
423  IntegrationPointCollection mIntegrationPoints;
424 
425  public:
426 
427  Ply()
428  : mPlyIndex(0)
429  , mIntegrationPoints()
430  {}
431 
432  Ply(const int PlyIndex, int NumIntegrationPoints, const Properties& rProps)
433  : mPlyIndex(PlyIndex)
434  , mIntegrationPoints()
435  {
436  // make sure the number is greater than 0 and odd
437  KRATOS_ERROR_IF(NumIntegrationPoints < 1) << "Number of Integration points must be larger than 0!" << std::endl;
438  if (NumIntegrationPoints < 0) {
439  NumIntegrationPoints = -NumIntegrationPoints;
440  }
441  if (NumIntegrationPoints == 0) {
442  NumIntegrationPoints = 5;
443  }
444  if (NumIntegrationPoints % 2 == 0) {
445  NumIntegrationPoints += 1;
446  }
447  InitializeIntegrationPoints(rProps, NumIntegrationPoints);
448  }
449 
450  Ply(const Ply& other)
451  : mPlyIndex(other.mPlyIndex)
452  , mIntegrationPoints(other.mIntegrationPoints)
453  {}
454 
455  virtual ~Ply() {}
456 
457  Ply& operator = (const Ply& other)
458  {
459  if (this != &other) {
460  mPlyIndex = other.mPlyIndex;
461  mIntegrationPoints = other.mIntegrationPoints;
462  }
463  return *this;
464  }
465 
466  public:
467 
468  inline double GetThickness(const Properties& rProps) const
469  {
470  return ShellUtilities::GetThickness(rProps, mPlyIndex);
471  }
472 
473  inline double GetLocation(const Properties& rProps) const
474  {
475  double my_location(0.0);
476 
477  double current_location = ShellUtilities::GetThickness(rProps) * 0.5;
478  const double offset = GetOffset(rProps);
479 
480  for (int i=0; i<mPlyIndex+1; ++i) {
481  double ply_thickness = GetThickness(rProps);
482  my_location = current_location - ply_thickness*0.5 - offset;
483  current_location -= ply_thickness;
484  }
485  return my_location;
486  }
487 
494  inline double GetOrientationAngle(const Properties& rProps) const
495  {
496  return ShellUtilities::GetOrientationAngle(rProps, mPlyIndex);
497  }
498 
499  inline double GetOffset(const Properties& rProps) const
500  {
501  return ShellUtilities::GetOffset(rProps);
502  }
503 
504  void RecoverOrthotropicProperties(const IndexType currentPly, Properties& laminaProps);
505 
507  {
508  UpdateIntegrationPoints(rProps);
509  return mIntegrationPoints;
510  }
511 
512  inline double CalculateMassPerUnitArea(const Properties& rProps) const
513  {
514  return ShellUtilities::GetDensity(rProps, mPlyIndex) * GetThickness(rProps);
515  }
516 
517  inline IntegrationPointCollection::size_type NumberOfIntegrationPoints() const
518  {
519  return mIntegrationPoints.size();
520  }
521 
522  inline void SetConstitutiveLawAt(IntegrationPointCollection::size_type integrationPointID, const ConstitutiveLaw::Pointer& pNewConstitutiveLaw)
523  {
524  if (integrationPointID < mIntegrationPoints.size()) {
525  mIntegrationPoints[integrationPointID].SetConstitutiveLaw(pNewConstitutiveLaw);
526  }
527  }
528 
529  private:
530 
531  void InitializeIntegrationPoints(const Properties& rProps, const int NumIntegrationPoints)
532  {
533  KRATOS_TRY
534 
535  const ConstitutiveLaw::Pointer& pMaterial = rProps[CONSTITUTIVE_LAW];
536  KRATOS_ERROR_IF(pMaterial == nullptr) << "A Ply needs a constitutive law to be set. "
537  << "Missing constitutive law in property: " << rProps.Id() << std::endl;;
538 
539  // generate the integration points
540  mIntegrationPoints.clear();
541  mIntegrationPoints.resize(NumIntegrationPoints);
542  for (int i=0; i<NumIntegrationPoints; ++i) {
543  mIntegrationPoints[i].SetConstitutiveLaw(pMaterial->Clone());
544  }
545 
546  KRATOS_CATCH("")
547  }
548  void UpdateIntegrationPoints(const Properties& rProps)
549  {
550  KRATOS_TRY
551 
552  const SizeType num_int_points = mIntegrationPoints.size();
553 
554  // generate the weights (composite simpson rule)
555  Vector ip_w(num_int_points, 1.0);
556  if (num_int_points >= 3) {
557  for (IndexType i=1; i<num_int_points-1; ++i) {
558  double iw = (i % 2 == 0) ? 2.0 : 4.0;
559  ip_w(i) = iw;
560  }
561  ip_w /= sum(ip_w);
562  }
563 
564  // generate locations (direction: top(+thickness/2) to bottom(-thickness/2)
565  const double location = GetLocation(rProps);
566  const double thickness = GetThickness(rProps);
567 
568  Vector ip_loc(num_int_points, 0.0);
569  if (num_int_points >= 3) {
570  double loc_start = location + 0.5 * thickness;
571  double loc_incr = thickness / double(num_int_points-1);
572  for (IndexType i=0; i<num_int_points; ++i) {
573  ip_loc(i) = loc_start;
574  loc_start -= loc_incr;
575  }
576  }
577 
578  for (IndexType i=0; i<num_int_points; ++i) {
579  IntegrationPoint& r_int_point = mIntegrationPoints[i];
580  r_int_point.SetWeight(ip_w(i) * thickness);
581  r_int_point.SetLocation(ip_loc(i));
582  }
583 
584  KRATOS_CATCH("")
585  }
586 
587  private:
588 
589  friend class Serializer;
590 
591  virtual void save(Serializer& rSerializer) const
592  {
593  rSerializer.save("idx", mPlyIndex);
594  rSerializer.save("IntP", mIntegrationPoints);
595  }
596 
597  virtual void load(Serializer& rSerializer)
598  {
599  rSerializer.load("idx", mPlyIndex);
600  rSerializer.load("IntP", mIntegrationPoints);
601  }
602 
603  };
604 
605 protected:
606 
608  double DeterminantF;
610 
616 
622 
623  double GYZ;
624  double GXZ;
625 
630  };
631 
633 
634 public:
635 
638 
643 
649 
653  ~ShellCrossSection() override;
654 
656 
659 
665 
667 
670 
676  void BeginStack();
677 
688  void AddPly(const IndexType PlyIndex, int numPoints, const Properties& rProps);
689 
693  void EndStack();
694 
699  virtual std::string GetInfo(const Properties& rProps);
700 
705  virtual ShellCrossSection::Pointer Clone()const;
706 
712  virtual bool Has(const Variable<double>& rThisVariable);
713 
719  virtual bool Has(const Variable<Vector>& rThisVariable);
720 
726  virtual bool Has(const Variable<Matrix>& rThisVariable);
727 
734  virtual bool Has(const Variable<array_1d<double, 3 > >& rThisVariable);
735 
742  virtual bool Has(const Variable<array_1d<double, 6 > >& rThisVariable);
743 
750  virtual double& GetValue(const Variable<double>& rThisVariable, const Properties& rProps, double& rValue);
751 
758  virtual Vector& GetValue(const Variable<Vector>& rThisVariable, Vector& rValue);
759 
765  virtual Matrix& GetValue(const Variable<Matrix>& rThisVariable, Matrix& rValue);
766 
774  array_1d<double, 3 >& rValue);
775 
783  array_1d<double, 6 >& rValue);
784 
791  virtual void SetValue(const Variable<double>& rVariable,
792  const double& rValue,
793  const ProcessInfo& rCurrentProcessInfo);
794 
801  virtual void SetValue(const Variable<Vector >& rVariable,
802  const Vector& rValue,
803  const ProcessInfo& rCurrentProcessInfo);
804 
811  virtual void SetValue(const Variable<Matrix >& rVariable,
812  const Matrix& rValue,
813  const ProcessInfo& rCurrentProcessInfo);
814 
821  virtual void SetValue(const Variable<array_1d<double, 3 > >& rVariable,
822  const array_1d<double, 3 >& rValue,
823  const ProcessInfo& rCurrentProcessInfo);
824 
831  virtual void SetValue(const Variable<array_1d<double, 6 > >& rVariable,
832  const array_1d<double, 6 >& rValue,
833  const ProcessInfo& rCurrentProcessInfo);
834 
843  virtual bool ValidateInput(const Properties& rMaterialProperties);
844 
853  virtual void InitializeCrossSection(const Properties& rMaterialProperties,
854  const GeometryType& rElementGeometry,
855  const Vector& rShapeFunctionsValues);
856 
865  virtual void InitializeSolutionStep(const Properties& rMaterialProperties,
866  const GeometryType& rElementGeometry,
867  const Vector& rShapeFunctionsValues,
868  const ProcessInfo& rCurrentProcessInfo);
869 
878  virtual void FinalizeSolutionStep(const Properties& rMaterialProperties,
879  const GeometryType& rElementGeometry,
880  const Vector& rShapeFunctionsValues,
881  const ProcessInfo& rCurrentProcessInfo);
882 
891  virtual void InitializeNonLinearIteration(const Properties& rMaterialProperties,
892  const GeometryType& rElementGeometry,
893  const Vector& rShapeFunctionsValues,
894  const ProcessInfo& rCurrentProcessInfo);
895 
904  virtual void FinalizeNonLinearIteration(const Properties& rMaterialProperties,
905  const GeometryType& rElementGeometry,
906  const Vector& rShapeFunctionsValues,
907  const ProcessInfo& rCurrentProcessInfo);
908 
915  virtual void CalculateSectionResponse(SectionParameters& rValues, const ConstitutiveLaw::StressMeasure& rStressMeasure);
916 
923  virtual void FinalizeSectionResponse(SectionParameters& rValues, const ConstitutiveLaw::StressMeasure& rStressMeasure);
924 
932  virtual void ResetCrossSection(const Properties& rMaterialProperties,
933  const GeometryType& rElementGeometry,
934  const Vector& rShapeFunctionsValues);
935 
945  virtual int Check(const Properties& rMaterialProperties,
946  const GeometryType& rElementGeometry,
947  const ProcessInfo& rCurrentProcessInfo);
948 
955  inline void GetRotationMatrixForGeneralizedStrains(double radians, Matrix& T)
956  {
957  double c = std::cos(radians);
958  double s = std::sin(radians);
959 
960  SizeType strain_size = GetStrainSize();
961 
962  if (T.size1() != strain_size || T.size2() != strain_size) {
963  T.resize(strain_size, strain_size, false);
964  }
966 
967  T(0, 0) = c * c;
968  T(0, 1) = s * s;
969  T(0, 2) = - s * c;
970  T(1, 0) = s * s;
971  T(1, 1) = c * c;
972  T(1, 2) = s * c;
973  T(2, 0) = 2.0 * s * c;
974  T(2, 1) = - 2.0 * s * c;
975  T(2, 2) = c * c - s * s;
976 
977  project(T, range(3, 6), range(3, 6)) = project(T, range(0, 3), range(0, 3));
978 
979  if (strain_size == 8) {
980  T(6, 6) = c;
981  T(6, 7) = s;
982  T(7, 6) = - s;
983  T(7, 7) = c;
984  }
985  }
986 
993  inline void GetRotationMatrixForCondensedStrains(double radians, Matrix& T)
994  {
995  SizeType strain_size = GetCondensedStrainSize();
996 
997  if (T.size1() != strain_size || T.size2() != strain_size) {
998  T.resize(strain_size, strain_size, false);
999  }
1001 
1002  T(0, 0) = 1.0; // condensed strain E.zz is always at index 0
1003 
1004  if (strain_size == 3) { // if section is thin the condensed strains are (in order): E.zz E.yz E.xz
1005  double c = std::cos(radians);
1006  double s = std::sin(radians);
1007 
1008  T(1, 1) = c;
1009  T(1, 2) = s;
1010  T(2, 1) = - s;
1011  T(2, 2) = c;
1012  }
1013  }
1014 
1021  inline void GetRotationMatrixForGeneralizedStresses(double radians, Matrix& T)
1022  {
1023  double c = std::cos(radians);
1024  double s = std::sin(radians);
1025 
1026  SizeType strain_size = GetStrainSize();
1027 
1028  if (T.size1() != strain_size || T.size2() != strain_size) {
1029  T.resize(strain_size, strain_size, false);
1030  }
1032 
1033  T(0, 0) = c * c;
1034  T(0, 1) = s * s;
1035  T(0, 2) = - 2.0 * s * c;
1036  T(1, 0) = s * s;
1037  T(1, 1) = c * c;
1038  T(1, 2) = 2.0 * s * c;
1039  T(2, 0) = s * c;
1040  T(2, 1) = - s * c;
1041  T(2, 2) = c * c - s * s;
1042 
1043  project(T, range(3, 6), range(3, 6)) = project(T, range(0, 3), range(0, 3));
1044 
1045  if (strain_size == 8) {
1046  T(6, 6) = c;
1047  T(6, 7) = s;
1048  T(7, 6) = - s;
1049  T(7, 7) = c;
1050  }
1051  }
1052 
1059  inline void GetRotationMatrixForCondensedStresses(double radians, Matrix& T)
1060  {
1061  SizeType strain_size = GetCondensedStrainSize();
1062 
1063  if (T.size1() != strain_size || T.size2() != strain_size) {
1064  T.resize(strain_size, strain_size, false);
1065  }
1067 
1068  T(0, 0) = 1.0; // condensed stresse S.zz is always at index 0
1069 
1070  if (strain_size == 3) { // if section is thin the condensed stresses are (in order): S.zz S.yz S.xz
1071  double c = std::cos(radians);
1072  double s = std::sin(radians);
1073 
1074  T(1, 1) = c;
1075  T(1, 2) = s;
1076  T(2, 1) = - s;
1077  T(2, 2) = c;
1078  }
1079  }
1080 
1082 
1083 public:
1084 
1087 
1092  inline double GetThickness(const Properties& rProps) const
1093  {
1094  double thickness = 0.0;
1095  for (const auto& r_ply : mStack) {
1096  thickness += r_ply.GetThickness(rProps);
1097  }
1098  return thickness;
1099  }
1100 
1108  inline double GetOffset(const Properties& rProps) const
1109  {
1110  KRATOS_DEBUG_ERROR_IF(mStack.size() == 0) << "no plies available!" << std::endl;
1111  return mStack[0].GetOffset(rProps);
1112  }
1113 
1117  void GetPlyThicknesses(const Properties& rProps, Vector& rPlyThicknesses)
1118  {
1119  KRATOS_DEBUG_ERROR_IF_NOT(mStack.size() == rPlyThicknesses.size()) << "Size mismatch!" << std::endl;
1120  for (IndexType i_ply=0; i_ply<mStack.size(); ++i_ply) {
1121  rPlyThicknesses[i_ply] = mStack[i_ply].GetThickness(rProps);
1122  }
1123  }
1124 
1129  {
1130  // This function must be called before requesting un-integrated
1131  // constitutive matrices for each ply!
1132  mStorePlyConstitutiveMatrices = true;
1133  mPlyConstitutiveMatrices = std::vector<Matrix>(this->NumberOfPlies());
1134 
1135  for (IndexType ply = 0; ply < this->NumberOfPlies(); ++ply) {
1136  if (mBehavior == Thick) {
1137  mPlyConstitutiveMatrices[ply].resize(8, 8, false);
1138  } else {
1139  mPlyConstitutiveMatrices[ply].resize(6, 6, false);
1140  }
1141 
1142  mPlyConstitutiveMatrices[ply].clear();
1143  }
1144  }
1145 
1150  {
1151  return mPlyConstitutiveMatrices[PlyIndex];
1152  }
1153 
1158  inline SizeType NumberOfPlies() const
1159  {
1160  return mStack.size();
1161  }
1162 
1168  inline SizeType NumberOfIntegrationPointsAt(const IndexType PlyIndex) const
1169  {
1170  if (PlyIndex < mStack.size()) {
1171  return mStack[PlyIndex].NumberOfIntegrationPoints();
1172  }
1173  return 0;
1174  }
1175 
1181  inline void SetConstitutiveLawAt(const IndexType PlyIndex, SizeType point_id, const ConstitutiveLaw::Pointer& pNewConstitutiveLaw)
1182  {
1183  if (PlyIndex < mStack.size()) {
1184  mStack[PlyIndex].SetConstitutiveLawAt(point_id, pNewConstitutiveLaw);
1185  }
1186  }
1187 
1192  inline double CalculateMassPerUnitArea(const Properties& rProps) const
1193  {
1194  double vol(0.0);
1195  for (const auto& r_ply : mStack) {
1196  vol += r_ply.CalculateMassPerUnitArea(rProps);
1197  }
1198  return vol;
1199  }
1200 
1205  inline double CalculateAvarageDensity(const Properties& rProps) const
1206  {
1207  return CalculateMassPerUnitArea(rProps) / GetThickness(rProps);
1208  }
1209 
1216  inline double GetOrientationAngle() const
1217  {
1218  return mOrientation;
1219  }
1220 
1226  inline void SetOrientationAngle(const double Radians)
1227  {
1228  mOrientation = Radians;
1229  }
1230 
1236  {
1237  return mBehavior;
1238  }
1239 
1245  {
1246  mBehavior = behavior;
1247  }
1248 
1255  {
1256  return (mBehavior == Thick) ? 8 : 6;
1257  }
1258 
1265  {
1266  return (mBehavior == Thick) ? 1 : 3;
1267  }
1268 
1273  inline double GetDrillingStiffness() const
1274  {
1275  return mDrillingPenalty;
1276  }
1277 
1278  std::vector<ConstitutiveLaw::Pointer> GetConstitutiveLawsVector(const Properties& rProps);
1279 
1283  void ParseOrthotropicPropertyMatrix(const Properties& pProps);
1284 
1288  void GetLaminaeOrientation(const Properties& pProps, Vector& rOrientation_Vector);
1289 
1293  void GetLaminaeStrengths(std::vector<Matrix>& rLamina_Strengths, const Properties& rProps);
1295 
1296 private:
1297 
1300 
1301  void InitializeParameters(SectionParameters& rValues, ConstitutiveLaw::Parameters& rMaterialValues, GeneralVariables& rVariables);
1302 
1303  void UpdateIntegrationPointParameters(const IntegrationPoint& rPoint, ConstitutiveLaw::Parameters& rMaterialValues, GeneralVariables& rVariables);
1304 
1305  void CalculateIntegrationPointResponse(const IntegrationPoint& rPoint,
1306  ConstitutiveLaw::Parameters& rMaterialValues,
1307  SectionParameters& rValues,
1308  GeneralVariables& rVariables,
1309  const ConstitutiveLaw::StressMeasure& rStressMeasure,
1310  const unsigned int& plyNumber);
1311 
1317  void PrivateCopy(const ShellCrossSection& other);
1318 
1320 
1321 public:
1322 
1325 
1327 
1328 private:
1329 
1332 
1333  PlyCollection mStack;
1334  bool mEditingStack;
1335  bool mHasDrillingPenalty;
1336  double mDrillingPenalty;
1337  double mOrientation;
1338  SectionBehaviorType mBehavior;
1339  bool mInitialized;
1340  bool mNeedsOOPCondensation;
1341  Vector mOOP_CondensedStrains;
1342  Vector mOOP_CondensedStrains_converged;
1343  bool mStorePlyConstitutiveMatrices = false;
1344  std::vector<Matrix> mPlyConstitutiveMatrices;
1345 
1347 
1350 
1351  friend class Serializer;
1352 
1353  void save(Serializer& rSerializer) const override
1354  {
1356  rSerializer.save("stack", mStack);
1357  rSerializer.save("edit", mEditingStack);
1358  rSerializer.save("dr", mHasDrillingPenalty);
1359  rSerializer.save("bdr", mDrillingPenalty);
1360  rSerializer.save("or", mOrientation);
1361 
1362  rSerializer.save("behav", (int)mBehavior);
1363 
1364  rSerializer.save("init", mInitialized);
1365  rSerializer.save("hasOOP", mNeedsOOPCondensation);
1366  rSerializer.save("OOP_eps", mOOP_CondensedStrains);
1367  rSerializer.save("OOP_eps_conv", mOOP_CondensedStrains_converged);
1368  rSerializer.save("store_ply_mat", mStorePlyConstitutiveMatrices);
1369  rSerializer.save("ply_mat", mPlyConstitutiveMatrices);
1370  }
1371 
1372  void load(Serializer& rSerializer) override
1373  {
1374  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Flags);
1375  rSerializer.load("stack", mStack);
1376  rSerializer.load("edit", mEditingStack);
1377  rSerializer.load("dr", mHasDrillingPenalty);
1378  rSerializer.load("bdr", mDrillingPenalty);
1379  rSerializer.load("or", mOrientation);
1380 
1381  int temp;
1382  rSerializer.load("behav", temp);
1383  mBehavior = (SectionBehaviorType)temp;
1384 
1385  rSerializer.load("init", mInitialized);
1386  rSerializer.load("hasOOP", mNeedsOOPCondensation);
1387  rSerializer.load("OOP_eps", mOOP_CondensedStrains);
1388  rSerializer.load("OOP_eps_conv", mOOP_CondensedStrains_converged);
1389  rSerializer.load("store_ply_mat", mStorePlyConstitutiveMatrices);
1390  rSerializer.load("ply_mat", mPlyConstitutiveMatrices);
1391  }
1392 
1394 
1395 };
1396 
1399 
1400 inline std::istream& operator >> (std::istream& rIStream, ShellCrossSection& rThis);
1401 
1402 inline std::ostream& operator << (std::ostream& rOStream, ShellCrossSection& rThis)
1403 {
1404  return rOStream; // << rThis.GetInfo();
1405 }
1406 
1408 
1409 }
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: constitutive_law.h:47
StressMeasure
Definition: constitutive_law.h:69
Definition: flags.h:58
std::size_t IndexType
Definition: flags.h:74
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
void Reset(const Flags ThisFlag)
Definition: flags.h:193
Geometry base class.
Definition: geometry.h:71
IndexType Id() const
Definition: indexed_object.h:107
Short class definition.
Definition: integration_point.h:52
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
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
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
Definition: shell_cross_section.hpp:232
IntegrationPoint()
Definition: shell_cross_section.hpp:335
double GetWeight() const
Definition: shell_cross_section.hpp:367
double GetLocation() const
Definition: shell_cross_section.hpp:376
IntegrationPoint(double location, double weight, const ConstitutiveLaw::Pointer pMaterial)
Definition: shell_cross_section.hpp:341
void SetLocation(double l)
Definition: shell_cross_section.hpp:380
void SetConstitutiveLaw(const ConstitutiveLaw::Pointer &pLaw)
Definition: shell_cross_section.hpp:389
const ConstitutiveLaw::Pointer & GetConstitutiveLaw() const
Definition: shell_cross_section.hpp:385
void SetWeight(double w)
Definition: shell_cross_section.hpp:371
IntegrationPoint(const IntegrationPoint &other)
Definition: shell_cross_section.hpp:349
virtual ~IntegrationPoint()
Definition: shell_cross_section.hpp:347
Definition: shell_cross_section.hpp:302
double GetThickness(const Properties &rProps) const
Definition: shell_cross_section.hpp:468
virtual ~Ply()
Definition: shell_cross_section.hpp:455
Ply(const int PlyIndex, int NumIntegrationPoints, const Properties &rProps)
Definition: shell_cross_section.hpp:432
Ply(const Ply &other)
Definition: shell_cross_section.hpp:450
double GetOffset(const Properties &rProps) const
Definition: shell_cross_section.hpp:499
double GetOrientationAngle(const Properties &rProps) const
Definition: shell_cross_section.hpp:494
Ply()
Definition: shell_cross_section.hpp:427
void SetConstitutiveLawAt(IntegrationPointCollection::size_type integrationPointID, const ConstitutiveLaw::Pointer &pNewConstitutiveLaw)
Definition: shell_cross_section.hpp:522
IntegrationPointCollection & GetIntegrationPoints(const Properties &rProps)
Definition: shell_cross_section.hpp:506
IntegrationPointCollection::size_type NumberOfIntegrationPoints() const
Definition: shell_cross_section.hpp:517
double GetLocation(const Properties &rProps) const
Definition: shell_cross_section.hpp:473
std::vector< IntegrationPoint > IntegrationPointCollection
Definition: shell_cross_section.hpp:418
double CalculateMassPerUnitArea(const Properties &rProps) const
Definition: shell_cross_section.hpp:512
SectionParameters.
Definition: shell_cross_section.hpp:101
void SetShapeFunctionsDerivatives(const Matrix &rShapeFunctionsDerivatives)
Definition: shell_cross_section.hpp:255
void SetOptions(const Flags &rOptions)
Definition: shell_cross_section.hpp:233
Vector & GetGeneralizedStressVector()
Definition: shell_cross_section.hpp:289
Vector & GetGeneralizedStrainVector()
Definition: shell_cross_section.hpp:285
const Properties & GetMaterialProperties()
Definition: shell_cross_section.hpp:310
SectionParameters()
Definition: shell_cross_section.hpp:122
bool CheckMechanicalVariables()
Definition: shell_cross_section.hpp:199
void SetConstitutiveMatrix(Matrix &rConstitutiveMatrix)
Definition: shell_cross_section.hpp:246
void SetGeneralizedStressVector(Vector &rGeneralizedStressVector)
Definition: shell_cross_section.hpp:242
Flags & GetOptions()
Definition: shell_cross_section.hpp:280
const Matrix & GetShapeFunctionsDerivatives()
Definition: shell_cross_section.hpp:302
void SetShapeFunctionsValues(const Vector &rShapeFunctionsValues)
Definition: shell_cross_section.hpp:251
const ProcessInfo & GetProcessInfo()
Definition: shell_cross_section.hpp:306
void Set(const Flags ThisFlag)
Definition: shell_cross_section.hpp:224
Matrix & GetConstitutiveMatrix()
Definition: shell_cross_section.hpp:293
SectionParameters(const SectionParameters &rNewParameters)
Definition: shell_cross_section.hpp:146
void SetProcessInfo(const ProcessInfo &rProcessInfo)
Definition: shell_cross_section.hpp:259
bool CheckInfoMaterialGeometry()
Definition: shell_cross_section.hpp:179
bool CheckShapeFunctions()
Definition: shell_cross_section.hpp:163
void Reset(const Flags ThisFlag)
Definition: shell_cross_section.hpp:228
void SetElementGeometry(const GeometryType &rElementGeometry)
Definition: shell_cross_section.hpp:267
SectionParameters(const GeometryType &rElementGeometry, const Properties &rMaterialProperties, const ProcessInfo &rCurrentProcessInfo)
Definition: shell_cross_section.hpp:133
const Vector & GetShapeFunctionsValues()
Definition: shell_cross_section.hpp:298
void SetMaterialProperties(const Properties &rMaterialProperties)
Definition: shell_cross_section.hpp:263
const GeometryType & GetElementGeometry()
Definition: shell_cross_section.hpp:314
void SetGeneralizedStrainVector(Vector &rGeneralizedStrainVector)
Definition: shell_cross_section.hpp:238
void SetStenbergShearStabilization(const double &StenbergShearStabilization)
Definition: shell_cross_section.hpp:271
double GetStenbergShearStabilization()
Definition: shell_cross_section.hpp:318
ShellCrossSection.
Definition: shell_cross_section.hpp:45
SizeType NumberOfIntegrationPointsAt(const IndexType PlyIndex) const
Definition: shell_cross_section.hpp:1168
SectionBehaviorType
Definition: shell_cross_section.hpp:68
virtual void ResetCrossSection(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const Vector &rShapeFunctionsValues)
void GetRotationMatrixForCondensedStresses(double radians, Matrix &T)
Definition: shell_cross_section.hpp:1059
virtual array_1d< double, 3 > & GetValue(const Variable< array_1d< double, 3 > > &rVariable, array_1d< double, 3 > &rValue)
SectionBehaviorType GetSectionBehavior() const
Definition: shell_cross_section.hpp:1235
std::vector< Ply > PlyCollection
Definition: shell_cross_section.hpp:54
virtual Matrix & GetValue(const Variable< Matrix > &rThisVariable, Matrix &rValue)
double GetOffset(const Properties &rProps) const
Definition: shell_cross_section.hpp:1108
virtual bool ValidateInput(const Properties &rMaterialProperties)
virtual bool Has(const Variable< Vector > &rThisVariable)
virtual void FinalizeSolutionStep(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const Vector &rShapeFunctionsValues, const ProcessInfo &rCurrentProcessInfo)
KRATOS_CLASS_POINTER_DEFINITION(ShellCrossSection)
void SetupGetPlyConstitutiveMatrices()
Definition: shell_cross_section.hpp:1128
ShellCrossSection(const ShellCrossSection &other)
virtual void InitializeNonLinearIteration(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const Vector &rShapeFunctionsValues, const ProcessInfo &rCurrentProcessInfo)
virtual int Check(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const ProcessInfo &rCurrentProcessInfo)
virtual array_1d< double, 6 > & GetValue(const Variable< array_1d< double, 6 > > &rVariable, array_1d< double, 6 > &rValue)
virtual void SetValue(const Variable< array_1d< double, 6 > > &rVariable, const array_1d< double, 6 > &rValue, const ProcessInfo &rCurrentProcessInfo)
void GetRotationMatrixForCondensedStrains(double radians, Matrix &T)
Definition: shell_cross_section.hpp:993
Matrix GetPlyConstitutiveMatrix(const IndexType PlyIndex)
Definition: shell_cross_section.hpp:1149
virtual void SetValue(const Variable< array_1d< double, 3 > > &rVariable, const array_1d< double, 3 > &rValue, const ProcessInfo &rCurrentProcessInfo)
virtual Vector & GetValue(const Variable< Vector > &rThisVariable, Vector &rValue)
virtual bool Has(const Variable< array_1d< double, 6 > > &rThisVariable)
double CalculateAvarageDensity(const Properties &rProps) const
Definition: shell_cross_section.hpp:1205
virtual bool Has(const Variable< Matrix > &rThisVariable)
SizeType GetCondensedStrainSize()
Definition: shell_cross_section.hpp:1264
SizeType GetStrainSize()
Definition: shell_cross_section.hpp:1254
virtual ShellCrossSection::Pointer Clone() const
double GetThickness(const Properties &rProps) const
Definition: shell_cross_section.hpp:1092
SizeType NumberOfPlies() const
Definition: shell_cross_section.hpp:1158
virtual bool Has(const Variable< array_1d< double, 3 > > &rThisVariable)
Geometry< Node > GeometryType
Definition: shell_cross_section.hpp:52
void SetOrientationAngle(const double Radians)
Definition: shell_cross_section.hpp:1226
void GetRotationMatrixForGeneralizedStrains(double radians, Matrix &T)
Definition: shell_cross_section.hpp:955
double GetOrientationAngle() const
Definition: shell_cross_section.hpp:1216
virtual void SetValue(const Variable< Vector > &rVariable, const Vector &rValue, const ProcessInfo &rCurrentProcessInfo)
virtual void InitializeSolutionStep(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const Vector &rShapeFunctionsValues, const ProcessInfo &rCurrentProcessInfo)
virtual void SetValue(const Variable< double > &rVariable, const double &rValue, const ProcessInfo &rCurrentProcessInfo)
void SetConstitutiveLawAt(const IndexType PlyIndex, SizeType point_id, const ConstitutiveLaw::Pointer &pNewConstitutiveLaw)
Definition: shell_cross_section.hpp:1181
void SetSectionBehavior(SectionBehaviorType behavior)
Definition: shell_cross_section.hpp:1244
void GetRotationMatrixForGeneralizedStresses(double radians, Matrix &T)
Definition: shell_cross_section.hpp:1021
virtual void FinalizeNonLinearIteration(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const Vector &rShapeFunctionsValues, const ProcessInfo &rCurrentProcessInfo)
virtual void SetValue(const Variable< Matrix > &rVariable, const Matrix &rValue, const ProcessInfo &rCurrentProcessInfo)
void GetPlyThicknesses(const Properties &rProps, Vector &rPlyThicknesses)
Definition: shell_cross_section.hpp:1117
double GetDrillingStiffness() const
Definition: shell_cross_section.hpp:1273
std::size_t SizeType
Definition: shell_cross_section.hpp:56
virtual bool Has(const Variable< double > &rThisVariable)
virtual void InitializeCrossSection(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const Vector &rShapeFunctionsValues)
double CalculateMassPerUnitArea(const Properties &rProps) const
Definition: shell_cross_section.hpp:1192
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#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
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
#define KRATOS_DEBUG_ERROR_IF_NOT(conditional)
Definition: exception.h:172
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
double GetThickness(const Properties &rProps)
Definition: shell_utilities.cpp:197
double GetOrientationAngle(const Properties &rProps, const IndexType Index)
Definition: shell_utilities.cpp:234
double GetDensity(const Properties &rProps, const IndexType Index)
Definition: shell_utilities.cpp:223
double GetOffset(const Properties &rProps)
Definition: shell_utilities.cpp:251
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
TExpressionType::data_type sum(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:675
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
w
Definition: generate_convection_diffusion_explicit_element.py:108
int strain_size
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:16
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
def load(f)
Definition: ode_solve.py:307
Definition: project.py:1
float temp
Definition: rotating_cone.py:85
thickness
Definition: sp_statistics.py:14
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
Definition: constitutive_law.h:189
Definition: shell_cross_section.hpp:607
double GYZ
Definition: shell_cross_section.hpp:623
Matrix DeformationGradientF0_2D
Definition: shell_cross_section.hpp:615
Matrix ConstitutiveMatrix_2D
Definition: shell_cross_section.hpp:613
Matrix DeformationGradientF_2D
Definition: shell_cross_section.hpp:614
Vector StressVector_2D
Definition: shell_cross_section.hpp:612
Vector CondensedStressVector
Definition: shell_cross_section.hpp:629
double GXZ
Definition: shell_cross_section.hpp:624
Matrix LT
Definition: shell_cross_section.hpp:628
Matrix H
Definition: shell_cross_section.hpp:626
Matrix DeformationGradientF_3D
Definition: shell_cross_section.hpp:620
Matrix L
Definition: shell_cross_section.hpp:627
Matrix DeformationGradientF0_3D
Definition: shell_cross_section.hpp:621
Vector StressVector_3D
Definition: shell_cross_section.hpp:618
double DeterminantF0
Definition: shell_cross_section.hpp:609
double DeterminantF
Definition: shell_cross_section.hpp:608
Vector StrainVector_2D
Definition: shell_cross_section.hpp:611
Matrix ConstitutiveMatrix_3D
Definition: shell_cross_section.hpp:619
Vector StrainVector_3D
Definition: shell_cross_section.hpp:617