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.
conservative_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_CONSERVATIVE_ELEMENT_H_INCLUDED
14 #define KRATOS_CONSERVATIVE_ELEMENT_H_INCLUDED
15 
16 // System includes
17 
18 
19 // External includes
20 
21 
22 // Project includes
23 #include "wave_element.h"
24 
25 namespace Kratos
26 {
29 
32 
36 
40 
44 
48 
50 template<std::size_t TNumNodes>
51 class ConservativeElement : public WaveElement<TNumNodes>
52 {
53 public:
56 
57  typedef std::size_t IndexType;
58 
59  typedef Node NodeType;
60 
62 
64 
66 
68 
70 
72 
74 
76 
80 
82 
86 
91 
95  ConservativeElement(IndexType NewId, const NodesArrayType& ThisNodes) : WaveElementType(NewId, ThisNodes){}
96 
100  ConservativeElement(IndexType NewId, GeometryType::Pointer pGeometry) : WaveElementType(NewId, pGeometry){}
101 
105  ConservativeElement(IndexType NewId, GeometryType::Pointer pGeometry, typename PropertiesType::Pointer pProperties) : WaveElementType(NewId, pGeometry, pProperties){}
106 
110  ~ ConservativeElement() override {};
111 
115 
123  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, typename PropertiesType::Pointer pProperties) const override
124  {
125  return Kratos::make_intrusive<ConservativeElement<TNumNodes>>(NewId, this->GetGeometry().Create(ThisNodes), pProperties);
126  }
127 
135  Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, typename PropertiesType::Pointer pProperties) const override
136  {
137  return Kratos::make_intrusive<ConservativeElement<TNumNodes>>(NewId, pGeom, pProperties);
138  }
139 
146  Element::Pointer Clone(IndexType NewId, NodesArrayType const& ThisNodes) const override
147  {
148  Element::Pointer p_new_elem = Create(NewId, this->GetGeometry().Create(ThisNodes), this->pGetProperties());
149  p_new_elem->SetData(this->GetData());
150  p_new_elem->Set(Flags(*this));
151  return p_new_elem;
152  }
153 
157 
162  const Parameters GetSpecifications() const override;
163 
167 
171  std::string Info() const override
172  {
173  return "ConservativeElement";
174  }
175 
177 
178 protected:
181 
183 
187 
188  const Variable<double>& GetUnknownComponent(int Index) const override;
189 
190  LocalVectorType GetUnknownVector(const ElementData& rData) const override;
191 
192  void GetNodalData(ElementData& rData, const GeometryType& rGeometry, int Step = 0) override;
193 
194  void UpdateGaussPointData(ElementData& rData, const array_1d<double,TNumNodes>& rN) override;
195 
197  BoundedMatrix<double,3,3>& rViscosity,
198  BoundedMatrix<double,2,2>& rDiffusion,
199  const ElementData& rData,
200  const array_1d<double,TNumNodes>& rN,
201  const BoundedMatrix<double,TNumNodes,2>& rDN_DX) override;
202 
204  BoundedMatrix<double,3,3>& rFriction,
205  const ElementData& rData) override;
206 
207  double StabilizationParameter(const ElementData& rData) const override;
208 
209  void CalculateGradient(array_1d<double,2>& rGradient, const GeometryType& rGeometry);
210 
211  void CalculateEdgeUnitNormal(array_1d<double,2>& rNormal, const GeometryType& rGeometry);
212 
214 
215 private:
218 
219  friend class Serializer;
220 
221  void save(Serializer& rSerializer) const override
222  {
224  }
225 
226  void load(Serializer& rSerializer) override
227  {
229  }
230 
234 
235 
239 
240 
242 
243 }; // Class ConservativeElement
244 
248 
249 
251 
253 
254 } // namespace Kratos.
255 
256 #endif // KRATOS_CONSERVATIVE_ELEMENT_H_INCLUDED defined
Implementation of a linear element for shallow water problems.
Definition: conservative_element.h:52
WaveElement< TNumNodes > WaveElementType
Definition: conservative_element.h:63
void CalculateEdgeUnitNormal(array_1d< double, 2 > &rNormal, const GeometryType &rGeometry)
Definition: conservative_element.cpp:206
WaveElementType::LocalMatrixType LocalMatrixType
Definition: conservative_element.h:71
void GetNodalData(ElementData &rData, const GeometryType &rGeometry, int Step=0) override
Definition: conservative_element.cpp:66
ConservativeElement(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: conservative_element.h:95
Element::Pointer Clone(IndexType NewId, NodesArrayType const &ThisNodes) const override
Create a new element pointer and clone the previous element data.
Definition: conservative_element.h:146
void UpdateGaussPointData(ElementData &rData, const array_1d< double, TNumNodes > &rN) override
Definition: conservative_element.cpp:78
WaveElementType::LocalVectorType LocalVectorType
Definition: conservative_element.h:73
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, typename PropertiesType::Pointer pProperties) const override
Create a new element pointer.
Definition: conservative_element.h:135
LocalVectorType GetUnknownVector(const ElementData &rData) const override
Definition: conservative_element.cpp:53
const Variable< double > & GetUnknownComponent(int Index) const override
Definition: conservative_element.cpp:42
Geometry< NodeType > GeometryType
Definition: conservative_element.h:61
ConservativeElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: conservative_element.h:100
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(ConservativeElement)
const Parameters GetSpecifications() const override
This method provides the specifications/requirements of the element.
Definition: conservative_element.cpp:30
ConservativeElement(IndexType NewId, GeometryType::Pointer pGeometry, typename PropertiesType::Pointer pProperties)
Constructor using Geometry and Properties.
Definition: conservative_element.h:105
~ ConservativeElement() override
Destructor.
Definition: conservative_element.h:110
void CalculateGradient(array_1d< double, 2 > &rGradient, const GeometryType &rGeometry)
Definition: conservative_element.cpp:189
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: conservative_element.cpp:139
static constexpr IndexType mLocalSize
Definition: conservative_element.h:182
WaveElementType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: conservative_element.h:75
std::string Info() const override
Turn back information as a string.
Definition: conservative_element.h:171
double StabilizationParameter(const ElementData &rData) const override
Definition: conservative_element.cpp:129
WaveElementType::PropertiesType PropertiesType
Definition: conservative_element.h:67
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, typename PropertiesType::Pointer pProperties) const override
Create a new element pointer.
Definition: conservative_element.h:123
std::size_t IndexType
Definition: conservative_element.h:57
ConservativeElement()
Default constructor.
Definition: conservative_element.h:90
Node NodeType
Definition: conservative_element.h:59
void CalculateArtificialDamping(BoundedMatrix< double, 3, 3 > &rFriction, const ElementData &rData) override
Definition: conservative_element.cpp:173
WaveElementType::NodesArrayType NodesArrayType
Definition: conservative_element.h:65
WaveElementType::ElementData ElementData
Definition: conservative_element.h:69
Base class for all Elements.
Definition: element.h:60
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
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
Definition: amatrix_interface.h:41
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
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Implementation of a linear element for shallow water problems.
Definition: wave_element.h:55
static constexpr IndexType mLocalSize
Definition: wave_element.h:287
Short class definition.
Definition: array_1d.h:61
#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 Index()
Definition: hdf5_io_tools.py:38
def load(f)
Definition: ode_solve.py:307
Definition: wave_element.h:299