num_errors

# num_errors - QWWVAQQU 23g m Some Examples and Numerical...

This preview shows pages 1–17. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: QWWVAQQU 23g m... Some Examples and Numerical Errors 135 _ t” (’3 PHYSICAL PROBLEM Geometry Less Important Effects MATHEMATICAL MODEL 136 Simplifying Assumptions n U "IF/+1 PHYSICAL MODEL (Navier Stokes Eqn) Euler Equation Linearity Incompressibility Laplace Equation Homer}. Types of Numerical Hydrodynamics Problems 1. Evaluation of Mathematical Functions 2. Simulation 3. Direct Solution of Differential or Integral Equations Example of Function Evaluation 5.0 Consider a diffuser With circular crossections and radius vs length as shoWn. Units are meters. The average velocity of an incompressible ﬂuid across the inlet at (I: = 0 is 5 m/s. Determine the average velocity across all cross sections. Q = 57r[2 + tanh(—5)]2 Q Q mm = = 137 I”) 0M6?!" 3 % MATLAB Program diffu fname = input(' Type name for output file: ','s'); fid = fopen(fname,'w'); q = 5.0 * pi * (2.0 + tanh(—5.O))A2; x = O : 0.2 : 10.0 ; v = q ./ (pi * (2.0 + tanh(x—5.0)) .“2); for j = 1:51; fprintf(fid,' %10.4f %10.4f \n', x(j), v(j) end; fclose(fid); plot (x,v>; xlabel('x (meters)'); ylabel( 'v_{ave} (m/s)'); axis([0 10 O 10]); 138 (W8) ave 1O 5 x (meters) 139 034mg": em k 10 H OKOKOKOKDKOCDGJCDQCO\1\]\l\l\JmmmammmmmwvbbubbvbwwthJWNNNNNl—‘Hl-‘l—‘l—‘OOOOO .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 .2000 .4000 .6000 .8000 .0000 OOOOOOOOOOOOOOOOOOOOOOOOi—‘Ht—‘HNNwabbubbubbbbbhﬂubhb-bubﬁm .0000 .9996 .9989 .9979 .9964 .9942 .9909 .9860 .9787 .9679 .9518 .9280 .8929 .8415 .7668 .6596 .5085 .3008 .0251 .6762 .2608 .8019 .3366 .9054 .5390 .2502 .0357 .8829 .7769 .7046 .6557 .6228 .6007 .5859 .5759 .5692 .5648 .5618 .5597 .5584 .5575 .5569 .5565 .5562 .5560 .5559 .5558 .5558 .5557 .5557 .5557 140 10 (m/s) Vave 5 x (meters) Wan/567"” 14‘ a»! Example of Solution of Ordinary Differential Equation Motion of a Sphere Due to Drag —-——,—-> dt —-——-> dZa: l 2 dw 2 2 (ii—:22], ggzpCZdLR (Vz—ZuV+u2) Discretize and use forward Euler Integration: ui+1 2 214+ I At dt 2 act-+1 2 xi + tot-At Initial Conditions: x0 0 u0 = 0 142 K/UME‘T? May:qu spheredg % MATLAB program spheredg fid = fopenC sphere.out','w'); rho = 1000.0; cd = 1.0; v =1.0; r = 0.05; m = 5.0; fac = rho * cd *p1 “r *r /(2 0 * m), tt = 10.0; dt = 0 01; n = tt]dt + 1; %1nitia1ize t(1) = 0.0; x(1) = 0.0; uCl) = 0.0; fprinthfid,'%15.7f %15.7f %15.7f \n', t(1), x(1), u(1)2; for 1:2:n; j = 1-1; tCi) = th) + dt; x(i)= x(j) + qu)*dt; u(i) = qu) + fac*(v*v— 2.0* u(j)*v + u(j)*u(j))*dt; Sprinthf1d,'%15.7f %15.7f %15.7f \n ,tCi),x(1),u(i)); en ; p1OtCtsx’ I—ﬂ Itlu! '__') x1abe1C'Time (seconds)'); h=1egend( “x (meters)" , 'u (meters/second)" , 2); Page 1 143 My METs f‘r — __ x (meters) ___ u (meters/second) Time (seconds) 144 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO t .0000000 .0100000 .0200000 .0300000 .0400000 .0500000 .0600000 .0700000 .0800000 .0900000 .1000000 .1100000 .1200000 .1300000 .1400000 .1500000 .1600000 .1700000 .1800000 .1900000 .2000000 .2100000 .2200000 .2300000 .2400000 .2500000 .2600000 .2700000 .2800000 .2900000 .3000000 .3100000 .3200000 .3300000 .3400000 .3500000 .3600000 .3700000 .3800000 .3900000 .4000000 .4100000 .4200000 .4300000 .4400000 .4500000 .4600000 .4700000 .4800000 .4900000 .5000000 .5100000 .5200000 .5300000 .5400000 .5500000 .5600000 —‘ OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO X .OOOOOOO .0000000 .0000785 .0002344 .0004664 .0007733 .0011539 .0016073 .0021323 .0027277 .0033926 .0041260 .0049268 .0057941 .0067269 .0077242 .0087852 .0099090 .0110946 .0123413 .0136481 .0150143 .0164391 .0179215 .0194610 .0210567 .0227079 .0244138 .0261737 .0279870 .0298529 .0317708 .0337399 .0357598 .0378296 .0399489 .0421169 .0443331 .0465968 .0489076 .0512648 .0536679 .0561163 .0586096 .0611470 .0637282 .0663527 .0690198 .0717292 .0744804 .0772728 .0801060 .0829795 .0858929 .0888458 .0918377 .0948682 ' —.. 145 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO U .0000000 .0078540 .0155851 .0231962 .0306900 .0380693 .0453367 .0524947 .0595457 .0664922 .0733364 .0800807 .0867271 .0932779 .0997350 .1061005 .1123762 .1185642 .1246662 .1306840 .1366193 .1424739 .1482493 .1539472 .1595691 .1651166 .1705911 .1759940 .1813267 .1865906 .1917871 .1969174 .2019828 .2069844 .2119236 .2168014 .2216190 .2263776 .2310781 .2357217 .2403094 .2448422 .2493210 .2537469 .2581207 .2624434 .2667159 .2709390 .2751137 .2792406 .2833207 .2873548 .2913435 .2952877 .2991882 .3030455 .3068606 ’ »‘ MUmeT83 H ODLOKOKDKOKOKOkOkOkokokaKOkOKOOKDKOkOKDKOKDKDKDkOKDkOKDLOKQ 4; ’ ”‘ .6900000 .7000000 .7100000 .7200000 .7300000 .7400000 .7500000 .7600000 .7700000 .7800000 .7900000 .8000000 .8100000 .8200000 .8300000 .8400000 .8500000 .8600000 .8700000 .8800000 .8900000 .9000000 .9100000 .9200000 .9300000 .9400000 .9500000 .9600000 .9700000 .9800000 .9900000 .0000000 X ”’ 6.9506656 6.9595065 6.9683485 6.9771915 6.9860356 .9948807 .0037269 .0125741 .0214224 .0302717 .0391220 .0479734 .0568258 .0656792 .0745337 .0833892 .0922458 .1011033 .1099619 .1188215 .1276822 .1365438 .1454065 .1542702 .1631349 .1720006 .1808673 .1897351 .1986038 .2074735 .2163443 .2252160 \l\l\l~J\l\l\l\)\l\l\l\l\l\l\l\l\l\l\l\l\I\I\I\I\I\IO\ 146 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO LA .1"— .8840910 .8841966 .8843019 .8844070 .8845120 .8846167 .8847213 .8848256 .8849298 .8850338 .8851376 .8852413 .8853447 .8854479 .8855510 .8856539 .8857566 .8858591 .8859614 .8860635 .8861655 .8862673 .8863689 .8864703 .8865715 .8866725 .8867734 .8868741 .8869746 .8870749 .8871751 .8872751 ,VUHE7 3C Example of Solution of Partial Differential Equation Potential Streaming Flow about a Circular Cylinder —> _ V—D There is an equation at each grid point: ¢i—1,j — 291% + ¢i+1,j + ¢i,j—1 — 2¢m + ¢M+1 = 0 32 82 Boundary Condition far (many diameters) from the cylinder: ¢i+1,j *‘ ¢i,j : V (1523141 _ 2 0 s 0 5 Boundary Condition on the cylinder: ——¢i+1’j _ lb” c056 + ———————¢i’j +1 _ as“ sin0 = 0 s s 147 Mamet 10 cylindrical coordinates Equation at each grid point: ¢i+1,j — ¢i—1,j + ¢i+1,j — 24% + ¢i—1,j 27‘d7‘ (dr)2 ¢i,j+1 — 2%; + ¢i,j—1 T261052 + :0 Boundary Condition far (many diameters) from the cylinder: ¢i,j+1 — ¢i,j _ ¢i+1,j - \$13 _ . dr —VI,cos€ “l6 —-V0sm9 Boundary Condition on the cylinder: ¢i,j+1 — ¢i,j __ d7“ _ 0 149 ﬁUme+H Example of Discretized Integral Equation Potential Streaming Flow about a Circular Cylinder Here we seek the per— turbation velocity that exists in addition to the uniform ﬂow of speed V0. Exterior ﬂow is represented as a source distribution of strength 0(0) on the surface of the cylinder. a 2« «rem—Pm] U 7" = —————-—2Rd9 ( ) f0 27r|r —;’(6)l —p Just outside the surface of the cylinder, U - fi : —Vo cos 0 Now we can form the discretized approximate equation: g MRMQ = —Vocos€' i=1,i¢j 27W? — “[2 2 J 150 VD West m. Stability When applying a numerical procedure to a problem in ﬂuid mechanics, the result can diverge. In other words, the process is unstable. Such instabilities can be fundamentally ﬂuid mechanical or they may come from inaccuracies in the numerical procedure. For example, suppose a process is governed by the differential equation: 5'53 dt 2 33; with initial condition y(0) = 1 We know that the solution to this equation is y = e3t which diverges as t increases. This is a fundamental instability in the process being modeled. A prOper numerical solution will capture this instability. Now we explore a numerical instability using numerical values with three decimal places. Consider the set of values, 2,, deﬁned for non—negative integers n by: 11;“ 2n = 0 x + 5033: A recursion relation for the 2’s can be made as follows: 1 m” + 523""1 1 x"‘1(x + 5) 1 Zn+5zn-1—/o Trs—d\$*/() 745—6196- ; 1 Zn 1: _ " 5 zn—l n 1 For n = 0, 20 2/01 a: + 5dr 2 111(6) — 111(5) = 0.182 For n > 0, 2n = % ——52,,_1 21 = 1.000 — 5 X 0.182 = 0.090 22 = 0.500 — 5 X 0.090 = 0.050 23 = 0.333 — 5 X 0.050 = 0.083 24 = 0.250 —— 5 X 0.083 = —0.165 The above negative value for 24 must be wrong since the integrand is positive. It comes from numerical instability associated with roundoff error. 151 Oum¢+ :5 An alternative recursion relation is: 1 Zn 1 Zn_1—%—?—0.2(;—Zn> This reduces the effect of the error by a factor of 5. We Will start with an approximation to 210 and use the recursion relation for successively smaller values of n. A ' E'-—1 \$10 02110 2d—015 pprox1mate quation. zm — f0 ~ . /0 x (1—0. :12) :1: — 0. 210 : 0.015 1 : . — — . = . 1 z9 02 10 0015) 00 7 1 .28 = 0.2 — 0.017) = 0.019 1 1 . 26 = 0.2 — 0.021) = 0.024 1 25 : 0.2 — 0.024) = 0.029 24 = 0.2 ~— 0.029) = 0.034 1 Z2 2 0.2 — 0.043) = 0.058 1 1 z0 : 0.2 ~ 0.088) = 0.182 Note that the result for 20 is cortrect even though an approximate value was used for Z10. This iteration scheme is stable. 152 ...
View Full Document

{[ snackBarMessage ]}

### Page1 / 17

num_errors - QWWVAQQU 23g m Some Examples and Numerical...

This preview shows document pages 1 - 17. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online