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.
boussinesq_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 authors: Miguel Maso Sotomayor
11 //
12 
13 #ifndef KRATOS_BOUSSINESQ_ELEMENT_H_INCLUDED
14 #define KRATOS_BOUSSINESQ_ELEMENT_H_INCLUDED
15 
16 // System includes
17 
18 
19 // External includes
20 
21 
22 // Project includes
23 #include "primitive_element.h"
24 
25 namespace Kratos
26 {
29 
32 
36 
40 
44 
48 
50 template<std::size_t TNumNodes>
51 class BoussinesqElement : public PrimitiveElement<TNumNodes>
52 {
53 public:
56 
57  typedef std::size_t IndexType;
58 
59  typedef Node NodeType;
60 
62 
64 
65  typedef typename BaseType::VectorType VectorType;
66 
68 
70 
72 
74 
76 
78 
82 
84 
88 
93 
97  BoussinesqElement(IndexType NewId, const NodesArrayType& ThisNodes) : BaseType(NewId, ThisNodes){}
98 
102  BoussinesqElement(IndexType NewId, GeometryType::Pointer pGeometry) : BaseType(NewId, pGeometry){}
103 
107  BoussinesqElement(IndexType NewId, GeometryType::Pointer pGeometry, typename PropertiesType::Pointer pProperties) : BaseType(NewId, pGeometry, pProperties){}
108 
112  ~ BoussinesqElement() override {};
113 
117 
125  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, typename PropertiesType::Pointer pProperties) const override
126  {
127  return Kratos::make_intrusive<BoussinesqElement<TNumNodes>>(NewId, this->GetGeometry().Create(ThisNodes), pProperties);
128  }
129 
137  Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, typename PropertiesType::Pointer pProperties) const override
138  {
139  return Kratos::make_intrusive<BoussinesqElement<TNumNodes>>(NewId, pGeom, pProperties);
140  }
141 
148  Element::Pointer Clone(IndexType NewId, NodesArrayType const& ThisNodes) const override
149  {
150  Element::Pointer p_new_elem = Create(NewId, this->GetGeometry().Create(ThisNodes), this->pGetProperties());
151  p_new_elem->SetData(this->GetData());
152  p_new_elem->Set(Flags(*this));
153  return p_new_elem;
154  }
155 
160  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
161 
168  void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
169 
174  void AddExplicitContribution(const ProcessInfo& rCurrentProcessInfo) override;
175 
179 
184  const Parameters GetSpecifications() const override;
185 
189 
193  std::string Info() const override
194  {
195  return "BoussinesqElement";
196  }
197 
199 
200 protected:
203 
205 
209 
210  void AddRightHandSide(
211  LocalVectorType& rRHS,
212  ElementData& rData,
213  const Matrix& rNContainer,
214  const ShapeFunctionsGradientsType& rDN_DXContainer,
215  const Vector& rWeights);
216 
218  LocalVectorType& rDispersionH,
219  LocalVectorType& rDispersionU,
220  const ElementData& rData,
221  const array_1d<double,TNumNodes>& rN,
222  const BoundedMatrix<double,TNumNodes,2>& rDN_DX,
223  const double Weight = 1.0);
224 
225  void GetNodalData(ElementData& rData, const GeometryType& rGeometry, int Step = 0) override;
226 
228  BoundedMatrix<double,3,3>& rViscosity,
229  BoundedMatrix<double,2,2>& rDiffusion,
230  const ElementData& rData,
231  const array_1d<double,TNumNodes>& rN,
232  const BoundedMatrix<double,TNumNodes,2>& rDN_DX) override;
233 
234  void AlgebraicResidual(
235  double& rMassResidual,
236  array_1d<double,2>& rFreeSurfaceGradient,
237  const ElementData& rData,
238  const array_1d<double,TNumNodes>& rN,
239  const BoundedMatrix<double,TNumNodes,2>& rDN_DX) const;
240 
241  void AddDispersiveTerms(
242  LocalVectorType& rVector,
243  const ElementData& rData,
244  const array_1d<double,TNumNodes>& rN,
245  const BoundedMatrix<double,TNumNodes,2>& rDN_DX,
246  const double Weight = 1.0) override;
247 
248  void AddMassTerms(
249  LocalMatrixType& rMatrix,
250  const ElementData& rData,
251  const array_1d<double,TNumNodes>& rN,
252  const BoundedMatrix<double,TNumNodes,2>& rDN_DX,
253  const double Weight = 1.0) override;
254 
256 
257 private:
260 
261  friend class Serializer;
262 
263  void save(Serializer& rSerializer) const override
264  {
266  }
267 
268  void load(Serializer& rSerializer) override
269  {
271  }
272 
276 
277 
281 
282 
284 
285 }; // Class BoussinesqElement
286 
290 
291 
293 
295 
296 } // namespace Kratos.
297 
298 #endif // KRATOS_BOUSSINESQ_ELEMENT_H_INCLUDED defined
Implementation of a linear element for shallow water problems.
Definition: boussinesq_element.h:52
BoussinesqElement(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: boussinesq_element.h:97
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Calculate the rhs according to the Adams-Moulton scheme.
Definition: boussinesq_element.cpp:372
void CalculateArtificialViscosity(BoundedMatrix< double, 3, 3 > &rViscosity, BoundedMatrix< double, 2, 2 > &rDiffusion, const ElementData &rData, const array_1d< double, TNumNodes > &rN, const BoundedMatrix< double, TNumNodes, 2 > &rDN_DX) override
Definition: boussinesq_element.cpp:63
BaseType::LocalVectorType LocalVectorType
Definition: boussinesq_element.h:75
~ BoussinesqElement() override
Destructor.
Definition: boussinesq_element.h:112
void AlgebraicResidual(double &rMassResidual, array_1d< double, 2 > &rFreeSurfaceGradient, const ElementData &rData, const array_1d< double, TNumNodes > &rN, const BoundedMatrix< double, TNumNodes, 2 > &rDN_DX) const
Definition: boussinesq_element.cpp:91
void AddRightHandSide(LocalVectorType &rRHS, ElementData &rData, const Matrix &rNContainer, const ShapeFunctionsGradientsType &rDN_DXContainer, const Vector &rWeights)
Definition: boussinesq_element.cpp:325
void AddDispersiveTerms(LocalVectorType &rVector, const ElementData &rData, const array_1d< double, TNumNodes > &rN, const BoundedMatrix< double, TNumNodes, 2 > &rDN_DX, const double Weight=1.0) override
Definition: boussinesq_element.cpp:112
BaseType::NodesArrayType NodesArrayType
Definition: boussinesq_element.h:67
static constexpr IndexType mLocalSize
Definition: boussinesq_element.h:204
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, typename PropertiesType::Pointer pProperties) const override
Create a new element pointer.
Definition: boussinesq_element.h:125
BoussinesqElement()
Default constructor.
Definition: boussinesq_element.h:92
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(BoussinesqElement)
void AddExplicitContribution(const ProcessInfo &rCurrentProcessInfo) override
Add the explicit contribution according to the Adams-Bashforth scheme.
Definition: boussinesq_element.cpp:410
std::size_t IndexType
Definition: boussinesq_element.h:57
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: boussinesq_element.h:77
PrimitiveElement< TNumNodes > BaseType
Definition: boussinesq_element.h:63
BaseType::VectorType VectorType
Definition: boussinesq_element.h:65
void InitializeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo) override
Calculate the velocity laplacian projection.
Definition: boussinesq_element.cpp:277
Element::Pointer Clone(IndexType NewId, NodesArrayType const &ThisNodes) const override
Create a new element pointer and clone the previous element data.
Definition: boussinesq_element.h:148
void AddDispersionProjection(LocalVectorType &rDispersionH, LocalVectorType &rDispersionU, const ElementData &rData, const array_1d< double, TNumNodes > &rN, const BoundedMatrix< double, TNumNodes, 2 > &rDN_DX, const double Weight=1.0)
Definition: boussinesq_element.cpp:230
BoussinesqElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: boussinesq_element.h:102
Node NodeType
Definition: boussinesq_element.h:59
Geometry< NodeType > GeometryType
Definition: boussinesq_element.h:61
void GetNodalData(ElementData &rData, const GeometryType &rGeometry, int Step=0) override
Definition: boussinesq_element.cpp:47
BaseType::ElementData ElementData
Definition: boussinesq_element.h:71
BoussinesqElement(IndexType NewId, GeometryType::Pointer pGeometry, typename PropertiesType::Pointer pProperties)
Constructor using Geometry and Properties.
Definition: boussinesq_element.h:107
const Parameters GetSpecifications() const override
This method provides the specifications/requirements of the element.
Definition: boussinesq_element.cpp:34
void AddMassTerms(LocalMatrixType &rMatrix, const ElementData &rData, const array_1d< double, TNumNodes > &rN, const BoundedMatrix< double, TNumNodes, 2 > &rDN_DX, const double Weight=1.0) override
Definition: boussinesq_element.cpp:180
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, typename PropertiesType::Pointer pProperties) const override
Create a new element pointer.
Definition: boussinesq_element.h:137
BaseType::PropertiesType PropertiesType
Definition: boussinesq_element.h:69
std::string Info() const override
Turn back information as a string.
Definition: boussinesq_element.h:193
BaseType::LocalMatrixType LocalMatrixType
Definition: boussinesq_element.h:73
Base class for all Elements.
Definition: element.h:60
Vector VectorType
Definition: element.h:88
PropertiesType::Pointer pGetProperties()
returns the pointer to the property of the element. Does not throw an error, to allow copying of elem...
Definition: element.h:1014
std::size_t IndexType
Definition: flags.h:74
Flags()
Default constructor.
Definition: flags.h:119
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
DataValueContainer & GetData()
Definition: geometrical_object.h:212
Geometry base class.
Definition: geometry.h:71
virtual Pointer Create(PointsArrayType const &rThisPoints) const
Creates a new geometry pointer.
Definition: geometry.h:813
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
Implementation of a linear element for shallow water problems.
Definition: primitive_element.h:51
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: primitive_element.h:74
BaseType::LocalVectorType LocalVectorType
Definition: primitive_element.h:72
static constexpr IndexType mLocalSize
Definition: primitive_element.h:171
BaseType::NodesArrayType NodesArrayType
Definition: primitive_element.h:64
BaseType::LocalMatrixType LocalMatrixType
Definition: primitive_element.h:70
BaseType::ElementData ElementData
Definition: primitive_element.h:68
BaseType::PropertiesType PropertiesType
Definition: primitive_element.h:66
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
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
def load(f)
Definition: ode_solve.py:307