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.
direction_damping_utilities.h
Go to the documentation of this file.
1 // ==============================================================================
2 // KratosShapeOptimizationApplication
3 //
4 // License: BSD License
5 // license: ShapeOptimizationApplication/license.txt
6 //
7 // Main authors: Armin Geiser, https://github.com/armingeiser
8 //
9 // ==============================================================================
10 
11 #ifndef DIRECTION_DAMPING_UTILITIES_H
12 #define DIRECTION_DAMPING_UTILITIES_H
13 
14 // ------------------------------------------------------------------------------
15 // System includes
16 // ------------------------------------------------------------------------------
17 #include <iostream>
18 #include <string>
19 
20 // ------------------------------------------------------------------------------
21 // Project includes
22 // ------------------------------------------------------------------------------
23 #include "includes/model_part.h"
25 #include "custom_utilities/filter_function.h"
26 
27 // ==============================================================================
28 
29 namespace Kratos
30 {
31 
34 
36 
42 class KRATOS_API(SHAPE_OPTIMIZATION_APPLICATION) DirectionDampingUtilities
43 {
44 public:
47 
48  // Type definitions for better reading later
51  typedef ModelPart::NodeType::Pointer NodeTypePointer;
52  typedef std::vector<NodeTypePointer> NodeVector;
53  typedef std::vector<NodeTypePointer>::iterator NodeVectorIterator;
54  typedef std::vector<double> DoubleVector;
55  typedef std::vector<double>::iterator DoubleVectorIterator;
56 
57  // Type definitions for tree-search
60 
63 
67 
69  DirectionDampingUtilities( ModelPart& modelPartToDamp, Parameters DampingSettings );
70 
73  {
74  }
75 
76 
80 
81 
85 
86  void CreateListOfNodesOfModelPart();
87 
88  void CreateSearchTreeWithAllNodesOfModelPart();
89 
90  void InitalizeDampingFactorsToHaveNoInfluence();
91 
92  void SetDampingFactors();
93 
94  FilterFunction::Pointer CreateDampingFunction( std::string damping_type ) const;
95 
96  void ThrowWarningIfNodeNeighborsExceedLimit( const ModelPart::NodeType& given_node, const unsigned int number_of_neighbors ) const;
97 
98  void DampNodalVariable( const Variable<array_3d> &rNodalVariable );
99 
100 
104 
106  virtual std::string Info() const
107  {
108  return "DirectionDampingUtilities";
109  }
110 
112  virtual void PrintInfo(std::ostream& rOStream) const
113  {
114  rOStream << "DirectionDampingUtilities";
115  }
116 
118  virtual void PrintData(std::ostream& rOStream) const
119  {
120  }
122 
123 private:
126 
127  // Initialized by class constructor
128  ModelPart& mrModelPartToDamp;
129  Parameters mDampingSettings;
130  array_3d mDirection;
131  std::vector<double> mDampingFactors;
132 
133  // Variables for spatial search
134  unsigned int mBucketSize = 100;
135  unsigned int mMaxNeighborNodes = 10000;
136  NodeVector mListOfNodesOfModelPart;
137  KDTree::Pointer mpSearchTree;
138 
140 
141 }; // Class DirectionDampingUtilities
142 
144 
145 } // namespace Kratos.
146 
147 #endif // DIRECTION_DAMPING_UTILITIES_H
Short class definition.
Definition: bucket.h:57
Class for direction damping of the shape update.
Definition: direction_damping_utilities.h:43
Bucket< 3, NodeType, NodeVector, NodeTypePointer, NodeVectorIterator, DoubleVectorIterator > BucketType
Definition: direction_damping_utilities.h:58
Tree< KDTreePartition< BucketType > > KDTree
Definition: direction_damping_utilities.h:59
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: direction_damping_utilities.h:118
array_1d< double, 3 > array_3d
Definition: direction_damping_utilities.h:49
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: direction_damping_utilities.h:112
std::vector< double > DoubleVector
Definition: direction_damping_utilities.h:54
ModelPart::NodeType::Pointer NodeTypePointer
Definition: direction_damping_utilities.h:51
virtual ~DirectionDampingUtilities()
Destructor.
Definition: direction_damping_utilities.h:72
KRATOS_CLASS_POINTER_DEFINITION(DirectionDampingUtilities)
Pointer definition of DirectionDampingUtilities.
virtual std::string Info() const
Turn back information as a string.
Definition: direction_damping_utilities.h:106
std::vector< NodeTypePointer >::iterator NodeVectorIterator
Definition: direction_damping_utilities.h:53
ModelPart::NodeType NodeType
Definition: direction_damping_utilities.h:50
std::vector< double >::iterator DoubleVectorIterator
Definition: direction_damping_utilities.h:55
std::vector< NodeTypePointer > NodeVector
Definition: direction_damping_utilities.h:52
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
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
A generic tree data structure for spatial partitioning.
Definition: tree.h:190
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