DEPARTMENT OF SCIENTIFIC COMPUTING ACS Lab 3 Interpolation and Integration Tim A. Handy 3/15/2010 Problem Using an interpolation technique and two different integration techniques, determine the transient temperature profile for various positions below ground at three different locations. The model equation to solve is given by π(π₯, π‘) = π₯ 2√ππΌ π‘ ∫ ππ (π) 0 e − π₯2 4πΌ(π‘−π) 3⁄ ππ 2 (π‘ − π) Use average air temperatures for three different cities for the surface temperature Ts. The thermal diffusivity (πΌ) is 0.21m2/day. The temperature should be determined for 5, 10, 20, and 50 meters below ground-level. Solution Data Daily temperature data was obtained from the University of Dayton’s Average Daily Temperature Archive (http://www.engr.udayton.edu/weather/). These were calculated as the mean of 24 hourly readings, rather than the mean of the min and max temperatures for a day. At days with missing temperature data, appending the missing day with the average of surrounding days was done. All data used was for the year of 2009 at the following cities: Tallahassee, FL; Oklahoma City, OK; Portland, OR. Data Preprocessing The daily air temperature data is quite noisy and does not lend itself well to direct integration. As such, there are two possible routes to fitting a more helpful function. The first is to use an error-minimizing method such as least squares directly to fit a given function to the data. There is no particular detraction to this method and it may be more conceptually easy to implement, but was not the path chosen here. The other, more interesting, way is to realize that that the earth’s crust acts as a low pass filter with respect to a temperature signal. One way to view this concept is that the thermal penetration depth for transient surface temperatures is given by (Incropera, DeWitt - Fundamentals of Mass and Heat Transfer) πΏπ = 4√πΌ/π where π is the angular velocity of the surface profile. Therefore, as the angular velocity of the signal is increased, it penetrates shallower into the medium. Thus, the frequency data we need to retain is limited by the smallest depth below the surface that we care to study. For πΏπ = 5π, the largest angular velocity that will reach that depth is π = 0.1344 πππ/πππ¦. Thus, if we build a low pass filter that will only let pass frequencies below approximately 8 days/rad we obtain a much smoother input profile to fit. Using a 2nd order Butterworth low pass filter in Matlab, the noisy input temperature profile is filtered and resampled down to 128 points (from 365). Interpolation For the interpolation portion of the assignment, piecewise cubic splines with periodic boundary conditions (first and second derivatives are matched at the end points) were used. The points used for construction of the splines were the resampled values of the filtered input. Thus, the fitted data is composed of 128 splines. For ease of implementation in Matlab the csape routine was used to build the splines, and the ppval command was used to evaluate them in the integration routines. For proof of ability, my cubic interpolation code is also included but was not used. Figure 1. Oklahoma City -- Power Spectrum and Surface Temperature Figure 2. Tallahassee, FL Surface Temperature Figure 3. Portland, OR Surface Temperature Integration Romberg Integration The first integration method used was Romberg integration. Stopping criterion for the integration was set to the difference between the final two columns of a refinement row being below 1x10-10. One error that arose during this method is that it is unable to handle functions with singularities at either end point. Thus, when evaluating the integrand at π = π‘, the denominator is identically zero and the method fails. As a workaround for this the integrand is evaluated at π = 0.999π‘. The result of integrating equation 1 over a period of 8 years is given below. Figure 4. Oklahoma City Temperature Results Figure 5. Tallahassee Temperature Results Figure 6. Portland Temperature Results Gauss-Legendre Integration The second method used was Gauss-Legendre integration with 50 integration points. While this method works well for integrands that may be fit well with polynomials, it falls short outside of those cases. Due to the structure of the integrand, it appears as a Gaussian for a majority of the integrations, and thus this method ends up working suboptimally. This lack of accuracy may be validated by observing that the 0-frequency component (DC offset) of the signal is not zero in any of the three cities, and is typically between 10 and 15 degrees Celcius. From the penetration depth equation the DC component of the signal should propagate an infinite distance into the medium. But, as we’ll see, the G-L integration scheme does not accurately capture this behavior and deeper positions remain at very low temperature values. Figure 7. Oklahoma City Temperature Results Figure 8. Tallahassee Temperature Results Figure 9. Portland Temperature Results