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.
droplet_dynamics_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: Mohammad R. Hashemi (based on TwoFluidsNavierStokes element)
11 //
12 
13 #if !defined(KRATOS_DROPLET_DYNAMICS_ELEMENT)
14 #define KRATOS_DROPLET_DYNAMICS_ELEMENT
15 
16 // System includes
17 
18 // Project includes
19 #include "includes/define.h"
20 #include "includes/element.h"
21 #include "includes/variables.h"
22 #include "includes/serializer.h"
23 #include "includes/cfd_variables.h"
26 #include "utilities/geometry_utilities.h"
29 
30 namespace Kratos
31 {
32 
33 /*The "DropletDynamicsElement" is based on the "TwoFluidNavierStokes" element and uses the very same structure and stabilization
34 Techniques.*/
35 
38 
42 
46 
50 
54 
55 template< class TElementData >
56 class DropletDynamicsElement : public FluidElement<TElementData>
57 {
58 public:
59 
62 
65 
66  typedef Node NodeType;
69  typedef Vector VectorType;
70  typedef Matrix MatrixType;
71  typedef std::size_t IndexType;
72  typedef std::size_t SizeType;
73  typedef std::vector<std::size_t> EquationIdVectorType;
74  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
79  constexpr static unsigned int Dim = FluidElement<TElementData>::Dim;
80  constexpr static unsigned int NumNodes = FluidElement<TElementData>::NumNodes;
81  constexpr static unsigned int BlockSize = FluidElement<TElementData>::BlockSize;
82  constexpr static unsigned int LocalSize = FluidElement<TElementData>::LocalSize;
83  constexpr static unsigned int StrainSize = (Dim - 1) * 3;
84 
88 
90 
94 
96 
101 
103 
107  DropletDynamicsElement(IndexType NewId, GeometryType::Pointer pGeometry);
108 
110 
115  DropletDynamicsElement(IndexType NewId, GeometryType::Pointer pGeometry, Properties::Pointer pProperties);
116 
119 
123 
127 
129 
136  Element::Pointer Create(IndexType NewId,
137  NodesArrayType const& ThisNodes,
138  Properties::Pointer pProperties) const override;
139 
141 
148  Element::Pointer Create(IndexType NewId,
149  GeometryType::Pointer pGeom,
150  Properties::Pointer pProperties) const override;
151 
153 
161  MatrixType &rLeftHandSideMatrix,
162  VectorType &rRightHandSideVector,
163  const ProcessInfo &rCurrentProcessInfo) override;
164 
166 
173  VectorType &rRightHandSideVector,
174  const ProcessInfo &rCurrentProcessInfo) override;
175 
177 
182  int Check(const ProcessInfo &rCurrentProcessInfo) const override;
183 
187 
191 
192  const Parameters GetSpecifications() const override;
193 
195  std::string Info() const override;
196 
198  void PrintInfo(std::ostream& rOStream) const override;
199 
203 
207 
211 
213 
222  const Variable<double> &rVariable,
223  std::vector<double> &rValues,
224  const ProcessInfo &rCurrentProcessInfo ) override;
225 
229 
231 protected:
234 
238 
242 
246 
256  TElementData& rData,
257  MatrixType& rLHS,
258  VectorType& rRHS) override;
259 
267  TElementData& rData,
268  MatrixType& rLHS) override;
269 
277  TElementData& rData,
278  VectorType& rRHS) override;
279 
287  TElementData& rData,
288  MatrixType& rLHS);
289 
297  TElementData& rData,
298  VectorType& rRHS);
299 
311  TElementData& rData,
312  MatrixType& rV,
313  MatrixType& rH,
314  MatrixType& rKee,
315  VectorType& rRHS_ee);
316 
318 
324  TElementData& rData,
325  unsigned int IntegrationPointIndex,
326  double Weight,
327  const typename TElementData::MatrixRowType& rN,
328  const typename TElementData::ShapeDerivativesType& rDN_DX) const override;
329 
331 
339  TElementData& rData,
340  unsigned int IntegrationPointIndex,
341  double Weight,
342  const typename TElementData::MatrixRowType& rN,
343  const typename TElementData::ShapeDerivativesType& rDN_DX,
344  const typename TElementData::MatrixRowType& rNenr,
345  const typename TElementData::ShapeDerivativesType& rDN_DXenr) const;
346 
357  const TElementData& rData,
358  const Vector& rInterfaceWeights,
359  const Matrix& rEnrInterfaceShapeFunctionPos,
360  const Matrix& rEnrInterfaceShapeFunctionNeg,
361  const GeometryType::ShapeFunctionsGradientsType& rInterfaceShapeDerivatives,
362  MatrixType& rKeeTot,
363  VectorType& rRHSeeTot);
364 
370  void CalculateStrainRate(TElementData& rData) const override;
371 
375 
379 
383 
387 
391 
395 
396  friend class Serializer;
397 
398  void save(Serializer& rSerializer) const override;
399 
400  void load(Serializer& rSerializer) override;
401 
403 private:
406 
421  void ComputeSplitting(
422  TElementData& rData,
423  MatrixType& rShapeFunctionsPos,
424  MatrixType& rShapeFunctionsNeg,
425  MatrixType& rEnrichedShapeFunctionsPos,
426  MatrixType& rEnrichedShapeFunctionsNeg,
427  GeometryType::ShapeFunctionsGradientsType& rShapeDerivativesPos,
428  GeometryType::ShapeFunctionsGradientsType& rShapeDerivativesNeg,
429  GeometryType::ShapeFunctionsGradientsType& rEnrichedShapeDerivativesPos,
430  GeometryType::ShapeFunctionsGradientsType& rEnrichedShapeDerivativesNeg,
431  ModifiedShapeFunctions::Pointer pModifiedShapeFunctions);
432 
444  void ComputeSplitInterface(
445  const TElementData& rData,
446  MatrixType& rInterfaceShapeFunctionNeg,
447  MatrixType& rEnrInterfaceShapeFunctionPos,
448  MatrixType& rEnrInterfaceShapeFunctionNeg,
449  GeometryType::ShapeFunctionsGradientsType& rInterfaceShapeDerivativesNeg,
450  Vector& rInterfaceWeightsNeg,
451  std::vector<array_1d<double,3>>& rInterfaceNormalsNeg,
452  ModifiedShapeFunctions::Pointer pModifiedShapeFunctions);
453 
459  ModifiedShapeFunctions::UniquePointer pGetModifiedShapeFunctionsUtility(
460  const GeometryType::Pointer pGeometry,
461  const Vector& rDistances);
462 
468  void CalculateCurvatureOnInterfaceGaussPoints(
469  const Matrix& rInterfaceShapeFunctions,
470  Vector& rInterfaceCurvature);
471 
481  void SurfaceTension(
482  const double SurfaceTensionCoefficient,
483  const Vector& rCurvature,
484  const Vector& rInterfaceWeights,
485  const Matrix& rInterfaceShapeFunctions,
486  const std::vector<array_1d<double,3>>& rInterfaceNormalsNeg,
487  VectorType& rRHS);
488 
502  void CondenseEnrichment(
503  Matrix& rLeftHandSideMatrix,
504  VectorType& rRightHandSideVector,
505  const MatrixType& rVTot,
506  const MatrixType& rHTot,
507  MatrixType& rKeeTot,
508  const VectorType& rRHSeeTot);
509 
510  void AddSurfaceTensionContribution(
511  const TElementData& rData,
512  MatrixType& rInterfaceShapeFunction,
513  MatrixType& rEnrInterfaceShapeFunctionPos,
514  MatrixType& rEnrInterfaceShapeFunctionNeg,
515  GeometryType::ShapeFunctionsGradientsType& rInterfaceShapeDerivatives,
516  Vector& rInterfaceWeights,
517  std::vector<array_1d<double, 3>>& rInterfaceNormalsNeg,
518  Matrix &rLeftHandSideMatrix,
519  VectorType &rRightHandSideVector,
520  const MatrixType &rHtot,
521  const MatrixType &rVtot,
522  MatrixType &rKeeTot,
523  VectorType &rRHSeeTot);
524 
528 
532 
536 
539 
542 
544 
545 }; // Class DropletDynamicsElement
548 
552 
554 template< class TElementData >
555 inline std::istream& operator >> (std::istream& rIStream,
557 {
558  return rIStream;
559 }
560 
562 template< class TElementData >
563 inline std::ostream& operator <<(std::ostream& rOStream,
565 {
566  rThis.PrintInfo(rOStream);
567  rOStream << std::endl;
568  rThis.PrintData(rOStream);
569 
570  return rOStream;
571 }
573 
574 } // namespace Kratos.
575 
576 #endif // KRATOS_DROPLET_DYNAMICS_ELEMENT
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: droplet_dynamics_element.h:57
std::vector< std::size_t > EquationIdVectorType
Definition: droplet_dynamics_element.h:73
std::size_t SizeType
Definition: droplet_dynamics_element.h:72
virtual void ComputeGaussPointRHSContribution(TElementData &rData, VectorType &rRHS)
Computes the RHS Gaus pt. contribution This method computes the contribution to the RHS of a Gauss pt...
constexpr static unsigned int BlockSize
Definition: droplet_dynamics_element.h:81
void AddTimeIntegratedLHS(TElementData &rData, MatrixType &rLHS) override
Computes the time integrated LHS matrix This method computes the Left Hand Side time integrated contr...
virtual void ComputeGaussPointLHSContribution(TElementData &rData, MatrixType &rLHS)
Computes the LHS Gauss pt. contribution This method computes the contribution to the LHS of a Gauss p...
std::size_t IndexType
Definition: droplet_dynamics_element.h:71
Vector VectorType
Definition: droplet_dynamics_element.h:69
std::string Info() const override
Turn back information as a string.
constexpr static unsigned int Dim
Definition: droplet_dynamics_element.h:79
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Computes the elemental LHS and RHS elemental contributions.
void UpdateIntegrationPointData(TElementData &rData, unsigned int IntegrationPointIndex, double Weight, const typename TElementData::MatrixRowType &rN, const typename TElementData::ShapeDerivativesType &rDN_DX) const override
Set up the element's data and constitutive law for the current integration point.
void UpdateIntegrationPointData(TElementData &rData, unsigned int IntegrationPointIndex, double Weight, const typename TElementData::MatrixRowType &rN, const typename TElementData::ShapeDerivativesType &rDN_DX, const typename TElementData::MatrixRowType &rNenr, const typename TElementData::ShapeDerivativesType &rDN_DXenr) const
Set up the element's data for a cut element and constitutive law for the current integration point.
virtual void ComputeGaussPointEnrichmentContributions(TElementData &rData, MatrixType &rV, MatrixType &rH, MatrixType &rKee, VectorType &rRHS_ee)
Computes the pressure enrichment contributions This method computes the pressure enrichment contribut...
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, Properties::Pointer pProperties) const override
Create a new element of this type using given geometry.
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
FluidElement< TElementData >::ShapeFunctionDerivativesArrayType ShapeFunctionDerivativesArrayType
Definition: droplet_dynamics_element.h:78
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(DropletDynamicsElement)
Counted pointer of.
Geometry< NodeType > GeometryType
Definition: droplet_dynamics_element.h:67
Node NodeType
Definition: droplet_dynamics_element.h:66
FluidElement< TElementData >::ShapeFunctionsType ShapeFunctionsType
Definition: droplet_dynamics_element.h:76
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Auxiliar element check function.
DropletDynamicsElement(IndexType NewId=0)
Default constuctor.
void CalculateOnIntegrationPoints(const Variable< double > &rVariable, std::vector< double > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Function to visualize the divergence field.
FluidElement< TElementData >::ShapeFunctionDerivativesType ShapeFunctionDerivativesType
Definition: droplet_dynamics_element.h:77
constexpr static unsigned int LocalSize
Definition: droplet_dynamics_element.h:82
constexpr static unsigned int NumNodes
Definition: droplet_dynamics_element.h:80
DropletDynamicsElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using a geometry object.
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Create a new element of this type.
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: droplet_dynamics_element.h:75
virtual ~DropletDynamicsElement()
Destructor.
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: droplet_dynamics_element.h:74
void CalculateStrainRate(TElementData &rData) const override
Calculate the strain rate In this function we calculate the strain rate at the mid step.
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Computes the elemental RHS elemental contribution.
Matrix MatrixType
Definition: droplet_dynamics_element.h:70
DropletDynamicsElement(IndexType NewId, GeometryType::Pointer pGeometry, Properties::Pointer pProperties)
Constuctor using geometry and properties.
void load(Serializer &rSerializer) override
void AddTimeIntegratedRHS(TElementData &rData, VectorType &rRHS) override
Computes the time integrated RHS vector This method computes the Right Hand Side time integrated cont...
virtual void PressureGradientStabilization(const TElementData &rData, const Vector &rInterfaceWeights, const Matrix &rEnrInterfaceShapeFunctionPos, const Matrix &rEnrInterfaceShapeFunctionNeg, const GeometryType::ShapeFunctionsGradientsType &rInterfaceShapeDerivatives, MatrixType &rKeeTot, VectorType &rRHSeeTot)
Computes the enriched LHS/RHS terms associated with the pressure stabilizations at the interface.
const Parameters GetSpecifications() const override
This method provides the specifications/requirements of the element.
DropletDynamicsElement(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: droplet_dynamics_element.h:68
void AddTimeIntegratedSystem(TElementData &rData, MatrixType &rLHS, VectorType &rRHS) override
Computes time integrated LHS and RHS arrays This method computes both the Left Hand Side and Right Ha...
void save(Serializer &rSerializer) const override
constexpr static unsigned int StrainSize
Definition: droplet_dynamics_element.h:83
std::size_t IndexType
Definition: flags.h:74
Large Displacement Lagrangian Element for 3D and 2D geometries. (base class)
Definition: fluid_element.h:61
MatrixRow< Matrix > ShapeFunctionsType
Type for shape function values container.
Definition: fluid_element.h:95
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: fluid_element.hpp:584
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
A stabilized element for the incompressible Navier-Stokes equations, utilizing lagrangian_Eulerian ap...
Definition: surface_tension.h:91
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