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.
qs_convection_diffusion_explicit.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: Riccardo Tosi
11 //
12 
13 #ifndef KRATOS_QS_CONVECTION_DIFFUSION_EXPLICIT_H
14 #define KRATOS_QS_CONVECTION_DIFFUSION_EXPLICIT_H
15 
16 // System includes
17 
18 
19 // External includes
20 
21 
22 // Project includes
23 #include "includes/element.h"
24 #include "includes/serializer.h"
25 #include "includes/checks.h"
26 #include "includes/variables.h"
28 #include "geometries/geometry.h"
29 #include "utilities/geometry_utilities.h"
30 #include "includes/cfd_variables.h"
32 
33 namespace Kratos
34 {
35 
38 
42 
46 
50 
54 
69 template< unsigned int TDim, unsigned int TNumNodes>
71 {
72 public:
75 
76  typedef Element BaseType;
77  typedef Node NodeType;
79 
82 
86 
87  //Constructors.
89  IndexType NewId,
90  GeometryType::Pointer pGeometry);
91 
93  IndexType NewId,
94  GeometryType::Pointer pGeometry,
95  Properties::Pointer pProperties);
96 
98 
101 
105 
106 
110 
111  Element::Pointer Create(
112  IndexType NewId,
113  NodesArrayType const& ThisNodes,
114  Properties::Pointer pProperties) const override;
115 
116  Element::Pointer Create(
117  IndexType NewId,
118  GeometryType::Pointer pGeom,
119  Properties::Pointer pProperties) const override;
120 
122  MatrixType& rLeftHandSideMatrix,
123  VectorType& rRightHandSideVector,
124  const ProcessInfo& rCurrentProcessInfo) override;
125 
127  VectorType& rRightHandSideVector,
128  const ProcessInfo& rCurrentProcessInfo) override;
129 
130  void EquationIdVector(
131  EquationIdVectorType& rResult,
132  const ProcessInfo& rCurrentProcessInfo) const override;
133 
134  void GetDofList(
135  DofsVectorType& rElementalDofList,
136  const ProcessInfo& rCurrentProcessInfo) const override;
137 
138  void AddExplicitContribution(const ProcessInfo &rCurrentProcessInfo) override;
139 
141  MatrixType &rMassMatrix,
142  const ProcessInfo &rCurrentProcessInfo) override;
143 
145  VectorType& rLumpedMassVector,
146  const ProcessInfo& rCurrentProcessInfo
147  ) const override;
148 
149  void Calculate(
150  const Variable<double>& rVariable,
151  double& Output,
152  const ProcessInfo& rCurrentProcessInfo) override;
153 
157 
161 
163  std::string Info() const override
164  {
165  return "QSConvectionDiffusionExplicitElement #";
166  }
167 
169  void PrintInfo(std::ostream& rOStream) const override
170  {
171  rOStream << Info() << Id();
172  }
173 
175 
176 protected:
177 
180 
181  struct ElementData
182  {
183  // scalars
184  double diffusivity;
186  double weight;
187  double delta_time;
189  double dynamic_tau;
191  double volume;
192  // arrays
198  // matrices
200  // auxiliary containers for the symbolically-generated matrices
203  // auxiliary containers for the symbolically-generated data for Gauss integration
207  };
208 
212 
213 
217 
219  ElementData& rData,
220  const ProcessInfo& rCurrentProcessInfo);
221 
223 
227 
228 
232 
233  IntegrationMethod GetIntegrationMethod() const override;
234 
238 
239  // Protected default constructor necessary for serialization
241  {
242  }
243 
245 
246 private:
247 
250 
254 
258 
259  friend class Serializer;
260 
261  void save(Serializer& rSerializer) const override
262  {
264  }
265 
266  void load(Serializer& rSerializer) override
267  {
269  }
270 
274 
277 
280 
284 
285  void QSCalculateRightHandSideInternal(
286  BoundedVector<double, TNumNodes>& rRightHandSideBoundedVector,
287  const ProcessInfo& rCurrentProcessInfo);
288 
289  void QSCalculateOrthogonalSubgridScaleRHSInternal(
290  BoundedVector<double, TNumNodes>& rRightHandSideVector,
291  const ProcessInfo& rCurrentProcessInfo);
292 
293  void QSCalculateTau(ElementData& rData);
294 
298 
302 
306 
308 
309 }; // Class QSConvectionDiffusionExplicit
310 
312 
315 
316 
320 
321 
323 template< unsigned int TDim, unsigned int TNumNodes = TDim + 1>
324 inline std::istream& operator >>(
325  std::istream& rIStream,
327 {
328  return rIStream;
329 }
330 
332 template< unsigned int TDim, unsigned int TNumNodes = TDim + 1>
333 inline std::ostream& operator <<(
334  std::ostream& rOStream,
336 {
337  rThis.PrintInfo(rOStream);
338  rOStream << std::endl;
339  rThis.PrintData(rOStream);
340 
341  return rOStream;
342 }
344 
346 
347 } // namespace Kratos.
348 
349 #endif // KRATOS_QS_CONVECTION_DIFFUSION_EXPLICIT_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Elements.
Definition: element.h:60
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: element.h:1135
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
IndexType Id() const
Definition: indexed_object.h:107
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
This element solves the convection-diffusion equation, stabilized with algebraic subgrid scale or ort...
Definition: qs_convection_diffusion_explicit.h:71
void CalculateLumpedMassVector(VectorType &rLumpedMassVector, const ProcessInfo &rCurrentProcessInfo) const override
Definition: qs_convection_diffusion_explicit.cpp:218
void AddExplicitContribution(const ProcessInfo &rCurrentProcessInfo) override
Definition: qs_convection_diffusion_explicit.cpp:141
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(QSConvectionDiffusionExplicit)
Pointer definition of QSConvectionDiffusionExplicit.
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: qs_convection_diffusion_explicit.cpp:68
QSConvectionDiffusionExplicit()
Definition: qs_convection_diffusion_explicit.h:240
Element BaseType
Definition: qs_convection_diffusion_explicit.h:76
std::string Info() const override
Turn back information as a string.
Definition: qs_convection_diffusion_explicit.h:163
IntegrationMethod GetIntegrationMethod() const override
Definition: qs_convection_diffusion_explicit.cpp:925
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: qs_convection_diffusion_explicit.h:169
virtual ~QSConvectionDiffusionExplicit()
Default constuctor.
Definition: qs_convection_diffusion_explicit.cpp:39
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Definition: qs_convection_diffusion_explicit.cpp:118
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Definition: qs_convection_diffusion_explicit.cpp:95
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Definition: qs_convection_diffusion_explicit.cpp:45
void Calculate(const Variable< double > &rVariable, double &Output, const ProcessInfo &rCurrentProcessInfo) override
Definition: qs_convection_diffusion_explicit.cpp:236
Geometry< NodeType > GeometryType
Definition: qs_convection_diffusion_explicit.h:78
Node NodeType
Definition: qs_convection_diffusion_explicit.h:77
void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo) override
void InitializeEulerianElement(ElementData &rData, const ProcessInfo &rCurrentProcessInfo)
Definition: qs_convection_diffusion_explicit.cpp:266
double ComputeH(BoundedMatrix< double, TNumNodes, TDim > &rDN_DX)
Definition: qs_convection_diffusion_explicit.cpp:861
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: qs_convection_diffusion_explicit.cpp:82
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
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
ProcessInfo
Definition: edgebased_PureConvection.py:116
def load(f)
Definition: ode_solve.py:307
Definition: qs_convection_diffusion_explicit.h:182
array_1d< double, TNumNodes > N
Definition: qs_convection_diffusion_explicit.h:204
array_1d< double, TNumNodes > unknown
Definition: qs_convection_diffusion_explicit.h:195
array_1d< double, TNumNodes > tau
Definition: qs_convection_diffusion_explicit.h:193
double delta_time
Definition: qs_convection_diffusion_explicit.h:187
array_1d< double, TNumNodes > unknown_old
Definition: qs_convection_diffusion_explicit.h:196
array_1d< double, TNumNodes > forcing
Definition: qs_convection_diffusion_explicit.h:194
BoundedMatrix< double, TNumNodes, 3 > convective_velocity
Definition: qs_convection_diffusion_explicit.h:199
array_1d< double, TNumNodes > rhs
Definition: qs_convection_diffusion_explicit.h:202
double lumping_factor
Definition: qs_convection_diffusion_explicit.h:185
double explicit_step_coefficient
Definition: qs_convection_diffusion_explicit.h:188
double unknown_subscale
Definition: qs_convection_diffusion_explicit.h:190
BoundedMatrix< double, TNumNodes, TNumNodes > lhs
Definition: qs_convection_diffusion_explicit.h:201
array_1d< double, TNumNodes > oss_projection
Definition: qs_convection_diffusion_explicit.h:197
double volume
Definition: qs_convection_diffusion_explicit.h:191
BoundedMatrix< double, TNumNodes, TDim > DN_DX
Definition: qs_convection_diffusion_explicit.h:206
double diffusivity
Definition: qs_convection_diffusion_explicit.h:184
double dynamic_tau
Definition: qs_convection_diffusion_explicit.h:189
BoundedMatrix< double, TNumNodes, TNumNodes > N_gausspoint
Definition: qs_convection_diffusion_explicit.h:205
double weight
Definition: qs_convection_diffusion_explicit.h:186