Ideal plasticity converged, both 2D and 3D

This commit is contained in:
Olli Väinölä
2016-10-28 15:46:04 +03:00
parent b7ddc4d4c8
commit c3bc708f01
4 changed files with 144 additions and 45 deletions
@@ -16,22 +16,23 @@ using JuliaFEM.Testing
7 => [1.0, 1.0, 1.0],
8 => [0.0, 1.0, 1.0])
element1 = Element(Hex8, [1, 2, 3, 4, 5, 6, 7, 8])
update!([element1], "geometry", nodes)
update!([element1], "youngs modulus", 200e3)
update!([element1], "poissons ratio", 0.3)
element = Element(Hex8, [1, 2, 3, 4, 5, 6, 7, 8])
update!([element], "geometry", nodes)
update!([element], "youngs modulus", 200e3)
update!([element], "poissons ratio", 1/3)
plastic_parameters = Dict{Any, Any}("type" => JuliaFEM.ideal_plasticity!,
"yield_surface" => Val{:von_mises},
"params" => Dict("yield_stress" => 175.0))
"params" => Dict("yield_stress" => 400.0))
to_integ_points = Dict()
map(x-> to_integ_points[x] = plastic_parameters, get_connectivity(element))
update!(element, "plasticity", to_integ_points)
elasticity_problem = Problem(Elasticity, "solve continuum block", 3)
elasticity_problem.properties.finite_strain = false
elasticity_problem.properties.geometric_stiffness = false
push!(elasticity_problem, element1)
push!(elasticity_problem.properties.store_fields, :plastic_strain)
push!(elasticity_problem, element)
bc = Element(Quad4, [1,4,8,5])
update!([bc], "geometry", nodes)
@@ -48,12 +49,13 @@ using JuliaFEM.Testing
push!(boundary_motion, disp)
solver = NonlinearSolver("solve block problem")
solver.time = 1.0
push!(solver, elasticity_problem)
push!(solver, boundary_problem)
push!(solver, boundary_motion)
solver()
disp = element1("displacement", [1.0, 1.0, 1.0], 0.0)
disp = element("displacement", [1.0, 1.0, 1.0], 1.0)
info("displacement at tip: $disp")
u_expected = 2.0 * [-1/3, -1/3, 1.0]
# @test isapprox(disp, u_expected)
+71 -11
View File
@@ -64,17 +64,17 @@ function test_von_mises_3D_basic()
stress_last = zeros(Float64, 6)
strain = zeros(Float64, 6)
Dtan = zeros(6,6)
for i=1:steps
strain_new = reshape(strain_tot[i, :, :], (6, 1))
dstrain = strain_new - strain
JuliaFEM.plastic_von_mises!(stress_new, stress_last, dstrain, C, params, Dtan, Val{:type_3d})
strain[:] = vec(strain_new)[:]
push!(ss, stress[1])
push!(ee, strain[1])
fill_tensor(eig_stress, stress_new)
eig_vals[i, :] = sort(eigvals(eig_stress))
stress_last[:] = stress_new[:]
end
#for i=1:steps
# strain_new = reshape(strain_tot[i, :, :], (6, 1))
# dstrain = strain_new - strain
# JuliaFEM.plastic_von_mises!(stress_new, stress_last, dstrain, C, params, Dtan, Val{:type_3d})
# strain[:] = vec(strain_new)[:]
# push!(ss, stress[1])
# push!(ee, strain[1])
# fill_tensor(eig_stress, stress_new)
# eig_vals[i, :] = sort(eigvals(eig_stress))
# stress_last[:] = stress_new[:]
#end
toc()
# ================ Plotting =================== #
@@ -118,6 +118,66 @@ function test_von_mises_3D_basic()
info("Calculation finished")
# plot3D(ee, ss)
# plot the surface
xx = zeros(10, 10)
yy = zeros(10, 10)
for i=1:10
for j=1:10
xx[i, j] = (i - 5) * 100
yy[i, j] = (j - 5) * 100
end
end
# calculate corresponding z
z = zeros(10, 10)
for i=1:10
for j=1:10
z[i, j] = 1
end
end
# ==================================================================
# plot the surface
plot_surface(xx, yy, z, color="blue")
stress_y = 200.0
function vm_upper(a, c)
vals = f(a[1], a[2], c)
vm(vals[1], vals[2], 200)
end
vm(a,b) = sqrt(a^2 - a*b + b^2) - stress_y
f(m,c) = [600*cos(c) 600*sin(c)].*m
x_vals = []
max_iter = 100
y_vals = []
for i=0:0.1:(2*pi+0.3)
wf(x) = f(x, i)
t = 0.01
step = 2
merkki = -1
s11, s22 = wf(t)
ii = 0
while (abs(vm(s11, s22)) > 1e-7) && ii < max_iter
val = vm(s11, s22)
if sign(val) != merkki
merkki *= -1
step *= -0.5
end
t += step
s11, s22 = wf(t)
ii += 1
end
push!(x_vals, s11)
push!(y_vals, s22)
end
plot(x_vals, y_vals, zeros(length(y_vals)), color="yellow")
axis("equal")
# ==================================================================
plot3D(eig_vals[:, 1], eig_vals[:, 2], eig_vals[:, 3], color="red")
PyPlot.title("Stress path and von Mises yield surface")
PyPlot.xlabel("Eig Stress 1")