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.
apply_periodic_boundary_condition_process.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: Aditya Ghantasala
11 //
12 //
13 
14 #ifndef APPLY_PERIODIC_CONDITION_PROCESS_H
15 #define APPLY_PERIODIC_CONDITION_PROCESS_H
16 
17 // System includes
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
22 #include "processes/process.h"
23 #include "utilities/math_utils.h"
25 #include "includes/model_part.h"
26 
27 namespace Kratos
28 {
29 
30 class KRATOS_API(KRATOS_CORE) ApplyPeriodicConditionProcess : public Process
31 {
32 
33  public:
36 
37  typedef Node NodeType;
41  typedef Matrix MatrixType;
42  typedef Vector VectorType;
44 
51  ApplyPeriodicConditionProcess(ModelPart &rMasterModelPart, ModelPart &rSlaveModelPart,
52  Parameters Settings);
53 
58 
62  void ExecuteInitialize() override;
63 
67  void ExecuteInitializeSolutionStep() override;
68 
72  const Parameters GetDefaultParameters() const override;
73 
77  void PrintInfo(std::ostream& rOStream) const override;
78 
81  enum class TransformationType {
82  TRANSLATION = 1,
83  ROTATION = 2
84  };
86 
87  private:
88  MatrixType mTransformationMatrix; // This can be either for rotating or for translating the slave geometry to Master geometry
89  MatrixType mTransformationMatrixVariable; // This can be either for rotating or for translating the master variable to slave geometry
90  ModelPart &mrMasterModelPart; // the master modelpart to which the master-slave constraints are added.
91  ModelPart &mrSlaveModelPart;
92  Parameters mParameters; // parameters
93  double mAngleOfRotation;
94  DenseVector<double> mCenterOfRotation;
95  DenseVector<double> mAxisOfRotationVector;
97  double mDistance;
98  DenseVector<double> mDirOfTranslation;
99  double mSearchTolerance;
100  IndexType mSearchMaxResults;
101 
105  void RemoveCommonNodesFromSlaveModelPart();
106 
111  template <int TDim>
112  void ApplyConstraintsForPeriodicConditions();
113 
123  template <int TDim>
124  void ConstraintSlaveNodeWithConditionForVectorVariable(NodeType& rSlaveNode, const GeometryType& rHostedGeometry, const VectorType& rWeights, const std::string& rVarName);
125 
135  template <int TDim>
136  void ConstraintSlaveNodeWithConditionForScalarVariable(NodeType& rSlaveNode, const GeometryType& rHostedGeometry, const VectorType& rWeights, const std::string& rVarName);
137 
141  void CalculateTransformationMatrix();
142 
143  /*
144  * @brief Transform the point(node_cords) using the mTransformationMatrix calculated in CalculateTransformationMatrix function
145  * @param rCoordinates The original coordinates which have to be transformed
146  * @param rTransformedCoordinates The new coordinates which are transformed with rTransformationMatrix.
147  */
148  void TransformNode(const array_1d<double, 3 >& rCoordinates, array_1d<double, 3 >& rTransformedCoordinates) const;
149 
150 
151 
152 }; // Class
153 
154 
156 
159 
160 
164 
166 
167 
168 } // namespace Kratos.
169 
170 #endif // APPLY_PERIODIC_CONDITION_PROCESS_H defined
void ExecuteInitialize() override
Definition: periodic_interface_process.hpp:37
Definition: apply_periodic_boundary_condition_process.h:31
Node NodeType
Definition: apply_periodic_boundary_condition_process.h:37
Variable< double > VariableType
Definition: apply_periodic_boundary_condition_process.h:38
KRATOS_CLASS_POINTER_DEFINITION(ApplyPeriodicConditionProcess)
Pointer definition of ApplyPeriodicConditionProcess.
ModelPart::NodeIterator NodeIteratorType
Definition: apply_periodic_boundary_condition_process.h:40
Geometry< NodeType > GeometryType
Definition: apply_periodic_boundary_condition_process.h:43
TransformationType
Definition: apply_periodic_boundary_condition_process.h:81
Matrix MatrixType
Definition: apply_periodic_boundary_condition_process.h:41
Vector VectorType
Definition: apply_periodic_boundary_condition_process.h:42
NodeType::IndexType IndexType
Definition: apply_periodic_boundary_condition_process.h:39
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
This class defines the node.
Definition: node.h:65
std::size_t IndexType
The index type.
Definition: node.h:86
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21