buckling test, fixed bug with tensor <-> vector order

This commit is contained in:
Jukka Aho
2016-06-08 21:50:45 +03:00
parent b65468c5d1
commit fe46907ac7
4 changed files with 72 additions and 23 deletions
@@ -21,7 +21,7 @@ using JuliaFEM.Test
x10 = 0.5*(x3+x4)
el["geometry"] = Vector{Float64}[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10]
pr = Problem(Elasticity, "tet10", 3)
Kt, f = assemble(pr, el, 0.0)
Kt, f = assemble(pr, el, 0.0, Val{:continuum_linear})
eigs = real(eigvals(Kt))
eigs_expected = [8809.45, 4936.01, 2880.56, 2491.66, 2004.85,
1632.49, 1264.32, 1212.42, 817.905,
+10 -1
View File
@@ -15,7 +15,7 @@ using JuliaFEM.Test
x4 = [4.0, 3.0, 6.0]
el["geometry"] = Vector{Float64}[x1, x2, x3, x4]
pr = Problem(Elasticity, "tet4", 3)
Kt, f = assemble(pr, el, 0.0)
Kt, f = assemble(pr, el, 0.0, Val{:continuum_linear})
Kt_expected = [
149.0 108.0 24.0 -1.0 6.0 12.0 -54.0 -48.0 0.0 -94.0 -66.0 -36.0
108.0 344.0 54.0 -24.0 104.0 42.0 -24.0 -216.0 -12.0 -60.0 -232.0 -84.0
@@ -29,5 +29,14 @@ using JuliaFEM.Test
-94.0 -60.0 -24.0 -10.0 0.0 0.0 36.0 24.0 0.0 68.0 36.0 24.0
-66.0 -232.0 -60.0 18.0 -76.0 -36.0 12.0 144.0 24.0 36.0 164.0 72.0
-36.0 -84.0 -94.0 12.0 -36.0 -46.0 0.0 48.0 36.0 24.0 72.0 104.0]
if !isapprox(Kt, Kt_expected)
info("Test failed")
info("Kt_expected")
dump(Kt_expected)
info("Kt")
dump(Kt)
end
@test isapprox(Kt, Kt_expected)
Kt, f = assemble(pr, el, 0.0, Val{:continuum})
@test isapprox(Kt, Kt_expected)
end
+32
View File
@@ -64,3 +64,35 @@ end
@test isapprox(u_4, u_expected)
end
@testset "test tet4 + buckling" begin
X = Dict{Int, Vector{Float64}}(
1 => [2.0, 3.0, 4.0],
2 => [6.0, 3.0, 2.0],
3 => [2.0, 5.0, 1.0],
4 => [4.0, 3.0, 6.0])
u = Dict{Int, Vector{Float64}}(
1 => [0.0, 0.0, 0.0],
2 => [0.0, 0.0, 0.0],
3 => [0.0, 0.0, 0.0],
4 => [-0.25, -0.25, -0.25])
e1 = Element(Tet4, [1, 2, 3, 4])
update!(e1, "geometry", X)
update!(e1, "displacement", u)
update!(e1, "youngs modulus", 96.0)
update!(e1, "poissons ratio", 1/3)
p1 = Problem(Elasticity, "tetra", 3)
p1.properties.formulation = :continuum_buckling
push!(p1, e1)
assemble!(p1, 0.0)
free_dofs = [10, 11, 12]
Km = sparse(p1.assembly.K)[free_dofs, free_dofs]
Kg = sparse(p1.assembly.Kg)[free_dofs, free_dofs]
dump(full(Km))
dump(full(Kg))
la = sort(eigs(Km, -Kg)[1])
la_expected = [1.0, 4.0]
info("la = $la")
info("la_expected = $(la_expected)")
@test isapprox(la, la_expected)
end