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.
runge_kutta_scheme.h
Go to the documentation of this file.
1 //
2 // Author: Joaquin Irazabal, jirazabal@cimne.upc.edu
3 //
4 
5 #if !defined(KRATOS_RUNGE_KUTTA_SCHEME_H_INCLUDED )
6 #define KRATOS_RUNGE_KUTTA_SCHEME_H_INCLUDED
7 
8 // System includes
9 #include <string>
10 #include <iostream>
11 #include <cfloat>
12 
13 // Project includes
14 #include "dem_integration_scheme.h"
15 #include "includes/define.h"
16 #include "utilities/openmp_utils.h"
17 #include "includes/model_part.h"
19 #include "utilities/quaternion.h"
20 
21 namespace Kratos {
22 
23  class KRATOS_API(DEM_APPLICATION) RungeKuttaScheme : public DEMIntegrationScheme {
24  public:
25 
27 
30 
33 
35  virtual ~RungeKuttaScheme() {}
36 
37  DEMIntegrationScheme* CloneRaw() const override {
38  DEMIntegrationScheme* cloned_scheme(new RungeKuttaScheme(*this));
39  return cloned_scheme;
40  }
41 
42  DEMIntegrationScheme::Pointer CloneShared() const override {
43  DEMIntegrationScheme::Pointer cloned_scheme(new RungeKuttaScheme(*this));
44  return cloned_scheme;
45  }
46 
47  void SetTranslationalIntegrationSchemeInProperties(Properties::Pointer pProp, bool verbose = true) const override;
48  void SetRotationalIntegrationSchemeInProperties(Properties::Pointer pProp, bool verbose = true) const override;
49 
50  void UpdateTranslationalVariables(
51  int StepFlag,
52  Node& i,
54  array_1d<double, 3 >& displ,
55  array_1d<double, 3 >& delta_displ,
57  const array_1d<double, 3 >& initial_coor,
58  const array_1d<double, 3 >& force,
59  const double force_reduction_factor,
60  const double mass,
61  const double delta_t,
62  const bool Fix_vel[3]) override;
63 
64  void CalculateNewRotationalVariablesOfSpheres(
65  int StepFlag,
66  Node& i,
67  const double moment_of_inertia,
68  array_1d<double, 3 >& angular_velocity,
69  array_1d<double, 3 >& torque,
70  const double moment_reduction_factor,
71  array_1d<double, 3 >& rotated_angle,
72  array_1d<double, 3 >& delta_rotation,
73  const double delta_t,
74  const bool Fix_Ang_vel[3]) override;
75 
76  void CalculateNewRotationalVariablesOfRigidBodyElements(
77  int StepFlag,
78  Node& i,
79  const array_1d<double, 3 > moments_of_inertia,
80  array_1d<double, 3 >& angular_velocity,
81  array_1d<double, 3 >& torque,
82  const double moment_reduction_factor,
83  array_1d<double, 3 >& rotated_angle,
84  array_1d<double, 3 >& delta_rotation,
85  Quaternion<double >& Orientation,
86  const double delta_t,
87  const bool Fix_Ang_vel[3]) override;
88 
89  virtual void UpdateRotationalVariables(
90  int StepFlag,
91  Node& i,
92  const double& moment_of_inertia,
93  array_1d<double, 3 >& rotated_angle,
94  array_1d<double, 3 >& delta_rotation,
95  Quaternion<double >& Orientation,
96  const array_1d<double, 3 >& angular_momentum,
97  array_1d<double, 3 >& angular_velocity,
98  const double delta_t,
99  const bool Fix_Ang_vel[3]) override;
100 
101  void UpdateRotationalVariables(
102  int StepFlag,
103  Node& i,
104  const array_1d<double, 3 >& moments_of_inertia,
105  array_1d<double, 3 >& rotated_angle,
106  array_1d<double, 3 >& delta_rotation,
107  Quaternion<double >& Orientation,
108  const array_1d<double, 3 >& angular_momentum,
109  array_1d<double, 3 >& angular_velocity,
110  const double delta_t,
111  const bool Fix_Ang_vel[3]) override;
112 
113  void UpdateAngularVelocity(
114  const Quaternion<double>& Orientation,
115  const double LocalTensorInv[3][3],
116  const array_1d<double, 3>& angular_momentum,
117  array_1d<double, 3>& angular_velocity) override;
118 
119  void CalculateLocalAngularAcceleration(
120  const double moment_of_inertia,
121  const array_1d<double, 3 >& torque,
122  const double moment_reduction_factor,
123  array_1d<double, 3 >& angular_acceleration) override;
124 
125  void CalculateLocalAngularAccelerationByEulerEquations(
126  const array_1d<double, 3 >& local_angular_velocity,
127  const array_1d<double, 3 >& moments_of_inertia,
128  const array_1d<double, 3 >& local_torque,
129  const double moment_reduction_factor,
130  array_1d<double, 3 >& local_angular_acceleration) override;
131 
132  void CalculateAngularVelocityRK(
133  const Quaternion<double >& Orientation,
134  const double& moment_of_inertia,
135  const array_1d<double, 3 >& angular_momentum,
136  array_1d<double, 3 >& angular_velocity,
137  const double delta_t,
138  const bool Fix_Ang_vel[3]) override;
139 
140  void CalculateAngularVelocityRK(
141  const Quaternion<double >& Orientation,
142  const array_1d<double, 3 >& moments_of_inertia,
143  const array_1d<double, 3 >& angular_momentum,
144  array_1d<double, 3 > & angular_velocity,
145  const double delta_t,
146  const bool Fix_Ang_vel[3]) override;
147 
148  void QuaternionCalculateMidAngularVelocities(
149  const Quaternion<double>& Orientation,
150  const double LocalTensorInv[3][3],
151  const array_1d<double, 3>& angular_momentum,
152  const double dt,
153  const array_1d<double, 3>& InitialAngularVel,
154  array_1d<double, 3>& FinalAngularVel) override;
155 
157 
158  virtual std::string Info() const override{
159  std::stringstream buffer;
160  buffer << "RungeKuttaScheme";
161  return buffer.str();
162  }
163 
165 
166  virtual void PrintInfo(std::ostream& rOStream) const override{
167  rOStream << "RungeKuttaScheme";
168  }
169 
171 
172  virtual void PrintData(std::ostream& rOStream) const override{
173  }
174 
175 
176  protected:
177 
178 
179  private:
180 
182 
184  return *this;
185  }
186 
188 
189  RungeKuttaScheme(RungeKuttaScheme const& rOther) {
190  *this = rOther;
191  }
192 
193 
195 
196  }; // Class RungeKuttaScheme
197 
198 
199  inline std::istream& operator>>(std::istream& rIStream,
200  RungeKuttaScheme& rThis) {
201  return rIStream;
202  }
203 
204  inline std::ostream& operator<<(std::ostream& rOStream,
205  const RungeKuttaScheme& rThis) {
206  rThis.PrintInfo(rOStream);
207  rOStream << std::endl;
208  rThis.PrintData(rOStream);
209 
210  return rOStream;
211  }
212 
213 } // namespace Kratos.
214 
215 #endif // KRATOS_RUNGE_KUTTA_SCHEME_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: dem_integration_scheme.h:24
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class defines the node.
Definition: node.h:65
Definition: runge_kutta_scheme.h:23
DEMIntegrationScheme * CloneRaw() const override
Definition: runge_kutta_scheme.h:37
RungeKuttaScheme()
Default constructor.
Definition: runge_kutta_scheme.h:32
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: runge_kutta_scheme.h:166
virtual std::string Info() const override
Turn back information as a string.
Definition: runge_kutta_scheme.h:158
KRATOS_CLASS_POINTER_DEFINITION(RungeKuttaScheme)
Pointer definition of RungeKuttaScheme.
virtual ~RungeKuttaScheme()
Destructor.
Definition: runge_kutta_scheme.h:35
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: runge_kutta_scheme.h:172
ModelPart::NodesContainerType NodesArrayType
Definition: runge_kutta_scheme.h:26
DEMIntegrationScheme::Pointer CloneShared() const override
Definition: runge_kutta_scheme.h:42
dt
Definition: DEM_benchmarks.py:173
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
vel
Definition: pure_conduction.py:76
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
integer i
Definition: TensorModule.f:17