Heat equation examples

advertisement
Heat equation examples
The Heat equation is discussed in depth in
http://tutorial.math.lamar.edu/Classes/DE/IntroPDE.aspx,
starting on page 6.
You may recall Newton’s Law of Cooling from
Calculus. Just kidding.
In case you don’t, here goes:
An object changes temperature at a rate proportional to the difference
between its temperature and the temperature of the surrounding
medium.
As an equation:
dy
 k (T0  y )
dt
for an object with temperature y(t) in a medium of constant temperature T0 and thermal
constant k. And in case you don’t recall how to solve this, you might want to seek help
from a professional (hint: better be a professional math teacher, because ln is involved).
This N’s LoC treats the object as a point body (aren’t all Newtonian objects point
bodies?) immersed in a uniform medium (aren’t all media uniform?)
What’s different about the heat equation we write as a PDE? The temperature function
u(x, t) (or u(x, y, t) in two spatial dimensions) is the temperature within an object as a
function of both position and time. Heat flows within an object in a process known as
conduction, in response to an internal temperature gradient, which we represent in one
dimension by du/dx and in two dimensions as some combination of du/dx and du/dy:
Let q(x, t) be the heat flow function (aka heat flux) within the object: In one
u
for a constant .
dimension, we have the flux equation q( x, t )  
x
Heat flows down the temperature gradient: When the gradient is +, temperature increases
with increasing x position and heat flows to the left (towards decreasing x). When the
gradient is negative, temperature decreases with increasing x and heat flows to the right.
This gives rise to Fourier’s Law of Conduction, which states that the time rate of
change in the temperature function u is proportional to the negative gradient of the
heat flow, -dq/dx. Putting it all together, we obtain the Heat Equation:
u ( x, t )
q
 2u
 
  k 2 or ut = - kuxx.
t
x
x
See http://www.math.duke.edu/education/ccp/materials/engin/pdeintro/pde1.html and
subsequent pages (accessed from the intro page with the  button). Be sure you look
through all 4 parts of the exercise; answer the two questions in the summary.
In more general terms, the function u(x,t) is a solution to the heat equation if it satisfies
u
 2u

k 2  q( x, t ) . The constant k is the thermal diffusivity and the function
the PDE
t
x
q(x, t) represents any external heat source (positive for heat in) or sink (negative for heat
out). The function u(x,t) describes the temperature distribution in the one-dimensional
material as functions of position and time.
Here is a Mathematica expression for solving the one dimensional heat equation for a rod
of length 1 over a time interval of 25 sec.
In this expression, the initial condition is the temperature function at t = 0, f[x]. A heat
supply/sink function q[x,t] (positive for heat flow in, negative for heat flow out) can be
specified outside NDSolve[ ]. The thermal diffusivity constant is arbitrarily set at 0.01.
The ends of the rod are kept at temperature = 0, as specified by the twin BCs u[0,t] == 0
and u[len,t] == 0.
Sample output (q[x] = 0):
To produce this output, the initial
temperature function f[x] was a half cycle of
a sinusoid with a peak temperature of 100o
at x = 0.5. Note how the time-decaying
exponential takes over and the temperature
2
function flattens out. Note the snazzy color scheme.
You can also try a different looking color scheme by specifying
We can obtain the exponential decay rate, even though u[x, t] is an output of NDSolve[ ]:
FindFit[ ] neatly generates the required
exponential decay with time, using the
temperatures at x = .5, providing a value
for the exponent b.
Now suppose there is a nonzero q[x]
external source function. Let’s put a gentle
flame at the middle of the bar:
Here is the resulting 3D plot
of the solution:
Not surprisingly, the heat
source in the center kept the
central temperature from
decreasing as rapidly as
above.
3
And here our center heat source
is turned into a sink, representing
heat flow out of the onedimensional system:
The temperature now rapidly
cools to well below 0!
Make sure you see that this is
one dimensional (x only) as a
function of time!
Problems
1. Try a similar heat flow model (cold boundaries, hot middle) for a variety of
thermal diffusivities (it was 0.01 in the above).
2. Investigate different initial temperature distributions with no external heat flow.
3. What happens if there are nonzero q functions? Start with a hot middle and
allow positive heat flow. Try one side with positive heat flow, the other side with
negative heat flow.
Note that we also can produce slices of temperature vs. time:
4
Samples shown; the actual result of GraphicsRow would be three temp vs time graphs,
side-by-side.
Here is a slice at a constant time: temp as a
function of x
This is a good place for Animate[ ].
See the worked examples 1-5 on pages 29-44 in Dawkins’ PDE chapter.
Heat equation with a varying boundary condition
Evaluate and plot the following pair of two heat equations, paying particular attention to
the behavior of solutions u(t, x) at x = 0.
sol1= NDSolve[{D[u[t,x],t]==D[u[t,x],{x,2}],
u[0,x]==0, u[t,0]==Sin[t], u[t,5]==0},
u[t,x],{t,0,10},{x,0,5}]//Flatten
sol2=NDSolve[{D[u[t,x],t]==D[u[t,x],{x,2}],
u[0,x]==1, u[t,0]==Cos[t], u[t,5]==1},
u[t,x],{t,0,10},{x,0,5}]//Flatten
5
Diffusion
The same PDE is also known as the diffusion relationship, governing the rate of spread of
a substance throughout a medium: Mixtures of different chemicals, osmosis, as well as
the spread of biological characteristics in otherwise stable populations.
u
 2u
 D 2 , where D is the diffusivity constant and u(x,t) is the concentration of the
