Heat Diffusion

Heat Diffusion preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

chemistry and physics 

Tagged by Reuven M. Lerner over 11 years ago

heat 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 733 times • Downloaded 80 times • Run 0 times
Download the 'Heat Diffusion' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model simulates transient and steady-state temperature distribution of a thin plate.

The View shows a square thin plate as viewed from above. The plate is thermally isolated on the two faces parallel to the view such that heat can flow only in and out from the perimeter of the plate and not into or out of the world. Heat is kept constant at the edges. As the simulation runs, heat is transmitted from warmer parts of the plate to cooler parts of the plate as shown by the varying color of the plate. Therefore, the temperature of the plate begins to change immediately and possibly differently at different locations, gradually converging to a stable state. Overall, the temperature distribution over the plate is a function of time and location. In addition to this simple use of the model, you are encouraged to control various paramaters, such as the temperature of each edge edge of the plate and of the center of the plate before--and even while--the model is running.

Heat diffuses ("spreads") at different rates through different media. These rates can be determined and are called the Thermal Diffusivity of the material. The Greek letter alpha is often associated with this value. The diffusivity of a material does not change based on how much of the material there is. It is always the same. Below is a table containing several different materials with different diffusivity rates. See that wood (bottom row) has a lower heat diffusivity than, say, iron. This means that it takes a longer for heat to spread through a wooden object than an iron one. That is one reason why the handles of iron saucepans are wooden, and not the other way round. Also, think of a marble table with iron legs that has just been put out in the sun in a street-side cafe. Which material part of the table do you expect will warm up faster? The model allows you to change thermal diffusivity of the plate in two ways. You can directly change the value of ALPHA to any value you like, or you can indirectly change ALPHA by selecting a material.

Thermal diffusivity of selected materials

MaterialThermal diffusivity
(alpha cm*cm/s)
Wood (Maple)0.00128
Stone (Marble)0.0120
Iron0.2034
Aluminum0.8418
Silver1.7004

HOW IT WORKS

Initialize the plate and edges to have temperatures that equal their respective slider values. Each time through the GO procedure, diffuse the heat on each patch in the following way. Have each patch set its current temperature to the sum of the 4 neighbors' old temperature times a constant based on alpha plus a weighted version of the patch's old temperature. (For those interested, the updated temperature is calculated by using a Forward Euler Method.) Then the edges are set back to the specified values and the old temperature is updated to the current temperature. Then the plate is redrawn.

HOW TO USE IT

There are five temperature sliders which enable users to set four fixed edge temperatures and one initial plate temperature:
-- TOP-TEMP - Top edge temperature
-- BOTTOM-TEMP - Bottom edge temperature
-- IN-PLATE-TEMP - Initial plate temperature
-- LEFT-TEMP - Left edge temperature
-- RIGHT-TEMP - Right edge temperature

There are two sliders that govern the thermal diffusivity of the plate:
-- MATERIAL-TYPE - The value of the chooser is that of the above chart. You must press UPDATE ALPHA for this to change the value of ALPHA.
-- ALPHA - The alpha constant of thermal diffusivity

There are four buttons with the following functions:
-- SETUP - Initializes the model
-- GO - Runs the simulation indefinitely
-- GO ONCE - Runs the simulation for 1 time step
-- UPDATE ALPHA - press this if you want to set ALPHA to a preset value based on a material selected by the MATERIAL-TYPE chooser

The TIME monitor shows how many time steps the model has gone through.

THINGS TO TRY

Set the paramters on the temperature sliders. Pick a value for ALPHA (or pick MATERIAL-TYPE and press UPDATE ALPHA). After you have changed all the sliders to values you like, press Setup followed by GO or GO ONCE.

THINGS TO NOTICE

How does the equilibrium temperature distribution vary for different edge temperature settings?

Notice how an equilibrium (the steady-state condition) is reached.

Keep track of the units:

VariablesUnits
time0.1 second
temperaturedegrees Celsius
lengthcentimeters
diffusivitysquare centimeters per second

THINGS TO TRY

Try different materials to observe the heat transfer speed. How does this compare to physical experiments?

Try the following sample settings:

  • Top:100, Bottom:0, Left:0, Right:0
  • Top:0, Bottom:100, Left:100, Right:100
  • Top:0, Bottom:66, Left:99, Right:33
  • Top:25, Bottom:25, Left:100, Right:0

EXTENDING THE MODEL

This model simulates a classic partial differential equation problem (that of heat diffusion). The thin square plate is a typical example, and the simplest model of the behavior. Try changing the shape or thickness of the plate (e.g. a circular or elliptical plate), or adding a hole in the center (the plate would then be a slice of a torus, a doughnut-shaped geometric object).

Add a slider to alter this thickness.

Try modeling derivative or combined boundary conditions.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (1998). NetLogo Heat Diffusion model. http://ccl.northwestern.edu/netlogo/models/HeatDiffusion. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 1998 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

patches-own
[
  old-temperature  ;; the temperature of the patch the last time thru go
  temperature  ;; the current temperature of the patch
]

globals
[
  plate-size  ;; the size of the plate on which heat is diffusing
  ;; Used for scaling the color of the patches
  min-temp  ;; the minimum temperature at setup time
  max-temp  ;; the maximum temperature at setup time
]


