mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-10 04:50:49 +00:00
Remove badly designed test (#208)
Solution not known for tests. Let's create simpler tests with known solutions.
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Preprocess
|
||||
using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
@testset "2d curved block with frictionless finite sliding contact using forwarddiff" begin
|
||||
meshfile = @__DIR__() * "/testdata/block_2d_curved.med"
|
||||
mesh = aster_read_mesh(meshfile)
|
||||
|
||||
upper = Problem(Elasticity, "upper", 2)
|
||||
upper.properties.formulation = :plane_stress
|
||||
upper.properties.finite_strain = true
|
||||
upper.properties.geometric_stiffness = true
|
||||
upper.elements = create_elements(mesh, "UPPER")
|
||||
update!(upper, "youngs modulus", 96.0)
|
||||
update!(upper, "poissons ratio", 1/3)
|
||||
|
||||
lower = Problem(Elasticity, "lower", 2)
|
||||
lower.properties.formulation = :plane_stress
|
||||
lower.properties.finite_strain = true
|
||||
lower.properties.geometric_stiffness = true
|
||||
lower.elements = create_elements(mesh, "LOWER")
|
||||
update!(lower, "youngs modulus", 96.0)
|
||||
update!(lower, "poissons ratio", 1/3)
|
||||
|
||||
bc_upper = Problem(Dirichlet, "upper boundary", 2, "displacement")
|
||||
bc_upper.elements = create_elements(mesh, "UPPER_TOP")
|
||||
update!(bc_upper, "displacement 1", 0.0)
|
||||
update!(bc_upper, "displacement 2", -0.15)
|
||||
|
||||
bc_lower = Problem(Dirichlet, "lower boundary", 2, "displacement")
|
||||
bc_lower.elements = create_elements(mesh, "LOWER_BOTTOM")
|
||||
update!(bc_lower, "displacement 1", 0.0)
|
||||
update!(bc_lower, "displacement 2", 0.0)
|
||||
|
||||
contact = Problem(Contact2DAD, "contact between upper and lower block", 2, "displacement")
|
||||
contact.properties.rotate_normals = true
|
||||
contact_slave_elements = create_elements(mesh, "LOWER_TOP")
|
||||
contact_master_elements = create_elements(mesh, "UPPER_BOTTOM")
|
||||
add_slave_elements!(contact, contact_slave_elements)
|
||||
add_master_elements!(contact, contact_master_elements)
|
||||
|
||||
nnodes = length(mesh.nodes)
|
||||
contact.assembly.u = zeros(2*nnodes)
|
||||
contact.assembly.la = zeros(2*nnodes)
|
||||
|
||||
solver = NonlinearSolver(upper, lower, bc_upper, bc_lower, contact)
|
||||
solver()
|
||||
normu = norm(contact.assembly.u)
|
||||
info("displacement vector norm = $normu")
|
||||
|
||||
@test isapprox(normu, 0.4974792662500015; atol=1.0e-5)
|
||||
end
|
||||
|
||||
#= TODO: Fix test, this is not converging
|
||||
@testset "project from master to slave" begin
|
||||
el = Element(Seg2, [1, 2])
|
||||
x1 = DVTI(Vector{Float64}[
|
||||
[ 0.07406987526791842, 0.6628967239474994],
|
||||
[-0.24633092752656838, 0.4732606367688589]])
|
||||
n1 = DVTI(Vector{Float64}[
|
||||
[0.40398625635635355, 0.9147650543583191],
|
||||
[-0.5093430176405901, 0.860563588807229]])
|
||||
x2 = [0.5049198709043257, 0.27765317280577695]
|
||||
xi = project_from_master_to_slave(el, x1, n1, x2; debug=true)
|
||||
info("xi = $xi")
|
||||
end
|
||||
=#
|
||||
@@ -1,82 +0,0 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Preprocess
|
||||
using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
pkg_dir = Pkg.dir("JuliaFEM")
|
||||
datadir = joinpath(pkg_dir, "test", first(splitext(basename(@__FILE__))))
|
||||
|
||||
meshfile = joinpath(datadir, "block_2d.med")
|
||||
mesh = aster_read_mesh(meshfile)
|
||||
|
||||
upper = Problem(mesh, Elasticity, "UPPER", 2)
|
||||
lower = Problem(mesh, Elasticity, "LOWER", 2)
|
||||
|
||||
for body in [upper, lower]
|
||||
body.properties.formulation = :plane_stress
|
||||
update!(body, "youngs modulus", 288.0)
|
||||
update!(body, "poissons ratio", 1/3)
|
||||
end
|
||||
|
||||
load = Problem(mesh, Elasticity, "UPPER_TOP", 2)
|
||||
load.properties.formulation = :plane_stress
|
||||
update!(load, "displacement traction force 2", 0.0 => 0.0)
|
||||
update!(load, "displacement traction force 2", 1.0 => -28.8)
|
||||
bc1 = Problem(mesh, Dirichlet, "LOWER_BOTTOM", 2, "displacement")
|
||||
update!(bc1, "displacement 2", 0.0)
|
||||
bc2 = Problem(mesh, Dirichlet, "LOWER_LEFT", 2, "displacement")
|
||||
update!(bc2, "displacement 1", 0.0)
|
||||
bc3 = Problem(mesh, Dirichlet, "UPPER_LEFT", 2, "displacement")
|
||||
update!(bc3, "displacement 1", 0.0)
|
||||
|
||||
interface = Problem(Contact2DAD, "interface", 2, "displacement")
|
||||
interface_slave_elements = create_elements(mesh, "LOWER_TOP")
|
||||
interface_master_elements = create_elements(mesh, "UPPER_BOTTOM")
|
||||
add_slave_elements!(interface, interface_slave_elements)
|
||||
add_master_elements!(interface, interface_master_elements)
|
||||
interface.properties.rotate_normals = true
|
||||
|
||||
# in LOWER_LEFT we have node belonging also to contact interface
|
||||
# let's remove it from dirichlet bc
|
||||
create_node_set_from_element_set!(mesh, "LOWER_LEFT")
|
||||
nid = find_nearest_node(mesh, [0.0, 0.5]; node_set="LOWER_LEFT")
|
||||
coords = mesh.nodes[nid]
|
||||
info("nearest node to (0.0, 0.5) = $nid, coordinates = $coords")
|
||||
dofs = [2*(nid-1)+1, 2*(nid-1)+2]
|
||||
info("removing nid $nid, dofs $dofs from LOWER_LEFT")
|
||||
push!(bc2.assembly.removed_dofs, dofs...)
|
||||
|
||||
solver = Solver(Nonlinear)
|
||||
push!(solver, upper, lower, load, bc1, bc2, bc3, interface)
|
||||
|
||||
interface.assembly.u = zeros(48)
|
||||
interface.assembly.la = zeros(48)
|
||||
|
||||
for body in [upper, lower]
|
||||
body.properties.geometric_stiffness = true
|
||||
body.properties.finite_strain = true
|
||||
end
|
||||
|
||||
for time in [0.0, 1/3, 2/3, 1.0]
|
||||
interface.properties.iteration = 0
|
||||
solve!(solver, time)
|
||||
end
|
||||
|
||||
node_ids, displacement = get_nodal_vector(interface.elements, "displacement", 1.0)
|
||||
node_ids, geometry = get_nodal_vector(interface.elements, "geometry", 1.0)
|
||||
node_ids, la = get_nodal_vector(interface.elements, "lambda", 1.0)
|
||||
u2 = [u[2] for u in displacement]
|
||||
f2 = [f[2] for f in la]
|
||||
maxabsu2 = maximum(abs.(u2))
|
||||
stdabsu2 = std(abs.(u2))
|
||||
info("max(abs(u2)) = $maxabsu2, std(abs(u2)) = $stdabsu2")
|
||||
@test isapprox(stdabsu2, 0.0; atol=1.0e-12)
|
||||
maxabsf2 = maximum(abs.(f2))
|
||||
stdabsf2 = std(abs.(f2))
|
||||
info("max(abs(f2)) = $maxabsf2, std(abs(f2)) = $stdabsf2")
|
||||
@test isapprox(stdabsf2, 0.0; atol=1.0e-12)
|
||||
# for linear case pressure 28.8
|
||||
@test isapprox(mean(abs.(f2)), 27.76616800689944; rtol=1.0e-3)
|
||||
Reference in New Issue
Block a user