/home/runner/work/kynema/kynema/kynema/src/system/masses/calculate_quadrature_point_values.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/system/masses/calculate_quadrature_point_values.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_quadrature_point_values.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
11
12namespace kynema::masses {
13
14template <typename DeviceType>
16 using TeamPolicy = typename Kokkos::TeamPolicy<typename DeviceType::execution_space>;
17 using member_type = typename TeamPolicy::member_type;
18 template <typename ValueType>
19 using View = Kokkos::View<ValueType, DeviceType>;
20 template <typename ValueType>
22
23 double beta_prime;
25
29
35
38
40 void operator()(size_t element) const {
41 using Kokkos::ALL;
42 using Kokkos::Array;
43 using Kokkos::subview;
44 using CopyMatrix = KokkosBatched::SerialCopy<>;
45 using NoTranspose = KokkosBatched::Trans::NoTranspose;
46 using Default = KokkosBatched::Algo::Gemm::Default;
47 using Gemm = KokkosBatched::SerialGemm<NoTranspose, NoTranspose, Default>;
48
49 const auto index = node_state_indices(element);
50
51 // Allocate scratch views
52 const auto u_ddot_data = Array<double, 3>{A(index, 0), A(index, 1), A(index, 2)};
53 const auto omega_dot_data = Array<double, 3>{A(index, 3), A(index, 4), A(index, 5)};
54 const auto omega_data = Array<double, 3>{V(index, 3), V(index, 4), V(index, 5)};
60
61 // Set up Views
62 const auto u_ddot = ConstView<double[3]>(u_ddot_data.data());
64 const auto omega = ConstView<double[3]>(omega_data.data());
65 auto Muu = View<double[6][6]>(Muu_data.data());
66 auto eta = View<double[3]>(eta_data.data());
67 auto rho = View<double[3][3]>(rho_data.data());
70
71 // Do the math
72 {
74 const auto r0_data = Array<double, 4>{
75 node_x0(element, 3), node_x0(element, 4), node_x0(element, 5), node_x0(element, 6)
76 };
77 const auto r_data = Array<double, 4>{Q(index, 3), Q(index, 4), Q(index, 5), Q(index, 6)};
79
80 const auto Mstar = View<double[6][6]>(Mstar_data.data());
81 const auto r0 = ConstView<double[4]>(r0_data.data());
82 const auto r = ConstView<double[4]>(r_data.data());
83 const auto xr = View<double[4]>(xr_data.data());
84
85 CopyMatrix::invoke(subview(qp_Mstar, element, ALL, ALL), Mstar);
89
91
94 }
95
96 {
100
102 auto Fg = View<double[6]>(Fg_data.data());
103 auto Fi = View<double[6]>(Fi_data.data());
104
105 const auto mass = Muu(0, 0);
106
108
112 );
113
114 for (auto component = 0U; component < 6U; ++component) {
116 }
117 }
118
119 {
122 auto T_data = Array<double, 36>{};
124
125 auto Guu = View<double[6][6]>(Guu_data.data());
126 auto Kuu = View<double[6][6]>(Kuu_data.data());
127 auto T = View<double[6][6]>(T_data.data());
128 auto STpI = View<double[6][6]>(STpI_data.data());
129
130 const auto mass = Muu(0, 0);
131
135 );
136
137 CopyMatrix::invoke(Kokkos::subview(tangent, index, Kokkos::ALL, Kokkos::ALL), T);
138
139 for (auto component_1 = 0U; component_1 < 6U; ++component_1) {
140 for (auto component_2 = 0U; component_2 < 6U; ++component_2) {
143 }
144 }
145
146 Gemm::invoke(1., Kuu, T, 1., STpI);
147
148 CopyMatrix::invoke(
149 STpI, Kokkos::subview(system_matrix_terms, element, Kokkos::ALL, Kokkos::ALL)
150 );
151 }
152 }
153};
154
155} // namespace kynema::masses
Definition calculate_gravity_force.hpp:6
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 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:11
static KOKKOS_FUNCTION void invoke(double mass, const ConstView< double[3]> &gravity, const ConstView< double[3][3]> &eta_tilde, const View< double[6]> &FG)
Definition calculate_gravity_force.hpp:15
static KOKKOS_FUNCTION void invoke(double mass, const ConstView< double[3]> &omega, const ConstView< double[3]> &eta, const ConstView< double[3][3]> &rho, const ConstView< double[3][3]> &omega_tilde, const Kokkos::View< double[6][6], DeviceType > &Guu)
Definition calculate_gyroscopic_matrix.hpp:20
static KOKKOS_FUNCTION void invoke(double mass, const ConstView< double[3]> &u_ddot, const ConstView< double[3]> &omega, const ConstView< double[3]> &omega_dot, const ConstView< double[3]> &eta, const ConstView< double[3][3]> &rho, const ConstView< double[3][3]> &omega_tilde, const ConstView< double[3][3]> &omega_dot_tilde, const View< double[6][6]> &Kuu)
Definition calculate_inertia_stiffness_matrix.hpp:19
static KOKKOS_FUNCTION void invoke(double mass, const ConstView< double[3]> &u_ddot, const ConstView< double[3]> &omega, const ConstView< double[3]> &omega_dot, const ConstView< double[3]> &eta, const ConstView< double[3][3]> &eta_tilde, const ConstView< double[3][3]> &rho, const ConstView< double[3][3]> &omega_tilde, const ConstView< double[3][3]> &omega_dot_tilde, const View< double[6]> &FI)
Definition calculate_inertial_force.hpp:16
Definition calculate_quadrature_point_values.hpp:15
double gamma_prime
Definition calculate_quadrature_point_values.hpp:24
typename TeamPolicy::member_type member_type
Definition calculate_quadrature_point_values.hpp:17
ConstView< double *[6][6]> qp_Mstar
Definition calculate_quadrature_point_values.hpp:33
typename View< ValueType >::const_type ConstView
Definition calculate_quadrature_point_values.hpp:21
ConstView< double *[7]> node_x0
Definition calculate_quadrature_point_values.hpp:34
View< double *[6]> A
Definition calculate_quadrature_point_values.hpp:28
View< double *[6]> V
Definition calculate_quadrature_point_values.hpp:27
ConstView< size_t * > node_state_indices
Definition calculate_quadrature_point_values.hpp:31
View< double *[6]> residual_vector_terms
Definition calculate_quadrature_point_values.hpp:36
KOKKOS_FUNCTION void operator()(size_t element) const
Definition calculate_quadrature_point_values.hpp:40
View< double *[6][6]> system_matrix_terms
Definition calculate_quadrature_point_values.hpp:37
Kokkos::View< ValueType, DeviceType > View
Definition calculate_quadrature_point_values.hpp:19
ConstView< double[3]> gravity
Definition calculate_quadrature_point_values.hpp:32
ConstView< double *[6][6]> tangent
Definition calculate_quadrature_point_values.hpp:30
double beta_prime
Definition calculate_quadrature_point_values.hpp:23
View< double *[7]> Q
Definition calculate_quadrature_point_values.hpp:26
typename Kokkos::TeamPolicy< typename DeviceType::execution_space > TeamPolicy
Definition calculate_quadrature_point_values.hpp:16
static KOKKOS_FUNCTION void invoke(const ConstView< double[4]> &xr, const ConstView< double[6][6]> &Cstar, const View< double[6][6]> &Cuu)
Definition rotate_section_matrix.hpp:17