ViewVC logotype

Contents of /trunk/doc/cookbook/twodheatdiff001.tex

Parent Directory Parent Directory | Revision Log Revision Log

Revision 2606 - (show annotations)
Thu Aug 13 04:32:23 2009 UTC (11 years, 8 months ago) by ahallam
Original Path: trunk/doc/cookbook/TEXT/twodheatdiff001.tex
File MIME type: application/x-tex
File size: 4399 byte(s)
Updates to first chapter in cookbook -> approaching completion.
New figures added for model descriptions.
Scripts updated to use pylab/matplotlib and movie making scripts added for *.avi creation.
Still to finalise in chapter 1
- twodheatdiff model of intrusion

- heat refraction scripts and begin cookbook sections
	- pycad discussion
	- steady state pde discussion
	- quiver plot discussion
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % Copyright (c) 2003-2009 by University of Queensland
5 % Earth Systems Science Computational Center (ESSCC)
6 % http://www.uq.edu.au/esscc
7 %
8 % Primary Business: Queensland, Australia
9 % Licensed under the Open Software License version 3.0
10 % http://www.opensource.org/licenses/osl-3.0.php
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 \section{Two Dimensional Heat Diffusion for a basic Magmatic Intrusion}
15 %\label{Sec:2DHD}
16 Building upon our success from the 1D models it is now prudent to expand our domain by another dimension. For this example we will be using a very simple magmatic intrusion as the basis for our model. The simulation will be a single event where some molten granite has formed a hemisphericle dome at the base of some cold sandstone country rock. A hemisphere is semetric so taking a cross-section through its centre will effectively model a 3D problem in 2D. New concepts will include non-linear boundaries and the abilitity to prescribe location specific variables.
18 \begin{figure}[h!]
19 \centerline{\includegraphics[width=4.in]{figures/twodheatdiff}}
20 \caption{2D model: granitic intrusion of sandstone country rock.}
21 \label{fig:twodhdmodel}
22 \end{figure}
24 To expand upon our 1D problem, the domain must first be expanded. This will be done in our definition phase by creating a square domain in $x$ and $y$ that is 600 meters along eacy side \reffig{fig:twodhdmodel}. The number of discrete spatial cells will be 100. The radius of the intrusion will be 200 meters And the location of the centre of the intrusion will be at the 300 meter mark on the x-axis. The domain variables are;
25 \begin{verbatim}
26 mx = 600 # model lenght
27 my = 600 # model width
28 ndx = 100 # steps in x direction
29 ndy = 100 # steps in y direction
30 r = 200 # radius of intrusion
31 ic = [300, 0] #centre of intrusion
32 \end{verbatim}
33 The next step is to define our variables for each material in the model in a manner similar to the previous tutorial. Note that each material has its own unique set of values. The time steps and set up for the domain remain as before. Prior to setting up the PDE the boundary between the two materials must be established. The distance $s$ between two points in car cartesian coordinates is defined as:
34 \begin{equation}
35 (x_{1}-x_{0})^{2}+(y_{1}-y_{0})^{2} = s^{2}
36 \end{equation}
37 If $[x_{0},y_{0}]$ is the point $c$ the centre of the semi-circle that defines our intrusion then for all the points $[x,y]$ in our solution space we can define a distance to $c$. Hence, and points that fall within the radius $r$ of our intrusion will have a coresponding value $s < r$ and all those belonging to the country rock will have a value $s > r$. By subtracting $r$ from both of these conditions we find $s-r < 0$ for all intrusion points and $s-r > 0$ for all country rock points. Defining these conditions into the code is quite simple and is done using the following command:
38 \begin{verbatim}
39 bound = length(x-ic)-r #where the boundary will be located
40 \end{verbatim}
41 This definition of the boundary can now be used with the \verb wherePositive() and \verb whereNegative() commands from before to help define the material constants and temperatures in our domain. By examining the general form we solved in the earlier tutorials, it is obvious that both \verb A and \verb D depend on the predefined variables. To set these variables accordingly and complete our PDE we use:
42 \begin{verbatim}
43 A = (kappai)*whereNegative(bound)+(kappac)*wherePositive(bound)
44 D = (rhocpi/h)*whereNegative(bound)+(rhocpc/h)*wherePositive(bound)
46 mypde.setValue(A=A*kronecker(model),D=D,d=eta,y=eta*Tc)
47 \end{verbatim}
48 Our PDE has now been properly established. The initial conditions for temperature are set out in a similar matter:
49 \begin{verbatim}
50 T= Ti*whereNegative(bound)+Tc*wherePositive(bound) #defining the initial temperatures.
51 \end{verbatim}
52 The itteration process now begins as before, but using our new conditions for \verb D as defined above.
54 \subsection{Contouring escript data}
55 \begin{verbatim}
56 # rearrage mymesh to suit solution function space
57 oldspacecoords=model.getX()
58 coords=Data(oldspacecoords, T.getFunctionSpace())
59 coords = np.array(coords.toListOfTuples())
60 coordX = coords[:,0]
61 coordY = coords[:,1]
62 # create regular grid
63 xi = np.linspace(0.0,600.0,100)
64 yi = np.linspace(0.0,600.0,100)
65 \end{verbatim}

  ViewVC Help
Powered by ViewVC 1.1.26