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 //
2 // Project Name: KratosSolidMechanicsApplication $
3 // Created by: $Author: Massimo Petracca $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: January 2014 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(SHELL_CROSS_SECTION_H_INCLUDED)
11 #define SHELL_CROSS_SECTION_H_INCLUDED
12 
13 
14 // System includes
15 #include <string>
16 #include <iostream>
17 
18 // Project includes
19 #include "includes/define.h"
20 #include "includes/serializer.h"
22 #include "containers/flags.h"
23 #include "custom_utilities/properties_extensions.hpp"
24 #include "custom_utilities/solid_mechanics_math_utilities.hpp"
25 
26 namespace Kratos
27 {
28 
44 class KRATOS_API(SOLID_MECHANICS_APPLICATION) ShellCrossSection : public Flags
45 {
46 
47 public:
48 
49  class Ply;
50 
52 
54 
55  typedef std::vector< Ply > PlyCollection;
56 
57  typedef std::size_t SizeType;
58 
60 
63 
68  {
70  Thin
71  };
72 
74 
77 
78  struct Features
79  {
81  double mStrainSize;
83  std::vector< ConstitutiveLaw::StrainMeasure > mStrainMeasures;
84  };
85 
86  class Parameters
87  {
88 
89  private:
90 
91  Flags mOptions;
92 
93  Vector* mpGeneralizedStrainVector;
94  Vector* mpGeneralizedStressVector;
95  Matrix* mpConstitutiveMatrix;
96 
97  const Vector* mpShapeFunctionsValues;
98  const Matrix* mpShapeFunctionsDerivatives;
99  const ProcessInfo* mpCurrentProcessInfo;
100  const Properties* mpMaterialProperties;
101  const GeometryType* mpElementGeometry;
102 
103  public:
104 
106  : mpGeneralizedStrainVector(NULL)
107  , mpGeneralizedStressVector(NULL)
108  , mpConstitutiveMatrix(NULL)
109  , mpShapeFunctionsValues(NULL)
110  , mpShapeFunctionsDerivatives(NULL)
111  , mpCurrentProcessInfo(NULL)
112  , mpMaterialProperties(NULL)
113  , mpElementGeometry(NULL)
114  {}
115 
116  Parameters (const GeometryType& rElementGeometry,
117  const Properties& rMaterialProperties,
118  const ProcessInfo& rCurrentProcessInfo)
119  : mpGeneralizedStrainVector(NULL)
120  , mpGeneralizedStressVector(NULL)
121  , mpConstitutiveMatrix(NULL)
122  , mpShapeFunctionsValues(NULL)
123  , mpShapeFunctionsDerivatives(NULL)
124  , mpCurrentProcessInfo(&rCurrentProcessInfo)
125  , mpMaterialProperties(&rMaterialProperties)
126  , mpElementGeometry(&rElementGeometry)
127  {}
128 
129  Parameters (const Parameters & rNewParameters)
130  : mOptions(rNewParameters.mOptions)
131  , mpGeneralizedStrainVector(rNewParameters.mpGeneralizedStrainVector)
132  , mpGeneralizedStressVector(rNewParameters.mpGeneralizedStressVector)
133  , mpConstitutiveMatrix(rNewParameters.mpConstitutiveMatrix)
134  , mpShapeFunctionsValues(rNewParameters.mpShapeFunctionsValues)
135  , mpShapeFunctionsDerivatives(rNewParameters.mpShapeFunctionsDerivatives)
136  , mpCurrentProcessInfo(rNewParameters.mpCurrentProcessInfo)
137  , mpMaterialProperties(rNewParameters.mpMaterialProperties)
138  , mpElementGeometry(rNewParameters.mpElementGeometry)
139  {}
140 
141  public:
142 
147  {
148  if(!mpShapeFunctionsValues)
149  KRATOS_THROW_ERROR(std::invalid_argument,"ShapeFunctionsValues NOT SET","");
150 
151  if(!mpShapeFunctionsDerivatives)
152  KRATOS_THROW_ERROR(std::invalid_argument,"ShapeFunctionsDerivatives NOT SET","");
153 
154  return 1;
155  }
156 
161  {
162  if(!mpCurrentProcessInfo)
163  KRATOS_THROW_ERROR(std::invalid_argument,"CurrentProcessInfo NOT SET","");
164 
165  if(!mpMaterialProperties)
166  KRATOS_THROW_ERROR(std::invalid_argument,"MaterialProperties NOT SET","");
167 
168  if(!mpElementGeometry)
169  KRATOS_THROW_ERROR(std::invalid_argument,"ElementGeometry NOT SET","");
170 
171  return 1;
172  }
173 
178  {
179  if(!mpGeneralizedStrainVector)
180  KRATOS_THROW_ERROR(std::invalid_argument,"GenralizedStrainVector NOT SET","");
181 
182  if(!mpGeneralizedStressVector)
183  KRATOS_THROW_ERROR(std::invalid_argument,"GenralizedStressVector NOT SET","");
184 
185  if(!mpConstitutiveMatrix)
186  KRATOS_THROW_ERROR(std::invalid_argument,"ConstitutiveMatrix NOT SET","");
187 
188  return 1;
189  }
190 
199  void Set (Flags ThisFlag) {mOptions.Set(ThisFlag);};
200  void Reset (Flags ThisFlag) {mOptions.Reset(ThisFlag);};
201 
202  void SetOptions (const Flags& rOptions) {mOptions=rOptions;};
203 
204  void SetGeneralizedStrainVector (Vector& rGeneralizedStrainVector) {mpGeneralizedStrainVector=&rGeneralizedStrainVector;};
205  void SetGeneralizedStressVector (Vector& rGeneralizedStressVector) {mpGeneralizedStressVector=&rGeneralizedStressVector;};
206  void SetConstitutiveMatrix (Matrix& rConstitutiveMatrix) {mpConstitutiveMatrix =&rConstitutiveMatrix;};
207 
208  void SetShapeFunctionsValues (const Vector& rShapeFunctionsValues) {mpShapeFunctionsValues=&rShapeFunctionsValues;};
209  void SetShapeFunctionsDerivatives (const Matrix& rShapeFunctionsDerivatives) {mpShapeFunctionsDerivatives=&rShapeFunctionsDerivatives;};
210  void SetProcessInfo (const ProcessInfo& rProcessInfo) {mpCurrentProcessInfo =&rProcessInfo;};
211  void SetMaterialProperties (const Properties& rMaterialProperties) {mpMaterialProperties =&rMaterialProperties;};
212  void SetElementGeometry (const GeometryType& rElementGeometry) {mpElementGeometry =&rElementGeometry;};
213 
218  Flags& GetOptions () {return mOptions;};
219 
220  Vector& GetGeneralizedStrainVector () {return *mpGeneralizedStrainVector;};
221  Vector& GetGeneralizedStressVector () {return *mpGeneralizedStressVector;};
222  Matrix& GetConstitutiveMatrix () {return *mpConstitutiveMatrix;};
223 
224  const Vector& GetShapeFunctionsValues () {return *mpShapeFunctionsValues;};
225  const Matrix& GetShapeFunctionsDerivatives () {return *mpShapeFunctionsDerivatives;};
226  const ProcessInfo& GetProcessInfo () {return *mpCurrentProcessInfo;};
227  const Properties& GetMaterialProperties () {return *mpMaterialProperties;};
228  const GeometryType& GetElementGeometry () {return *mpElementGeometry;};
229  };
230 
232  {
233 
234  private:
235 
236  double mWeight;
237  double mLocation;
238  ConstitutiveLaw::Pointer mConstitutiveLaw;
239 
240  public:
241 
243  : mWeight(0.0)
244  , mLocation(0.0)
245  , mConstitutiveLaw(ConstitutiveLaw::Pointer())
246  {}
247 
248  IntegrationPoint(double location, double weight, const ConstitutiveLaw::Pointer pMaterial)
249  : mWeight(weight)
250  , mLocation(location)
251  , mConstitutiveLaw(pMaterial)
252  {}
253 
255  : mWeight(other.mWeight)
256  , mLocation(other.mLocation)
257  , mConstitutiveLaw(other.mConstitutiveLaw != NULL ? other.mConstitutiveLaw->Clone() : ConstitutiveLaw::Pointer())
258  {}
259 
261  if(this != &other) {
262  mWeight = other.mWeight;
263  mLocation = other.mLocation;
264  mConstitutiveLaw = other.mConstitutiveLaw != NULL ? other.mConstitutiveLaw->Clone() : ConstitutiveLaw::Pointer();
265  }
266  return *this;
267  }
268 
269  virtual ~IntegrationPoint(){};
270 
271  public:
272 
273  inline double GetWeight()const { return mWeight; }
274  inline void SetWeight(double w) { mWeight = w; }
275 
276  inline double GetLocation()const { return mLocation; }
277  inline void SetLocation(double l) { mLocation = l; }
278 
279  inline const ConstitutiveLaw::Pointer& GetConstitutiveLaw()const { return mConstitutiveLaw; }
280  inline void SetConstitutiveLaw(const ConstitutiveLaw::Pointer& pLaw) { mConstitutiveLaw = pLaw; }
281 
282  private:
283 
284  friend class Serializer;
285 
286  virtual void save(Serializer& rSerializer) const
287  {
288  rSerializer.save("W", mWeight);
289  rSerializer.save("L", mLocation);
290  rSerializer.save("CLaw", mConstitutiveLaw);
291  }
292 
293  virtual void load(Serializer& rSerializer)
294  {
295  rSerializer.load("W", mWeight);
296  rSerializer.load("L", mLocation);
297  rSerializer.load("CLaw", mConstitutiveLaw);
298  }
299  };
300 
301  class Ply
302  {
303 
304  public:
305 
306  typedef std::vector< IntegrationPoint > IntegrationPointCollection;
307 
308  private:
309 
310  double mThickness;
311  double mLocation;
312  double mOrientationAngle;
313  IntegrationPointCollection mIntegrationPoints;
314  Properties::Pointer mpProperties;
315 
316  public:
317 
318  Ply()
319  : mThickness(0.0)
320  , mLocation(0.0)
321  , mOrientationAngle(0.0)
322  , mIntegrationPoints()
323  , mpProperties(Properties::Pointer())
324  {}
325 
326  Ply(double thickness, double location, double orientationAngle, int numPoints, const Properties::Pointer & pProperties)
327  : mThickness(thickness)
328  , mLocation(location)
329  , mIntegrationPoints()
330  , mpProperties(pProperties)
331  {
332  this->SetOrientationAngle(orientationAngle);
333  this->SetUpIntegrationPoints(numPoints);
334  }
335 
336  Ply(const Ply& other)
337  : mThickness(other.mThickness)
338  , mLocation(other.mLocation)
339  , mOrientationAngle(other.mOrientationAngle)
340  , mIntegrationPoints(other.mIntegrationPoints)
341  , mpProperties(other.mpProperties)
342  {}
343 
344  Ply & operator = (const Ply & other) {
345  if(this != &other) {
346  mThickness = other.mThickness;
347  mLocation = other.mLocation;
348  mOrientationAngle = other.mOrientationAngle;
349  mIntegrationPoints = other.mIntegrationPoints;
350  mpProperties = other.mpProperties;
351  }
352  return *this;
353  }
354 
355  virtual ~Ply(){};
356 
357  public:
358 
359  inline double GetThickness()const { return mThickness; }
360  inline void SetThickness(double thickness) { mThickness = thickness; }
361 
362  inline double GetLocation()const { return mLocation; }
363  inline void SetLocation(double location) {
364  if(location != mLocation) {
365  for(IntegrationPointCollection::iterator it = mIntegrationPoints.begin(); it != mIntegrationPoints.end(); ++it)
366  (*it).SetLocation((*it).GetLocation() + location - mLocation); // remove the last location and add the new one (this avoids to re-setup the integration points.
367  mLocation = location; // update the current location
368  }
369  }
370 
371  inline double GetOrientationAngle()const { return mOrientationAngle; }
372  inline void SetOrientationAngle(double degrees) {
373  mOrientationAngle = std::fmod(degrees, 360.0);
374  if(mOrientationAngle < 0.0)
375  mOrientationAngle += 360.0;
376  }
377 
378  inline const IntegrationPointCollection& GetIntegrationPoints()const { return mIntegrationPoints; }
379  inline IntegrationPointCollection& GetIntegrationPoints() { return mIntegrationPoints; }
380 
381  inline const Properties::Pointer & GetPropertiesPointer()const { return mpProperties; }
382 
383  inline const Properties & GetProperties()const { return *mpProperties; }
384 
385  inline double CalculateMassPerUnitArea()const { return mpProperties->GetValue(DENSITY) * mThickness; }
386 
387  inline IntegrationPointCollection::size_type NumberOfIntegrationPoints()const { return mIntegrationPoints.size(); }
388 
389  inline void SetConstitutiveLawAt(IntegrationPointCollection::size_type integrationPointID, const ConstitutiveLaw::Pointer& pNewConstitutiveLaw)
390  {
391  if(integrationPointID < mIntegrationPoints.size())
392  mIntegrationPoints[integrationPointID].SetConstitutiveLaw(pNewConstitutiveLaw);
393  }
394 
395  private:
396 
397  void SetUpIntegrationPoints(int n)
398  {
399  KRATOS_TRY
400 
401  const ConstitutiveLaw::Pointer & pMaterial = GetProperties()[CONSTITUTIVE_LAW];
402  if(pMaterial == NULL)
403  KRATOS_THROW_ERROR(std::logic_error, "A Ply needs a constitutive law to be set. Missing constitutive law in property : ", GetProperties().Id());
404 
405  // make sure the number is greater than 0 and odd
406  if(n < 0) n = -n;
407  if(n == 0) n = 5;
408  if(n % 2 == 0) n += 1;
409 
410  // generate the weights (composite simpson rule)
411  Vector ip_w(n, 1.0);
412  if(n >= 3) {
413  for(int i = 1; i < n-1; i++) {
414  double iw = (i % 2 == 0) ? 2.0 : 4.0;
415  ip_w(i) = iw;
416  }
417  ip_w /= sum( ip_w );
418  }
419 
420  // generate locations (direction: top(+thickness/2) to bottom(-thickness/2)
421  Vector ip_loc(n, 0.0);
422  if(n >= 3) {
423  double loc_start = mLocation + 0.5 * mThickness;
424  double loc_incr = mThickness / double(n-1);
425  for(int i = 0; i < n; i++) {
426  ip_loc(i) = loc_start;
427  loc_start -= loc_incr;
428  }
429  }
430 
431  // generate the integration points
432  mIntegrationPoints.clear();
433  mIntegrationPoints.resize(n);
434  for(int i = 0; i < n; i++) {
435  IntegrationPoint& intp = mIntegrationPoints[i];
436  intp.SetWeight(ip_w(i) * mThickness);
437  intp.SetLocation(ip_loc(i));
438  intp.SetConstitutiveLaw(pMaterial->Clone());
439  }
440 
441  KRATOS_CATCH("")
442  }
443 
444  private:
445 
446  friend class Serializer;
447 
448  virtual void save(Serializer& rSerializer) const
449  {
450  rSerializer.save("T", mThickness);
451  rSerializer.save("L", mLocation);
452  rSerializer.save("O", mOrientationAngle);
453  rSerializer.save("IntP", mIntegrationPoints);
454  rSerializer.save("Prop", mpProperties);
455  }
456 
457  virtual void load(Serializer& rSerializer)
458  {
459  rSerializer.load("T", mThickness);
460  rSerializer.load("L", mLocation);
461  rSerializer.load("O", mOrientationAngle);
462  rSerializer.load("IntP", mIntegrationPoints);
463  rSerializer.load("Prop", mpProperties);
464  }
465 
466  };
467 
468  protected:
469 
471  {
472  double DeterminantF;
474 
480 
486 
487  double GYZ;
488  double GXZ;
489 
494  };
495 
497 
498  public:
499 
502 
507 
512  ShellCrossSection(const ShellCrossSection & other);
513 
517  ~ShellCrossSection() override;
518 
520 
523 
529 
531 
534 
540  void BeginStack();
541 
552  void AddPly(double thickness, double orientationAngle, int numPoints, const Properties::Pointer & pProperties);
553 
557  void EndStack();
558 
563  virtual std::string GetInfo()const;
564 
569  virtual ShellCrossSection::Pointer Clone()const;
570 
576  virtual bool Has(const Variable<double>& rThisVariable);
577 
583  virtual bool Has(const Variable<Vector>& rThisVariable);
584 
590  virtual bool Has(const Variable<Matrix>& rThisVariable);
591 
598  virtual bool Has(const Variable<array_1d<double, 3 > >& rThisVariable);
599 
606  virtual bool Has(const Variable<array_1d<double, 6 > >& rThisVariable);
607 
614  virtual double& GetValue(const Variable<double>& rThisVariable, double& rValue);
615 
622  virtual Vector& GetValue(const Variable<Vector>& rThisVariable, Vector& rValue);
623 
629  virtual Matrix& GetValue(const Variable<Matrix>& rThisVariable, Matrix& rValue);
630 
637  virtual array_1d<double, 3 > & GetValue(const Variable<array_1d<double, 3 > >& rVariable,
638  array_1d<double, 3 > & rValue);
639 
646  virtual array_1d<double, 6 > & GetValue(const Variable<array_1d<double, 6 > >& rVariable,
647  array_1d<double, 6 > & rValue);
648 
655  virtual void SetValue(const Variable<double>& rVariable,
656  const double& rValue,
657  const ProcessInfo& rCurrentProcessInfo);
658 
665  virtual void SetValue(const Variable<Vector >& rVariable,
666  const Vector& rValue,
667  const ProcessInfo& rCurrentProcessInfo);
668 
675  virtual void SetValue(const Variable<Matrix >& rVariable,
676  const Matrix& rValue,
677  const ProcessInfo& rCurrentProcessInfo);
678 
685  virtual void SetValue(const Variable<array_1d<double, 3 > >& rVariable,
686  const array_1d<double, 3 > & rValue,
687  const ProcessInfo& rCurrentProcessInfo);
688 
695  virtual void SetValue(const Variable<array_1d<double, 6 > >& rVariable,
696  const array_1d<double, 6 > & rValue,
697  const ProcessInfo& rCurrentProcessInfo);
698 
707  virtual bool ValidateInput(const Properties& rMaterialProperties);
708 
717  virtual void InitializeCrossSection(const Properties& rMaterialProperties,
718  const GeometryType& rElementGeometry,
719  const Vector& rShapeFunctionsValues);
720 
729  virtual void InitializeSolutionStep(const Properties& rMaterialProperties,
730  const GeometryType& rElementGeometry,
731  const Vector& rShapeFunctionsValues,
732  const ProcessInfo& rCurrentProcessInfo);
733 
742  virtual void FinalizeSolutionStep(const Properties& rMaterialProperties,
743  const GeometryType& rElementGeometry,
744  const Vector& rShapeFunctionsValues,
745  const ProcessInfo& rCurrentProcessInfo);
746 
755  virtual void InitializeNonLinearIteration(const Properties& rMaterialProperties,
756  const GeometryType& rElementGeometry,
757  const Vector& rShapeFunctionsValues,
758  const ProcessInfo& rCurrentProcessInfo);
759 
768  virtual void FinalizeNonLinearIteration(const Properties& rMaterialProperties,
769  const GeometryType& rElementGeometry,
770  const Vector& rShapeFunctionsValues,
771  const ProcessInfo& rCurrentProcessInfo);
772 
779  virtual void CalculateSectionResponse(Parameters& rValues, const ConstitutiveLaw::StressMeasure& rStressMeasure);
780 
787  virtual void FinalizeSectionResponse(Parameters& rValues, const ConstitutiveLaw::StressMeasure& rStressMeasure);
788 
796  virtual void ResetCrossSection(const Properties& rMaterialProperties,
797  const GeometryType& rElementGeometry,
798  const Vector& rShapeFunctionsValues);
799 
809  virtual int Check(const Properties& rMaterialProperties,
810  const GeometryType& rElementGeometry,
811  const ProcessInfo& rCurrentProcessInfo);
812 
819  inline void GetRotationMatrixForGeneralizedStrains(double radians, Matrix & T)
820  {
821  double c = std::cos(radians);
822  double s = std::sin(radians);
823 
824  SizeType strain_size = GetStrainSize();
825 
826  if(T.size1() != strain_size || T.size2() != strain_size)
827  T.resize(strain_size, strain_size, false);
829 
830  T(0, 0) = c * c; T(0, 1) = s * s; T(0, 2) = - s * c;
831  T(1, 0) = s * s; T(1, 1) = c * c; T(1, 2) = s * c;
832  T(2, 0) = 2.0 * s * c; T(2, 1) = - 2.0 * s * c; T(2, 2) = c * c - s * s;
833 
834  Matrix H = MathUtilsType::project(T, MathUtilsType::range(0, 3), MathUtilsType::range(0, 3));
835  MathUtilsType::project(T, MathUtilsType::range(3, 6), MathUtilsType::range(3, 6), H);
836 
837  if(strain_size == 8)
838  {
839  T(6, 6) = c; T(6, 7) = s;
840  T(7, 6) = - s; T(7, 7) = c;
841  }
842  }
843 
850  inline void GetRotationMatrixForCondensedStrains(double radians, Matrix & T)
851  {
852  SizeType strain_size = GetCondensedStrainSize();
853 
854  if(T.size1() != strain_size || T.size2() != strain_size)
855  T.resize(strain_size, strain_size, false);
857 
858  T(0, 0) = 1.0; // condensed strain E.zz is always at index 0
859 
860  if(strain_size == 3) // if section is thin the condensed strains are (in order): E.zz E.yz E.xz
861  {
862  double c = std::cos(radians);
863  double s = std::sin(radians);
864 
865  T(1, 1) = c; T(1, 2) = s;
866  T(2, 1) = - s; T(2, 2) = c;
867  }
868  }
869 
876  inline void GetRotationMatrixForGeneralizedStresses(double radians, Matrix & T)
877  {
878  double c = std::cos(radians);
879  double s = std::sin(radians);
880 
881  SizeType strain_size = GetStrainSize();
882 
883  if(T.size1() != strain_size || T.size2() != strain_size)
884  T.resize(strain_size, strain_size, false);
886 
887  T(0, 0) = c * c; T(0, 1) = s * s; T(0, 2) = - 2.0 * s * c;
888  T(1, 0) = s * s; T(1, 1) = c * c; T(1, 2) = 2.0 * s * c;
889  T(2, 0) = s * c; T(2, 1) = - s * c; T(2, 2) = c * c - s * s;
890 
891  Matrix H = MathUtilsType::project(T, MathUtilsType::range(0, 3), MathUtilsType::range(0, 3));
892  MathUtilsType::project(T, MathUtilsType::range(3, 6), MathUtilsType::range(3, 6), H);
893 
894  if(strain_size == 8)
895  {
896  T(6, 6) = c; T(6, 7) = s;
897  T(7, 6) = - s; T(7, 7) = c;
898  }
899  }
900 
907  inline void GetRotationMatrixForCondensedStresses(double radians, Matrix & T)
908  {
909  SizeType strain_size = GetCondensedStrainSize();
910 
911  if(T.size1() != strain_size || T.size2() != strain_size)
912  T.resize(strain_size, strain_size, false);
914 
915  T(0, 0) = 1.0; // condensed stresse S.zz is always at index 0
916 
917  if(strain_size == 3) // if section is thin the condensed stresses are (in order): S.zz S.yz S.xz
918  {
919  double c = std::cos(radians);
920  double s = std::sin(radians);
921 
922  T(1, 1) = c; T(1, 2) = s;
923  T(2, 1) = - s; T(2, 2) = c;
924  }
925  }
926 
928 
929  public:
930 
933 
938  inline const double GetThickness()const
939  {
940  return mThickness;
941  }
942 
950  inline const double GetOffset()const
951  {
952  return mOffset;
953  }
954 
962  inline void SetOffset(double offset)
963  {
964  if((mOffset != offset) && (!mEditingStack))
965  {
966  for(PlyCollection::iterator it = mStack.begin(); it != mStack.end(); ++it)
967  (*it).SetLocation((*it).GetLocation() + offset - mOffset);
968  mOffset = offset;
969  }
970  }
971 
976  inline PlyCollection::size_type NumberOfPlies()const
977  {
978  return mStack.size();
979  }
980 
987  {
988  if(ply_id < mStack.size())
989  return mStack[ply_id].NumberOfIntegrationPoints();
990  return 0;
991  }
992 
998  inline void SetConstitutiveLawAt(SizeType ply_id, SizeType point_id, const ConstitutiveLaw::Pointer& pNewConstitutiveLaw)
999  {
1000  if(ply_id < mStack.size())
1001  mStack[ply_id].SetConstitutiveLawAt(point_id, pNewConstitutiveLaw);
1002  }
1003 
1008  inline double CalculateMassPerUnitArea()const
1009  {
1010  double vol(0.0);
1011  for(PlyCollection::const_iterator it = mStack.begin(); it != mStack.end(); ++it)
1012  vol += (*it).CalculateMassPerUnitArea();
1013  return vol;
1014  }
1015 
1020  inline double CalculateAvarageDensity()const
1021  {
1022  return CalculateMassPerUnitArea() / mThickness;
1023  }
1024 
1030  inline double GetOrientationAngle()const
1031  {
1032  return mOrientation;
1033  }
1034 
1040  inline void SetOrientationAngle(double radians)
1041  {
1042  mOrientation = radians;
1043  }
1044 
1050  {
1051  return mBehavior;
1052  }
1053 
1059  {
1060  mBehavior = behavior;
1061  }
1062 
1069  {
1070  return (mBehavior == Thick) ? 8 : 6;
1071  }
1072 
1079  {
1080  return (mBehavior == Thick) ? 1 : 3;
1081  }
1082 
1087  inline double GetDrillingStiffness()const
1088  {
1089  return mDrillingPenalty;
1090  }
1091 
1093 
1094  private:
1095 
1098 
1099  void InitializeParameters(Parameters& rValues, ConstitutiveLaw::Parameters& rMaterialValues, ElementVariables& rVariables);
1100 
1101  void UpdateIntegrationPointParameters(IntegrationPoint& rPoint, ConstitutiveLaw::Parameters& rMaterialValues, ElementVariables& rVariables);
1102 
1103  void CalculateIntegrationPointResponse(IntegrationPoint& rPoint,
1104  ConstitutiveLaw::Parameters& rMaterialValues,
1105  Parameters& rValues,
1106  ElementVariables& rVariables,
1107  const ConstitutiveLaw::StressMeasure& rStressMeasure);
1108 
1114  void PrivateCopy(const ShellCrossSection & other);
1115 
1117 
1118  public:
1119 
1122 
1124 
1125  private:
1126 
1129 
1130  double mThickness;
1131  double mOffset;
1132  PlyCollection mStack;
1133  bool mEditingStack;
1134  bool mHasDrillingPenalty;
1135  double mDrillingPenalty;
1136  double mOrientation;
1137  SectionBehaviorType mBehavior;
1138  bool mInitialized;
1139  bool mNeedsOOPCondensation;
1140  Vector mOOP_CondensedStrains;
1141  Vector mOOP_CondensedStrains_converged;
1142 
1144 
1147 
1148  friend class Serializer;
1149 
1150  void save(Serializer& rSerializer) const override
1151  {
1152  KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, Flags );
1153  rSerializer.save("th", mThickness);
1154  rSerializer.save("offs", mOffset);
1155  rSerializer.save("stack", mStack);
1156  rSerializer.save("edit", mEditingStack);
1157  rSerializer.save("dr", mHasDrillingPenalty);
1158  rSerializer.save("bdr", mDrillingPenalty);
1159  rSerializer.save("or", mOrientation);
1160 
1161  rSerializer.save("behav", (int)mBehavior);
1162 
1163  rSerializer.save("init", mInitialized);
1164  rSerializer.save("hasOOP", mNeedsOOPCondensation);
1165  rSerializer.save("OOP_eps", mOOP_CondensedStrains_converged);
1166  }
1167 
1168  void load(Serializer& rSerializer) override
1169  {
1170  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Flags );
1171  rSerializer.load("th", mThickness);
1172  rSerializer.load("offs", mOffset);
1173  rSerializer.load("stack", mStack);
1174  rSerializer.load("edit", mEditingStack);
1175  rSerializer.load("dr", mHasDrillingPenalty);
1176  rSerializer.load("bdr", mDrillingPenalty);
1177  rSerializer.load("or", mOrientation);
1178 
1179  int temp;
1180  rSerializer.load("behav", temp);
1181  mBehavior = (SectionBehaviorType)temp;
1182 
1183  rSerializer.load("init", mInitialized);
1184  rSerializer.load("hasOOP", mNeedsOOPCondensation);
1185  rSerializer.load("OOP_eps", mOOP_CondensedStrains_converged);
1186  }
1187 
1189 
1190  public:
1191 
1194 
1195 };
1196 
1199 
1200 inline std::istream & operator >> (std::istream & rIStream, ShellCrossSection & rThis);
1201 
1202 inline std::ostream & operator << (std::ostream & rOStream, const ShellCrossSection & rThis)
1203 {
1204  return rOStream << rThis.GetInfo();
1205 }
1206 
1208 
1209 }
1210 
1211 
1212 #endif // SHELL_CROSS_SECTION_H_INCLUDED
#define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES
Definition: properties_extensions.hpp:14
#define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES
Definition: properties_extensions.hpp:29
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: constitutive_law.h:47
StressMeasure
Definition: constitutive_law.h:69
Definition: flags.h:58
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
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
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
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:242
double GetWeight() const
Definition: shell_cross_section.hpp:273
double GetLocation() const
Definition: shell_cross_section.hpp:276
IntegrationPoint(double location, double weight, const ConstitutiveLaw::Pointer pMaterial)
Definition: shell_cross_section.hpp:248
void SetLocation(double l)
Definition: shell_cross_section.hpp:277
void SetConstitutiveLaw(const ConstitutiveLaw::Pointer &pLaw)
Definition: shell_cross_section.hpp:280
const ConstitutiveLaw::Pointer & GetConstitutiveLaw() const
Definition: shell_cross_section.hpp:279
void SetWeight(double w)
Definition: shell_cross_section.hpp:274
IntegrationPoint(const IntegrationPoint &other)
Definition: shell_cross_section.hpp:254
virtual ~IntegrationPoint()
Definition: shell_cross_section.hpp:269
Definition: shell_cross_section.hpp:87
Parameters()
Definition: shell_cross_section.hpp:105
void Reset(Flags ThisFlag)
Definition: shell_cross_section.hpp:200
const GeometryType & GetElementGeometry()
Definition: shell_cross_section.hpp:228
Flags & GetOptions()
Definition: shell_cross_section.hpp:218
void SetConstitutiveMatrix(Matrix &rConstitutiveMatrix)
Definition: shell_cross_section.hpp:206
bool CheckMechanicalVariables()
Definition: shell_cross_section.hpp:177
void SetGeneralizedStressVector(Vector &rGeneralizedStressVector)
Definition: shell_cross_section.hpp:205
void SetElementGeometry(const GeometryType &rElementGeometry)
Definition: shell_cross_section.hpp:212
void SetOptions(const Flags &rOptions)
Definition: shell_cross_section.hpp:202
void SetMaterialProperties(const Properties &rMaterialProperties)
Definition: shell_cross_section.hpp:211
Vector & GetGeneralizedStrainVector()
Definition: shell_cross_section.hpp:220
void SetShapeFunctionsValues(const Vector &rShapeFunctionsValues)
Definition: shell_cross_section.hpp:208
bool CheckShapeFunctions()
Definition: shell_cross_section.hpp:146
const Matrix & GetShapeFunctionsDerivatives()
Definition: shell_cross_section.hpp:225
void SetGeneralizedStrainVector(Vector &rGeneralizedStrainVector)
Definition: shell_cross_section.hpp:204
const Properties & GetMaterialProperties()
Definition: shell_cross_section.hpp:227
const ProcessInfo & GetProcessInfo()
Definition: shell_cross_section.hpp:226
void SetProcessInfo(const ProcessInfo &rProcessInfo)
Definition: shell_cross_section.hpp:210
void Set(Flags ThisFlag)
Definition: shell_cross_section.hpp:199
Matrix & GetConstitutiveMatrix()
Definition: shell_cross_section.hpp:222
bool CheckInfoMaterialGeometry()
Definition: shell_cross_section.hpp:160
Parameters(const Parameters &rNewParameters)
Definition: shell_cross_section.hpp:129
Vector & GetGeneralizedStressVector()
Definition: shell_cross_section.hpp:221
void SetShapeFunctionsDerivatives(const Matrix &rShapeFunctionsDerivatives)
Definition: shell_cross_section.hpp:209
Parameters(const GeometryType &rElementGeometry, const Properties &rMaterialProperties, const ProcessInfo &rCurrentProcessInfo)
Definition: shell_cross_section.hpp:116
const Vector & GetShapeFunctionsValues()
Definition: shell_cross_section.hpp:224
Definition: shell_cross_section.hpp:302
const Properties::Pointer & GetPropertiesPointer() const
Definition: shell_cross_section.hpp:381
virtual ~Ply()
Definition: shell_cross_section.hpp:355
double CalculateMassPerUnitArea() const
Definition: shell_cross_section.hpp:385
void SetLocation(double location)
Definition: shell_cross_section.hpp:363
Ply(double thickness, double location, double orientationAngle, int numPoints, const Properties::Pointer &pProperties)
Definition: shell_cross_section.hpp:326
Ply(const Ply &other)
Definition: shell_cross_section.hpp:336
double GetOrientationAngle() const
Definition: shell_cross_section.hpp:371
double GetThickness() const
Definition: shell_cross_section.hpp:359
void SetThickness(double thickness)
Definition: shell_cross_section.hpp:360
double GetLocation() const
Definition: shell_cross_section.hpp:362
IntegrationPointCollection & GetIntegrationPoints()
Definition: shell_cross_section.hpp:379
Ply()
Definition: shell_cross_section.hpp:318
void SetConstitutiveLawAt(IntegrationPointCollection::size_type integrationPointID, const ConstitutiveLaw::Pointer &pNewConstitutiveLaw)
Definition: shell_cross_section.hpp:389
const Properties & GetProperties() const
Definition: shell_cross_section.hpp:383
IntegrationPointCollection::size_type NumberOfIntegrationPoints() const
Definition: shell_cross_section.hpp:387
std::vector< IntegrationPoint > IntegrationPointCollection
Definition: shell_cross_section.hpp:306
const IntegrationPointCollection & GetIntegrationPoints() const
Definition: shell_cross_section.hpp:378
void SetOrientationAngle(double degrees)
Definition: shell_cross_section.hpp:372
ShellCrossSection.
Definition: shell_cross_section.hpp:45
SectionBehaviorType
Definition: shell_cross_section.hpp:68
@ Thick
Definition: shell_cross_section.hpp:69
void GetRotationMatrixForCondensedStresses(double radians, Matrix &T)
Definition: shell_cross_section.hpp:907
SectionBehaviorType GetSectionBehavior() const
Definition: shell_cross_section.hpp:1049
std::vector< Ply > PlyCollection
Definition: shell_cross_section.hpp:55
void SetOffset(double offset)
Definition: shell_cross_section.hpp:962
SizeType NumberOfIntegrationPointsAt(SizeType ply_id) const
Definition: shell_cross_section.hpp:986
KRATOS_CLASS_POINTER_DEFINITION(ShellCrossSection)
const double GetOffset() const
Definition: shell_cross_section.hpp:950
void GetRotationMatrixForCondensedStrains(double radians, Matrix &T)
Definition: shell_cross_section.hpp:850
void SetOrientationAngle(double radians)
Definition: shell_cross_section.hpp:1040
void SetConstitutiveLawAt(SizeType ply_id, SizeType point_id, const ConstitutiveLaw::Pointer &pNewConstitutiveLaw)
Definition: shell_cross_section.hpp:998
double CalculateMassPerUnitArea() const
Definition: shell_cross_section.hpp:1008
PlyCollection::size_type NumberOfPlies() const
Definition: shell_cross_section.hpp:976
double CalculateAvarageDensity() const
Definition: shell_cross_section.hpp:1020
const double GetThickness() const
Definition: shell_cross_section.hpp:938
SizeType GetCondensedStrainSize()
Definition: shell_cross_section.hpp:1078
SizeType GetStrainSize()
Definition: shell_cross_section.hpp:1068
Geometry< Node > GeometryType
Definition: shell_cross_section.hpp:53
void GetRotationMatrixForGeneralizedStrains(double radians, Matrix &T)
Definition: shell_cross_section.hpp:819
double GetOrientationAngle() const
Definition: shell_cross_section.hpp:1030
virtual std::string GetInfo() const
Definition: shell_cross_section.cpp:82
void SetSectionBehavior(SectionBehaviorType behavior)
Definition: shell_cross_section.hpp:1058
void GetRotationMatrixForGeneralizedStresses(double radians, Matrix &T)
Definition: shell_cross_section.hpp:876
double GetDrillingStiffness() const
Definition: shell_cross_section.hpp:1087
std::size_t SizeType
Definition: shell_cross_section.hpp:57
SolidMechanicsMathUtilities< double > MathUtilsType
Definition: shell_cross_section.hpp:59
Definition: solid_mechanics_math_utilities.hpp:34
#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
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
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::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
def SetValue(entity, variable, value)
Definition: coupling_interface_data.py:256
w
Definition: generate_convection_diffusion_explicit_element.py:108
H
Definition: generate_droplet_dynamics.py:257
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
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
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:471
Vector StrainVector_3D
Definition: shell_cross_section.hpp:481
Vector CondensedStressVector
Definition: shell_cross_section.hpp:493
Vector StressVector_2D
Definition: shell_cross_section.hpp:476
Matrix L
Definition: shell_cross_section.hpp:491
Matrix ConstitutiveMatrix_2D
Definition: shell_cross_section.hpp:477
Matrix H
Definition: shell_cross_section.hpp:490
Matrix DeformationGradientF_2D
Definition: shell_cross_section.hpp:478
Matrix DeformationGradientF0_3D
Definition: shell_cross_section.hpp:485
Matrix DeformationGradientF0_2D
Definition: shell_cross_section.hpp:479
Matrix DeformationGradientF_3D
Definition: shell_cross_section.hpp:484
Matrix ConstitutiveMatrix_3D
Definition: shell_cross_section.hpp:483
double DeterminantF
Definition: shell_cross_section.hpp:472
double GYZ
Definition: shell_cross_section.hpp:487
double GXZ
Definition: shell_cross_section.hpp:488
Matrix LT
Definition: shell_cross_section.hpp:492
Vector StressVector_3D
Definition: shell_cross_section.hpp:482
Vector StrainVector_2D
Definition: shell_cross_section.hpp:475
double DeterminantF0
Definition: shell_cross_section.hpp:473
Definition: shell_cross_section.hpp:79
double mSpaceDimension
Definition: shell_cross_section.hpp:82
std::vector< ConstitutiveLaw::StrainMeasure > mStrainMeasures
Definition: shell_cross_section.hpp:83
double mStrainSize
Definition: shell_cross_section.hpp:81
Flags mOptions
Definition: shell_cross_section.hpp:80