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_surface_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 
18 // External includes
19 
20 // Project includes
21 #include "geometries/geometry.h"
22 #include "includes/node.h"
23 #include "includes/element.h"
24 #include "includes/process_info.h"
25 #include "utilities/math_utils.h"
26 
27 // Application includes
31 
32 namespace Kratos {
33 
34 template <unsigned int TDim, unsigned int TNumNodes, unsigned int TDataDimension>
36 {
37 public:
40 
41  using IndexType = std::size_t;
42 
44 
45  static constexpr IndexType NumberOfNodes = TNumNodes;
46 
47  static constexpr IndexType NumberOfVariables = (TDataDimension == 1) ? 1 : TDim;
48 
50 
52 
56 
58  {
59  public:
62 
64  const Element& rElement,
65  const GeometryData::IntegrationMethod& rIntegrationMethod,
66  const ProcessInfo& rProcessInfo)
67  : mrGeometry(rElement.GetGeometry()),
68  mrIntegrationMethod(rIntegrationMethod)
69  {
70  mHelmholtzRadius = rProcessInfo[HELMHOLTZ_RADIUS];
71  const auto& integration_points = mrGeometry.IntegrationPoints(mrIntegrationMethod);
72 
73  array_1d<double, 3> normal = ZeroVector(3);
74 
75  for (IndexType point_number = 0;
76  point_number < integration_points.size(); ++point_number) {
77  normal += mrGeometry.UnitNormal(point_number, mrIntegrationMethod);
78  }
79 
80  normal /= integration_points.size();
81  normal /= MathUtils<double>::Norm3(normal);
82 
83  const BoundedMatrix<double, 3, 3>& id_matrix = IdentityMatrix(3, 3);
84 
85  noalias(mTangentProjectionMatrix) = id_matrix - outer_prod(normal, normal);
86  }
87 
89 
90  private:
93 
94  const GeometryType& mrGeometry;
95 
96  const GeometryData::IntegrationMethod& mrIntegrationMethod;
97 
98  BoundedMatrix<double, 3, 3> mTangentProjectionMatrix;
99 
100  double mHelmholtzRadius;
101 
105 
107 
109  };
110 
114 
116  : mpSolidGeometry(EntityCalculationUtils::CreateSolidGeometry(rGeometry))
117  {
118  }
119 
121  Matrix& rStiffnessMatrix,
122  const double W,
124  const ConstantDataContainer& rConstantData) const
125  {
126  Matrix DN_DX;
127  EntityCalculationUtils::CalculateSurfaceElementShapeDerivatives(DN_DX, *mpSolidGeometry, rConstantData.mrGeometry, rConstantData.mrIntegrationMethod, IntegrationPoint);
128  const Matrix& rdNdX = prod(DN_DX, rConstantData.mTangentProjectionMatrix);
129 
130  const BoundedMatrix<double, NumberOfNodes, NumberOfNodes>& A_dirc = W * rConstantData.mHelmholtzRadius * rConstantData.mHelmholtzRadius * prod(rdNdX, trans(rdNdX));
131 
132  for (IndexType i = 0; i < NumberOfNodes; ++i) {
133  const IndexType index_i = i * NumberOfVariables;
134  for (IndexType k = 0; k < NumberOfNodes; ++k) {
135  const IndexType index_k = k * NumberOfVariables;
136  for (IndexType j = 0; j < NumberOfVariables; ++j) {
137  rStiffnessMatrix(index_i + j, index_k + j) += A_dirc(i, k);
138  }
139  }
140  }
141  }
142 
144 
145 private:
148 
149  const Geometry<Node>::Pointer mpSolidGeometry;
150 
152 };
153 
154 } // namespace Kratos
Base class for all Elements.
Definition: element.h:60
Definition: entity_calculation_utils.h:30
static void CalculateSurfaceElementShapeDerivatives(TMatrixType &rOutput, GeometryType &rSolidGeometry, const GeometryType &rSurfaceGeometry, const IntegrationMethodType &rIntegrationMethod, const IndexType PointNumber)
Definition: entity_calculation_utils.cpp:76
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
virtual array_1d< double, 3 > UnitNormal(const CoordinatesArrayType &rPointLocalCoordinates) const
It computes the unit normal of the geometry in the given local point.
Definition: geometry.h:1639
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
Definition: helmholtz_surface_data_container.h:58
ConstantDataContainer(const Element &rElement, const GeometryData::IntegrationMethod &rIntegrationMethod, const ProcessInfo &rProcessInfo)
Definition: helmholtz_surface_data_container.h:63
Definition: helmholtz_surface_data_container.h:36
HelmholtzSurfaceDataContainer(const Geometry< Node > &rGeometry)
Definition: helmholtz_surface_data_container.h:115
void AddStiffnessGaussPointContributions(Matrix &rStiffnessMatrix, const double W, const IndexType IntegrationPoint, const ConstantDataContainer &rConstantData) const
Definition: helmholtz_surface_data_container.h:120
static constexpr IndexType NumberOfVariables
Definition: helmholtz_surface_data_container.h:47
std::size_t IndexType
Definition: helmholtz_surface_data_container.h:41
static constexpr auto SourceVariablesList
Definition: helmholtz_surface_data_container.h:51
static constexpr IndexType NumberOfNodes
Definition: helmholtz_surface_data_container.h:45
static constexpr auto TargetVariablesList
Definition: helmholtz_surface_data_container.h:49
Short class definition.
Definition: integration_point.h:52
Definition: amatrix_interface.h:41
static double Norm3(const TVectorType &a)
Calculates the norm of vector "a" which is assumed to be of size 3.
Definition: math_utils.h:691
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
AMatrix::VectorOuterProductExpression< TExpression1Type, TExpression2Type > outer_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:582
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17
Definition: helmholtz_variable_data.h:29