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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/constraints/calculate_fixed_bc_3DOF_constraint.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_fixed_bc_3DOF_constraint.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]>& X0, const ConstView<double[7]>& node_u,
22 const View<double[6]>& residual_terms, const View<double[6][6]>& target_gradient_terms
23 ) {
24 using Kokkos::Array;
25
26 constexpr auto u1_data = Array<double, 3>{0., 0., 0.};
27 constexpr auto R1_data = Array<double, 4>{1., 0., 0., 0.};
28 const auto u2_data = Array<double, 3>{node_u(0), node_u(1), node_u(2)};
29 const auto R2_data = Array<double, 4>{node_u(3), node_u(4), node_u(5), node_u(6)};
33 auto A_data = Array<double, 9>{};
34 auto C_data = Array<double, 9>{};
36
37 const auto u1 = ConstView<double[3]>{u1_data.data()};
38 const auto R1 = ConstView<double[4]>{R1_data.data()};
39 const auto u2 = ConstView<double[3]>{u2_data.data()};
40 const auto R2 = ConstView<double[4]>{R2_data.data()};
41 const auto R1t = View<double[4]>{R1t_data.data()};
42 const auto R1_X0 = View<double[4]>{R1_X0_data.data()};
43 const auto R2_R1t = View<double[4]>{R2_R1t_data.data()};
44 const auto A = View<double[3][3]>{A_data.data()};
45 const auto C = View<double[3][3]>{C_data.data()};
46 const auto V3 = View<double[3]>{V3_data.data()};
47
48 //----------------------------------------------------------------------
49 // Residual Vector
50 //----------------------------------------------------------------------
51
52 // Phi(0:3) = u2 + X0 - u1 - R1*X0
55 for (auto component = 0; component < 3; ++component) {
56 residual_terms(component) =
58 }
59
60 //----------------------------------------------------------------------
61 // Constraint Gradient Matrix
62 //----------------------------------------------------------------------
63
64 //---------------------------------
65 // Target Node
66 //---------------------------------
67
68 // B(0:3,0:3) = I
69 for (auto component = 0; component < 3; ++component) {
70 target_gradient_terms(component, component) = 1.;
71 }
72 }
73};
74
75} // 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
KOKKOS_INLINE_FUNCTION void QuaternionInverse(const QuaternionInput &q_in, const QuaternionOutput &q_out)
Computes the inverse of a quaternion.
Definition quaternion_operations.hpp:172
Kernel for calculating the residual and system gradient for a Fix BC constraint with three degrees of...
Definition calculate_fixed_bc_3DOF_constraint.hpp:14
static KOKKOS_FUNCTION void invoke(const ConstView< double[3]> &X0, const ConstView< double[7]> &node_u, const View< double[6]> &residual_terms, const View< double[6][6]> &target_gradient_terms)
Definition calculate_fixed_bc_3DOF_constraint.hpp:20
Kokkos::View< ValueType, DeviceType > View
Definition calculate_fixed_bc_3DOF_constraint.hpp:16
typename View< ValueType >::const_type ConstView
Definition calculate_fixed_bc_3DOF_constraint.hpp:18