;;;;;;;;;;;;;;;;;;;;;;;;
;;; Setup Procedures ;;;
;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  ;; initialize variables
  set plate-size round (0.6 * max-pxcor)  ;; use 0.6 to make a nice sized plate

  ;; set up the plate
  ask patches
  [
    set pcolor gray
    set-initial-temperatures
    set-edge-temperatures
    set old-temperature temperature
  ]
  set min-temp min [old-temperature] of patches
  set max-temp max [old-temperature] of patches
  draw-legend
  ask patches [ draw-plate ]
  reset-ticks
end 

;; Sets the temperature for inside of the plate

to set-initial-temperatures  ;; Patch Procedure
  if ((abs pycor) < plate-size) and ((abs pxcor) < plate-size)
  [set temperature initial-plate-temp]
end 

;; Draws the Color Scale Legend

to draw-legend  ;; Patch Procedure
  let x (1 + min-pxcor)
  repeat 3
  [
    let y 0
    repeat 10
    [
      ask patch (x + 4) (y * 2 - 11) [ set temperature (y * 10) ]
      ask patch (x + 4) (y * 2 - 10) [ set temperature (y * 10) ]
      set y y + 1
    ]
    set x x + 1
  ]

  set x (1 + min-pxcor)
  repeat 3
  [
    let y 0
    repeat 10
    [
      ask patch (x + 4) (y * 2 - 11) [color-patch ]
      ask patch (x + 4) (y * 2 - 10) [color-patch ]
      set y y + 1
    ]
    set x x + 1
  ]


  set x (1 + min-pxcor)
  repeat 3
  [
    let y 0
    repeat 11
    [
      if (x = (3 + min-pxcor)) [ ask patch  x (y * 2 - 12) [ set plabel (y * 10) ] ]
    set y y + 1
    ]
    set x x + 1
  ]
end 

;; Sets the temperatures of the plate edges and corners

to set-edge-temperatures  ;; patch procedure
  ;; set the temperatures of the edges
  if (pxcor >= plate-size) and ((abs pycor) < plate-size)
  [set temperature right-temp]
  if (pxcor <= (- plate-size)) and ((abs pycor) < plate-size)
  [set temperature left-temp]
  if (pycor >= plate-size) and ((abs pxcor) < plate-size)
  [set temperature top-temp]
  if (pycor <= (- plate-size)) and ((abs pxcor) < plate-size )
  [set temperature bottom-temp]

  ;; set the temperatures of the corners
  if (pxcor >= plate-size) and (pycor >= plate-size)
  [set temperature 0.5 * (right-temp + top-temp)]
  if (pxcor >= plate-size) and (pycor <= (- plate-size))
  [set temperature 0.5 * (right-temp + bottom-temp)]
  if (pxcor <= (- plate-size)) and (pycor >= plate-size)
  [set temperature 0.5 * (left-temp + top-temp)]
  if (pxcor <= (- plate-size)) and (pycor <= (- plate-size))
  [set temperature 0.5 * (left-temp + bottom-temp)]
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Runtime Procedures ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Runs the simulation through a loop

to go
  ask patches
  [
    ;; diffuse the heat of a patch with its neighbors
    set temperature (heat-diffusivity * (sum [old-temperature] of neighbors4)) + ((1 - ( 4 * heat-diffusivity )) * old-temperature)
    ;; set the edges back to their constant heat
    set-edge-temperatures
    set old-temperature temperature
    draw-plate
  ]
  tick
end 

;; Draws the patches that are within the plate

to draw-plate  ;; Patch Procedure
  if ((abs pycor) <= plate-size) and ((abs pxcor) <= plate-size)
  [color-patch]
end 

;; color the patch based on its temperature

to color-patch  ;; Patch Procedure
  set pcolor scale-color red temperature min-temp max-temp
end 

;; report the heat diffusivity constant that we use for the calculations

to-report heat-diffusivity
  ;; a few notes on the constants used here:
  ;; --we use .25 as a time step that causes the heat to diffuse at a reasonable pace
  ;; --we use alpha + .3 instead of just alpha here since alpha would be too
  ;; small to view any changes between some of the preset materials
  ;; --these constants are necessary since this model uses an Euler approximation to
  ;; calculate the temperature.  the approximation is only valid within a certain range
  ;; of time-steps and this range changes depending upon the value of alpha.
  report .25 * e ^ (-1 / (alpha + .3))
end 

;; Sets the material

to update-alpha
  ifelse (material-type = "wood")
  [ set alpha 0.00128 ]
  [
    ifelse (material-type = "stone")
    [ set alpha 0.012 ]
    [
      ifelse (material-type = "iron")
      [ set alpha 0.2034 ]
      [
        ifelse (material-type = "aluminum")
        [ set alpha 0.8418 ]
        [
          ifelse (material-type = "silver")
          [ set alpha 1.7004 ]
          [ user-message "Choose your own value for alpha!" ]
        ]
      ]
    ]
  ]
end 


; Copyright 1998 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Heat Diffusion Download this version

Attached files

File Type Description Last updated
Heat Diffusion.png preview Preview for 'Heat Diffusion' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.