12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

470 chapter 1717.17.4 Heat Equation ImplementationRecollect that we want to solve for the temperature distribution within analuminum bar of length L =1m subject to the boundary and initial conditionsT (x =0,t)=T (x = L, t)=0K, T(x, t =0)=100K. (17.75)The thermal conductivity, specific heat, and density for Al areK = 237 W/(mK), C = 900 J/(kg K), ρ= 2700 kg/m 3 . (17.76)1. Write or modify EqHeat.java in Listing 17.3 to solve the heat equation.2. Define a 2-D array T[101][2] for the temperature as a function of space andtime. The first index is for the 100 space divisions of the bar, and the secondindex is for present and past times (because you may have to make thousandsof time steps, you save memory by saving only two times).3. For time t =0( j=1), initialize T so that all points on the bar except the endsare at 100 K. Set the temperatures of the ends to 0 K.4. Apply (17.68) to obtain the temperature at the next time step.5. Assign the present-time values of the temperature to the past values:T[i][1] = T[i][2], i = 1, . . . , 101.6. Start with 50 time steps. Once you are confident the program is runningproperly, use thousands of steps to see the bar cool smoothly with time. Forapproximately every 500 time steps, print the time and temperature alongthe bar.17.18 Assessment and Visualization1. Check that your program gives a temperature distribution that variessmoothly along the bar and agrees with the boundary conditions, as inFigure 17.14.2. Check that your program gives a temperature distribution that variessmoothly with time and attains equilibrium. You may have to vary the timeand space steps to obtain well-behaved solutions.3. Compare the analytic and numeric solutions (and the wall times needed tocompute them). If the solutions differ, suspect the one that does not appearsmooth and continuous.4. Make surface plots of temperature versus position for several times.5. Better yet, make a surface plot of temperature versus position versus time.6. Plot the isotherms (contours of constant temperature).7. Stability test: Check (17.74) that the temperature diverges in t if η> 1 4 .8. Material dependence: Repeat the calculation for iron. Note that the stabilitycondition requires you to change the size of the time step.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 470

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!