Skip to content

Instantly share code, notes, and snippets.

@alesolano
Last active October 22, 2017 12:10
Show Gist options
  • Save alesolano/987ca9f2b15e67acf7ce10057aad0abc to your computer and use it in GitHub Desktop.
Save alesolano/987ca9f2b15e67acf7ce10057aad0abc to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Drawing Mohr's circles"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 50, 300, 0],\n",
" [ 300, -400, 0],\n",
" [ 0, 0, 0]])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Given a certain stress tensor\n",
"σ = np.array([[50, 300, 0], [300, -400, 0], [0, 0, 0]])\n",
"σ"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"n = 100000\n",
"\n",
"σn = np.zeros([n, 1]) # array of normal stress component\n",
"τ = np.zeros([n, 1]) # array of shear stress component\n",
"\n",
"for i in range(n):\n",
" \n",
" # Generate normal vectors to n random planes\n",
" θ = np.random.uniform(0, 2*np.pi)\n",
" ϕ = np.random.uniform(0, np.pi)\n",
" η = np.array([np.sin(ϕ)*np.cos(θ), np.sin(ϕ)*np.sin(θ), np.cos(ϕ)])\n",
" \n",
" # Cauchy's Law\n",
" T = σ.dot(η)\n",
" \n",
" # Stress components\n",
" σn[i, 0] = η.dot(T)\n",
" τ[i, 0] = np.sqrt(np.array([(T**2).sum() - σn[i, 0]**2]).astype(np.float32))[0]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgI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wA3\nTPPUo8B/Ab5FuRX6LeCPKAdBpqrU+HuUux6Cma0+d3/K3R8FHjWzR4DfAX4/0wKpXmNyzKPAJWB/\nlrVNqqVGaS53dzMLPrTQzD4D/BD4hrt/WHk5JYsaow96d/9yLceZ2Z8AP0oenqbcLz5pVbLvNB//\n2V+5P5UazewfUe6nO5K8MVYBPzOznixrrPU1pBygP6Yc9Ll4DSeZ2b8CfhP4x0lXB3mrcQaZ1jjH\nmvLiXTNb7u5nky6ukWR/kLrNbAHlkN/v7n8RpMY0L0Tk/QNYXrH9byn3jQHczNUXRN5k5gtgd2VY\n79t8fDE2FzUC6yq2fxf4n3mqLznfncAg0DFlf25qrKipl6svxuaxxvlJHWv4+GLszVmce4Z6VnP1\nxdjvcPWFzj3VXssUazPK10++O2V/pjUG+Y/Jywfw34G/AX4OPM3Vwf8o5Svex6gYzQB0A68lz32P\nZNJZRvVeCfq81Ei5pfJa8hr+b2BlnupLzneCcr/nq8nH93NY4z+j3B87DrwLPJO3GqfUexflESRD\nlLueMjnvNHX8OXAWuJi8fvcDnwcOAm8APwGWVHstU6zv1yl3Df+84v13V9Y1amasiEjkNOpGRCRy\nCnoRkcgp6EVEIqegFxGJnIJeRCRyCnoRkcgp6EVEIqegFxGJ3P8Ht4bQ9WuD95QAAAAASUVORK5C\nYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7fb8efabafd0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Plot circles\n",
"plt.plot(σn, τ, 'c.')\n",
"plt.axis('equal')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Checking how the maximum and minimum values of the normal stress component match the principal normal stresses."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-549.99030444725634, 199.97520159297252)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Principal normal stresses (not including σz), numerically\n",
"σn.min(), σn.max()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-550.0, 200.0)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σx = σ[0, 0]\n",
"σy = σ[1, 1]\n",
"τxy = σ[0, 1]\n",
"\n",
"# Center and radius of the external circle\n",
"C = (σx + σy)/2\n",
"R = np.sqrt(((σx - σy)/2)**2 + τxy**2)\n",
"\n",
"# Principal normal stresses (not including σz), graphically\n",
"C - R, C + R"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 200., -550., 0.])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Principal normal stresses, analitically\n",
"np.linalg.eigvals(σ)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment