×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

by: Chloe Reilly

15

0

0

# Computing Techniques ME 2016

Chloe Reilly

GPA 3.62

Aldo Ferri

These notes were just uploaded, and will be ready to view shortly.

Either way, we'll remind you when they're ready :)

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

COURSE
PROF.
Aldo Ferri
TYPE
Class Notes
PAGES
0
WORDS
KARMA
25 ?

## Popular in Mechanical Engineering

This 0 page Class Notes was uploaded by Chloe Reilly on Monday November 2, 2015. The Class Notes belongs to ME 2016 at Georgia Institute of Technology - Main Campus taught by Aldo Ferri in Fall. Since its upload, it has received 15 views. For similar materials see /class/234238/me-2016-georgia-institute-of-technology-main-campus in Mechanical Engineering at Georgia Institute of Technology - Main Campus.

×

## Reviews for Computing Techniques

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 11/02/15
ME2016 Dr Ferri Example showing Fourier series applied to a unitamplitude square wave of period T 211 and fundamental frequency 030 l rads tO000l20 gtgt Yl for nl251 ysinntn YY y end Y 4Ypi plottYl Now add the rst 3 rows of Y to get the lst plus 3rd plus 5Lh harmonic Note that when the Matlab sum command is applied to a matrix it gives a rowvector that is the sum of the rows of the matrix Also recall that Y 1 3 gives the rst 3 rows of the matrix Y gtgt plottsumYl3 1J Now let s add the rst 6 rows giving the sum of odd harmonic numbers 1 through 11 gtgt plottsumYl6 15 u Now let s add some more harmonics gtgt plottsumYl12 15 1 vquot W quotI Iquot ii 05 0 0 5 1 n39 at n39 an n39 31 45 39 39 39 39 39 39 39 39 39 ME2016 Dr Ferri FiniteDifference Example One of the most important types of problems that engineers and scientists need to solve is known as a twopointboundaryvalueproblem TPBVP A popular solution technique known as the nitedifference technique is explored in this problem See Section 271 of the text A cooling fin extends from a hot furnace wall as shown below Assuming that heat ows only in the xdirection the thermal equilibrium equation leads to the following governing equation dZT W2 kA 7hPT7Ta0 1 where k thermal conductivity A crosssectional area h convection heat transfer coefficient Ta surrounding or ambient temperature P perimeter and Tx temperature at x The boundary conditions for this problem are TO To and ik hTL7Ta 2a b For simplicity let Y T Ta let ldh NP l Ll and let T0 Ta 10 Then the equation and boundary conditions are 2 d Y M 3a b c dx 2 Y 0 Y0T07Ta 10 and dx Y0 Y1 V2 VN1 y vinu al nodequot l l fol l l I I I I l TO Cooling Fin Tx l AX l AX l o AX AX x J X0 X1 X2 X L l L Now consider a nitedifference solution to this problem Divide the fin into N equal segments of length Ax UN The temperature difference at each node is denoted yi i l 2 N XN1 N XN1 The first and secondderivative at each node can be expressed to order 0Ax2 using centered difference expressions see page 89 of text ym yH quot yH Zyz yi1 4 b y 2m y a At node 1 substitution of 4b into 3a yields quot y 2y y 2 y1y130 122y132m y1y2y0 5 Ax where yo 10 Similarly at nodes 2 3 Nl we would get u y 2y y 2 yi yi 3 yi 3 yi712myiyi10 12N391 6 The end point requires special treatment because of the convective or natural boundary condition at x L 3c Imagine that there was an Nlst virtual node with temperature yNH Approximating 3a at node N yields yN3in71 2Ax2yN yNl 0 7 u 7 yNil 2 N f yN1 yN yN 3 Ax2 To get a relation for yNH we use the natural boundary condition 3c at x L together with the first centered difference expression 4a yN1 yNil 2m yiv yN 3 yN 3 yN1 yNil ZAWN 8 Equation 8 can be used to eliminate yNH from equation 7 above 2yN122AxAx2yN0 9 Equation 5 6 and 9 constitute N linear algebraic equations in Nunknowns It is known that the exact solution to equation 3a subject to boundary conditions 3b and 3c is Y x 10 e x We will compare this answer to finitedifference solutions using N2 and N5 Solution The following function implements the FiniteDifference FD method for this problem function xy fdifinN Ll dxLN y0 10 x Ozdsz Initialize A to be all zeros A zerosNN Assign nonzero elements of first row All2dxA2 Al2 l A2l l Assign nonzero elements of rows 2 through Nl for k 2Nl Akk l l Akk 2dxA2 Akkl 1 end Assign nonzero elements of Nth row ANN22dxdxA2 ANNl 2 RHS B zerosNl Bl yO solve yiliNAB Now append y to the initial temperature y0 y y0 viliN For N 5 we obtain the following matrix for A Note that it is diagonally dominant regardless of N that means that iterative solution techniques such as Jacobi iteration and GaussSeidel iteration are guaranteed to converge Also note that the matrix is tridiagonal There are many ef cient routines for solving such systems gtgtA A 20400 l0000 0 0 0 l0000 20400 l0000 0 0 0 l0000 20400 l0000 0 0 0 l0000 20400 l0000 0 0 0 20000 24400 t l Exactsdu on 9 lt9 N2 A N5 g 7 gt 6 5 4 l 392 W W W W W W W W W Figure l Exact solution vs FiniteDifference solutions using N2 and N5 The result is shown in Figure l The error between the FD solutions and the exact solution is shown in Figure 2 Note that while both approximate results are fairly good the N5 solution is better than the N2 result 0067 7 0057 7 error 0047 7 0037 7 002 AL Aquot 001 7 Aquot 7 Aquot A W W W W W W W W W 01 02 03 04 05 06 07 03 09 1 X Figure 2 Error between exact solution and FD solution ME2016 Dr Ferri Cubic Spline Example Consider the following 5 data points bump ow pHmmow 5 There are n 4 intervals over which cubic spline interpolation functions are desired The four interpolation functions have the form f1X alx3 blx2 01X d1 fzX azX3 by2 ch dz f3X a33 ngz c3X d3 f4X a43 b42 c4X d4 It may be noted that there are 4n l6 unknowns for which we need 16 equations There are 5 types of conditions imposed on the coefficients a1 b1 c4 d4 1 C0 continuity at interior knots and the spline must equal the true yValue of the data point at the interior knots Xk k l 2 3 f1X1l 2 gtEqnlgta1b1 Cld12 fzX1l2 gt Eqn 2 gt a bzczdz 2 fzXz 2 3 gt Eqn 2 gt 8a2 4bz 202 dz 3 f3Xz 2 3 gt Eqn 3 gt 8a3 4b3 203 13 3 303 3 1 gt Eqn 3 gt 27a3 9b3 3c3 d3 1 403 3 1 gt Eqn 4 gt 27a4 9b4 3c4 d4 1 2 Spline must equal yValues of data points at X0 and X4 f1x0 0 0 gt Eqn 1 gt d1 0 f4X4 4 05 gt Eqn 4 gt 64a4 16b4 4c4 d4 05 3 C1 condition at interior knots at X X1 gt 3a1 2b1 l Cl 332 l 2bz 02 at X X2 gt 12a2 4b2 02 12a3 4b3 C3 df3dX df4dX at X X3 gt 27a3 6b3 c3 27a4 6b4 c4 4 C2 condition at interior knots 5 6 7 8 9 10 11 12 13 14 15 dzfldxz dzfzdxz at x x1 gt 6a1 2b1 6az 2b2 16 dzfzdxz digde at x x2 gt 12a2 2b2 12a3 2b3 17 dzfldxz dzfzdxz at x X3 gt 18a3 2b3 18a4 2b4 18 Different possibilities exist for the last two conditions Two common conventions are the natural spline which imposes a quotzerocurvaturequot condition at the end points x0 and Xu and the socalled not a knot spline which imposes a condition of continuous third derivative at the rst and last interior knots x1 and xn1 5a Natural spline condition dzfldxz 0 at x x0 gt 2b1 0 19a dind2 0 at x X4 gt 24a4 2b4 0 20a 5b NotaKnot Condition d3f1dx3 d3fzdx3 at x x1 gt 6a1 6a2 19b d3f3dx3 d3f4dx3 at x X3 gt 6a3 6a4 20b Equations 5 20 constitute 16 equations in 16 unknowns These equations can be written in matrix form and solved for the unknown coef cients as seen in the attached Matlab code No attempt has been made to optimize the code or to generalize it for arbitrary input values xk and yk Figure 1 shows a comparison of the results from the direct solution of equations 5 through 20 and from the Matlab splinem command It can be seen that the results are virtually identical Figure 2 compares the natural spline with the notaknot spline The gure shows that there are noticable differences between the two interpolation schemes Which approximation is better is to a large extent in the eyes of the beholder NotaKnot Spline 35 Original Data Computed 3 Using splinem 25 2 gt 15 1 05 n 05 1 15 2 25 3 35 4 X Figure l Comparison of Splines 35 I I I I I Original Data NotaKnot 3 Natural 25 2 gt 15 1 05 n I I I I 0 5 1 1 5 2 25 3 3 5 4 X Figure 2 Matlab Code ME2016 Dr Ferri Spline Example o o Define Data Points X and Y wal O l l 5 OHwNO do The order of unknowns is al bl cl d1 a2 d3 a4 b4 04 d4 Define A matrix A zerosl6l6 B zerosl6l A11 1 A25 1 A59 27 A510 9 A5ll 3 A512 1 35 1 A613 27 A6l4 9 A615 3 A6l6 1 B6 1 0 A813 64 A814 16 A815 4 A816 1 B8 05 A91 3 A92 2 A93 1 A95 3 A96 2 A97 1 A105 12 A106 4 A107 1 A10 9 12 A1o1o 4 A1o11 1 A119 27 All10 6 A1111 1 A1113 27 A1114 6 A1115 1 A121 6 A122 2 A125 6 A126 2 A135 12 Al36 2 A139 12 A1310 2 A149 18 Al410 2 A1413 18 A1414 2 Conditions for quotnot a knotquot spline third derivative continuous at XXl and Xn l do A15l 6 A155 6 169 6 Al6l3 6 abcdAB Xl 000l099 X2 l00ll99 X3 200l299 X4300l4 aabcdl babcd2 cabcd3 dabcd4 yl aXlA3 bXlA2 CXl aabcd5 babcd6 cabcd7 dabcd8 y2 aX2A3 bX2A2 CX2 d aabcd9 babcd10 cabcdll dabcd12 y3 aX3A3 bX3A2 CX3 d aabcdl3 babcdl4 cabcd15 dabcdl6 y4 aX4A3 bX4 2 CX4 d o 6 Form single vector containing interpolated X and y values xse X1 X2 X3 X4 ynak Y1 y2 Y3 Y4 plotXY o XseynakXsesplineXYXse Xlabel X ylabel Y title Not a Knot Spline legend Original Data Computed Using splinem pause Now compute natural spline A15 l6zeros2l6 A152 2 A1613 24 A1614 2 abcdAB aabcdl babcd2 cabcd yl aXlA3 bXlA2 CXl aabcd5 babcd6 cabcd 3 dabcd4 d 7 dabcd8

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Bentley McCaw University of Florida

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Jennifer McGill UCSF Med School

#### "Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over \$500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Steve Martinelli UC Los Angeles

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com