1 

% 
2 
% $Id$ 
% $Id$ 
3 
% 
% 
4 
% Copyright © 2006 by ACcESS MNRF 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
5 
% \url{http://www.access.edu.au 
% 
6 
% Primary Business: Queensland, Australia. 
% Copyright 20032007 by ACceSS MNRF 
7 
% Licensed under the Open Software License version 3.0 
% Copyright 2007 by University of Queensland 
8 
% http://www.opensource.org/licenses/osl3.0.php 
% 
9 

% http://esscc.uq.edu.au 
10 

% Primary Business: Queensland, Australia 
11 

% Licensed under the Open Software License version 3.0 
12 

% http://www.opensource.org/licenses/osl3.0.php 
13 

% 
14 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
15 
% 
% 
16 


17 
\section{The Diffusion Problem} 
\section{The Diffusion Problem} 
24 
\end{figure} 
\end{figure} 
25 


26 
\subsection{\label{DIFFUSION OUT SEC}Outline} 
\subsection{\label{DIFFUSION OUT SEC}Outline} 
27 
In this chapter we will discuss how to solve the time dependenttemperature diffusion\index{diffusion equation} for 
In this chapter we will discuss how to solve a timedependent temperature diffusion\index{diffusion equation} PDE for 
28 
a block of material. Within the block there is a heat source which drives the temperature diffusion. 
a given block of material. Within the block there is a heat source which drives the temperature diffusion. 
29 
On the surface, energy can radiate into the surrounding environment. 
On the surface, energy can radiate into the surrounding environment. 
30 
\fig{DIFFUSION FIG 1} shows the configuration. 
\fig{DIFFUSION FIG 1} shows the configuration. 
31 


46 
\end{equation} 
\end{equation} 
47 
where $\rho c\hackscore p$ and $\kappa$ are given material constants. In case of a composite 
where $\rho c\hackscore p$ and $\kappa$ are given material constants. In case of a composite 
48 
material the parameters depend on their location in the domain. $q\hackscore H$ is 
material the parameters depend on their location in the domain. $q\hackscore H$ is 
49 
a heat source (or sink) within the domain. We are using Einstein summation convention \index{summation convention} 
a heat source (or sink) within the domain. We are using the Einstein summation convention \index{summation convention} 
50 
as introduced in \Chap{FirstSteps}. In our case we assume $q\hackscore H$ to be equal to a constant heat production rate 
as introduced in \Chap{FirstSteps}. In our case we assume $q\hackscore H$ to be equal to a constant heat production rate 
51 
$q^{c}$ on a circle or sphere with center $x^c$ and radius $r$ and $0$ elsewhere: 
$q^{c}$ on a circle or sphere with center $x^c$ and radius $r$ and $0$ elsewhere: 
52 
\begin{equation} 
\begin{equation} 
64 


65 
On the surface of the domain we are 
On the surface of the domain we are 
66 
specifying a radiation condition 
specifying a radiation condition 
67 
which precribes the normal component of the flux $\kappa T\hackscore{,i}$ to be proportional 
which prescribes the normal component of the flux $\kappa T\hackscore{,i}$ to be proportional 
68 
to the difference of the current temperature to the surrounding temperature $T\hackscore{ref}$: 
to the difference of the current temperature to the surrounding temperature $T\hackscore{ref}$: 
69 
\begin{equation} 
\begin{equation} 
70 
\kappa T\hackscore{,i} n\hackscore i = \eta (T\hackscore{ref}T) 
\kappa T\hackscore{,i} n\hackscore i = \eta (T\hackscore{ref}T) 
71 
\label{DIFFUSION TEMP EQ 2} 
\label{DIFFUSION TEMP EQ 2} 
72 
\end{equation} 
\end{equation} 
73 
$\eta$ is a given material coefficient depending on the material of the block and the surrounding medium. 
$\eta$ is a given material coefficient depending on the material of the block and the surrounding medium. 
74 
As usual $n\hackscore i$ is the $i$th component of the outer normal field \index{outer normal field} 
$n\hackscore i$ is the $i$th component of the outer normal field \index{outer normal field} 
75 
at the surface of the domain. 
at the surface of the domain. 
76 


77 
To solve the time dependent \eqn{DIFFUSION TEMP EQ 1} the initial temperature at time 
To solve the timedependent \eqn{DIFFUSION TEMP EQ 1} the initial temperature at time 
78 
$t=0$ has to be given. Here we assume that the initial temperature is the surrounding temperature: 
$t=0$ has to be given. Here we assume that the initial temperature is the surrounding temperature: 
79 
\begin{equation} 
\begin{equation} 
80 
T(x,0)=T\hackscore{ref} 
T(x,0)=T\hackscore{ref} 
285 


286 
\subsection{The Transition Problem} 
\subsection{The Transition Problem} 
287 
\label{DIFFUSION TRANS SEC} 
\label{DIFFUSION TRANS SEC} 
288 
Now we are ready to solve the original time dependent problem. The main 
Now we are ready to solve the original timedependent problem. The main 
289 
part of the script is the loop over time $t$ which takes the following form: 
part of the script is the loop over time $t$ which takes the following form: 
290 
\begin{python} 
\begin{python} 
291 
t=0 
t=0 
331 
\end{equation} 
\end{equation} 
332 
So \code{length(xxc)} calculates the distances 
So \code{length(xxc)} calculates the distances 
333 
of the location \var{x} to the center of the circle \var{xc} where the heat source is acting. 
of the location \var{x} to the center of the circle \var{xc} where the heat source is acting. 
334 
Note that the coordinates of \var{xc} are defined as a list of floating point numbers. It is independently 
Note that the coordinates of \var{xc} are defined as a list of floating point numbers. It is automatically 
335 
converted into a \Data class object before being subtracted from \var{x}. The function \function{whereNegative} 
converted into a \Data class object before being subtracted from \var{x}. The function \function{whereNegative} 
336 
applied to 
applied to 
337 
\code{length(xxc)r}, returns a \Data class which is equal to one where the object is negative and 
\code{length(xxc)r}, returns a \Data object which is equal to one where the object is negative (inside the circle) and 
338 
zero elsewhere. After multiplication with \var{qc} we get a function with the desired property. 
zero elsewhere. After multiplication with \var{qc} we get a function with the desired property of having value \var{qc} inside 
339 

the circle and zero elsewhere. 
340 


341 
Now we can put the components together to create the script \file{diffusion.py} which is available in the \ExampleDirectory: 
Now we can put the components together to create the script \file{diffusion.py} which is available in the \ExampleDirectory: 
342 
\index{scripts!\file{diffusion.py}}: 
\index{scripts!\file{diffusion.py}}: 
389 
\caption{Results of the Temperature Diffusion Problem for Time Steps $1$ $16$, $32$ and $48$.} 
\caption{Results of the Temperature Diffusion Problem for Time Steps $1$ $16$, $32$ and $48$.} 
390 
\label{DIFFUSION FIG 2} 
\label{DIFFUSION FIG 2} 
391 
\end{figure} 
\end{figure} 
392 

\fig{DIFFUSION FIG 2} shows the result for some selected time steps. 
393 
An easy way to visualize the results is the command 
An easy way to visualize the results is the command 
394 
\begin{verbatim} 
\begin{verbatim} 
395 
mayavi d T.1.xml m SurfaceMap & 
mayavi d T.1.xml m SurfaceMap & 
396 
\end{verbatim} 
\end{verbatim} 
397 
Use the \texttt{Configure Data} 
Use the \texttt{Configure Data} window in mayavi 
398 
to move forward and and backwards in time. 
to move forward and and backwards in time. 

\fig{DIFFUSION FIG 2} shows the result for some selected time steps. 
