diff --git a/17_integrals_and_derivatives/17_integrals.ipynb b/17_integrals_and_derivatives/17_integrals.ipynb index 03cd66f..2618cea 100644 --- a/17_integrals_and_derivatives/17_integrals.ipynb +++ b/17_integrals_and_derivatives/17_integrals.ipynb @@ -4,9 +4,10 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": true, - "slideshow": { - "slide_type": "skip" + "attributes": { + "classes": [], + "id": "", + "n": "1" } }, "outputs": [], @@ -18,9 +19,10 @@ "cell_type": "code", "execution_count": 2, "metadata": { - "collapsed": true, - "slideshow": { - "slide_type": "skip" + "attributes": { + "classes": [], + "id": "", + "n": "2" } }, "outputs": [], @@ -30,42 +32,30 @@ }, { "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# Numerical Integrals" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, + "metadata": {}, "source": [ + "# Numerical Integrals\n", + "\n", "# Integrals in practice\n", "\n", "### Example: Compare toughness of Stainless steel to Structural steel\n", "\n", "![Stress-strain plot of steel](steel_psi.jpg)\n", "\n", - "### Step 1 - G3Data to get points \n", + "### Step 1 - G3Data to get points\n", "\n", - "Use the plot shown to determine the toughness of stainless steel and the toughness of structural steel.\n", - "\n" + "Use the plot shown to determine the toughness of stainless steel and the\n", + "toughness of structural steel." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "slide" + "attributes": { + "classes": [], + "id": "", + "n": "9" } }, "outputs": [ @@ -91,30 +81,20 @@ }, { "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, + "metadata": {}, "source": [ "# Gauss Quadrature (for functions)\n", "\n", - "Evaluating an integral, we assumed a polynomial form for each Newton-Cotes approximation.\n", + "Evaluating an integral, we assumed a polynomial form for each Newton-Cotes\n", + "approximation.\n", "\n", - "If we can evaluate the function at any point, it makes more sense to choose points more wisely rather than just using endpoints\n", + "If we can evaluate the function at any point, it makes more sense to choose\n", + "points more wisely rather than just using endpoints\n", "\n", - "![trapezoidal example](trap_example.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "Set up two unknown constants, $c_{0}$ and $x_{0}$ and determine a *wise* place to evaluate f(x) such that \n", + "![trapezoidal example](trap_example.png)\n", + "\n", + "Set up two unknown constants, $c_{0}$ and $x_{0}$ and determine a *wise* place\n", + "to evaluate f(x) such that\n", "\n", "$I=c_{0}f(x_{0})$\n", "\n", @@ -133,9 +113,10 @@ "cell_type": "code", "execution_count": 10, "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "subslide" + "attributes": { + "classes": [], + "id": "", + "n": "10" } }, "outputs": [ @@ -321,9 +302,10 @@ "cell_type": "code", "execution_count": 11, "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "slide" + "attributes": { + "classes": [], + "id": "", + "n": "11" } }, "outputs": [ @@ -348,13 +330,10 @@ }, { "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, + "metadata": {}, "source": [ - "This process is called **Gauss Quadrature**. Usually, the bounds are fixed at -1 and 1 instead of a and b\n", + "This process is called **Gauss Quadrature**. Usually, the bounds are fixed at -1\n", + "and 1 instead of a and b\n", "\n", "$I=c_{0}f(x_{0})$\n", "\n", @@ -366,17 +345,8 @@ "\n", "so $c_{0}=2$ and $x_{0}=0$\n", "\n", - "$I=\\int_{-1}^{1}f(x)dx \\approx 2f\\left(0\\right)$" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ + "$I=\\int_{-1}^{1}f(x)dx \\approx 2f\\left(0\\right)$\n", + "\n", "Now, integrals can be performed with a change of variable\n", "\n", "a=2\n", @@ -391,18 +361,9 @@ "\n", "at $x_{d}=-1$, x=a\n", "\n", - "at $x_{d}=1$, x=b" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "so \n", + "at $x_{d}=1$, x=b\n", + "\n", + "so\n", "\n", "$x=\\frac{(b+a) +(b-a)x_{d}}{2}$\n", "\n", @@ -414,27 +375,20 @@ "\n", "$\\int_{2}^{3}x+1dx=\\int_{-1}^{1}\\left(\\frac{5 +x_{d}}{2}\n", "+1\\right)\n", - "\\frac{3-2}{2}dx_{d}$" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "fragment" - } - }, - "source": [ - "$\\int_{2}^{3}x+1dx=\\int_{-1}^{1}\\left(\\frac{7}{4}+\\frac{1}{4}x_{d}\\right)dx_{d}=2\\frac{7}{4}=3.5$" + "\\frac{3-2}{2}dx_{d}$\n", + "\n", + "$\\int_{2}^{3}x+1dx=\\int_{-1}^{1}\\left(\\frac{7}{4}+\\frac{1}{4}x_{d}\\right)dx_{d}=\n", + "2\\frac{7}{4}=3.5$" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { - "collapsed": true, - "slideshow": { - "slide_type": "slide" + "attributes": { + "classes": [], + "id": "", + "n": "12" } }, "outputs": [], @@ -454,9 +408,10 @@ "cell_type": "code", "execution_count": 14, "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "fragment" + "attributes": { + "classes": [], + "id": "", + "n": "14" } }, "outputs": [ @@ -474,53 +429,55 @@ }, { "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, + "metadata": {}, "source": [ "## General Gauss weights and points\n", "\n", - "![Gauss quadrature table](gauss_weights.png)" + "![Gauss quadrature table](gauss_weights.png)\n", + "\n", + "### If you need to evaluate an integral, to increase accuracy, increase number\n", + "of Gauss points\n", + "\n", + "### Adaptive Quadrature\n", + "\n", + "Matlab/Octave built-in functions use two types of adaptive quadrature to\n", + "increase accuracy of integrals of functions.\n", + "\n", + "1. `quad`: Simpson quadrature good for nonsmooth functions\n", + "\n", + "2. `quadl`: Lobatto quadrature good for smooth functions" ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "metadata": { - "slideshow": { - "slide_type": "slide" + "attributes": { + "classes": [ + "matlab" + ], + "id": "" } }, + "outputs": [], "source": [ - "### If you need to evaluate an integral, to increase accuracy, increase number of Gauss points\n", - "\n", - "### Adaptive Quadrature\n", - "\n", - "Matlab/Octave built-in functions use two types of adaptive quadrature to increase accuracy of integrals of functions. \n", - "\n", - "1. `quad`: Simpson quadrature good for nonsmooth functions\n", - "\n", - "2. `quadl`: Lobatto quadrature good for smooth functions\n", - "\n", - "```matlab\n", "q = quad(fun, a, b, tol, trace, p1, p2, …)\n", "fun : function to be integrates\n", "a, b: integration bounds\n", "tol: desired absolute tolerance (default: 10-6)\n", "trace: flag to display details or not\n", "p1, p2, …: extra parameters for fun\n", - "quadl has the same arguments\n", - "```" + "quadl has the same arguments" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "subslide" + "attributes": { + "classes": [], + "id": "", + "n": "15" } }, "outputs": [ @@ -545,9 +502,10 @@ "cell_type": "code", "execution_count": 16, "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "subslide" + "attributes": { + "classes": [], + "id": "", + "n": "16" } }, "outputs": [ @@ -573,36 +531,13 @@ }, { "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, + "metadata": {}, "source": [ "# Thanks" ] } ], - "metadata": { - "celltoolbar": "Slideshow", - "kernelspec": { - "display_name": "Octave", - "language": "octave", - "name": "octave" - }, - "language_info": { - "file_extension": ".m", - "help_links": [ - { - "text": "MetaKernel Magics", - "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" - } - ], - "mimetype": "text/x-octave", - "name": "octave", - "version": "0.19.14" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 } diff --git a/final_project/README.md b/final_project/README.md new file mode 100644 index 0000000..e237797 --- /dev/null +++ b/final_project/README.md @@ -0,0 +1,97 @@ +# ME 3255 Final Project +## Designing a graphene pressure sensor + +[grading rubric](./rubric.md) + +![Graphene membrane under +pressure](http://appliedmechanics.asmedigitalcollection.asme.org/data/journals/jamcav/926983/jam_80_4_040905_f001.png) + +In this final project, you and your team mates will design a graphene pressure sensor. +Graphene is a single-layer of carbon atoms arranged in a hexagonal lattice. Graphene films +have a thickness of 0.3 nm, Young's modulus of 1 TPa, and Poisson's ratio of 0.31. The +film has no bending stiffness so the shape of the membrane under a given pressure, P, with +a pretension, T is given by: + +![eq1](./equations/eq1.png) (1) + +This equation assumes you know both the applied pressure and tension in the membrane, but +the tension will be a function of the applied pressure, assuming there is no initial +pretension. We will use an energy balance to solve the nonlinear relation between tension +and pressure. + +![eq2](./equations/eq2.png) (2) + +![eq3](./equations/eq3.png) (3) + +Where w(x,y) is the displacement of the membrane at a given point, (x,y), and the integral +is over the entire of area of the membrane, A. We can rewrite this exact integral as a +summation over the elements, as such. + +![eq4](./equations/eq4.png) (4) + +Where, ![eq5](./equations/eq5.png) is the average w of the four nodes in the element, and +the summation goes from 1 to the number of elements, nel. + +In this design problem, we will solve for +the tension and deflection of a square membrane, as seen in figure 2. + +![Figure 2. Square membrane design with sides of 10 um.](./figures/membrane.png) + +Figure 2. Square membrane design with sides of 10 um. 2A demonstrates the node and element +numbering for 9 interior nodes and 16 elements. 2B shows element 6 and its nodal +displacments along with the aveerage displacement as the red point. 2C shows a +cross-section of the force-balance for the square membrane window and 2D shows an +isometric view of the membrane displacement solution and force-balance. + +**a\.** Create a central finite difference approximation of the gradient with 3-by-3 interior nodes of w +for the given membrane solution in terms of P and T. `[w]=membrane_solution3(T,P);` The +output `w` should be a vector, but the solution represents a 2D data set w(x,y). + +**b\.** Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN. Plot the result with +`surf(X,Y,W)` where X, Y, and W are the x-, y-, and z-coordinates of each point on the +membrane from 0-10um. + +**c\.** Create a general central finite difference approximation of the gradient with +n-by-n interior nodes of w +for the given membrane solution in terms of P and T. `[w]=membrane_solution(T,P,n);` The +output `w` should be a vector, but the solution represents a 2D data set w(x,y). + +**d\.** Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN with 10 interior +nodes. Plot the result with `surf(X,Y,W)` where X, Y, and W are the x-, y-, and +z-coordinates of each point on the membrane from 0-10um. Include the graph in your README. + +**e\.** Create a function `SE_diff` that calculates the difference in strain energy (right hand side Eq. +4) and work done by pressure (left hand side Eq. 4) for n-by-n elements. + +`[pw_se,w]=SE_diff(T,P,n)` + +Use the solution from part **c** to calculate w, then do a numerical integral over the +elements to calculate work done and strain energy. + +**f\.** Use a root-finding method to calculate the tension in the membrane given a +pressure, P=0.001 MPa, and n=[20:5:40] interior nodes. + +Show that the error in tension is decreasing with a table: + +``` +|number of nodes|Tension (uN)| rel. error| +|---|---|---| +|20|0.08| n/a| +|25|0.006|0.5%| +|30|0.006|0.3%| +|40|0.006|0.2%| +``` + + +**g\.** Plot the Pressure vs maximum deflection (P (y-axis) vs max(w) (x-axis)) for +P=linspace(0.001,0.01,10). Use a root-finding method to determine tension, T, at each +pressure. Use a cubic best-fit to find A, where, P(x)=A*dw^3. State how +many interior nodes were used for the graph. Plot the data and best-fit curve in your +README. + +**h\.[Bonus 5 pts]** Show that the constant A is converging as the number of nodes is +increased (Similar table to **f**). + +**i\.[Bonus 10 pts]** If the square membrane sides are always equal, but have a tolerance of 0.1\%, what +should the depth of the sensor be if 2.5% of the sensors won't hit the bottom given a +maximum pressure of 0.01 MPa. diff --git a/final_project/equations/eq1.png b/final_project/equations/eq1.png new file mode 100644 index 0000000..4cd0303 Binary files /dev/null and b/final_project/equations/eq1.png differ diff --git a/final_project/equations/eq1.tex b/final_project/equations/eq1.tex new file mode 100644 index 0000000..13c2295 --- /dev/null +++ b/final_project/equations/eq1.tex @@ -0,0 +1 @@ +\frac{\partial^2 w}{\partial x^2}+\frac{\partial^2 w}{\partial y^2}=-\frac{P}{T} diff --git a/final_project/equations/eq2.png b/final_project/equations/eq2.png new file mode 100644 index 0000000..3ec8b2f Binary files /dev/null and b/final_project/equations/eq2.png differ diff --git a/final_project/equations/eq2.tex b/final_project/equations/eq2.tex new file mode 100644 index 0000000..a8d1d57 --- /dev/null +++ b/final_project/equations/eq2.tex @@ -0,0 +1 @@ +\int_{A}wP dA=\int_{A}t/2\sigma_{ij}\epsilon_{ij}dA diff --git a/final_project/equations/eq3.png b/final_project/equations/eq3.png new file mode 100644 index 0000000..ae0c746 Binary files /dev/null and b/final_project/equations/eq3.png differ diff --git a/final_project/equations/eq3.tex b/final_project/equations/eq3.tex new file mode 100644 index 0000000..4a33e25 --- /dev/null +++ b/final_project/equations/eq3.tex @@ -0,0 +1,4 @@ +\int_{A}wP dA=\frac{Et}{2(1-v^2)}\int_{A}\frac{1}{4}\left(\frac{\partial w}{\partial +x}\right)^{4}+\frac{1}{4}\left(\frac{\partial w}{\partial +y}\right)^{4}+\frac{1}{2}\left(\frac{\partial w \partial w}{\partial +x \partial y}\right)^{2}dA diff --git a/final_project/equations/eq4.png b/final_project/equations/eq4.png new file mode 100644 index 0000000..47cdac8 Binary files /dev/null and b/final_project/equations/eq4.png differ diff --git a/final_project/equations/eq4.tex b/final_project/equations/eq4.tex new file mode 100644 index 0000000..b806301 --- /dev/null +++ b/final_project/equations/eq4.tex @@ -0,0 +1,4 @@ +\sum_{el=1}^{nel}Ph^2\bar{w}=\frac{Eth^{2}}{2(1-v^2)}\sum_{el=1}^{nel}\left[\frac{1}{4}\left(\frac{\partial w}{\partial +x}\right)^{4}+\frac{1}{4}\left(\frac{\partial w}{\partial +y}\right)^{4}+\frac{1}{2}\left(\frac{\partial w \partial w}{\partial +x \partial y}\right)^{2}\right] diff --git a/final_project/equations/eq5.png b/final_project/equations/eq5.png new file mode 100644 index 0000000..a66cafc Binary files /dev/null and b/final_project/equations/eq5.png differ diff --git a/final_project/equations/eq5.tex b/final_project/equations/eq5.tex new file mode 100644 index 0000000..0387eb3 --- /dev/null +++ b/final_project/equations/eq5.tex @@ -0,0 +1 @@ +\bar{w} diff --git a/final_project/figures/membrane.png b/final_project/figures/membrane.png new file mode 100644 index 0000000..54b291a Binary files /dev/null and b/final_project/figures/membrane.png differ diff --git a/final_project/figures/membrane.svg b/final_project/figures/membrane.svg new file mode 100644 index 0000000..bca9460 --- /dev/null +++ b/final_project/figures/membrane.svg @@ -0,0 +1,1533 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + P + + T + + T + + T + + T + + 10 um + + P + + T + + T + + + + + + + + + P + T + + T + + el 1 + el 2 + + + el 3 + + el 5 + + el 4 + + el 6 + + el 6 + + + + + + w1 + w2 + w4 + w5 + A. + B. + C. + D. + w + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + + + + + + + +