/home/runner/work/kynema/kynema/kynema/src/system/beams/calculate_G_D2.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/system/beams/calculate_G_D2.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_G_D2.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <KokkosBatched_Gemm_Decl.hpp>
4#include <KokkosBlas.hpp>
5#include <KokkosBlas1_set.hpp>
6#include <Kokkos_Core.hpp>
7
10
11namespace kynema::beams {
12
13template <typename DeviceType>
15 template <typename ValueType>
16 using View = Kokkos::View<ValueType, DeviceType>;
17 template <typename ValueType>
19
21 const ConstView<double[4]>& r, const ConstView<double[3]>& xr_prime,
22 const ConstView<double[3]>& u_prime, const ConstView<double[3]>& kappa,
23 const ConstView<double[6][6]>& D, const View<double[6][6]>& G_D2
24 ) {
25 using NoTranspose = KokkosBatched::Trans::NoTranspose;
26 using Transpose = KokkosBatched::Trans::Transpose;
27 using Default = KokkosBatched::Algo::Gemm::Default;
28 using GemmNN = KokkosBatched::SerialGemm<NoTranspose, NoTranspose, Default>;
29 using GemmTN = KokkosBatched::SerialGemm<Transpose, NoTranspose, Default>;
30 using Kokkos::make_pair;
31 using Kokkos::subview;
32
33 KokkosBlas::SerialSet::invoke(0., G_D2);
34
35 auto r_xr_prime_data = Kokkos::Array<double, 3>{};
38 auto r_xr_prime_tilde_data = Kokkos::Array<double, 9>{};
41
42 auto kappa_tilde_data = Kokkos::Array<double, 9>{};
45
46 auto xr_u_prime_data = Kokkos::Array<double, 3>{};
48 for (auto component = 0; component < 3; ++component) {
50 }
51 auto tilde_xp_up_data = Kokkos::Array<double, 9>{};
54
55 auto d_tmp_data = Kokkos::Array<double, 9>{};
56 auto d_tmp = View<double[3][3]>(d_tmp_data.data());
57 auto D11 = subview(D, make_pair(0, 3), make_pair(0, 3));
58 auto D12 = subview(D, make_pair(0, 3), make_pair(3, 6));
59 GemmNN::invoke(1., D11, r_xr_prime_tilde, 0., d_tmp);
60 GemmNN::invoke(-1., D12, kappa_tilde, 1., d_tmp);
61
62 auto G_D2_22 = subview(G_D2, make_pair(3, 6), make_pair(3, 6));
63 GemmTN::invoke(1., tilde_xp_up, d_tmp, 0., G_D2_22);
64 }
65};
66} // namespace kynema::beams
Definition beam_quadrature.hpp:14
KOKKOS_INLINE_FUNCTION void VecTilde(const VectorType &vector, const MatrixType &matrix)
Converts a 3x1 vector to a 3x3 skew-symmetric matrix and returns the result.
Definition vector_operations.hpp:10
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:34
Definition calculate_G_D2.hpp:14
Kokkos::View< ValueType, DeviceType > View
Definition calculate_G_D2.hpp:16
static KOKKOS_FUNCTION void invoke(const ConstView< double[4]> &r, const ConstView< double[3]> &xr_prime, const ConstView< double[3]> &u_prime, const ConstView< double[3]> &kappa, const ConstView< double[6][6]> &D, const View< double[6][6]> &G_D2)
Definition calculate_G_D2.hpp:20
typename View< ValueType >::const_type ConstView
Definition calculate_G_D2.hpp:18