[SOLVED] CS160-Assignment 9 -lists using the 1-D heat diffusion model

25.00 $

Category:

Description

5/5 - (3 votes)

 Computation:

You will practice writing a Python program to gain a better understanding of lists using the 1-D heat diffusion model using the explicit method for solving finite difference approximations and visualization of data.  Your program will simulate the diffusion of heat through a 1-D object, such as a wire, using the explicit method to solve for new time instances.  

Background Information:

  1. How do we do this? Finite Difference Approximation to Solve Derivatives
  2. Function of Space and Time – u(x, t)
    • Boundary conditions – u(x0, t) = boundary1, u(xn, t) = boundary2
    • Initial conditions – u(xi, 0) = initial value, i = 1..n-1
  • What exactly do we mean by 1-D heat diffusion on a wire?
  • leave time continuous
  • divide on space/finite intervals
  1. Finite Difference Approximation, FDA, for Derivatives
    • f’’(x) ≈ ( f(x + h) – f(x) ) / h
    • f’’’(x) ≈ ( f(x + h) – 2 * f(x) + f(x – h) ) / h * h
    • So what is this h thing?

– the change in the variable you are taking the derivative w/ respect to

  1. What is the heat diffusion equation?
  • Conservation of mass, energy, momentum, etc.
  • Rate of flow in – Rate of flow out=Rate of heat storage

Don’t freak out!!!  We don’t have to do derivatives to write a program for it☺

Let’s use the explicit method for finite difference approximation (FDA) to solve the equation…

What are we interested in? 𝒖𝒕𝒙+∆𝒕

Writing Your Program:

  1. What are the inputs/outputs to the heat diffusion problem?

Input

  • Material Parameters: thermal conductivity (k), density (ρ), specific heat (c)
  • Initial and Boundary conditions
  • Material Length and how to divide length
  • Number of Timer Intervals and change in time

Output

  • If |(k * change in time) / (change in x^2 * c * ρ)| < .5 for stability o Time instance and values of all elements of 1-D at that time instance
  • Else o Error message
  1. Pseudocode for Explicit heat diffusion

For all time instances

For all points on material (u)

predict new value at new time instance (equation)

End For

End For

  1. Program Input/Output
    • Read the information from the user, make sure to handle anything that isn’t good (including an unstable condition for calculation < .5)
    • Print the time interval and values of the wire at each time instance to the screen
  1. Example Input w/ Thermal Conductivity, Density, and Specific Heat for Nickel (you can look up other metals here: http://www.engineersedge.com/properties_of_metals.htm).

 

52.4 0.321 0.12    // Thermal conductivity (k), density (ρ), specific heat (c)

0.0 0.0 100.0         //Initial temp, and boundary conditions (left and right)

10 10                     //Length of wire and sections

50 .000335            //Time intervals and change in time