Specific Heat
WHAT IS IT?
This project explores the concept of specific heat. The specific heat of a substance in the amount of energy required to raise the temperature of one kilogram of a substance through a temperature change of one Celsius degree with no change of state.
Each substance has an initial temperature and a specific heat. The surrounding box has some percent of insulation specified with the slider "insulation" and the temperature outside the box can be specified with the slider "cold".
The agents in this model are the particles that make up the substance. In this model, the environment consists of a bounding box, the environment outside the box, and a temperature sensing area in white. Each of the environment elements are made of patches. The white patches are used to "take the temperature." (open the "current temperature" monitor to see this)
HOW TO USE IT
For each substance, specify the substances' quantities using the amount sliders, specify initial temperatures using the initialtemp sliders, and specify the specific heats using the specheat sliders. For the bounding box, specify the insulation percentage using the "insulation" slider. Specify the temperature outside the box using the "cold" slider.
Once all these values have been set, click the setup button to initialize the agents and environment. Then press the go button to start the simulation running.
THINGS TO NOTICE
Watch the "current temperature" monitor to see how the temperature within the box changes. You can also watch the temperature plot to see how the temperature changes over time.
EXPLORATIONS
How does the insulation and outside temperature effect the measured temperature. Can you think of another way to take the temperature within the box? Does the size of the white area make a difference in the temperature readings?
The collisions with other particles are not modeled accurately and the bouncing off the walls is not modeled accurately. How would you improve these behaviors?
Turtle procedures
turtles-own [
energy ; the energy of the particle
specheat ; the specific heat of the particle
]
breeds [
item1 ; the breed of the particles of substance 1
item2 ; the breed of the particles of substance 2
]
;; go procedure
;; called by the go button
;; At each iteration, particles move within the box.
;; The color of the particle is scaled to reflect the particle's energy.
;; Then the temp is averaged.
;;
to go
move
check-patches
ifelse breed = item1
[scale-color red energy 0 100]
[scale-color blue energy 0 100]
collide
end
;; move procedure
;; called by the go procedure
;; The particles move with speed dependent on energy.
;; At each step the particle can change direction a little.
;;
to move
fd (energy / 100)
rt random 10
lt random 10
end
;; check-patches procedure
;; called by the go procedure
;; Checks to see if the wall is directly in front of the particle.
;; If the wall is ahead, then the energy changes to reflect the loss of
;; energy due to the interaction with the cold surface and the insulation
;; properties of the wall. The particle turns around and continues.
;; If the white patch is ahead, then the patches temp is set to be the
;; same as the turtles energy.
;;
to check-patches
if pc-ahead = gray [
setenergy (energy +
((1 - insulation / 100) * cold + (insulation / 100) * energy)
) / 2
rt 180
]
if pc = white [
settemp energy
]
end
;; collide procedure
;; called by the go procedure
;; When another particle is encountered on the same patch, the energy of the turtle is
;; recomputed using the following formula:
;;
;; eofme = eofme X specheatofme + eofpartner X specheatofPartner
;; -------- ----------------
;; (specheatofme + specheatofpartner) (specheatofme + specheatofPartner)
;;
;;
to collide
grab one-of-turtles-here
[
setenergy (energy * (specheat / (specheat + specheat-of partner)))
+ ((energy-of partner) * ((specheat-of partner) / (specheat + specheat-of partner)))
setenergy-of partner energy
]
end
Observer procedures
patches-own [temp] ; temperature at each patch is held in a patch variable
;; setup procedure
;; called by the setup button
;; Clears the plots and the turtles, but not the patches.
;; Creates the user-specified amounts of turtles of each substance,
;; initializes the turtles variables: position, energy
;; color, heading, specific heat and shape.
;; Initializes the patch variable, temp, for each patch.
;;
to setup
clearplots
ct
create-item1-and-do amount1 [
setxy ((random 37) - 18) ((random 37) - 18)
setenergy initialtemp1 - 5 + random 11
scale-color red energy 0 100
seth random 360
setspecheat specheat1
setshape molecule-shape
]
create-item2-and-do amount2 [
setxy ((random 37) - 18) ((random 37) - 18)
setenergy initialtemp2 - 5 + random 11
scale-color blue energy 0 100
seth random 360
setspecheat specheat2
setshape molecule-shape
]
ask-patches [
settemp initialtemp1
if pc = gray - 1 [setpc red]
]
end
