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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/system/beams/integrate_inertia_matrix.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
integrate_inertia_matrix.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <Kokkos_SIMD.hpp>
5
6namespace kynema::beams {
7
8template <typename DeviceType>
10 template <typename ValueType>
11 using View = Kokkos::View<ValueType, DeviceType>;
12 template <typename ValueType>
14 template <typename ValueType>
15 using LeftView = Kokkos::View<ValueType, Kokkos::LayoutLeft, DeviceType>;
16 template <typename ValueType>
18
19 size_t element;
20 size_t num_nodes;
21 size_t num_qps;
29 Kokkos::View<double** [6][6], DeviceType> gbl_M_;
30
32 void operator()(size_t node_simd_node) const {
33 using simd_type = Kokkos::Experimental::simd<double>;
34 using tag_type = Kokkos::Experimental::vector_aligned_tag;
35 using Kokkos::ALL;
36 using Kokkos::Array;
37 using Kokkos::make_pair;
38 using Kokkos::subview;
39
40 constexpr auto width = simd_type::size();
41 const auto extra_component = num_nodes % width == 0U ? 0U : 1U;
43 const auto node = node_simd_node / num_simd_nodes;
45
47
48 const auto qp_Muu = ConstView<double* [36]>(qp_Muu_.data(), num_qps);
49 const auto qp_Guu = ConstView<double* [36]>(qp_Guu_.data(), num_qps);
50
51 for (auto qp = 0U; qp < num_qps; ++qp) {
52 const auto w = simd_type(qp_weight_(qp));
53 const auto jacobian = simd_type(qp_jacobian_(qp));
54 const auto phi_1 = simd_type(shape_interp_(node, qp));
55 auto phi_2 = simd_type{};
56 phi_2.copy_from(&shape_interp_(simd_node, qp), tag_type());
57 const auto coeff = phi_1 * phi_2 * w * jacobian;
58 const auto Muu_local = subview(qp_Muu, qp, ALL);
59 const auto Guu_local = subview(qp_Guu, qp, ALL);
60 for (auto component = 0; component < 36; ++component) {
61 const auto contribution = simd_type(
63 );
65 }
66 }
67
68 const auto num_lanes = Kokkos::min(width, num_nodes - simd_node);
70 const auto M_slice =
72
73 for (auto lane = 0U; lane < num_lanes; ++lane) {
74 for (auto component = 0; component < 36; ++component) {
76 }
77 }
78 }
79};
80} // namespace kynema::beams
Definition beam_quadrature.hpp:16
Definition integrate_inertia_matrix.hpp:9
Kokkos::View< ValueType, DeviceType > View
Definition integrate_inertia_matrix.hpp:11
size_t element
Definition integrate_inertia_matrix.hpp:19
Kokkos::View< ValueType, Kokkos::LayoutLeft, DeviceType > LeftView
Definition integrate_inertia_matrix.hpp:15
ConstView< double *[6][6]> qp_Muu_
Definition integrate_inertia_matrix.hpp:25
size_t num_nodes
Definition integrate_inertia_matrix.hpp:20
typename View< ValueType >::const_type ConstView
Definition integrate_inertia_matrix.hpp:13
ConstLeftView< double ** > shape_interp_
Definition integrate_inertia_matrix.hpp:24
ConstView< double * > qp_weight_
Definition integrate_inertia_matrix.hpp:22
typename LeftView< ValueType >::const_type ConstLeftView
Definition integrate_inertia_matrix.hpp:17
double gamma_prime_
Definition integrate_inertia_matrix.hpp:28
ConstView< double *[6][6]> qp_Guu_
Definition integrate_inertia_matrix.hpp:26
ConstView< double * > qp_jacobian_
Definition integrate_inertia_matrix.hpp:23
double beta_prime_
Definition integrate_inertia_matrix.hpp:27
size_t num_qps
Definition integrate_inertia_matrix.hpp:21
Kokkos::View< double **[6][6], DeviceType > gbl_M_
Definition integrate_inertia_matrix.hpp:29
KOKKOS_FUNCTION void operator()(size_t node_simd_node) const
Definition integrate_inertia_matrix.hpp:32