cleaned version

This commit is contained in:
Olli Väinölä
2015-11-05 16:42:19 +02:00
parent fe9f902827
commit b30591724d
@@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"collapsed": false
},
@@ -34,11 +34,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"6x6 Array{Float64,2}:\n",
" 2.69231e5 1.15385e5 1.15385e5 0.0 0.0 0.0 \n",
" 1.15385e5 2.69231e5 1.15385e5 0.0 0.0 0.0 \n",
" 1.15385e5 1.15385e5 2.69231e5 0.0 0.0 0.0 \n",
" 0.0 0.0 0.0 1.53846e5 0.0 0.0 \n",
" 0.0 0.0 0.0 0.0 1.53846e5 0.0 \n",
" 0.0 0.0 0.0 0.0 0.0 1.53846e5"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"\n",
@@ -90,11 +107,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"calculate_stress (generic function with 1 method)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"M = [1 0 0 0 0 0;\n",
@@ -231,10 +259,9 @@
"\n",
" σ[:] += result[1:6]\n",
" else\n",
" dϵᵖ = zeros(Float64, (6, 1))\n",
" σ = σ_tria\n",
" end\n",
" return (dϵᵖ, σ)\n",
" return σ\n",
"end"
]
},
@@ -247,11 +274,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"linspace(-0.0,-0.0006,10)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"steps = 10\n",
"\n",
@@ -260,7 +298,8 @@
"# Adding only strain in x-axis and counting for the poisson effect\n",
"ϵ_tot[:, 1] = linspace(0, 0.002, steps)\n",
"ϵ_tot[:, 2] = linspace(0, 0.002, steps).*-ν\n",
"ϵ_tot[:, 3] = linspace(0, 0.002, steps).*-ν"
"ϵ_tot[:, 3] = linspace(0, 0.002, steps).*-ν\n",
"#ϵ_tot[:, 2] = 1/3 * linspace(0, 0.002, steps)"
]
},
{
@@ -276,12 +315,64 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[44.44444444444445 -3.552713678800501e-15 -3.552713678800501e-15 0.0 0.0 0.0]\n",
"([-3.552713678800501e-15,-3.552713678800501e-15,44.44444444444445],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[88.8888888888889 -7.105427357601002e-15 -7.105427357601002e-15 0.0 0.0 0.0]\n",
"([-7.105427357601002e-15,-7.105427357601002e-15,88.8888888888889],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[133.33333333333334 0.0 0.0 0.0 0.0 0.0]\n",
"([0.0,0.0,133.33333333333334],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[177.7777777777778 -6.217248937900877e-15 -7.105427357601002e-15 0.0 0.0 0.0]\n",
"([-7.105427357601002e-15,-6.217248937900877e-15,177.7777777777778],\n",
"[0.0 0.0 1.0\n",
" 0.0 1.0 0.0\n",
" 1.0 0.0 0.0])\n",
"[207.40740740740782 7.407407407407826 7.407407407407835 0.0 0.0 0.0]\n",
"([7.407407407407826,7.407407407407835,207.40740740740782],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[222.22222222222263 22.22222222222264 22.222222222222648 0.0 0.0 0.0]\n",
"([22.22222222222264,22.222222222222648,222.22222222222263],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[237.03703703703744 37.037037037037436 37.037037037037436 0.0 0.0 0.0]\n",
"([37.037037037037436,37.037037037037436,237.03703703703744],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[251.85185185185227 51.85185185185227 51.851851851852274 0.0 0.0 0.0]\n",
"([51.85185185185227,51.851851851852274,251.85185185185227],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n",
"[266.6666666666671 66.6666666666671 66.66666666666711 0.0 0.0 0.0]\n",
"([66.6666666666671,66.66666666666711,266.6666666666671],\n",
"[0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
" 0.0 1.0 0.0])\n"
]
}
],
"source": [
"ϵ_last = zeros(Float64, (6))\n",
"ϵᵖ = zeros(Float64, (6))\n",
@@ -290,20 +381,36 @@
"σy = 200.0\n",
"ss = zeros(Float64, steps)\n",
"ee = zeros(Float64, steps)\n",
"for i=1:steps\n",
"for i=2:steps\n",
" dϵ = (reshape(ϵ_tot[i, :, :], (6, 1)) - ϵ_last) / Δt \n",
" dϵᵖ, σ = calculate_stress(dϵ, Δt, σ, C, σy)\n",
" σ = calculate_stress(dϵ, Δt, σ, C, σy)\n",
" ϵ_last += dϵ * Δt\n",
" ss[i] = σ[1]\n",
" ee[i] = ϵ_last[1]\n",
" sdt = [σ[1] 0 0;\n",
" 0 σ[2] 0;\n",
" 0 0 σ[3]]\n",
" princip = eig(sdt)\n",
" println(σ')\n",
" println(princip)\n",
" \n",
"end\n",
"PyPlot.plot(ee, ss)\n",
"PyPlot.title(\"Stress-Strain curve\")\n",
"PyPlot.xlabel(\"Strain\")\n",
"PyPlot.ylabel(\"Stress\")\n",
"PyPlot.ylim([0, 250])"
"#PyPlot.plot(ee, ss)\n",
"#PyPlot.title(\"Stress-Strain curve\")\n",
"#PyPlot.xlabel(\"Strain\")\n",
"#PyPlot.ylabel(\"Stress\")\n",
"#PyPlot.ylim([0, 250])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,