2016-02-13 01:15:02 +02:00
|
|
|
# This file is a part of JuliaFEM.
|
|
|
|
|
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
|
|
|
|
|
2017-08-05 13:26:19 +03:00
|
|
|
using Base.Test
|
2016-05-22 02:34:38 +03:00
|
|
|
using JuliaFEM
|
2017-08-05 13:26:19 +03:00
|
|
|
|
|
|
|
|
@testset "2d linear elasticity + volume load + surface load" begin
|
|
|
|
|
|
|
|
|
|
X = Dict(1 => [0.0, 0.0],
|
|
|
|
|
2 => [1.0, 0.0],
|
|
|
|
|
3 => [1.0, 1.0],
|
|
|
|
|
4 => [0.0, 1.0])
|
|
|
|
|
|
|
|
|
|
props = ("formulation" => "plane_stress",
|
|
|
|
|
"finite_strain" => "false",
|
|
|
|
|
"geometric_stiffness" => "false")
|
2016-05-24 08:01:41 +03:00
|
|
|
|
2016-02-13 01:15:02 +02:00
|
|
|
# field problem
|
2016-05-24 08:01:41 +03:00
|
|
|
block = Problem(Elasticity, "BLOCK", 2)
|
2017-08-05 13:26:19 +03:00
|
|
|
block.elements = [Element(Quad4, [1, 2, 3, 4])]
|
|
|
|
|
update!(block.properties, props...)
|
|
|
|
|
update!(block.elements, "geometry", X)
|
2016-06-18 12:53:01 +03:00
|
|
|
update!(block.elements, "youngs modulus", 288.0)
|
|
|
|
|
update!(block.elements, "poissons ratio", 1/3)
|
2016-06-22 01:39:28 +03:00
|
|
|
update!(block.elements, "displacement load 2", 576.0)
|
2016-05-24 08:01:41 +03:00
|
|
|
|
2016-07-13 08:07:08 +03:00
|
|
|
# traction
|
2016-08-04 13:15:19 +03:00
|
|
|
traction = Problem(Elasticity, "TRACTION", 2)
|
2017-08-05 13:26:19 +03:00
|
|
|
traction.elements = [Element(Seg2, [3, 4])]
|
|
|
|
|
update!(traction.properties, props...)
|
|
|
|
|
update!(traction.elements, "geometry", X)
|
|
|
|
|
update!(traction.elements, "displacement traction force 2", 288.0)
|
2016-05-24 08:01:41 +03:00
|
|
|
|
2016-02-13 01:15:02 +02:00
|
|
|
# boundary conditions
|
2017-08-05 13:26:19 +03:00
|
|
|
bc = Problem(Dirichlet, "symmetry boundary conditions", 2, "displacement")
|
|
|
|
|
bc.elements = [Element(Seg2, [1, 2]), Element(Seg2, [4, 1])]
|
|
|
|
|
update!(bc.elements, "geometry", X)
|
|
|
|
|
update!(bc.elements[1], "displacement 2", 0.0)
|
|
|
|
|
update!(bc.elements[2], "displacement 1", 0.0)
|
2016-05-25 22:33:47 +03:00
|
|
|
|
2017-08-05 13:26:19 +03:00
|
|
|
solver = Solver(Linear, block, traction, bc)
|
|
|
|
|
solver()
|
2016-07-14 12:43:41 +03:00
|
|
|
|
2016-05-24 08:01:41 +03:00
|
|
|
f = 288.0
|
|
|
|
|
g = 576.0
|
|
|
|
|
E = 288.0
|
|
|
|
|
nu = 1/3
|
2016-11-15 22:01:00 +02:00
|
|
|
u3 = block("displacement", 0.0)[3]
|
2016-05-24 08:01:41 +03:00
|
|
|
u3_expected = f/E*[-nu, 1] + g/(2*E)*[-nu, 1]
|
2016-11-15 22:01:00 +02:00
|
|
|
@test isapprox(u3, u3_expected)
|
2016-02-13 01:15:02 +02:00
|
|
|
end
|