Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strain recovery coupling with beam analysis #110

Merged
merged 3 commits into from
Jun 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test for strain recovery coupling with beam analysis
  • Loading branch information
tylercritchfield committed Jun 7, 2023
commit 2c11b806a759d6f4bb9f40ea5f2f4fbdc3c795f5
96 changes: 96 additions & 0 deletions test/section.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,102 @@ end

end

@testset "strain recovery: cantilever beam coupled with beam analysis" begin

# Simple cantilever beam with tip load
beam_length = 1.0
num_beam_elements = 10

# define material - aluminum
E1 = 70e9
E2 = 70e9
E3 = 70e9
G12 = 27e9
G13 = 27e9
G23 = 27e9
nu12 = 0.3
nu13 = 0.3
nu23 = 0.3
rho = 2.7e3

material = GXBeam.Material(E1, E2, E3, G12, G13, G23,
nu12, nu13, nu23, rho)

# model square cross section mesh
nx = 20
ny = 20

xs = range(0.0, stop=beam_length/10, length=nx+1)
ys = range(0.0, stop=beam_length/10, length=ny+1)

nodes = [GXBeam.Node(xs[i], ys[j]) for j in 1:ny+1 for i in 1:nx+1]
elements = [GXBeam.MeshElement([i+(j-1)*(nx+1),
i+1+(j-1)*(nx+1),
nx+2+i+(j-1)*(nx+1),
nx+1+i+(j-1)*(nx+1)], material, 0.0)
for i in 1:nx for j in 1:ny]

# get compliance, mass matrices
cache = initialize_cache(nodes, elements)
compliance = [GXBeam.compliance_matrix(nodes, elements; cache, gxbeam_order=true, shear_center=false)[1]
for i in 1:num_beam_elements]
mass = [GXBeam.mass_matrix(nodes, elements)[1] for i in 1:num_beam_elements]

# model cantilever beam in GXBeam
xb = range(0.0, stop=beam_length, length=num_beam_elements+1)
yb = zero(xb)
zb = zero(xb)
points = [[xb[i],yb[i],zb[i]] for i = 1:lastindex(xb)]

start = 1:num_beam_elements
stop = 2:num_beam_elements+1

assembly = GXBeam.Assembly(points, start, stop; compliance, mass)

# apply a point load at the tip
Fx = 0.0
Fy = 0.0
Fz = -3.0

prescribed_conditions = Dict(
1 => GXBeam.PrescribedConditions(ux=0, uy=0, uz=0, theta_x=0, theta_y=0, theta_z=0),
num_beam_elements+1 => GXBeam.PrescribedConditions(Fx=Fx, Fy=Fy, Fz=Fz)
)

#solve GXBeam
system, state, converged = static_analysis(assembly;
prescribed_conditions,
linear=true)

# internal reaction loads at beam root
F_GXBeam = -state.points[1].F
M_GXBeam = -state.points[1].M

# run GXBeam strain recovery
strain_beam, stress_beam,
strain_ply, stress_ply = GXBeam.strain_recovery(F_GXBeam, M_GXBeam, nodes, elements, cache;
gxbeam_order=true)

#strains
@test isapprox(strain_beam[1,1], -2.44191e-7, rtol=1e-4) #axial strain is in the first row now to match GXBeam coordinate system
@test isapprox(strain_beam[1,400], 2.44191e-7, rtol=1e-4)
@test isapprox(strain_beam[2,6], 3.47086e-8, rtol=1e-4)
@test isapprox(strain_beam[3,3], 5.77984e-8, rtol=1e-4)
@test isapprox(strain_beam[4,2], -1.51972e-8, rtol=1e-4)
@test isapprox(strain_beam[5,5], -1.03921e-11, rtol=1e-4)
@test isapprox(strain_beam[6,1], 4.22068e-9, rtol=1e-4)

#stresses
@test isapprox(stress_beam[1,1], -17090.9, rtol=1e-4) #axial stress is in the first row now to match GXBeam coordinate system
@test isapprox(stress_beam[1,400], 17090.9, rtol=1e-4)
@test isapprox(stress_beam[2,6], -0.018244, rtol=1e-4)
@test isapprox(stress_beam[3,3], -2.78232, rtol=1e-4)
@test isapprox(stress_beam[4,2], -410.326, rtol=1e-4)
@test isapprox(stress_beam[5,5], -0.280588, rtol=1e-4)
@test isapprox(stress_beam[6,1], 113.958, rtol=1e-4)

end

function sectionwrapper(x)

TF = eltype(x)
Expand Down