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.
rule_of_mixtures_law.h
Go to the documentation of this file.
1 // KRATOS ___ _ _ _ _ _ __ _
2 // / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __
3 // / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ |
4 // / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) |
5 // \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/
6 // |_| |_|
7 //
8 // License: BSD License
9 // license: structural_mechanics_application/license.txt
10 //
11 // Main authors: Vicente Mataix Ferrandiz
12 // Fernando Rastellini
13 // Alejandro Cornejo Velazquez
14 //
15 
16 #pragma once
17 
18 // System includes
19 
20 // External includes
21 
22 // Project includes
24 
25 
26 namespace Kratos
27 {
30 
34 
38 
42 
46 
59 template<unsigned int TDim>
60 class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) ParallelRuleOfMixturesLaw
61  : public ConstitutiveLaw
62 {
63 public:
64 
67 
70 
73 
75  typedef std::size_t SizeType;
76 
78  typedef std::size_t IndexType;
79 
81  static constexpr SizeType VoigtSize = (TDim == 3) ? 6 : 3;
82 
84  static constexpr SizeType Dimension = TDim;
85 
87  static constexpr double machine_tolerance = std::numeric_limits<double>::epsilon();
88 
91 
94 
99 
104  ParallelRuleOfMixturesLaw(const std::vector<double>& rCombinationFactors);
105 
110 
114  ~ParallelRuleOfMixturesLaw() override;
115 
119 
123 
127  ConstitutiveLaw::Pointer Clone() const override;
128 
134  ConstitutiveLaw::Pointer Create(Kratos::Parameters NewParameters) const override;
135 
140  SizeType WorkingSpaceDimension() override;
141 
146  SizeType GetStrainSize() const override;
147 
152  {
153  return true;
154  }
155 
160  {
161  return true;
162  }
163 
169  bool Has(const Variable<bool>& rThisVariable) override;
170 
176  bool Has(const Variable<int>& rThisVariable) override;
177 
183  bool Has(const Variable<double>& rThisVariable) override;
184 
190  bool Has(const Variable<Vector>& rThisVariable) override;
191 
197  bool Has(const Variable<Matrix>& rThisVariable) override;
198 
205  bool Has(const Variable<array_1d<double, 3 > >& rThisVariable) override;
206 
213  bool Has(const Variable<array_1d<double, 6 > >& rThisVariable) override;
214 
221  bool& GetValue(
222  const Variable<bool>& rThisVariable,
223  bool& rValue
224  ) override;
225 
232  int& GetValue(
233  const Variable<int>& rThisVariable,
234  int& rValue
235  ) override;
236 
243  double& GetValue(
244  const Variable<double>& rThisVariable,
245  double& rValue
246  ) override;
247 
254  Vector& GetValue(
255  const Variable<Vector>& rThisVariable,
256  Vector& rValue
257  ) override;
258 
264  Matrix& GetValue(
265  const Variable<Matrix>& rThisVariable,
266  Matrix& rValue
267  ) override;
268 
276  const Variable<array_1d<double, 3 > >& rThisVariable,
277  array_1d<double, 3 > & rValue
278  ) override;
279 
287  const Variable<array_1d<double, 6 > >& rThisVariable,
288  array_1d<double, 6 > & rValue
289  ) override;
290 
297  void SetValue(
298  const Variable<bool>& rThisVariable,
299  const bool& rValue,
300  const ProcessInfo& rCurrentProcessInfo
301  ) override;
302 
309  void SetValue(
310  const Variable<int>& rThisVariable,
311  const int& rValue,
312  const ProcessInfo& rCurrentProcessInfo
313  ) override;
314 
321  void SetValue(
322  const Variable<double>& rThisVariable,
323  const double& rValue,
324  const ProcessInfo& rCurrentProcessInfo
325  ) override;
326 
333  void SetValue(
334  const Variable<Vector >& rThisVariable,
335  const Vector& rValue,
336  const ProcessInfo& rCurrentProcessInfo
337  ) override;
338 
345  void SetValue(
346  const Variable<Matrix >& rThisVariable,
347  const Matrix& rValue,
348  const ProcessInfo& rCurrentProcessInfo
349  ) override;
350 
357  void SetValue(
358  const Variable<array_1d<double, 3 > >& rThisVariable,
359  const array_1d<double, 3 > & rValue,
360  const ProcessInfo& rCurrentProcessInfo
361  ) override;
362 
369  void SetValue(
370  const Variable<array_1d<double, 6 > >& rThisVariable,
371  const array_1d<double, 6 > & rValue,
372  const ProcessInfo& rCurrentProcessInfo
373  ) override;
374 
382  double& CalculateValue(
383  Parameters& rParameterValues,
384  const Variable<double>& rThisVariable,
385  double& rValue
386  ) override;
387 
395  Vector& CalculateValue(
396  Parameters& rParameterValues,
397  const Variable<Vector>& rThisVariable,
398  Vector& rValue
399  ) override;
400 
408  Matrix& CalculateValue(
409  Parameters& rParameterValues,
410  const Variable<Matrix>& rThisVariable,
411  Matrix& rValue
412  ) override;
413 
422  Parameters& rParameterValues,
423  const Variable<array_1d<double, 3 > >& rVariable,
424  array_1d<double, 3 > & rValue
425  ) override;
426 
434  Parameters& rParameterValues,
435  const Variable<array_1d<double, 6 > >& rVariable,
436  array_1d<double, 6 > & rValue
437  ) override;
438 
445  bool ValidateInput(const Properties& rMaterialProperties) override;
446 
451  StrainMeasure GetStrainMeasure() override;
452 
457  StressMeasure GetStressMeasure() override;
458 
464  bool IsIncremental() override;
465 
473  void InitializeMaterial(
474  const Properties& rMaterialProperties,
475  const GeometryType& rElementGeometry,
476  const Vector& rShapeFunctionsValues
477  ) override;
478 
479  std::vector<ConstitutiveLaw::Pointer>& GetConstitutiveLaws()
480  {
481  return mConstitutiveLaws;
482  }
483 
484  std::vector<double>& GetCombinationFactors()
485  {
486  return mCombinationFactors;
487  }
488 
489  void SetCombinationFactors(const std::vector<double>& rVector )
490  {
491  mCombinationFactors = rVector;
492  }
493 
498  void CalculateMaterialResponsePK1 (Parameters& rValues) override;
499 
504  void CalculateMaterialResponsePK2 (Parameters& rValues) override;
505 
510  void CalculateMaterialResponseKirchhoff (Parameters& rValues) override;
511 
516  void CalculateMaterialResponseCauchy (Parameters& rValues) override;
517 
522  void InitializeMaterialResponsePK1 (Parameters& rValues) override;
523 
528  void InitializeMaterialResponsePK2 (Parameters& rValues) override;
529 
534  void InitializeMaterialResponseKirchhoff (Parameters& rValues) override;
535 
540  void InitializeMaterialResponseCauchy (Parameters& rValues) override;
541 
546  void FinalizeMaterialResponsePK1 (Parameters& rValues) override;
547 
552  void FinalizeMaterialResponsePK2 (Parameters& rValues) override;
553 
558  void FinalizeMaterialResponseKirchhoff (Parameters& rValues) override;
559 
564  void FinalizeMaterialResponseCauchy (Parameters& rValues) override;
565 
573  void ResetMaterial(
574  const Properties& rMaterialProperties,
575  const GeometryType& rElementGeometry,
576  const Vector& rShapeFunctionsValues
577  ) override;
578 
583  void GetLawFeatures(Features& rFeatures) override;
584 
593  int Check(
594  const Properties& rMaterialProperties,
595  const GeometryType& rElementGeometry,
596  const ProcessInfo& rCurrentProcessInfo
597  ) const override;
598 
604  const Properties& rMaterialProperties,
606  const IndexType Layer
607  );
608 
609 
614  void CalculateTangentTensor(
616  const ConstitutiveLaw::StressMeasure& rStressMeasure
617  );
618 
623  void CalculateGreenLagrangeStrain(Parameters &rValues);
624 
629  void CalculateAlmansiStrain(Parameters &rValues);
630 
631 protected:
632 
635 
639 
643 
647 
649 
650 private:
651 
654 
658 
659  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLaws;
660  std::vector<double> mCombinationFactors;
661 
665 
670 
675 
679  friend class Serializer;
680 
681  void save(Serializer& rSerializer) const override
682  {
684  rSerializer.save("ConstitutiveLaws", mConstitutiveLaws);
685  rSerializer.save("CombinationFactors", mCombinationFactors);
686  }
687 
688  void load(Serializer& rSerializer) override
689  {
691  rSerializer.load("ConstitutiveLaws", mConstitutiveLaws);
692  rSerializer.load("CombinationFactors", mCombinationFactors);
693  }
694 
695 
696 }; // Class ParallelRuleOfMixturesLaw
697 } // namespace Kratos.
Definition: constitutive_law.h:47
StrainMeasure
Definition: constitutive_law.h:52
StressMeasure
Definition: constitutive_law.h:69
Geometry base class.
Definition: geometry.h:71
This law defines a parallel rule of mixture (classic law of mixture)
Definition: rule_of_mixtures_law.h:62
array_1d< double, 6 > & CalculateValue(Parameters &rParameterValues, const Variable< array_1d< double, 6 > > &rVariable, array_1d< double, 6 > &rValue) override
Returns the value of a specified variable (array of 6 components)
array_1d< double, 3 > & GetValue(const Variable< array_1d< double, 3 > > &rThisVariable, array_1d< double, 3 > &rValue) override
Returns the value of a specified variable (array of 3 components)
std::vector< ConstitutiveLaw::Pointer > & GetConstitutiveLaws()
Definition: rule_of_mixtures_law.h:479
std::vector< double > & GetCombinationFactors()
Definition: rule_of_mixtures_law.h:484
ConstitutiveLaw BaseType
The definition of the CL base class.
Definition: rule_of_mixtures_law.h:72
KRATOS_CLASS_POINTER_DEFINITION(ParallelRuleOfMixturesLaw)
Pointer definition of ParallelRuleOfMixturesLaw.
void SetValue(const Variable< array_1d< double, 3 > > &rThisVariable, const array_1d< double, 3 > &rValue, const ProcessInfo &rCurrentProcessInfo) override
Sets the value of a specified variable (array of 3 components)
void SetCombinationFactors(const std::vector< double > &rVector)
Definition: rule_of_mixtures_law.h:489
array_1d< double, 3 > & CalculateValue(Parameters &rParameterValues, const Variable< array_1d< double, 3 > > &rVariable, array_1d< double, 3 > &rValue) override
Calculates the value of a specified variable (array of 3 components)
std::size_t SizeType
The definition of the size type.
Definition: rule_of_mixtures_law.h:75
void SetValue(const Variable< array_1d< double, 6 > > &rThisVariable, const array_1d< double, 6 > &rValue, const ProcessInfo &rCurrentProcessInfo) override
Sets the value of a specified variable (array of 6 components)
ProcessInfo ProcessInfoType
The definition of the process info.
Definition: rule_of_mixtures_law.h:69
bool RequiresInitializeMaterialResponse() override
If the CL requires to initialize the material response, called by the element in InitializeSolutionSt...
Definition: rule_of_mixtures_law.h:151
bool RequiresFinalizeMaterialResponse() override
If the CL requires to initialize the material response, called by the element in InitializeSolutionSt...
Definition: rule_of_mixtures_law.h:159
array_1d< double, 6 > & GetValue(const Variable< array_1d< double, 6 > > &rThisVariable, array_1d< double, 6 > &rValue) override
Returns the value of a specified variable (array of 6 components)
std::size_t IndexType
The definition of the index type.
Definition: rule_of_mixtures_law.h:78
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
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#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
void CalculateRotationMatrix(const double Theta, MatrixType &rMatrix, const DenseVector< double > &rAxisOfRotationVector, const DenseVector< double > &rCenterOfRotation)
Calculate the transformation matrix which rotates the given vector around mAxisOfRotationVector and m...
Definition: geometrical_transformation_utilities.cpp:41
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
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
def SetValue(entity, variable, value)
Definition: coupling_interface_data.py:256
def load(f)
Definition: ode_solve.py:307
Definition: constitutive_law.h:189