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.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_H
15 #define KRATOS_EMBEDDED_FLUID_ELEMENT_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 EmbeddedFluidElement : 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 unsigned int Dim = TBaseElement::Dim;
95  constexpr static unsigned int NumNodes = TBaseElement::NumNodes;
96  constexpr static unsigned int BlockSize = TBaseElement::BlockSize;
97  constexpr static unsigned int LocalSize = TBaseElement::LocalSize;
98  constexpr static unsigned int StrainSize = TBaseElement::StrainSize;
99 
100  using BaseElementData = typename TBaseElement::ElementData;
102 
106 
107  //Constructors.
108 
110 
113  EmbeddedFluidElement(IndexType NewId = 0);
114 
116 
120  EmbeddedFluidElement(IndexType NewId, const NodesArrayType& ThisNodes);
121 
123 
128 
130 
135  EmbeddedFluidElement(IndexType NewId, Geometry<NodeType>::Pointer pGeometry, Properties::Pointer pProperties);
136 
138  ~EmbeddedFluidElement() override;
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 
177  void Initialize(const ProcessInfo &rCurrentProcessInfo) override;
178 
180 
187  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
188  VectorType& rRightHandSideVector,
189  const ProcessInfo& rCurrentProcessInfo) override;
190 
192 
199  void Calculate(
200  const Variable<double> &rVariable,
201  double &rOutput,
202  const ProcessInfo &rCurrentProcessInfo) override;
203 
205 
212  void Calculate(
213  const Variable<array_1d<double, 3>> &rVariable,
214  array_1d<double, 3> &rOutput,
215  const ProcessInfo &rCurrentProcessInfo) override;
216 
218 
225  void Calculate(
226  const Variable<Vector> &rVariable,
227  Vector &rOutput,
228  const ProcessInfo &rCurrentProcessInfo) override;
229 
231 
238  void Calculate(
239  const Variable<Matrix> &rVariable,
240  Matrix &rOutput,
241  const ProcessInfo &rCurrentProcessInfo) override;
242 
246 
252 
261  const Variable<array_1d<double, 3>> &rVariable,
262  std::vector<array_1d<double, 3>> &rValues,
263  const ProcessInfo &rCurrentProcessInfo) override;
264 
268 
269  int Check(const ProcessInfo &rCurrentProcessInfo) const override;
270 
274 
275  const Parameters GetSpecifications() const override;
276 
278  std::string Info() const override;
279 
280 
282  void PrintInfo(std::ostream& rOStream) const override;
283 
284 
288 
289 
291 
292 protected:
293 
296 
297 
301 
302 
306 
307  void InitializeGeometryData(EmbeddedElementData& rData) const;
308 
310 
311  void DefineCutGeometryData(EmbeddedElementData& rData) const;
312 
313  void NormalizeInterfaceNormals(typename EmbeddedElementData::InterfaceNormalsType& rNormals, double Tolerance) const;
314 
322  MatrixType& rLHS,
323  VectorType& rRHS,
324  const EmbeddedElementData& rData) const;
325 
333  MatrixType& rLHS,
334  VectorType& rRHS,
335  const EmbeddedElementData& rData) const;
336 
344  MatrixType& rLHS,
345  VectorType& rRHS,
346  const EmbeddedElementData& rData) const;
347 
355  MatrixType& rLHS,
356  VectorType& rRHS,
357  const EmbeddedElementData& rData) const;
358 
366  const EmbeddedElementData& rData,
367  const Vector& rN) const;
368 
374  std::pair<const double, const double> ComputeSlipTangentialPenaltyCoefficients(
375  const EmbeddedElementData& rData) const;
376 
382  std::pair<const double, const double> ComputeSlipTangentialNitscheCoefficients(
383  const EmbeddedElementData& rData) const;
384 
392  MatrixType& rLHS,
393  VectorType& rRHS,
394  const EmbeddedElementData& rData) const;
395 
403  const EmbeddedElementData& rData,
404  const Vector& rN) const;
405 
413  MatrixType& rLHS,
414  VectorType& rRHS,
415  const EmbeddedElementData& rData) const;
416 
424  MatrixType& rLHS,
425  VectorType& rRHS,
426  const EmbeddedElementData& rData) const;
427 
431 
432 
436 
437 
441 
442 
446 
448 
449 private:
450 
453 
457 
461 
462  friend class Serializer;
463 
464  void save(Serializer& rSerializer) const override;
465 
466  void load(Serializer& rSerializer) override;
467 
471 
472 
476 
484  void CalculateDragForce(
485  EmbeddedElementData& rData,
486  array_1d<double,3>& rDragForce) const;
487 
495  void CalculateDragForceCenter(
496  EmbeddedElementData& rData,
497  array_1d<double,3>& rDragForceLocation) const;
498 
509  inline double AuxiliaryDensityGetter(
510  const EmbeddedElementData& rData,
511  const unsigned int NodeIndex) const;
512 
516 
517 
521 
522 
526 
529 
532 
534 
535 
536 }; // Class EmbeddedFluidElement
537 
538 namespace Internals {
539 
540 template <size_t TDim, size_t TNumNodes>
541 ModifiedShapeFunctions::Pointer GetShapeFunctionCalculator(
542  const Element& rElement, const Vector& rDistance);
543 
544 }
545 
547 
550 
551 
555 
556 
558 template< class TElementData >
559 inline std::istream& operator >>(std::istream& rIStream,
561 {
562  return rIStream;
563 }
564 
566 template< class TElementData >
567 inline std::ostream& operator <<(std::ostream& rOStream,
569 {
570  rThis.PrintInfo(rOStream);
571  rOStream << std::endl;
572  rThis.PrintData(rOStream);
573 
574  return rOStream;
575 }
577 
579 
580 } // namespace Kratos.
581 
582 #endif // KRATOS_EMBEDDED_FLUID_ELEMENT_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Elements.
Definition: element.h:60
Definition: embedded_data.h:29
std::vector< array_1d< double, 3 > > InterfaceNormalsType
Definition: embedded_data.h:39
Definition: embedded_fluid_element.h:55
void DefineCutGeometryData(EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:359
void AddBoundaryConditionPenaltyContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:757
Kratos::Matrix ShapeFunctionDerivativesType
Type for a matrix containing the shape function gradients.
Definition: embedded_fluid_element.h:89
void AddSlipTangentialSymmetricCounterpartContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:612
double ComputeSlipNormalPenaltyCoefficient(const EmbeddedElementData &rData, const Vector &rN) const
Definition: embedded_fluid_element.cpp:698
Matrix MatrixType
Matrix type for local contributions to the linear system.
Definition: embedded_fluid_element.h:73
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: embedded_fluid_element.cpp:305
constexpr static unsigned int Dim
Definition: embedded_fluid_element.h:94
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: embedded_fluid_element.h:81
Vector VectorType
Vector type for local contributions to the linear system.
Definition: embedded_fluid_element.h:70
void AddSlipNormalSymmetricCounterpartContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:450
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(EmbeddedFluidElement)
Pointer definition of EmbeddedFluidElement.
Geometry< NodeType >::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Type for an array of shape function gradient matrices.
Definition: embedded_fluid_element.h:92
EmbeddedFluidElement(IndexType NewId=0)
Default constuctor.
Definition: embedded_fluid_element.cpp:21
void AddSlipTangentialPenaltyContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:532
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: embedded_fluid_element.cpp:243
std::size_t IndexType
Definition: embedded_fluid_element.h:75
void NormalizeInterfaceNormals(typename EmbeddedElementData::InterfaceNormalsType &rNormals, double Tolerance) const
Definition: embedded_fluid_element.cpp:392
constexpr static unsigned int StrainSize
Definition: embedded_fluid_element.h:98
Kratos::Vector ShapeFunctionsType
Type for shape function values container.
Definition: embedded_fluid_element.h:86
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: embedded_fluid_element.h:83
void AddBoundaryConditionModifiedNitscheContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:866
constexpr static unsigned int LocalSize
Definition: embedded_fluid_element.h:97
~EmbeddedFluidElement() override
Destructor.
Definition: embedded_fluid_element.cpp:43
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition of nodes container type, redefined from GeometryType.
Definition: embedded_fluid_element.h:67
void Initialize(const ProcessInfo &rCurrentProcessInfo) override
Set up the element for solution.
Definition: embedded_fluid_element.cpp:63
void DefineStandardGeometryData(EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:349
double ComputePenaltyCoefficient(const EmbeddedElementData &rData, const Vector &rN) const
Definition: embedded_fluid_element.cpp:809
constexpr static unsigned int NumNodes
Definition: embedded_fluid_element.h:95
std::vector< std::size_t > EquationIdVectorType
Definition: embedded_fluid_element.h:79
void InitializeGeometryData(EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:321
void AddSlipNormalPenaltyContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:402
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Create a new element of this type.
Definition: embedded_fluid_element.cpp:50
std::pair< const double, const double > ComputeSlipTangentialPenaltyCoefficients(const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:723
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Calculates both LHS and RHS contributions.
Definition: embedded_fluid_element.cpp:84
std::string Info() const override
Turn back information as a string.
Definition: embedded_fluid_element.cpp:298
std::size_t SizeType
Definition: embedded_fluid_element.h:77
void CalculateOnIntegrationPoints(const Variable< array_1d< double, 3 >> &rVariable, std::vector< array_1d< double, 3 >> &rValues, const ProcessInfo &rCurrentProcessInfo) override
Get the Value On Integration Points object Computes the value in the Gauss pts. for a three component...
Definition: embedded_fluid_element.cpp:217
const Parameters GetSpecifications() const override
Definition: embedded_fluid_element.cpp:258
std::pair< const double, const double > ComputeSlipTangentialNitscheCoefficients(const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:740
typename TBaseElement::ElementData BaseElementData
Definition: embedded_fluid_element.h:100
void DropOuterNodesVelocityContribution(MatrixType &rLHS, VectorType &rRHS, const EmbeddedElementData &rData) const
Definition: embedded_fluid_element.cpp:845
void Calculate(const Variable< double > &rVariable, double &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Computes an elemental double value.
Definition: embedded_fluid_element.cpp:145
Node NodeType
Node type (default is: Node)
Definition: embedded_fluid_element.h:64
constexpr static unsigned int BlockSize
Definition: embedded_fluid_element.h:96
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 GetShapeFunctionCalculator(const Element &rElement, const Vector &rDistance)
pybind11::list CalculateOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const ProcessInfo &rProcessInfo)
Definition: add_mesh_to_python.cpp:142
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