Graphics Programs Reference
In-Depth Information
Here u is a function of t, x, y, and z that represents the temperature, or
concentration of impurity in the case of diffusion, at time t at position ( x, y, z )
in the medium. The constant k depends on the materials involved; it is
called the thermal conductivity in the case of heat flow and the diffusion
coefficient in the case of diffusion. To simplify matters, let us assume that the
medium is instead one-dimensional. This could represent diffusion in a thin
water-filled tube or heat flow in a thin insulated rod or wire; let us think
primarily of the case of heat flow. Then the partial differential equation
becomes
u
2 u
x 2 ,
where u ( x , t ) is the temperature at time t a distance x along the wire.
t = k
A Finite Difference Solution
To solve this partial differential equation we need both initial conditions of
the form u ( x , 0) = f ( x ), where f ( x ) gives the temperature distribution in the
wire at time 0, and boundary conditions at the endpoints of the wire; call
them x = a and x = b . We choose so-called Dirichlet boundary conditions
u ( a , t ) = T a and u ( b , t ) = T b , which correspond to the temperature being held
steady at values T a and T b at the two endpoints. Though an exact solution is
available in this scenario, let us instead illustrate the numerical method of
finite differences.
To begin with, on the computer we can only keep track of the temperature
u at a discrete set of times and a discrete set of positions x . Let the times be
0, t , 2 t ,..., N t , and let the positions be a , a + x ,..., a + J x = b , and
let u j = u ( a + j t , n t ). Rewriting the partial differential equation in terms
of finite-difference approximations to the derivatives, we get
u n + 1
u j
t
= k u j + 1 2 u j + u j 1
x 2
j
.
(These are the simplest approximations we can use for the derivatives, and
this method can be refined by using more accurate approximations,
especially for the t derivative.) Thus if for a particular n , we know the values
of u j for all j , we can solve the equation above to find u n + j for each j :
x 2 u j + 1 2 u j + u j 1 = s u j + 1 + u j 1 + (1 2 s ) u j ,
where s = k t / ( x ) 2 . In other words, this equation tells us how to find the
temperature distribution at time step n + 1 given the temperature
k t
u n + 1
= u j +
j
Search WWH ::




Custom Search