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.
compressible_potential_flow_element.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Inigo Lopez, Marc Nuñez and Riccardo Rossi
11 //
12 
13 #if !defined(KRATOS_COMPRESSIBLE_POTENTIAL_FLOW_ELEMENT_H)
14 #define KRATOS_COMPRESSIBLE_POTENTIAL_FLOW_ELEMENT_H
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/element.h"
22 #include "includes/kratos_flags.h"
23 #include "utilities/geometry_utilities.h"
25 namespace Kratos
26 {
29 
33 
37 
41 
45 
46 template <int Dim, int NumNodes>
48 {
49 public:
50  template <unsigned int TNumNodes, unsigned int TDim>
52  {
54  double vol;
55 
58  };
59 
62 
63  typedef Element BaseType;
64  static constexpr int TNumNodes = NumNodes;
65  static constexpr int TDim = Dim;
66 
71 
75 
76  // Constructors.
77 
79 
83  {
84  }
85 
90  : Element(NewId, ThisNodes)
91  {
92  }
93 
97  CompressiblePotentialFlowElement(IndexType NewId, GeometryType::Pointer pGeometry)
98  : Element(NewId, pGeometry)
99  {
100  }
101 
106  GeometryType::Pointer pGeometry,
107  PropertiesType::Pointer pProperties)
108  : Element(NewId, pGeometry, pProperties)
109  {
110  }
111 
116 
121 
126  {
127  }
128 
132 
135 
138 
142 
143  Element::Pointer Create(IndexType NewId,
144  NodesArrayType const& ThisNodes,
145  PropertiesType::Pointer pProperties) const override;
146 
147  Element::Pointer Create(IndexType NewId,
148  GeometryType::Pointer pGeom,
149  PropertiesType::Pointer pProperties) const override;
150 
151  Element::Pointer Clone(IndexType NewId, NodesArrayType const& ThisNodes) const override;
152 
153  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
154  VectorType& rRightHandSideVector,
155  const ProcessInfo& rCurrentProcessInfo) override;
156 
157  void CalculateRightHandSide(VectorType& rRightHandSideVector,
158  const ProcessInfo& rCurrentProcessInfo) override;
159 
160  void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix,
161  const ProcessInfo& rCurrentProcessInfo) override;
162 
163  void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& CurrentProcessInfo) const override;
164 
165  void GetDofList(DofsVectorType& rElementalDofList, const ProcessInfo& rCurrentProcessInfo) const override;
166 
167  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
168 
172 
173  void CalculateOnIntegrationPoints(const Variable<double>& rVariable,
174  std::vector<double>& rValues,
175  const ProcessInfo& rCurrentProcessInfo) override;
176 
177  void CalculateOnIntegrationPoints(const Variable<int>& rVariable,
178  std::vector<int>& rValues,
179  const ProcessInfo& rCurrentProcessInfo) override;
180 
182  std::vector<array_1d<double, 3>>& rValues,
183  const ProcessInfo& rCurrentProcessInfo) override;
184 
188 
189  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
190 
194 
196  std::string Info() const override;
197 
199  void PrintInfo(std::ostream& rOStream) const override;
200 
202  void PrintData(std::ostream& rOStream) const override;
203 
205 protected:
206 
207  double ComputeDensity(const ProcessInfo& rCurrentProcessInfo) const;
208 
209  double ComputeDensityDerivative(const double density,
210  const ProcessInfo& rCurrentProcessInfo) const;
211 
212 private:
215 
216  void GetWakeDistances(array_1d<double, NumNodes>& distances) const;
217 
218  void GetEquationIdVectorNormalElement(EquationIdVectorType& rResult) const;
219 
220  void GetEquationIdVectorKuttaElement(EquationIdVectorType& rResult) const;
221 
222  void GetEquationIdVectorWakeElement(EquationIdVectorType& rResult) const;
223 
224  void GetDofListNormalElement(DofsVectorType& rElementalDofList) const;
225 
226  void GetDofListKuttaElement(DofsVectorType& rElementalDofList) const;
227 
228  void GetDofListWakeElement(DofsVectorType& rElementalDofList) const;
229 
230  void CalculateLeftHandSideNormalElement(MatrixType& rLeftHandSideMatrix,
231  const ProcessInfo& rCurrentProcessInfo);
232 
233  void CalculateRightHandSideNormalElement(VectorType& rRightHandSideVector,
234  const ProcessInfo& rCurrentProcessInfo);
235 
236  void CalculateLeftHandSideWakeElement(MatrixType& rLeftHandSideMatrix,
237  const ProcessInfo& rCurrentProcessInfo);
238 
239  void CalculateRightHandSideWakeElement(VectorType& rRightHandSideVector,
240  const ProcessInfo& rCurrentProcessInfo);
241 
242  void CalculateLeftHandSideContribution(BoundedMatrix<double, NumNodes, NumNodes>& rLhs_total,
243  const ProcessInfo& rCurrentProcessInfo,
244  const array_1d<double, Dim>& rVelocity,
245  const ElementalData<NumNodes, Dim>& rData);
246 
247  void CalculateRightHandSideContribution(BoundedVector<double, NumNodes>& rRhs_total,
248  const ProcessInfo& rCurrentProcessInfo,
249  const array_1d<double, Dim>& rVelocity,
250  const ElementalData<NumNodes, Dim>& rData);
251 
252  void CalculateLeftHandSideSubdividedElement(Matrix& lhs_positive,
253  Matrix& lhs_negative,
254  const ProcessInfo& rCurrentProcessInfo);
255 
256  void CalculateVolumesSubdividedElement(double& rUpper_vol,
257  double& rLower_vol,
258  const ProcessInfo& rCurrentProcessInfo);
259 
260  void ComputeLHSGaussPointContribution(const double weight,
261  Matrix& lhs,
262  const ElementalData<NumNodes, Dim>& data) const;
263 
264  void AssignLeftHandSideSubdividedElement(Matrix& rLeftHandSideMatrix,
265  Matrix& lhs_positive,
266  Matrix& lhs_negative,
267  const BoundedMatrix<double, NumNodes, NumNodes>& rUpper_lhs_total,
268  const BoundedMatrix<double, NumNodes, NumNodes>& rLower_lhs_total,
269  const BoundedMatrix<double, NumNodes, NumNodes>& rLhs_wake_condition,
270  const ElementalData<NumNodes, Dim>& data) const;
271 
272  void AssignLeftHandSideWakeElement(MatrixType& rLeftHandSideMatrix,
273  const BoundedMatrix<double, NumNodes, NumNodes>& rUpper_lhs_total,
274  const BoundedMatrix<double, NumNodes, NumNodes>& rLower_lhs_total,
275  const BoundedMatrix<double, NumNodes, NumNodes>& rLhs_wake_condition,
276  const ElementalData<NumNodes, Dim>& rData) const;
277 
278  void AssignLeftHandSideWakeNode(MatrixType& rLeftHandSideMatrix,
279  const BoundedMatrix<double, NumNodes, NumNodes>& rUpper_lhs_total,
280  const BoundedMatrix<double, NumNodes, NumNodes>& rLower_lhs_total,
281  const BoundedMatrix<double, NumNodes, NumNodes>& rLhs_wake_condition,
282  const ElementalData<NumNodes, Dim>& rData,
283  unsigned int row) const;
284 
285  void AssignRightHandSideWakeNode(VectorType& rRightHandSideVector,
286  const BoundedVector<double, NumNodes>& rUpper_rhs,
287  const BoundedVector<double, NumNodes>& rLower_rhs,
288  const BoundedVector<double, NumNodes>& rWake_rhs,
289  const ElementalData<NumNodes, Dim>& rData,
290  unsigned int& rRow) const;
291 
292  void ComputeElementInternalEnergy();
293 
297 
301 
302  friend class Serializer;
303 
304  void save(Serializer& rSerializer) const override;
305 
306  void load(Serializer& rSerializer) override;
307 
311 
315 
319 
321 
322 }; // Class CompressiblePotentialFlowElement
323 
325 
328 
332 
334 
335 } // namespace Kratos.
336 
337 #endif // KRATOS_COMPRESSIBLE_POTENTIAL_FLOW_ELEMENT_H defined
Definition: compressible_potential_flow_element.h:48
double ComputeDensityDerivative(const double density, const ProcessInfo &rCurrentProcessInfo) const
Definition: compressible_potential_flow_element.cpp:858
std::string Info() const override
Turn back information as a string.
Definition: compressible_potential_flow_element.cpp:273
CompressiblePotentialFlowElement(IndexType NewId=0)
Default constuctor.
Definition: compressible_potential_flow_element.h:82
static constexpr int TDim
Definition: compressible_potential_flow_element.h:65
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
It creates a new element pointer.
Definition: compressible_potential_flow_element.cpp:26
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: compressible_potential_flow_element.cpp:63
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(CompressiblePotentialFlowElement)
CompressiblePotentialFlowElement(CompressiblePotentialFlowElement &&rOther)=delete
CompressiblePotentialFlowElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: compressible_potential_flow_element.h:105
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: compressible_potential_flow_element.cpp:76
CompressiblePotentialFlowElement(CompressiblePotentialFlowElement const &rOther)=delete
~CompressiblePotentialFlowElement() override
Definition: compressible_potential_flow_element.h:125
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: compressible_potential_flow_element.cpp:55
void CalculateOnIntegrationPoints(const Variable< double > &rVariable, std::vector< double > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: compressible_potential_flow_element.cpp:181
CompressiblePotentialFlowElement & operator=(CompressiblePotentialFlowElement &&rOther)=delete
Move operator.
CompressiblePotentialFlowElement & operator=(CompressiblePotentialFlowElement const &rOther)=delete
Assignment operator.
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Definition: compressible_potential_flow_element.cpp:117
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &CurrentProcessInfo) const override
Definition: compressible_potential_flow_element.cpp:89
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: compressible_potential_flow_element.cpp:281
void FinalizeSolutionStep(const ProcessInfo &rCurrentProcessInfo) override
Definition: compressible_potential_flow_element.cpp:145
static constexpr int TNumNodes
Definition: compressible_potential_flow_element.h:64
Element BaseType
Definition: compressible_potential_flow_element.h:63
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: compressible_potential_flow_element.cpp:287
Element::Pointer Clone(IndexType NewId, NodesArrayType const &ThisNodes) const override
It creates a new element pointer and clones the previous element data.
Definition: compressible_potential_flow_element.cpp:45
double ComputeDensity(const ProcessInfo &rCurrentProcessInfo) const
Definition: compressible_potential_flow_element.cpp:819
CompressiblePotentialFlowElement(IndexType NewId, const NodesArrayType &ThisNodes)
Definition: compressible_potential_flow_element.h:89
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: compressible_potential_flow_element.cpp:154
CompressiblePotentialFlowElement(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: compressible_potential_flow_element.h:97
Base class for all Elements.
Definition: element.h:60
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
Definition: amatrix_interface.h:41
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
float density
Definition: face_heat.py:56
lhs
Definition: generate_frictional_mortar_condition.py:297
data
Definition: mesh_to_mdpa_converter.py:59
def load(f)
Definition: ode_solve.py:307
Definition: compressible_potential_flow_element.h:52
array_1d< double, TNumNodes > N
Definition: compressible_potential_flow_element.h:57
double vol
Definition: compressible_potential_flow_element.h:54
array_1d< double, TNumNodes > potentials
Definition: compressible_potential_flow_element.h:53
BoundedMatrix< double, TNumNodes, TDim > DN_DX
Definition: compressible_potential_flow_element.h:56
array_1d< double, TNumNodes > distances
Definition: compressible_potential_flow_element.h:53