2011S

advertisement
South Dakota School of Mines and Technology
Department of Mathematics and Computer Sciences
Math 373
HQ 2A
March 30, 2011
Closed notes, books, and calculators
Turn in ONLY the printed sheets with your solutions in space provided. If a question seems to contain an
error, state the trouble and a reasonable correction and proceed with the solution under your assumed
correction. There is no intent for the exam to contain errors.
1. Set up the following Root Finding procedures:
a) Use Newton’s Method to find a root for x3 = 5. Use an initial guess of x1= 1. Show one iteration.
Identify x2.
b) Use One-Point Iteration to find the a root to x3 + x - 2ln(x) = 3
c) Secant Method:
Write a proportion from which one can find x3 given the points
[x1, f(x1)] and [x2, f(x2)]
d) Circle the bracketing methods.
One-Point Iteration
Secant
Newton’s
Bisection
False Position
2. Write the Macro Code in the VBA code provided below needed to
a) set the initial temperatures for all positions except the boundaries
b) write out all the current time and all temperatures – including the boundaries T’s at the current time
starting at row 11 when time is 0
c) values of  and  (The Tridiagonal Matrix Algorithm and Crank-Nicolson Equations are attached to the
exam.)
Sub CrankNicolson()
Dim T(10), Beta(9), Gamma(9), d(9)
‘ Get boundary temperatures
T(0) = [_T1]
T(10) = [_T2]
Tinitial=[Tinit]
‘Set the initial temperatures
(a)
‘Start Time Loop +1 ‘add one since the last loop is not moved to worksheet
For j = 0 To [_loops]
‘Write out the current temperatures to the worksheet
(b)
‘Get constants needed
a = -[_f]
c = -[_f]
b = 1 + 2 * [_f]
‘Compute the RHS’s
For i = 1 To 9
d(i) = [_f] * T(i - 1) + (1 - 2 * [_f]) * T(i) + [_f] * T(i + 1)
Next i
d(1) = d(1) - a * T(0)
‘Adjust left side for constant BC1
d(9) = d(9) - c * T(10)
‘Adjust right side for constant BC2
‘Get Beta’s and Gamma’s
(c)
‘Get new Temperatures
T (9) = Gamma(9)
For i = 8 To 1 Step -1
T (i) = Gamma(i) - c * T(i + 1) / Beta(i)
Next i
Next j
‘end of the time step loop
End Sub
3. Fast Explicit PDQ Methods:
a) Write the equation needed to compute a new temperature T  using the DuFort-Frankel Method.
′ T-
′T
′ T+
T-
T
T+
T′-
T′
T′+
b) Write the equations needed to compute new temperatures using the Saul’yev Method. Label the grid.
4. Solve by the Gauss-Seidel Method.
2y + 3z + 2u
5x + y
- 3u
-x + 6y + 2z
x + y + z +7u
Perform one complete iteration for each variable.
= -3
= 8
= -6
= 16
5. Write the MathCad (or equivalent software package) solution to perform a 4th order Runge-Kutta integration
of the following functions over the indicated time interval.
fx(t, x, y) = -9.8 + 0.02y
fy(t, x, y) = -0.4x + 0.02y
from 0 to 10 in 1000 steps.
At t = 0, x = 500 and y = 0.
Please detach this sheet. Do not turn it in with your exam.
This information may be unnecessary on some exams.
Crank-Nicolson Method Equations for nine unknown temperatures
aT'  bT '  cT'  fT  (1  2 f )T  fT
af
where
b  (1  2 f )
cf
f 
t
2x 2
The complete enumerations for all grid points where the temperatures are unknown are
bT1'  cT2 '  d1  fT0  (1- 2f )T1  fT2 - aT0'
1.
2.
aT1'  bT2'  cT3'  d 2  fT1  (1  2f )T2  fT3
3.
aT2'  bT3'  cT4'  d 3  fT2  (1  2f )T3  fT4
4.
aT3'  bT4'  cT5'  d 4  fT3  (1  2f )T4  fT5
5.
aT4'  bT5'  cT6'  d 5  fT4  (1  2f )T5  fT6
6.
aT5'  bT6'  cT7'  d 6  fT5  (1  2f )T6  fT7
7.
aT6'  bT7'  cT8'  d 7  fT6  (1  2f )T7  fT8
8.
aT7'  bT8'  cT9  d8  fT7  (1  2f )T8  fT9
9.
aT8'  bT9'
 d 9  fT8  (1  2f )T9  fT10  cT10'
Tridiagonal Matrix Algorithm
Crank-Nicholson has all the same a’s, b’s, and c’s and are not subscripted. The general Tridagonal Algorithm
allows unique values of a, b, and c in each equation and are, therefore, subscripted.
TN   N
ciTi 1
Ti   i 
i
i  N  1, N  2, ....1
Where the ’s and ’s are determined from the recursion formulas
 1  b1 ,
 1  d1  1 ,
 i  bi 
i 
ai ci 1
 i 1
d i  ai  i 1
i
i  2, 3, ......, N
i  2, 3, ......, N .

Scratch paper (detach and keep)
Download