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.
embedded_fluid_element_discontinuous.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 author: Ruben Zorrilla
11 // Co-authors: Jordi Cotela
12 //
13 
14 #ifndef KRATOS_EMBEDDED_FLUID_ELEMENT_DISCONTINUOUS_H
15 #define KRATOS_EMBEDDED_FLUID_ELEMENT_DISCONTINUOUS_H
16 
17 #include "includes/define.h"
18 #include "includes/element.h"
19 #include "includes/serializer.h"
20 #include "geometries/geometry.h"
22 
23 #include "includes/cfd_variables.h"
25 
27 
28 namespace Kratos
29 {
30 
33 
36 
40 
44 
48 
52 
53 template< class TBaseElement >
54 class EmbeddedFluidElementDiscontinuous : public TBaseElement
55 {
56 public:
59 
62 
64  typedef Node NodeType;
65 
68 
70  typedef Vector VectorType;
71 
73  typedef Matrix MatrixType;
74 
75  typedef std::size_t IndexType;
76 
77  typedef std::size_t SizeType;
78 
79  typedef std::vector<std::size_t> EquationIdVectorType;
80 
81  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
82 
84 
87 
90 
93 
94  constexpr static std::size_t Dim = TBaseElement::Dim;
95  constexpr static std::size_t NumNodes = TBaseElement::NumNodes;
96  constexpr static std::size_t BlockSize = TBaseElement::BlockSize;
97  constexpr static std::size_t LocalSize = TBaseElement::LocalSize;
98  constexpr static std::size_t StrainSize = TBaseElement::StrainSize;
99 
100  using BaseElementData = typename TBaseElement::ElementData;
102 
106 
107  //Constructors.
108 
110 
114 
116 
121 
123 
128 
130 
135  EmbeddedFluidElementDiscontinuous(IndexType NewId, Geometry<NodeType>::Pointer pGeometry, Properties::Pointer pProperties);
136 
139 
143 
144 
148 
149 
151 
158  Element::Pointer Create(IndexType NewId,
159  NodesArrayType const& ThisNodes,
160  Properties::Pointer pProperties) const override;
161 
163 
170  Element::Pointer Create(IndexType NewId,
172  Properties::Pointer pProperties) const override;
173 
175 
178  void Initialize(const ProcessInfo &rCurrentProcessInfo) override;
179 
181 
188  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
189  VectorType& rRightHandSideVector,
190  const ProcessInfo& rCurrentProcessInfo) override;
191 
193 
200  void Calculate(
201  const Variable<double> &rVariable,
202  double &rOutput,
203  const ProcessInfo &rCurrentProcessInfo) override;
204 
206 
213  void Calculate(
214  const Variable<array_1d<double, 3>> &rVariable,
215  array_1d<double, 3> &rOutput,
216  const ProcessInfo &rCurrentProcessInfo) override;
217 
219 
226  void Calculate(
227  const Variable<Vector> &rVariable,
228  Vector &rOutput,
229  const ProcessInfo &rCurrentProcessInfo) override;
230 
232 
239  void Calculate(
240  const Variable<Matrix> &rVariable,
241  Matrix &rOutput,
242  const ProcessInfo &rCurrentProcessInfo) override;
243 
247 
251 
252  int Check(const ProcessInfo &rCurrentProcessInfo) const override;
253 
257 
258  const Parameters GetSpecifications() const override;
259 
261  std::string Info() const override;
262 
263 
265  void PrintInfo(std::ostream& rOStream) const override;
266 
267 
271 
272 
274 
275 protected:
276 
279 
280 
284 
285 
289 
290 
294 
301 
308 
317 
326 
335  double Tolerance) const;
336 
344  MatrixType& rLHS,
345  VectorType& rRHS,
346  const EmbeddedDiscontinuousElementData& rData) const;
347 
355  MatrixType& rLHS,
356  VectorType& rRHS,
357  const EmbeddedDiscontinuousElementData& rData) const;
358 
366  MatrixType& rLHS,
367  VectorType& rRHS,
368  const EmbeddedDiscontinuousElementData& rData) const;
369 
377  MatrixType& rLHS,
378  VectorType& rRHS,
379  const EmbeddedDiscontinuousElementData& rData) const;
380 
389  const Vector& rN) const;
390 
396  std::pair<const double, const double> ComputeTangentialPenaltyCoefficients(const EmbeddedDiscontinuousElementData& rData) const;
397 
403  std::pair<const double, const double> ComputeTangentialNitscheCoefficients(const EmbeddedDiscontinuousElementData& rData) const;
404 
405 
409 
410 
414 
415 
419 
421 
422 private:
423 
426 
430 
434 
435  friend class Serializer;
436 
437  void save(Serializer& rSerializer) const override;
438 
439  void load(Serializer& rSerializer) override;
440 
444 
445 
449 
457  void CalculateDragForce(
459  array_1d<double,3>& rDragForce) const;
460 
468  void CalculateDragForceCenter(
470  array_1d<double,3>& rDragForceLocation) const;
471 
482  inline double AuxiliaryDensityGetter(
484  const std::size_t NodeIndex) const;
485 
489 
490 
494 
495 
499 
502 
505 
507 
508 
509 }; // Class EmbeddedFluidElementDiscontinuous
510 
511 namespace EmbeddedDiscontinuousInternals {
512 
513 template <size_t TDim, size_t TNumNodes>
514 ModifiedShapeFunctions::UniquePointer GetShapeFunctionCalculator(
515  const Element &rElement,
516  const Vector &rElementalDistances);
517 
518 template <size_t TDim, size_t TNumNodes>
519 ModifiedShapeFunctions::Pointer GetContinuousShapeFunctionCalculator(
520  const Element &rElement,
521  const Vector &rElementalDistances);
522 
523 template <size_t TDim, size_t TNumNodes>
524 ModifiedShapeFunctions::UniquePointer GetIncisedShapeFunctionCalculator(
525  const Element &rElement,
526  const Vector &rElementalDistancesWithExtrapolated,
527  const Vector &rElementalEdgeDistancesExtrapolated);
528 }
529 
531 
534 
535 
539 
540 
542 template< class TElementData >
543 inline std::istream& operator >>(
544  std::istream& rIStream,
546 {
547  return rIStream;
548 }
549 
551 template< class TElementData >
552 inline std::ostream& operator <<(
553  std::ostream& rOStream,
555 {
556  rThis.PrintInfo(rOStream);
557  rOStream << std::endl;
558  rThis.PrintData(rOStream);
559 
560  return rOStream;
561 }
563 
565 
566 } // namespace Kratos.
567 
568 #endif // KRATOS_EMBEDDED_FLUID_ELEMENT_DISCONTINUOUS_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Elements.
Definition: element.h:60
Definition: embedded_discontinuous_data.h:29
std::vector< array_1d< double, 3 > > InterfaceNormalsType
Definition: embedded_discontinuous_data.h:39
Definition: embedded_fluid_element_discontinuous.h:55
void Calculate(const Variable< double > &rVariable, double &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Computes an elemental double value.
Definition: embedded_fluid_element_discontinuous.cpp:194
std::pair< const double, const double > ComputeTangentialPenaltyCoefficients(const EmbeddedDiscontinuousElementData &rData) const
Definition: embedded_fluid_element_discontinuous.cpp:989
void NormalizeInterfaceNormals(typename EmbeddedDiscontinuousElementData::InterfaceNormalsType &rNormals, double Tolerance) const
For an intersected element, normalize the interface normals This method normalizes the interface norm...
Definition: embedded_fluid_element_discontinuous.cpp:494
void AddTangentialPenaltyContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedDiscontinuousElementData &rData) const
Definition: embedded_fluid_element_discontinuous.cpp:712
EmbeddedFluidElementDiscontinuous(IndexType NewId=0)
Default constuctor.
Definition: embedded_fluid_element_discontinuous.cpp:25
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Calculates both LHS and RHS contributions.
Definition: embedded_fluid_element_discontinuous.cpp:100
constexpr static std::size_t StrainSize
Definition: embedded_fluid_element_discontinuous.h:98
Node NodeType
Node type (default is: Node)
Definition: embedded_fluid_element_discontinuous.h:64
void AddNormalSymmetricCounterpartContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedDiscontinuousElementData &rData) const
Definition: embedded_fluid_element_discontinuous.cpp:579
Matrix MatrixType
Matrix type for local contributions to the linear system.
Definition: embedded_fluid_element_discontinuous.h:73
void AddTangentialSymmetricCounterpartContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedDiscontinuousElementData &rData) const
Definition: embedded_fluid_element_discontinuous.cpp:836
std::pair< const double, const double > ComputeTangentialNitscheCoefficients(const EmbeddedDiscontinuousElementData &rData) const
Definition: embedded_fluid_element_discontinuous.cpp:1005
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: embedded_fluid_element_discontinuous.cpp:254
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: embedded_fluid_element_discontinuous.h:83
double ComputeNormalPenaltyCoefficient(const EmbeddedDiscontinuousElementData &rData, const Vector &rN) const
Definition: embedded_fluid_element_discontinuous.cpp:964
void DefineIncisedGeometryData(EmbeddedDiscontinuousElementData &rData) const
Intersected element geometry data fill This method sets the data structure geometry fields (shape fun...
Definition: embedded_fluid_element_discontinuous.cpp:433
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition of nodes container type, redefined from GeometryType.
Definition: embedded_fluid_element_discontinuous.h:67
typename TBaseElement::ElementData BaseElementData
Definition: embedded_fluid_element_discontinuous.h:100
const Parameters GetSpecifications() const override
Definition: embedded_fluid_element_discontinuous.cpp:268
void DefineStandardGeometryData(EmbeddedDiscontinuousElementData &rData) const
Non-intersected element geometry data fill This method sets the data structure geometry fields (shape...
Definition: embedded_fluid_element_discontinuous.cpp:367
Kratos::Matrix ShapeFunctionDerivativesType
Type for a matrix containing the shape function gradients.
Definition: embedded_fluid_element_discontinuous.h:89
std::vector< std::size_t > EquationIdVectorType
Definition: embedded_fluid_element_discontinuous.h:79
void InitializeGeometryData(EmbeddedDiscontinuousElementData &rData) const
Current element data structure initialization This method checks if the element is intersected and ca...
Definition: embedded_fluid_element_discontinuous.cpp:332
std::string Info() const override
Turn back information as a string.
Definition: embedded_fluid_element_discontinuous.cpp:308
Vector VectorType
Vector type for local contributions to the linear system.
Definition: embedded_fluid_element_discontinuous.h:70
void DefineCutGeometryData(EmbeddedDiscontinuousElementData &rData) const
Intersected element geometry data fill This method sets the data structure geometry fields (shape fun...
Definition: embedded_fluid_element_discontinuous.cpp:375
std::size_t IndexType
Definition: embedded_fluid_element_discontinuous.h:75
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: embedded_fluid_element_discontinuous.h:81
constexpr static std::size_t LocalSize
Definition: embedded_fluid_element_discontinuous.h:97
void AddNormalPenaltyContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedDiscontinuousElementData &rData) const
Definition: embedded_fluid_element_discontinuous.cpp:505
Geometry< NodeType >::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Type for an array of shape function gradient matrices.
Definition: embedded_fluid_element_discontinuous.h:92
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(EmbeddedFluidElementDiscontinuous)
Pointer definition of EmbeddedFluidElementDiscontinuous.
Kratos::Vector ShapeFunctionsType
Type for shape function values container.
Definition: embedded_fluid_element_discontinuous.h:86
constexpr static std::size_t BlockSize
Definition: embedded_fluid_element_discontinuous.h:96
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: embedded_fluid_element_discontinuous.cpp:316
void Initialize(const ProcessInfo &rCurrentProcessInfo) override
Set up the element for solution.
Definition: embedded_fluid_element_discontinuous.cpp:73
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Create a new element of this type.
Definition: embedded_fluid_element_discontinuous.cpp:54
constexpr static std::size_t Dim
Definition: embedded_fluid_element_discontinuous.h:94
std::size_t SizeType
Definition: embedded_fluid_element_discontinuous.h:77
constexpr static std::size_t NumNodes
Definition: embedded_fluid_element_discontinuous.h:95
~EmbeddedFluidElementDiscontinuous() override
Destructor.
Definition: embedded_fluid_element_discontinuous.cpp:47
Geometry base class.
Definition: geometry.h:71
This object defines an indexed object.
Definition: indexed_object.h:54
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.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
ModifiedShapeFunctions::Pointer GetContinuousShapeFunctionCalculator(const Element &rElement, const Vector &rElementalDistances)
ModifiedShapeFunctions::UniquePointer GetIncisedShapeFunctionCalculator(const Element &rElement, const Vector &rElementalDistancesWithExtrapolated, const Vector &rElementalEdgeDistancesExtrapolated)
ModifiedShapeFunctions::UniquePointer GetShapeFunctionCalculator(const Element &rElement, const Vector &rElementalDistances)
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307