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.
two_fluid_navier_stokes.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: Daniel Diez
11 // Co-authors: Ruben Zorrilla
12 //
13 
14 #if !defined(KRATOS_TWO_FLUID_NAVIER_STOKES)
15 #define KRATOS_TWO_FLUID_NAVIER_STOKES
16 
17 // System includes
18 
19 // Project includes
20 #include "includes/define.h"
21 #include "includes/element.h"
22 #include "includes/variables.h"
23 #include "includes/serializer.h"
24 #include "includes/cfd_variables.h"
27 #include "utilities/geometry_utilities.h"
30 
31 namespace Kratos
32 {
33 
34 /*The "TwoFluidNavierStokes" element is an element based on the Variational Multiscale Stabilization technique (VMS)
35 * which is designed for the solution of a two fluids (air and a non-air one) problems.
36 *
37 * A distinctive feature of the element is the use of 4 LOCAL enrichment functions, which allows to model
38 * a discontinuity in both the pressure field and in its gradient.
39 * The enrichment functions are obtained by duplicating all of the degrees of freedom of the element.
40 * Since the enrichment is performed elementwise, a purely local static condensation step is performed,
41 * meaning that no extra degrees of freedom are added..
42 *
43 * Since a jump in the pressure can be considered, the element shall be able to habdle moderate changes of the viscosity
44 * between the two fluids to be considered*/
45 
48 
52 
56 
60 
64 
65 template< class TElementData >
66 class TwoFluidNavierStokes : public FluidElement<TElementData>
67 {
68 public:
69 
72 
75 
76  typedef Node NodeType;
79  typedef Vector VectorType;
80  typedef Matrix MatrixType;
81  typedef std::size_t IndexType;
82  typedef std::size_t SizeType;
83  typedef std::vector<std::size_t> EquationIdVectorType;
84  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
89  constexpr static unsigned int Dim = FluidElement<TElementData>::Dim;
90  constexpr static unsigned int NumNodes = FluidElement<TElementData>::NumNodes;
91  constexpr static unsigned int BlockSize = FluidElement<TElementData>::BlockSize;
92  constexpr static unsigned int LocalSize = FluidElement<TElementData>::LocalSize;
93  constexpr static unsigned int StrainSize = (Dim - 1) * 3;
94 
98 
100 
104 
106 
111 
113 
117  TwoFluidNavierStokes(IndexType NewId, GeometryType::Pointer pGeometry);
118 
120 
125  TwoFluidNavierStokes(IndexType NewId, GeometryType::Pointer pGeometry, Properties::Pointer pProperties);
126 
129 
133 
137 
139 
146  Element::Pointer Create(IndexType NewId,
147  NodesArrayType const& ThisNodes,
148  Properties::Pointer pProperties) const override;
149 
151 
158  Element::Pointer Create(IndexType NewId,
159  GeometryType::Pointer pGeom,
160  Properties::Pointer pProperties) const override;
161 
163 
171  MatrixType &rLeftHandSideMatrix,
172  VectorType &rRightHandSideVector,
173  const ProcessInfo &rCurrentProcessInfo) override;
174 
176 
183  VectorType &rRightHandSideVector,
184  const ProcessInfo &rCurrentProcessInfo) override;
185 
187 
192  int Check(const ProcessInfo &rCurrentProcessInfo) const override;
193 
197 
201 
202  const Parameters GetSpecifications() const override;
203 
205  std::string Info() const override;
206 
208  void PrintInfo(std::ostream& rOStream) const override;
209 
213 
217 
221 
223 
232  const Variable<double> &rVariable,
233  std::vector<double> &rValues,
234  const ProcessInfo &rCurrentProcessInfo ) override;
235 
239 
241 protected:
244 
248 
252 
256 
266  TElementData& rData,
267  MatrixType& rLHS,
268  VectorType& rRHS) override;
269 
277  TElementData& rData,
278  MatrixType& rLHS) override;
279 
287  TElementData& rData,
288  VectorType& rRHS) override;
289 
297  TElementData& rData,
298  MatrixType& rLHS);
299 
307  TElementData& rData,
308  VectorType& rRHS);
309 
321  TElementData& rData,
322  MatrixType& rV,
323  MatrixType& rH,
324  MatrixType& rKee,
325  VectorType& rRHS_ee);
326 
328 
334  TElementData& rData,
335  unsigned int IntegrationPointIndex,
336  double Weight,
337  const typename TElementData::MatrixRowType& rN,
338  const typename TElementData::ShapeDerivativesType& rDN_DX) const override;
339 
341 
349  TElementData& rData,
350  unsigned int IntegrationPointIndex,
351  double Weight,
352  const typename TElementData::MatrixRowType& rN,
353  const typename TElementData::ShapeDerivativesType& rDN_DX,
354  const typename TElementData::MatrixRowType& rNenr,
355  const typename TElementData::ShapeDerivativesType& rDN_DXenr) const;
356 
367  const TElementData& rData,
368  const Vector& rInterfaceWeights,
369  const Matrix& rEnrInterfaceShapeFunctionPos,
370  const Matrix& rEnrInterfaceShapeFunctionNeg,
371  const GeometryType::ShapeFunctionsGradientsType& rInterfaceShapeDerivatives,
372  MatrixType& rKeeTot,
373  VectorType& rRHSeeTot);
374 
380  void CalculateStrainRate(TElementData& rData) const override;
381 
385 
389 
393 
397 
401 
405 
406  friend class Serializer;
407 
408  void save(Serializer& rSerializer) const override;
409 
410  void load(Serializer& rSerializer) override;
411 
413 private:
416 
431  void ComputeSplitting(
432  TElementData& rData,
433  MatrixType& rShapeFunctionsPos,
434  MatrixType& rShapeFunctionsNeg,
435  MatrixType& rEnrichedShapeFunctionsPos,
436  MatrixType& rEnrichedShapeFunctionsNeg,
437  GeometryType::ShapeFunctionsGradientsType& rShapeDerivativesPos,
438  GeometryType::ShapeFunctionsGradientsType& rShapeDerivativesNeg,
439  GeometryType::ShapeFunctionsGradientsType& rEnrichedShapeDerivativesPos,
440  GeometryType::ShapeFunctionsGradientsType& rEnrichedShapeDerivativesNeg,
441  ModifiedShapeFunctions::Pointer pModifiedShapeFunctions);
442 
454  void ComputeSplitInterface(
455  const TElementData& rData,
456  MatrixType& rInterfaceShapeFunctionNeg,
457  MatrixType& rEnrInterfaceShapeFunctionPos,
458  MatrixType& rEnrInterfaceShapeFunctionNeg,
459  GeometryType::ShapeFunctionsGradientsType& rInterfaceShapeDerivativesNeg,
460  Vector& rInterfaceWeightsNeg,
461  std::vector<array_1d<double,3>>& rInterfaceNormalsNeg,
462  ModifiedShapeFunctions::Pointer pModifiedShapeFunctions);
463 
469  ModifiedShapeFunctions::UniquePointer pGetModifiedShapeFunctionsUtility(
470  const GeometryType::Pointer pGeometry,
471  const Vector& rDistances);
472 
478  void CalculateCurvatureOnInterfaceGaussPoints(
479  const Matrix& rInterfaceShapeFunctions,
480  Vector& rInterfaceCurvature);
481 
491  void SurfaceTension(
492  const double SurfaceTensionCoefficient,
493  const Vector& rCurvature,
494  const Vector& rInterfaceWeights,
495  const Matrix& rInterfaceShapeFunctions,
496  const std::vector<array_1d<double,3>>& rInterfaceNormalsNeg,
497  VectorType& rRHS);
498 
499 
512  void CondenseEnrichmentWithContinuity(
513  const TElementData& rData,
514  Matrix& rLeftHandSideMatrix,
515  VectorType& rRightHandSideVector,
516  const MatrixType& rVTot,
517  const MatrixType& rHTot,
518  MatrixType& rKeeTot,
519  const VectorType& rRHSeeTot);
520 
534  void CondenseEnrichment(
535  Matrix& rLeftHandSideMatrix,
536  VectorType& rRightHandSideVector,
537  const MatrixType& rVTot,
538  const MatrixType& rHTot,
539  MatrixType& rKeeTot,
540  const VectorType& rRHSeeTot);
541 
542  void AddSurfaceTensionContribution(
543  const TElementData& rData,
544  MatrixType& rInterfaceShapeFunction,
545  MatrixType& rEnrInterfaceShapeFunctionPos,
546  MatrixType& rEnrInterfaceShapeFunctionNeg,
547  GeometryType::ShapeFunctionsGradientsType& rInterfaceShapeDerivatives,
548  Vector& rInterfaceWeights,
549  std::vector<array_1d<double, 3>>& rInterfaceNormalsNeg,
550  Matrix &rLeftHandSideMatrix,
551  VectorType &rRightHandSideVector,
552  const MatrixType &rHtot,
553  const MatrixType &rVtot,
554  MatrixType &rKeeTot,
555  VectorType &rRHSeeTot);
556 
560 
564 
568 
571 
574 
576 
577 }; // Class TwoFluidNavierStokes
580 
584 
586 template< class TElementData >
587 inline std::istream& operator >> (std::istream& rIStream,
589 {
590  return rIStream;
591 }
592 
594 template< class TElementData >
595 inline std::ostream& operator <<(std::ostream& rOStream,
597 {
598  rThis.PrintInfo(rOStream);
599  rOStream << std::endl;
600  rThis.PrintData(rOStream);
601 
602  return rOStream;
603 }
605 
606 } // namespace Kratos.
607 
608 #endif // KRATOS_TWO_FLUID_NAVIER_STOKES
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
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
Definition: two_fluid_navier_stokes.h:67
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
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...
TwoFluidNavierStokes(IndexType NewId=0)
Default constuctor.
std::size_t IndexType
Definition: two_fluid_navier_stokes.h:81
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, Properties::Pointer pProperties) const override
Create a new element of this type using given geometry.
void AddTimeIntegratedRHS(TElementData &rData, VectorType &rRHS) override
Computes the time integrated RHS vector This method computes the Right Hand Side time integrated cont...
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.
FluidElement< TElementData >::ShapeFunctionDerivativesArrayType ShapeFunctionDerivativesArrayType
Definition: two_fluid_navier_stokes.h:88
constexpr static unsigned int BlockSize
Definition: two_fluid_navier_stokes.h:91
std::size_t SizeType
Definition: two_fluid_navier_stokes.h:82
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 StrainSize
Definition: two_fluid_navier_stokes.h:93
TwoFluidNavierStokes(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Auxiliar element check function.
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: two_fluid_navier_stokes.h:78
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: two_fluid_navier_stokes.h:85
constexpr static unsigned int LocalSize
Definition: two_fluid_navier_stokes.h:92
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.
Geometry< NodeType > GeometryType
Definition: two_fluid_navier_stokes.h:77
virtual ~TwoFluidNavierStokes()
Destructor.
FluidElement< TElementData >::ShapeFunctionDerivativesType ShapeFunctionDerivativesType
Definition: two_fluid_navier_stokes.h:87
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(TwoFluidNavierStokes)
Counted pointer of.
TwoFluidNavierStokes(IndexType NewId, GeometryType::Pointer pGeometry, Properties::Pointer pProperties)
Constuctor using geometry and properties.
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Computes the elemental LHS and RHS elemental contributions.
TwoFluidNavierStokes(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using a geometry object.
void save(Serializer &rSerializer) const override
Node NodeType
Definition: two_fluid_navier_stokes.h:76
void CalculateStrainRate(TElementData &rData) const override
Calculate the strain rate In this function we calculate the strain rate at the mid step.
FluidElement< TElementData >::ShapeFunctionsType ShapeFunctionsType
Definition: two_fluid_navier_stokes.h:86
Vector VectorType
Definition: two_fluid_navier_stokes.h:79
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Create a new element of this type.
constexpr static unsigned int Dim
Definition: two_fluid_navier_stokes.h:89
std::vector< std::size_t > EquationIdVectorType
Definition: two_fluid_navier_stokes.h:83
void CalculateOnIntegrationPoints(const Variable< double > &rVariable, std::vector< double > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Function to visualize the divergence field.
Matrix MatrixType
Definition: two_fluid_navier_stokes.h:80
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.
const Parameters GetSpecifications() const override
This method provides the specifications/requirements of the element.
void load(Serializer &rSerializer) override
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: two_fluid_navier_stokes.h:84
std::string Info() const override
Turn back information as a string.
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Computes the elemental RHS elemental contribution.
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...
constexpr static unsigned int NumNodes
Definition: two_fluid_navier_stokes.h:90
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...
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