Files
JuliaFEM.jl/test/test_elasticity_surface_load.jl
T

55 lines
1.7 KiB
Julia
Raw Normal View History

2016-02-01 09:15:42 +02:00
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM.Test
2016-02-03 06:49:42 +02:00
using JuliaFEM.Core: Node, update!, Quad4, Seg2, Problem, Elasticity, Solver, Dirichlet
2016-02-01 09:15:42 +02:00
@testset "test 2d linear elasticity with surface load." begin
nodes = Dict{Int64, Node}(
1 => [0.0, 0.0],
2 => [1.0, 0.0],
3 => [1.0, 1.0],
4 => [0.0, 1.0])
E = 288.0
nu = 1.0/3.0
f = -E/10.0
expected = f/E*[-nu, 1]
# field problem is plane stress linear elasticity
element1 = Quad4([1, 2, 3, 4])
element2 = Seg2([3, 4])
update!([element1, element2], "geometry", nodes)
update!(element1, "youngs modulus", E)
update!(element1, "poissons ratio", nu)
# update!(element2, "displacement traction force", [0.0, f])
update!(element2, "displacement traction force", Vector{Float64}[[0.0, f], [0.0, f]])
2016-02-03 06:49:42 +02:00
# type, name, dimension
2016-02-02 22:22:21 +02:00
elasticity_problem = Problem(Elasticity, "block", 2)
2016-02-03 06:49:42 +02:00
elasticity_problem.properties.formulation = :plane_stress
2016-02-01 09:15:42 +02:00
push!(elasticity_problem, element1, element2)
# dirichlet boundary condition, symmetry
sym13 = Seg2([1, 2])
sym23 = Seg2([4, 1])
update!([sym13, sym23], "geometry", nodes)
update!(sym13, "displacement 2", 0.0)
update!(sym23, "displacement 1", 0.0)
2016-02-03 06:49:42 +02:00
# type, name, dimension, unknown_field_name
boundary_problem = Problem(Dirichlet, "symmetry boundaries", 2, "displacement")
2016-02-01 09:15:42 +02:00
push!(boundary_problem, sym13, sym23)
2016-02-02 22:22:21 +02:00
solver = Solver("solve block problem")
2016-02-01 09:15:42 +02:00
push!(solver, elasticity_problem)
push!(solver, boundary_problem)
2016-02-02 22:22:21 +02:00
call(solver)
2016-02-01 09:15:42 +02:00
u_disp = element1("displacement", [1.0, 1.0], 0.0)
info("Displacement = $u_disp")
@test isapprox(u_disp, expected)
end