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.
alternative_d_vms_dem_coupled.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: Joaquin Gonzalez-Usua
11 //
12 
13 #ifndef KRATOS_ALTERNATIVE_D_VMS_DEM_COUPLED_H
14 #define KRATOS_ALTERNATIVE_D_VMS_DEM_COUPLED_H
15 
16 #include "includes/define.h"
17 #include "includes/element.h"
18 #include "includes/serializer.h"
19 #include "geometries/geometry.h"
20 
21 #include "includes/cfd_variables.h"
23 #include "custom_elements/d_vms.h"
25 
26 namespace Kratos
27 {
28 
31 
34 
38 
42 
46 
50 
51 template< class TElementData >
52 class AlternativeDVMSDEMCoupled : public DVMS<TElementData>
53 {
54 public:
57 
60 
62  typedef Node NodeType;
63 
66 
69 
71  typedef Vector VectorType;
72 
74  typedef Matrix MatrixType;
75 
76  typedef std::size_t IndexType;
77 
78  typedef std::size_t SizeType;
79 
80  typedef std::vector<std::size_t> EquationIdVectorType;
81 
82  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
83 
85 
88 
91 
94 
96 
97  constexpr static unsigned int Dim = DVMS<TElementData>::Dim;
98  constexpr static unsigned int NumNodes = DVMS<TElementData>::NumNodes;
99  constexpr static unsigned int BlockSize = DVMS<TElementData>::BlockSize;
100  constexpr static unsigned int LocalSize = DVMS<TElementData>::LocalSize;
101  constexpr static unsigned int StrainSize = DVMS<TElementData>::StrainSize;
102 
106 
107  //Constructors.
108 
110 
114 
116 
120  AlternativeDVMSDEMCoupled(IndexType NewId, const NodesArrayType& ThisNodes);
121 
123 
127  AlternativeDVMSDEMCoupled(IndexType NewId, GeometryType::Pointer pGeometry);
128 
130 
135  AlternativeDVMSDEMCoupled(IndexType NewId, GeometryType::Pointer pGeometry, Properties::Pointer pProperties);
136 
139 
143 
144 
148 
149 
151 
158  Element::Pointer Create(
159  IndexType NewId,
160  NodesArrayType const& ThisNodes,
161  Properties::Pointer pProperties) const override;
162 
164 
171  Element::Pointer Create(
172  IndexType NewId,
173  GeometryType::Pointer pGeom,
174  Properties::Pointer pProperties) const override;
175 
176  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
177 
178  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
179 
180  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
181 
182  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
183 
187 
191 
193  std::string Info() const override;
194 
195 
197  void PrintInfo(std::ostream& rOStream) const override;
198 
199 
203 
204 
206 
207 protected:
208 
211 
215 
216  // Velocity subscale history, stored at integration points
222 
226 
227 
231 
232  // Protected interface of FluidElement ////////////////////////////////////
233 
235  const TElementData& rData,
236  const array_1d<double,3> &rConvectionVelocity,
237  array_1d<double,3>& rResidual) const override;
238 
239  void MomentumProjTerm(
240  const TElementData& rData,
241  const array_1d<double,3>& rConvectionVelocity,
242  array_1d<double,3> &rMomentumRHS) const override;
243 
244  void AddVelocitySystem(
245  TElementData& rData,
246  MatrixType& rLocalLHS,
247  VectorType& rLocalRHS) override;
248 
249  void CalculateMassMatrix(MatrixType& rMassMatrix,
250  const ProcessInfo& rCurrentProcessInfo) override;
251 
253  MatrixType& rDampMatrix,
254  VectorType& rRightHandSideVector,
255  const ProcessInfo& rCurrentProcessInfo) override;
256 
257  // Implementation details of AlternativeDVMSDEMCoupled /////////////////////////////////////////
258 
259  void AddMassLHS(
260  TElementData& rData,
261  MatrixType& rMassMatrix) override;
262 
264  const TElementData& rData);
265 
267  TElementData& rData,
268  MatrixType& rMassMatrix) override;
269 
271  TElementData& rData,
272  BoundedMatrix<double,NumNodes*(Dim+1),NumNodes*(Dim+1)>& rLHS,
273  VectorType& rLocalRHS);
274 
275 
276  void AddViscousTerm(
277  const TElementData& rData,
279  VectorType& rRHS) override;
280 
281  void CalculateProjections(const ProcessInfo &rCurrentProcessInfo) override;
282 
284  TElementData& rData,
285  unsigned int IntegrationPointIndex,
286  double Weight,
287  const typename TElementData::MatrixRowType& rN,
288  const typename TElementData::ShapeDerivativesType& rDN_DX,
289  const typename TElementData::ShapeFunctionsSecondDerivativesType& rDDN_DDX) const;
290 
292  const TElementData& rData,
293  const array_1d<double,3> &Velocity,
295  double &TauTwo) const;
296 
297  void SubscaleVelocity(
298  const TElementData& rData,
299  array_1d<double,3>& rVelocitySubscale) const override;
300 
301  void SubscalePressure(
302  const TElementData& rData,
303  double& rPressureSubscale) const override;
304 
306  const TElementData& rData) const override;
307 
309  const TElementData& rData) override;
310 
312  const TElementData& rData);
313 
314  void MassProjTerm(
315  const TElementData& rData,
316  double& rMassRHS) const override;
317 
318  void Calculate(
319  const Variable<array_1d<double, 3>>& rVariable,
320  array_1d<double, 3>& rOutput, const ProcessInfo& rCurrentProcessInfo) override;
321 
323  const Variable<array_1d<double, 3>>& rVariable,
324  std::vector<array_1d<double, 3>>& rOutput,
325  const ProcessInfo& rCurrentProcessInfo) override;
326 
328  const Variable<double>& rVariable,
329  std::vector<double>& rOutput,
330  const ProcessInfo& rCurrentProcessInfo) override;
331 
333  Variable<Matrix> const& rVariable,
334  std::vector<Matrix>& rValues,
335  ProcessInfo const& rCurrentProcessInfo) override;
336 
338 
342 
343 
347 
348 
352 
354 
355 private:
356 
359 
363 
364  friend class Serializer;
365 
366  void save(Serializer& rSerializer) const override;
367 
368  void load(Serializer& rSerializer) override;
369 
373 
374 
378 
382 
383 
387 
388 
392 
395 
398 
400 
401 
402 }; // Class AlternativeDVMSDEMCoupled
403 
405 
408 
409 
413 
414 
416 template< class TElementData >
417 inline std::istream& operator >>(std::istream& rIStream,
419 {
420  return rIStream;
421 }
422 
424 template< class TElementData >
425 inline std::ostream& operator <<(std::ostream& rOStream,
427 {
428  rThis.PrintInfo(rOStream);
429  rOStream << std::endl;
430  rThis.PrintData(rOStream);
431 
432  return rOStream;
433 }
435 
437 
438 } // namespace Kratos.
439 
440 #endif // KRATOS_ALTERNATIVE_D_VMS_DEM_COUPLED_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: alternative_d_vms_dem_coupled.h:53
std::size_t SizeType
Definition: alternative_d_vms_dem_coupled.h:78
DenseVector< array_1d< double, Dim > > mPreviousVelocity
Definition: alternative_d_vms_dem_coupled.h:219
Node NodeType
Node type (default is: Node)
Definition: alternative_d_vms_dem_coupled.h:62
DenseVector< BoundedMatrix< double, Dim, Dim > > mViscousResistanceTensor
Definition: alternative_d_vms_dem_coupled.h:220
Kratos::Matrix ShapeFunctionDerivativesType
Type for a matrix containing the shape function gradients.
Definition: alternative_d_vms_dem_coupled.h:90
array_1d< double, 3 > FullConvectiveVelocity(const TElementData &rData) const override
Definition: alternative_d_vms_dem_coupled.cpp:1329
void MassProjTerm(const TElementData &rData, double &rMassRHS) const override
Definition: alternative_d_vms_dem_coupled.cpp:962
void AlgebraicMomentumResidual(const TElementData &rData, const array_1d< double, 3 > &rConvectionVelocity, array_1d< double, 3 > &rResidual) const override
Definition: alternative_d_vms_dem_coupled.cpp:449
std::size_t IndexType
Definition: alternative_d_vms_dem_coupled.h:76
Vector VectorType
Vector type for local contributions to the linear system.
Definition: alternative_d_vms_dem_coupled.h:71
AlternativeDVMSDEMCoupled(IndexType NewId=0)
Default constuctor.
Definition: alternative_d_vms_dem_coupled.cpp:31
void FinalizeSolutionStep(const ProcessInfo &rCurrentProcessInfo) override
Update the values of tracked small scale quantities.
Definition: alternative_d_vms_dem_coupled.cpp:342
void CalculateOnIntegrationPoints(const Variable< array_1d< double, 3 >> &rVariable, std::vector< array_1d< double, 3 >> &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Definition: alternative_d_vms_dem_coupled.cpp:300
void AddViscousTerm(const TElementData &rData, BoundedMatrix< double, LocalSize, LocalSize > &rLHS, VectorType &rRHS) override
Definition: alternative_d_vms_dem_coupled.cpp:1213
void CalculateResistanceTensor(const TElementData &rData)
Definition: alternative_d_vms_dem_coupled.cpp:921
void UpdateSubscaleVelocityPrediction(const TElementData &rData) override
Definition: alternative_d_vms_dem_coupled.cpp:1389
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: alternative_d_vms_dem_coupled.h:82
void UpdateIntegrationPointDataSecondDerivatives(TElementData &rData, unsigned int IntegrationPointIndex, double Weight, const typename TElementData::MatrixRowType &rN, const typename TElementData::ShapeDerivativesType &rDN_DX, const typename TElementData::ShapeFunctionsSecondDerivativesType &rDDN_DDX) const
Definition: alternative_d_vms_dem_coupled.cpp:415
constexpr static unsigned int LocalSize
Definition: alternative_d_vms_dem_coupled.h:100
void InitializeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo) override
Predict the value of the small scale velocity for the current iteration.
Definition: alternative_d_vms_dem_coupled.cpp:371
constexpr static unsigned int StrainSize
Definition: alternative_d_vms_dem_coupled.h:101
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: alternative_d_vms_dem_coupled.h:84
constexpr static unsigned int NumNodes
Definition: alternative_d_vms_dem_coupled.h:98
Matrix MatrixType
Matrix type for local contributions to the linear system.
Definition: alternative_d_vms_dem_coupled.h:74
int mInterpolationOrder
Definition: alternative_d_vms_dem_coupled.h:221
void CalculateProjections(const ProcessInfo &rCurrentProcessInfo) override
Definition: alternative_d_vms_dem_coupled.cpp:1155
GeometryType::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Type for an array of shape function gradient matrices.
Definition: alternative_d_vms_dem_coupled.h:93
std::string Info() const override
Turn back information as a string.
Definition: alternative_d_vms_dem_coupled.cpp:428
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: alternative_d_vms_dem_coupled.cpp:437
Kratos::Vector ShapeFunctionsType
Type for shape function values container.
Definition: alternative_d_vms_dem_coupled.h:87
void Initialize(const ProcessInfo &rCurrentProcessInfo) override
Set up the element.
Definition: alternative_d_vms_dem_coupled.cpp:179
void MomentumProjTerm(const TElementData &rData, const array_1d< double, 3 > &rConvectionVelocity, array_1d< double, 3 > &rMomentumRHS) const override
Definition: alternative_d_vms_dem_coupled.cpp:499
void AddMassLHS(TElementData &rData, MatrixType &rMassMatrix) override
Definition: alternative_d_vms_dem_coupled.cpp:931
~AlternativeDVMSDEMCoupled()
Destructor.
Definition: alternative_d_vms_dem_coupled.cpp:66
DenseVector< array_1d< double, Dim > > mPredictedSubscaleVelocity
Definition: alternative_d_vms_dem_coupled.h:217
DenseVector< array_1d< double, Dim > > mOldSubscaleVelocity
Definition: alternative_d_vms_dem_coupled.h:218
void CalculateStabilizationParameters(const TElementData &rData, const array_1d< double, 3 > &Velocity, BoundedMatrix< double, Dim, Dim > &TauOne, double &TauTwo) const
Definition: alternative_d_vms_dem_coupled.cpp:1233
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition of nodes container type, redefined from GeometryType.
Definition: alternative_d_vms_dem_coupled.h:68
void AddMassStabilization(TElementData &rData, MatrixType &rMassMatrix) override
Definition: alternative_d_vms_dem_coupled.cpp:1088
void UpdateSubscaleVelocity(const TElementData &rData)
Definition: alternative_d_vms_dem_coupled.cpp:1344
void AddReactionStabilization(TElementData &rData, BoundedMatrix< double, NumNodes *(Dim+1), NumNodes *(Dim+1)> &rLHS, VectorType &rLocalRHS)
Definition: alternative_d_vms_dem_coupled.cpp:985
void CalculateLocalVelocityContribution(MatrixType &rDampMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: alternative_d_vms_dem_coupled.cpp:878
GeometryType::ShapeFunctionsSecondDerivativesType ShapeFunctionsSecondDerivativesType
Definition: alternative_d_vms_dem_coupled.h:95
void FinalizeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo) override
Definition: alternative_d_vms_dem_coupled.cpp:393
void SubscalePressure(const TElementData &rData, double &rPressureSubscale) const override
Definition: alternative_d_vms_dem_coupled.cpp:1308
constexpr static unsigned int BlockSize
Definition: alternative_d_vms_dem_coupled.h:99
GeometryData::IntegrationMethod GetIntegrationMethod() const override
Definition: alternative_d_vms_dem_coupled.cpp:166
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(AlternativeDVMSDEMCoupled)
Pointer definition of AlternativeDVMSDEMCoupled.
void Calculate(const Variable< array_1d< double, 3 >> &rVariable, array_1d< double, 3 > &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Definition: alternative_d_vms_dem_coupled.cpp:92
std::vector< std::size_t > EquationIdVectorType
Definition: alternative_d_vms_dem_coupled.h:80
void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: alternative_d_vms_dem_coupled.cpp:842
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Create a new element of this type.
Definition: alternative_d_vms_dem_coupled.cpp:73
constexpr static unsigned int Dim
Definition: alternative_d_vms_dem_coupled.h:97
void AddVelocitySystem(TElementData &rData, MatrixType &rLocalLHS, VectorType &rLocalRHS) override
Definition: alternative_d_vms_dem_coupled.cpp:544
Geometry< NodeType > GeometryType
Geometry type (using with given NodeType)
Definition: alternative_d_vms_dem_coupled.h:65
void SubscaleVelocity(const TElementData &rData, array_1d< double, 3 > &rVelocitySubscale) const override
Definition: alternative_d_vms_dem_coupled.cpp:1278
Definition: d_vms.h:54
std::size_t IndexType
Definition: flags.h:74
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: fluid_element.hpp:584
IntegrationMethod
Definition: geometry_data.h:76
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
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
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
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