t
x
u
diffusing substance. Note that if the concentration increases in time (
 0 ), the
t
u
 2u  u
concentration gradient ( ) must also be increasing ( 2  ( )  0 ). At steady state
x
x
x x
2
u
u
u
(equilibrium),
0 2 0 
 const
t
x
x
Diffusion is usually a smoother-out-er: if you add salt to water, the salt diffuses
throughout the water until equilibrium is reached.
Coupled diffusion models
or How the leopard got its spots (ok, they’re giraffes, not leopards)
In a two-chemical system, diffusion can produce
feedback, leading to unstable systems (or the
evolutionary development of zebra stripes or spots
on leopards or patches on giraffes). These are
known as stimulator-inhibitor models, which have
common characteristics: Suppose chemical U1
produces melanin in the skin and chemical U2
inhibits it; excess of stimulator also stimulates
production of inhibitor; diffusion rates for the two
chemicals differ.
Let the concentrations of stimulator and inhibitor be given by u1 = u1e + u1, u2 = u2e +
u2, where the subscript e represents equilibrium concentration (when u1 = u2 = 0 and
u1 u2

 0 ). In a linear model, we could specify that for small deviations from
t
t
u
u2
 cu1  du2 (for constants a, b, c, d), but this neglects
equilibrium, 1  au1  bu2 ,
t
t
6
the effect of diffusion. To include differences in diffusion, we have two additional
constants and the stimulator-inhibitor diffusion relationship:
u1
 2u u
 2u
 au1  bu2  D1 21 , 2  cu1  du2  D2 22 .
t
x
t
x
These kinds of equations were first described by Alan Turing (the Alan Turing – if you
don’t know the name, rent a copy of Enigma or go see The Imitation Game) and
elaborated by J. Maynard Smith. See http://www.genetics.org/cgi/content/full/168/3/1105.
An interesting case occurs when all of the following conditions exist:
a > 0 and c > 0: As stimulator concentration rises above equilibrium, the rates of
production of both stimulator and inhibitor also increase;
b < 0: As inhibitor concentration rises, the rate of production of stimulator
decreases; and
D2 > D1: Inhibitor diffuses faster than stimulator.
Given the right parameters, a small change from equilibrium will lead to pronounced
“peaks” and “troughs” in the concentrations that do not smooth out with time. Hence:
spots on a giraffe! But the solutions of these coupled systems have to wait for finite
difference techniques.
7
Download