/home/runner/work/kynema/kynema/kynema/src/elements/beams/generate_sectional_properties.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/elements/beams/generate_sectional_properties.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
generate_sectional_properties.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cmath>
5
6namespace kynema::beams {
7
41static std::array<std::array<double, 6>, 6> GenerateStiffnessMatrix(
42 double EA, double EI_x, double EI_y, double GKt, double GA, double kxs, double kys, double x_C,
43 double y_C, double theta_p, double x_S, double y_S, double theta_s
44) {
45 const double cos_theta_p = std::cos(theta_p);
46 const double sin_theta_p = std::sin(theta_p);
47 const double cos_theta_s = std::cos(theta_s);
48 const double sin_theta_s = std::sin(theta_s);
49
50 // Calculate bending stiffness in principal frame
51 const double bending_xx = EI_x * cos_theta_p * cos_theta_p + EI_y * sin_theta_p * sin_theta_p;
52 const double bending_yy = EI_x * sin_theta_p * sin_theta_p + EI_y * cos_theta_p * cos_theta_p;
53 const double bending_xy = (EI_y - EI_x) * sin_theta_p * cos_theta_p;
54
55 // Calculate shear stiffness in principal frame
56 const double shear_xx = GA * (kxs * cos_theta_s * cos_theta_s + kys * sin_theta_s * sin_theta_s);
57 const double shear_yy = GA * (kxs * sin_theta_s * sin_theta_s + kys * cos_theta_s * cos_theta_s);
58 const double shear_xy = GA * (kys - kxs) * sin_theta_s * cos_theta_s;
59
60 //--------------------------------------------------------------------------
61 // Assemble stiffness matrix by blocks
62 //--------------------------------------------------------------------------
63 std::array<std::array<double, 6>, 6> stiffness_matrix = {}; // initialized to zeros
64
65 // Shear-shear coupling (rows 0-1, cols 0-1)
66 stiffness_matrix[0][0] = shear_xx;
67 stiffness_matrix[0][1] = -shear_xy;
68 stiffness_matrix[1][0] = -shear_xy;
69 stiffness_matrix[1][1] = shear_yy;
70
71 // Axial stiffness (row 2, col 2)
72 stiffness_matrix[2][2] = EA;
73
74 // Axial-bending coupling due to centroid offset (row 2, cols 3-4)
75 stiffness_matrix[2][3] = EA * y_C;
76 stiffness_matrix[2][4] = -EA * x_C;
77
78 // Bending-axial coupling due to centroid offset (rows 3-4, col 2)
79 stiffness_matrix[3][2] = EA * y_C;
80 stiffness_matrix[4][2] = -EA * x_C;
81
82 // Bending stiffness with axial-bending coupling (rows 3-4, cols 3-4)
83 stiffness_matrix[3][3] = bending_xx + EA * y_C * y_C;
84 stiffness_matrix[3][4] = -bending_xy - EA * x_C * y_C;
85 stiffness_matrix[4][3] = -bending_xy - EA * x_C * y_C;
86 stiffness_matrix[4][4] = bending_yy + EA * x_C * x_C;
87
88 // Shear-torsion coupling due to shear center offset (rows 0-1, col 5)
89 stiffness_matrix[0][5] = -shear_xx * y_S - shear_xy * x_S;
90 stiffness_matrix[1][5] = shear_xy * y_S + shear_yy * x_S;
91
92 // Torsion-shear coupling due to shear center offset (row 5, cols 0-1)
93 stiffness_matrix[5][0] = -shear_xx * y_S - shear_xy * x_S;
94 stiffness_matrix[5][1] = shear_xy * y_S + shear_yy * x_S;
95
96 // Torsional stiffness with shear-torsion coupling (row 5, col 5)
97 stiffness_matrix[5][5] =
98 GKt + shear_xx * y_S * y_S + 2. * shear_xy * x_S * y_S + shear_yy * x_S * x_S;
99
100 return stiffness_matrix;
101}
102
126static std::array<std::array<double, 6>, 6> GenerateMassMatrix(
127 double m, double I_x, double I_y, double I_p, double x_G = 0., double y_G = 0.,
128 double theta_i = 0.
129) {
130 const double cos_theta_i = std::cos(theta_i);
131 const double sin_theta_i = std::sin(theta_i);
132
133 // Calculate mass moments of inertia in reference frame
134 const double inertia_xx = I_x * cos_theta_i * cos_theta_i + I_y * sin_theta_i * sin_theta_i;
135 const double inertia_yy = I_x * sin_theta_i * sin_theta_i + I_y * cos_theta_i * cos_theta_i;
136 const double inertia_xy = (I_y - I_x) * sin_theta_i * cos_theta_i;
137
138 //--------------------------------------------------------------------------
139 // Assemble mass matrix by blocks
140 //--------------------------------------------------------------------------
141 std::array<std::array<double, 6>, 6> mass_matrix = {}; // initialized to zeros
142
143 // Translational mass with CG coupling (rows 0-2, cols 0-2)
144 mass_matrix[0][0] = m;
145 mass_matrix[1][1] = m;
146 mass_matrix[2][2] = m;
147
148 // Translational-rotational coupling due to CG offset (rows 0-2, cols 3-5)
149 mass_matrix[0][5] = -m * y_G; // F_x due to α_z
150 mass_matrix[1][5] = m * x_G; // F_y due to α_z
151 mass_matrix[2][3] = m * y_G; // F_z due to α_x
152 mass_matrix[2][4] = -m * x_G; // F_z due to α_y
153
154 // Rotational-translational coupling due to CG offset (rows 3-5, cols 0-2)
155 mass_matrix[3][2] = m * y_G; // M_x due to a_z
156 mass_matrix[4][2] = -m * x_G; // M_y due to a_z
157 mass_matrix[5][0] = -m * y_G; // M_z due to a_x
158 mass_matrix[5][1] = m * x_G; // M_z due to a_y
159
160 // Rotational inertia with translational-rotational coupling (rows 3-4, cols 3-4)
161 mass_matrix[3][3] = inertia_xx + m * y_G * y_G;
162 mass_matrix[3][4] = -inertia_xy - m * x_G * y_G;
163 mass_matrix[4][3] = -inertia_xy - m * x_G * y_G;
164 mass_matrix[4][4] = inertia_yy + m * x_G * x_G;
165
166 // Polar inertia with CG coupling (row 5, col 5)
167 mass_matrix[5][5] = I_p + m * (x_G * x_G + y_G * y_G);
168
169 return mass_matrix;
170}
171
172} // namespace kynema::beams
Definition beam_quadrature.hpp:16
static std::array< std::array< double, 6 >, 6 > GenerateMassMatrix(double m, double I_x, double I_y, double I_p, double x_G=0., double y_G=0., double theta_i=0.)
Generates a 6x6 cross-sectional mass matrix for use in beam elements.
Definition generate_sectional_properties.hpp:126
static std::array< std::array< double, 6 >, 6 > GenerateStiffnessMatrix(double EA, double EI_x, double EI_y, double GKt, double GA, double kxs, double kys, double x_C, double y_C, double theta_p, double x_S, double y_S, double theta_s)
Generates a 6x6 cross-sectional stiffness matrix for use in beam elements.
Definition generate_sectional_properties.hpp:41