9 #ifndef KRATOS_CONSTANT_ROTATION_PROCESS_H_INCLUDED
10 #define KRATOS_CONSTANT_ROTATION_PROCESS_H_INCLUDED
37 const double angular_velocity_x,
38 const double angular_velocity_y,
39 const double angular_velocity_z,
40 const double center_x,
41 const double center_y,
44 mW[0] = angular_velocity_x;
45 mW[1] = angular_velocity_y;
46 mW[2] = angular_velocity_z;
57 "model_part_name":"rotating_part",
58 "angular_velocity_x":0.0,
59 "angular_velocity_y":0.0,
60 "angular_velocity_z":1.0,
69 mW[0] = rParameters["angular_velocity_x"].
GetDouble();
70 mW[1] = rParameters[
"angular_velocity_y"].
GetDouble();
71 mW[2] = rParameters[
"angular_velocity_z"].
GetDouble();
76 if(rParameters.
Has(
"interval")) {
77 if(rParameters[
"interval"][1].IsString()) {
78 if(rParameters[
"interval"][1].GetString() ==
"End") rParameters[
"interval"][1].
SetDouble(1e30);
79 else KRATOS_THROW_ERROR(std::runtime_error,
"The second value of interval can be \"End\" or a number", 0);
94 const double& rCurrentTime = rCurrentProcessInfo[TIME];
96 if(rCurrentTime < mInitialTime || rCurrentTime >
mFinalTime) {
97 SetAllNodesVelocityToZero();
105 const double modulus_omega = sqrt(
mW[0]*
mW[0] +
mW[1]*
mW[1] +
mW[2]*
mW[2]);
106 const double rotated_angle = modulus_omega * rCurrentTime;
109 noalias(unitary_omega) =
mW / modulus_omega;
111 array_1d<double,3> initial_local_axis_1; initial_local_axis_1[0] = 1.0; initial_local_axis_1[1] = 0.0; initial_local_axis_1[2] = 0.0;
112 array_1d<double,3> initial_local_axis_2; initial_local_axis_2[0] = 0.0; initial_local_axis_2[1] = 1.0; initial_local_axis_2[2] = 0.0;
113 array_1d<double,3> initial_local_axis_3; initial_local_axis_2[0] = 0.0; initial_local_axis_3[1] = 0.0; initial_local_axis_3[2] = 1.0;
123 local_coordinates[0] = node_i->X0() -
mCenter[0];
124 local_coordinates[1] = node_i->Y0() -
mCenter[1];
125 local_coordinates[2] = node_i->Z0() -
mCenter[2];
129 new_from_center_to_node = local_coordinates[0] * current_local_axis_1 + local_coordinates[1] * current_local_axis_2 + local_coordinates[2] * current_local_axis_3;
132 noalias(current_node_position) =
mCenter + new_from_center_to_node;
134 node_i->pGetDof(VELOCITY_X)->FixDof();
135 node_i->pGetDof(VELOCITY_Y)->FixDof();
136 node_i->pGetDof(VELOCITY_Z)->FixDof();
137 array_1d<double,3>& current_node_velocity = node_i->FastGetSolutionStepValue(VELOCITY);
145 virtual std::string
Info()
const override
147 std::stringstream buffer;
148 buffer <<
"ConstantRotationProcess" ;
153 virtual void PrintInfo(std::ostream& rOStream)
const override {rOStream <<
"ConstantRotationProcess";}
156 virtual void PrintData(std::ostream& rOStream)
const override {}
175 double cang = cos(ang);
176 double sang = sin(ang);
178 new_vec[0] =
axis[0] * (
axis[0] * old_vec[0] +
axis[1] * old_vec[1] +
axis[2] * old_vec[2]) * (1 - cang) + old_vec[0] * cang + (-
axis[2] * old_vec[1] +
axis[1] * old_vec[2]) * sang;
179 new_vec[1] =
axis[1] * (
axis[0] * old_vec[0] +
axis[1] * old_vec[1] +
axis[2] * old_vec[2]) * (1 - cang) + old_vec[1] * cang + (
axis[2] * old_vec[0] -
axis[0] * old_vec[2]) * sang;
180 new_vec[2] =
axis[2] * (
axis[0] * old_vec[0] +
axis[1] * old_vec[1] +
axis[2] * old_vec[2]) * (1 - cang) + old_vec[2] * cang + (-
axis[1] * old_vec[0] +
axis[0] * old_vec[1]) * sang;
190 void SetAllNodesVelocityToZero(){
193 node_i->pGetDof(VELOCITY_X)->FixDof();
194 node_i->pGetDof(VELOCITY_Y)->FixDof();
195 node_i->pGetDof(VELOCITY_Z)->FixDof();
196 array_1d<double,3>& current_node_velocity = node_i->FastGetSolutionStepValue(VELOCITY);
197 current_node_velocity[0] = 0.0;
198 current_node_velocity[1] = 0.0;
199 current_node_velocity[2] = 0.0;
Definition: constant_rotation_process.hpp:26
virtual std::string Info() const override
Turn back information as a string.
Definition: constant_rotation_process.hpp:145
KRATOS_CLASS_POINTER_DEFINITION(ConstantRotationProcess)
Pointer definition of ConstantRotationProcess.
array_1d< double, 3 > mW
Definition: constant_rotation_process.hpp:168
Geometry< NodeType > GeometryType
Definition: constant_rotation_process.hpp:33
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: constant_rotation_process.hpp:153
ConstantRotationProcess(ModelPart &rModelPart, Parameters rParameters)
Definition: constant_rotation_process.hpp:52
Node NodeType
Definition: constant_rotation_process.hpp:32
void ExecuteInitializeSolutionStep() override
This function will be executed at every time step BEFORE performing the solve phase.
Definition: constant_rotation_process.hpp:90
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: constant_rotation_process.hpp:156
double mFinalTime
Definition: constant_rotation_process.hpp:171
ConstantRotationProcess(ModelPart &rModelPart, const double angular_velocity_x, const double angular_velocity_y, const double angular_velocity_z, const double center_x, const double center_y, const double center_z)
Constructor.
Definition: constant_rotation_process.hpp:36
void RotateAVectorAGivenAngleAroundAUnitaryVector(const array_1d< double, 3 > &old_vec, const array_1d< double, 3 > &axis, const double ang, array_1d< double, 3 > &new_vec)
Definition: constant_rotation_process.hpp:173
array_1d< double, 3 > mCenter
Definition: constant_rotation_process.hpp:169
double mInitialTime
Definition: constant_rotation_process.hpp:170
virtual ~ConstantRotationProcess()
Destructor.
Definition: constant_rotation_process.hpp:87
ModelPart & mrModelPart
Definition: constant_rotation_process.hpp:167
Geometry base class.
Definition: geometry.h:71
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
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
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
void SetDouble(const double Value)
This method sets the double contained in the current Parameter.
Definition: kratos_parameters.cpp:787
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
bool Has(const std::string &rEntry) const
This method checks if the Parameter contains a certain entry.
Definition: kratos_parameters.cpp:520
The base class for all processes in Kratos.
Definition: process.h:49
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
axis
Definition: all_t_win_vs_m_fixed_error.py:239