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.
helmholtz_solid_shape_data_container.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // license: OptimizationApplication/license.txt
9 //
10 // Main authors: Reza Najian Asl
11 // Suneth Warnakulasuriya
12 //
13 
14 #pragma once
15 
16 // System includes
17 #include <cmath>
18 
19 // External includes
20 
21 // Project includes
22 #include "geometries/geometry.h"
23 #include "includes/node.h"
24 #include "includes/element.h"
25 #include "includes/process_info.h"
27 #include "utilities/geometry_utilities.h"
28 
29 // Application includes
33 
34 namespace Kratos {
35 
36 template <unsigned int TDim, unsigned int TNumNodes>
38 {
39 public:
42 
43  using IndexType = std::size_t;
44 
46 
47  static constexpr IndexType NumberOfNodes = TNumNodes;
48 
49  static constexpr IndexType NumberOfVariables = TDim;
50 
52 
54 
58 
60  {
61  public:
64 
66  const Element& rElement,
67  const GeometryData::IntegrationMethod& rIntegrationMethod,
68  const ProcessInfo& rProcessInfo)
69  : mrElement(rElement),
70  mrIntegrationMethod(rIntegrationMethod),
71  mrProcessInfo(rProcessInfo)
72  {
73  Vector detJ;
74  mNs = mrElement.GetGeometry().ShapeFunctionsValues(rIntegrationMethod);
75  mrElement.GetGeometry().ShapeFunctionsIntegrationPointsGradients(mdNdXs, detJ, mrIntegrationMethod);
76  }
77 
79 
80  private:
83 
84  const Element& mrElement;
85 
86  const GeometryData::IntegrationMethod& mrIntegrationMethod;
87 
88  const ProcessInfo& mrProcessInfo;
89 
91 
92  Matrix mNs;
93 
97 
99 
101  };
102 
106 
108  {
109  }
110 
112  Matrix& rStiffnessMatrix,
113  const double W,
115  const ConstantDataContainer& rConstantData) const
116  {
117  const Matrix& rdNdX = rConstantData.mdNdXs[IntegrationPoint];
119  B.clear();
120 
121  IndexType local_index = 0;
122  for (IndexType i = 0; i < TNumNodes; ++i) {
123  B(0, local_index + 0) = rdNdX(i, 0);
124  B(1, local_index + 1) = rdNdX(i, 1);
125  B(2, local_index + 2) = rdNdX(i, 2);
126  B(3, local_index + 0) = rdNdX(i, 1);
127  B(3, local_index + 1) = rdNdX(i, 0);
128  B(4, local_index + 1) = rdNdX(i, 2);
129  B(4, local_index + 2) = rdNdX(i, 1);
130  B(5, local_index + 0) = rdNdX(i, 2);
131  B(5, local_index + 2) = rdNdX(i, 0);
132  local_index += 3;
133  }
134 
135  const auto& r_element = rConstantData.mrElement;
136  const auto& r_geometry = r_element.GetGeometry();
137  const auto& r_properties = r_element.GetProperties();
138 
139  ConstitutiveLaw::Parameters cl_params(r_geometry, r_properties, rConstantData.mrProcessInfo);
140  cl_params.SetShapeFunctionsValues(row(rConstantData.mNs, IntegrationPoint));
141 
142  Matrix constitutive_matrix;
143  constitutive_matrix = r_properties.GetValue(CONSTITUTIVE_LAW)->CalculateValue(cl_params, CONSTITUTIVE_MATRIX, constitutive_matrix);
144 
145  noalias(rStiffnessMatrix) += prod(trans(B), W * Matrix(prod(constitutive_matrix, B)));
146  }
147 
149 };
150 
151 } // namespace Kratos
Base class for all Elements.
Definition: element.h:60
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
const Matrix & ShapeFunctionsValues() const
Definition: geometry.h:3393
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult) const
Definition: geometry.h:3708
Definition: helmholtz_solid_shape_data_container.h:60
ConstantDataContainer(const Element &rElement, const GeometryData::IntegrationMethod &rIntegrationMethod, const ProcessInfo &rProcessInfo)
Definition: helmholtz_solid_shape_data_container.h:65
Definition: helmholtz_solid_shape_data_container.h:38
void AddStiffnessGaussPointContributions(Matrix &rStiffnessMatrix, const double W, const IndexType IntegrationPoint, const ConstantDataContainer &rConstantData) const
Definition: helmholtz_solid_shape_data_container.h:111
std::size_t IndexType
Definition: helmholtz_solid_shape_data_container.h:43
static constexpr auto TargetVariablesList
Definition: helmholtz_solid_shape_data_container.h:51
static constexpr IndexType NumberOfNodes
Definition: helmholtz_solid_shape_data_container.h:47
static constexpr auto SourceVariablesList
Definition: helmholtz_solid_shape_data_container.h:53
HelmholtzSolidShapeDataContainer(const Geometry< Node > &rGeometry)
Definition: helmholtz_solid_shape_data_container.h:107
static constexpr IndexType NumberOfVariables
Definition: helmholtz_solid_shape_data_container.h:49
Short class definition.
Definition: integration_point.h:52
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17
Definition: constitutive_law.h:189
void SetShapeFunctionsValues(const Vector &rShapeFunctionsValues)
Definition: constitutive_law.h:396
Definition: helmholtz_variable_data.h:29