Files
JuliaFEM.jl/test/test_elasticity.jl
T

51 lines
1.7 KiB
Julia
Raw Normal View History

2015-10-28 04:29:14 +02:00
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
2015-11-01 18:44:50 +02:00
module ElasticityTests
2015-10-28 04:29:14 +02:00
2015-11-01 18:44:50 +02:00
using JuliaFEM.Test
2015-11-18 01:19:04 +02:00
using JuliaFEM: Seg2, Quad4, Field, FieldSet, CPS4,
2015-11-11 00:52:16 +02:00
get_basis, solve!,
PlaneStressElasticityProblem
2015-10-28 04:29:14 +02:00
2015-11-18 01:19:04 +02:00
function test_elasticity_volume_load()
2015-10-28 04:29:14 +02:00
element = Quad4([1, 2, 3, 4])
2015-10-30 12:40:56 +02:00
element["geometry"] = Vector[[0.0, 0.0], [10.0, 0.0], [10.0, 1.0], [0.0, 1.0]]
element["youngs modulus"] = 500.0
element["poissons ratio"] = 0.3
element["displacement load"] = Vector[[0.0, -10.0], [0.0, -10.0], [0.0, -10.0], [0.0, -10.0]]
2015-10-28 04:29:14 +02:00
free_dofs = [3, 4, 5, 6]
2015-11-18 01:19:04 +02:00
problem = PlaneStressElasticityProblem()
push!(problem, element)
2015-10-28 04:29:14 +02:00
solve!(problem, free_dofs; max_iterations=10)
disp = get_basis(element)("displacement", [1.0, 1.0])[2]
2015-10-30 12:40:56 +02:00
info("displacement at tip: $disp")
2015-10-28 04:29:14 +02:00
# verified using Code Aster.
2015-11-11 00:52:16 +02:00
@test isapprox(disp, -8.77303119819776)
2015-10-28 04:29:14 +02:00
end
2015-11-18 01:19:04 +02:00
function test_elasticity_surface_load()
N = Vector[[0.0, 0.0], [10.0, 0.0], [10.0, 1.0], [0.0, 1.0]]
element1 = Quad4([1, 2, 3, 4])
element1["geometry"] = Vector[N[1], N[2], N[3], N[4]]
element1["youngs modulus"] = 500.0
element1["poissons ratio"] = 0.3
element2 = Seg2([3, 4])
element2["geometry"] = Vector[N[3], N[4]]
element2["displacement traction force"] = Vector[[0.0, -10.0], [0.0, -10.0]]
free_dofs = [3, 4, 5, 6]
problem = PlaneStressElasticityProblem()
push!(problem, element1)
push!(problem, element2)
solve!(problem, free_dofs; max_iterations=10)
disp = get_basis(element1)("displacement", [1.0, 1.0])[2]
info("displacement at tip: $disp")
# verified using Code Aster.
@test isapprox(disp, -9.33106637611714)
end
2015-11-01 18:44:50 +02:00
end