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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/constraints/calculate_revolute_joint_force.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_revolute_joint_force.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
6
7namespace kynema::constraints {
8
13template <typename DeviceType>
15 template <typename ValueType>
16 using View = Kokkos::View<ValueType, DeviceType>;
17 template <typename ValueType>
19
21 const ConstView<double[3][3]>& axes, const ConstView<double[7]>& inputs,
22 const ConstView<double[7]>& node_u, const View<double[6]>& system_residual_terms
23 ) {
24 using Kokkos::Array;
25
26 // Initial difference between nodes
27 const auto X0_data = Array<double, 3>{axes(0, 0), axes(0, 1), axes(0, 2)};
28 const auto R2_data = Array<double, 4>{node_u(3), node_u(4), node_u(5), node_u(6)};
30
31 const auto X0 = ConstView<double[3]>{X0_data.data()};
32 const auto R2 = ConstView<double[4]>{R2_data.data()};
33 const auto R2_X0 = View<double[3]>{R2_X0_data.data()};
34
35 //----------------------------------------------------------------------
36 // Residual Vector
37 //----------------------------------------------------------------------
38
39 // Extract residual rows relevant to this constraint
41
42 // Take axis_x and rotate it to right orientation
43 system_residual_terms(3) = R2_X0(0) * inputs(0);
44 system_residual_terms(4) = R2_X0(1) * inputs(0);
45 system_residual_terms(5) = R2_X0(2) * inputs(0);
46 }
47};
48
49} // namespace kynema::constraints
Definition calculate_constraint_output.hpp:8
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 force applied to the system residual as the result of a revolute joint con...
Definition calculate_revolute_joint_force.hpp:14
typename View< ValueType >::const_type ConstView
Definition calculate_revolute_joint_force.hpp:18
Kokkos::View< ValueType, DeviceType > View
Definition calculate_revolute_joint_force.hpp:16
static KOKKOS_FUNCTION void invoke(const ConstView< double[3][3]> &axes, const ConstView< double[7]> &inputs, const ConstView< double[7]> &node_u, const View< double[6]> &system_residual_terms)
Definition calculate_revolute_joint_force.hpp:20