In [1]:
using ConstLab
using Plots
using Voigt
plotly();

In [9]:
nslip = 2
create_component_macros("cp", (6, nslip, nslip))
include("crystal_plasticity.jl")


WARNING: redefining constant II
WARNING: redefining constant Idev
Out[9]:
compute_residual! (generic function with 1 method)

In [11]:
angles = [75.0, 75.0 + 180.0]
mp = CrystPlastMP(200000.0, 0.3, 1000.0, 2.0, 10000.0, 0.1, 1.0, 1000.0, angles);

In [12]:
ms = CrystPlastMS(length(angles))


Out[12]:
CrystPlastMS
  n_ε_p: [0.0,0.0,0.0,0.0,0.0,0.0]
  n_κ: [0.0,0.0]
  n_τ: [0.0,0.0]
  n_μ: [0.0,0.0]

In [13]:
tend = 1.0
ts = collect(linspace(0, tend, 100))
ε_max = 0.05
εs_pstrain, σs_pstrain, ε_control_pstrain = loadcase(:uniaxial_strain, ε_max, ts);

In [29]:
include("crystal_plasticity.jl")
@time εs_res_pstrain, σs_res_pstrain, matstats = driver(stress, (x)->x, ms, mp, ts, εs_pstrain, 
σs_pstrain, ε_control_pstrain);


WARNING: redefining constant II
WARNING: redefining constant Idev
  0.220314 seconds (270.99 k allocations: 17.013 MB, 2.37% gc time)

In [31]:
vm(x) = sqrt(3/2) * vnorm(dev(x))


Out[31]:
vm (generic function with 1 method)

In [36]:
p = plot(vec(εs_res_pstrain[1,:]), 
Float64[vm(σs_res_pstrain[:,i]) for i in 1:100]);
xlabel!(p, "ε_11"); ylabel!(p, "σ"); title!(p, "Uniaxial strain vs stress")


Out[36]:

In [37]:
q = plot(vec(εs_res_pstrain[1,:]),
Float64[matstats[i].n_κ[1] for i in 1:100])
plot!(q, vec(εs_res_pstrain[1,:]),
Float64[matstats[i].n_κ[2] for i in 1:100])
xlabel!("ε_11"); ylabel!("κ"); title!("Uniaxial strain vs hardening")


Out[37]:

In [38]:
q = plot(vec(εs_res_pstrain[1,:]),
Float64[matstats[i].n_τ[1] for i in 1:100])
plot!(q, vec(εs_res_pstrain[1,:]),
Float64[matstats[i].n_τ[2] for i in 1:100])
xlabel!("ε_11"); ylabel!("τ"); title!("Uniaxial strain vs hardening")


Out[38]: