1
0
mirror of https://gitlab.com/MisterBiggs/astro-helper.git synced 2025-06-16 07:06:43 +00:00

added Idealized cell math

This commit is contained in:
Anson Biggs 2021-01-30 18:04:43 -07:00
parent a524d2448d
commit 40e62cb1e4
3 changed files with 44 additions and 2 deletions

View File

@ -1,4 +1,5 @@
module AstroHelper module AstroHelper
using LinearAlgebra using LinearAlgebra
using DataFrames using DataFrames

View File

@ -27,5 +27,35 @@ struct Section
end end
export Section
function bending_moment(s::Section, Mx, My)
s.data.σz = (My / s.Iyy) .* s.data.x + (Mx / s.Ixx) .* s.data.y
s.data.σz
end
function shear_stress(s::Section, Vx, Vy)
s.data.Δq = -(Vx / s.Iyy) * s.data.A .* s.data.x - (Vy / s.Ixx) * s.data.A .* s.data.y
s.data.Δq
end
function shear_flow(s::Section)
if !("Δq" in names(s.data))
error("Missing Δq from Section! Run shear_stress function.")
end
q = s.data.Δq
s.data.q = [q[1], q[1] + q[2], q[1] + q[2] + q[3], sum(q)]
s.data.q
end
function total_shear(s::Section, qo, thickness)
s.data.τ = (s.q + qo) ./ thickness
s.data.τ
end
export Section

View File

@ -1,6 +1,6 @@
using Test using Test
import AstroHelper: Quaternion, Section import AstroHelper: Quaternion, Section,bending_moment, shear_stress, shear_flow, total_shear
@testset "AeroHelper" begin @testset "AeroHelper" begin
@ -23,8 +23,19 @@ import AstroHelper: Quaternion, Section
@testset "Section" begin @testset "Section" begin
tolerance = 1e-5
complist(a, b) = abs(sum(a .- b)) < tolerance
s = Section([2,1,0.5,0.5,0.75,0.75,2], [0,12,24,24,16,8,0], [0,0,0,6,7,8,9]) s = Section([2,1,0.5,0.5,0.75,0.75,2], [0,12,24,24,16,8,0], [0,0,0,6,7,8,9])
@test all([s.Ixx == 126.075 s.Iyy == 571.2 s.Ixy -28.2]) @test all([s.Ixx == 126.075 s.Iyy == 571.2 s.Ixy -28.2])
s = Section([1, .5, .5, 1], [-10, 20, 20, -10], [-5, -4, 4, 5])
@test all([s.Ixx == 66 s.Iyy == 600 s.Ixy == 0])
@test complist(bending_moment(s, -160000, -120000), [14121.2121 5696.9696 -13696.9696 -10121.2121])
@test complist(shear_stress(s, 600, 800), [70.6061 14.2424 -34.2424 -50.6061])
@test abs(shear_flow(s)[end]) < tolerance
end end
end end