/home/runner/work/kynema/kynema/kynema/src/constraints/calculate_revolute_joint_output.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/constraints/calculate_revolute_joint_output.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_revolute_joint_output.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
7
8namespace kynema::constraints {
9
14template <typename DeviceType>
16 template <typename ValueType>
17 using View = Kokkos::View<ValueType, DeviceType>;
18 template <typename ValueType>
20
24 ConstView<double* [7]> node_x0; // Initial position
29
31 void operator()() const {
32 using Kokkos::Array;
33
34 // Axis of rotation unit vector
35 const auto joint_axis0_data =
38
39 // Target node index
40 auto node = target_node_index(constraint);
41
42 // Target node initial rotation
43 const auto R0_data =
44 Array<double, 4>{node_u(node, 3), node_u(node, 4), node_u(node, 5), node_u(node, 6)};
45 const auto R0 = ConstView<double[4]>{R0_data.data()};
46
47 // Target node rotational displacement
48 const auto R_data =
49 Array<double, 4>{node_u(node, 3), node_u(node, 4), node_u(node, 5), node_u(node, 6)};
50 const auto R = ConstView<double[4]>{R_data.data()};
51
52 // Calculate current orientation
54 auto RR0 = View<double[4]>(RR0_data.data());
56
57 // Calculate rotational displacement as rotation vector
59 auto RotVec = View<double[3]>(RotVec_data.data());
61
62 // Target node rotational velocity vector
63 const auto omega_data =
64 Array<double, 3>{node_udot(node, 3), node_udot(node, 4), node_udot(node, 5)};
66
67 // Target node rotational acceleration vector
68 const auto omega_dot_data =
69 Array<double, 3>{node_uddot(node, 3), node_uddot(node, 4), node_uddot(node, 5)};
71
72 // Calculate joint axis in current configuration
76
77 // Calculate rotation about shaft axis
79
80 // Angular velocity about joint axis (rad/s)
82
83 // Angular acceleration about joint axis (rad/s)
85
86 // Save outputs
90 }
91};
92
93} // namespace kynema::constraints
Definition calculate_constraint_output.hpp:8
KOKKOS_INLINE_FUNCTION void QuaternionToRotationVector(const Quaternion &quaternion, const Vector &phi)
Returns a 3-D rotation vector from provided 4-D quaternion, i.e. the logarithmic map.
Definition quaternion_operations.hpp:248
KOKKOS_INLINE_FUNCTION void QuaternionCompose(const Quaternion1 &q1, const Quaternion2 &q2, QuaternionN &qn)
Composes (i.e. multiplies) two quaternions and stores the result in a third quaternion.
Definition quaternion_operations.hpp:204
KOKKOS_INLINE_FUNCTION double DotProduct(const AVectorType &a, const BVectorType &b)
Calculate the dot product between two vector views.
Definition vector_operations.hpp:25
KOKKOS_INLINE_FUNCTION void RotateVectorByQuaternion(const Quaternion &q, const View1 &v, const View2 &v_rot)
Rotates provided vector by provided unit quaternion and returns the result.
Definition quaternion_operations.hpp:120
Kernel for calculating the output for a revolute joint constraint for feedback to controllers.
Definition calculate_revolute_joint_output.hpp:15
int constraint
Definition calculate_revolute_joint_output.hpp:21
KOKKOS_FUNCTION void operator()() const
Definition calculate_revolute_joint_output.hpp:31
View< double *[3]> outputs
Definition calculate_revolute_joint_output.hpp:28
typename View< ValueType >::const_type ConstView
Definition calculate_revolute_joint_output.hpp:19
ConstView< double *[6]> node_uddot
Definition calculate_revolute_joint_output.hpp:27
ConstView< double *[6]> node_udot
Definition calculate_revolute_joint_output.hpp:26
Kokkos::View< ValueType, DeviceType > View
Definition calculate_revolute_joint_output.hpp:17
ConstView< size_t * > target_node_index
Definition calculate_revolute_joint_output.hpp:22
ConstView< double *[7]> node_u
Definition calculate_revolute_joint_output.hpp:25
ConstView< double *[7]> node_x0
Definition calculate_revolute_joint_output.hpp:24
ConstView< double *[3][3]> axes
Definition calculate_revolute_joint_output.hpp:23