/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 =
52 (EI_x * cos_theta_p * cos_theta_p) + (EI_y * sin_theta_p * sin_theta_p);
53 const double bending_yy =
54 (EI_x * sin_theta_p * sin_theta_p) + (EI_y * cos_theta_p * cos_theta_p);
55 const double bending_xy = (EI_y - EI_x) * sin_theta_p * cos_theta_p;
56
57 // Calculate shear stiffness in principal frame
58 const double shear_xx = GA * (kxs * cos_theta_s * cos_theta_s + kys * sin_theta_s * sin_theta_s);
59 const double shear_yy = GA * (kxs * sin_theta_s * sin_theta_s + kys * cos_theta_s * cos_theta_s);
60 const double shear_xy = GA * (kys - kxs) * sin_theta_s * cos_theta_s;
61
62 //--------------------------------------------------------------------------
63 // Assemble stiffness matrix by blocks
64 //--------------------------------------------------------------------------
65 std::array<std::array<double, 6>, 6> stiffness_matrix = {}; // initialized to zeros
66
67 // Shear-shear coupling (rows 0-1, cols 0-1)
68 stiffness_matrix[0][0] = shear_xx;
69 stiffness_matrix[0][1] = -shear_xy;
70 stiffness_matrix[1][0] = -shear_xy;
71 stiffness_matrix[1][1] = shear_yy;
72
73 // Axial stiffness (row 2, col 2)
74 stiffness_matrix[2][2] = EA;
75
76 // Axial-bending coupling due to centroid offset (row 2, cols 3-4)
77 stiffness_matrix[2][3] = EA * y_C;
78 stiffness_matrix[2][4] = -EA * x_C;
79
80 // Bending-axial coupling due to centroid offset (rows 3-4, col 2)
81 stiffness_matrix[3][2] = EA * y_C;
82 stiffness_matrix[4][2] = -EA * x_C;
83
84 // Bending stiffness with axial-bending coupling (rows 3-4, cols 3-4)
85 stiffness_matrix[3][3] = bending_xx + EA * y_C * y_C;
86 stiffness_matrix[3][4] = -bending_xy - EA * x_C * y_C;
87 stiffness_matrix[4][3] = -bending_xy - EA * x_C * y_C;
88 stiffness_matrix[4][4] = bending_yy + EA * x_C * x_C;
89
90 // Shear-torsion coupling due to shear center offset (rows 0-1, col 5)
91 stiffness_matrix[0][5] = -shear_xx * y_S - shear_xy * x_S;
92 stiffness_matrix[1][5] = shear_xy * y_S + shear_yy * x_S;
93
94 // Torsion-shear coupling due to shear center offset (row 5, cols 0-1)
95 stiffness_matrix[5][0] = -shear_xx * y_S - shear_xy * x_S;
96 stiffness_matrix[5][1] = shear_xy * y_S + shear_yy * x_S;
97
98 // Torsional stiffness with shear-torsion coupling (row 5, col 5)
99 stiffness_matrix[5][5] =
100 GKt + shear_xx * y_S * y_S + 2. * shear_xy * x_S * y_S + shear_yy * x_S * x_S;
101
102 return stiffness_matrix;
103}
104
128static std::array<std::array<double, 6>, 6> GenerateMassMatrix(
129 double m, double I_x, double I_y, double I_p, double x_G = 0., double y_G = 0.,
130 double theta_i = 0.
131) {
132 const double cos_theta_i = std::cos(theta_i);
133 const double sin_theta_i = std::sin(theta_i);
134
135 // Calculate mass moments of inertia in reference frame
136 const double inertia_xx = (I_x * cos_theta_i * cos_theta_i) + (I_y * sin_theta_i * sin_theta_i);
137 const double inertia_yy = (I_x * sin_theta_i * sin_theta_i) + (I_y * cos_theta_i * cos_theta_i);
138 const double inertia_xy = (I_y - I_x) * sin_theta_i * cos_theta_i;
139
140 //--------------------------------------------------------------------------
141 // Assemble mass matrix by blocks
142 //--------------------------------------------------------------------------
143 std::array<std::array<double, 6>, 6> mass_matrix = {}; // initialized to zeros
144
145 // Translational mass with CG coupling (rows 0-2, cols 0-2)
146 mass_matrix[0][0] = m;
147 mass_matrix[1][1] = m;
148 mass_matrix[2][2] = m;
149
150 // Translational-rotational coupling due to CG offset (rows 0-2, cols 3-5)
151 mass_matrix[0][5] = -m * y_G; // F_x due to α_z
152 mass_matrix[1][5] = m * x_G; // F_y due to α_z
153 mass_matrix[2][3] = m * y_G; // F_z due to α_x
154 mass_matrix[2][4] = -m * x_G; // F_z due to α_y
155
156 // Rotational-translational coupling due to CG offset (rows 3-5, cols 0-2)
157 mass_matrix[3][2] = m * y_G; // M_x due to a_z
158 mass_matrix[4][2] = -m * x_G; // M_y due to a_z
159 mass_matrix[5][0] = -m * y_G; // M_z due to a_x
160 mass_matrix[5][1] = m * x_G; // M_z due to a_y
161
162 // Rotational inertia with translational-rotational coupling (rows 3-4, cols 3-4)
163 mass_matrix[3][3] = inertia_xx + m * y_G * y_G;
164 mass_matrix[3][4] = -inertia_xy - m * x_G * y_G;
165 mass_matrix[4][3] = -inertia_xy - m * x_G * y_G;
166 mass_matrix[4][4] = inertia_yy + m * x_G * x_G;
167
168 // Polar inertia with CG coupling (row 5, col 5)
169 mass_matrix[5][5] = I_p + m * (x_G * x_G + y_G * y_G);
170
171 return mass_matrix;
172}
173
174} // namespace kynema::beams
Definition beam_quadrature.hpp:14
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:128
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