14 
\section{Steadystate Heat Refraction} 
\section{Steadystate Heat Refraction} 
15 
\label{STEADYSTATE HEAT REFRACTION} 
\label{STEADYSTATE HEAT REFRACTION} 
16 


17 
In this chapter we show how to handle more complex geometries. 
In this chapter we demonstrate how to handle more complex geometries. 
18 


19 
Steadystate heat refraction will give us an opportunity to investigate some of the richer features that the \esc package has to offer. One of these is \pycad . The advantage of using \pycad is that it offers an easy method for developing and manipulating complex domains. In conjunction with \gmsh we can generate finite element meshes that conform to our domain's shape providing accurate modelling of interfaces and boundaries. Another useful function of \pycad is that we can tag specific areas of our domain with labels as we construct them. These labels can then be used in \esc to define properties like material constants and source locations. 
Steadystate heat refraction will give us an opportunity to investigate some of the richer features that the \esc package has to offer. One of these is \pycad . The advantage of using \pycad is that it offers an easy method for developing and manipulating complex domains. In conjunction with \gmsh we can generate finite element meshes that conform to our domain's shape providing accurate modelling of interfaces and boundaries. Another useful function of \pycad is that we can tag specific areas of our domain with labels as we construct them. These labels can then be used in \esc to define properties like material constants and source locations. 
20 


30 
\section{Example 4: Creating the domain with \pycad} 
\section{Example 4: Creating the domain with \pycad} 
31 
\sslist{example04a.py} 
\sslist{example04a.py} 
32 


33 
We modify the example in Chapter~\ref{CHAP HEAT 2a} in two ways: we look the steady state 
We modify the example in Chapter~\ref{CHAP HEAT 2a} in two ways. Firstly, we look at the steady state 
34 
case with slightly modified boundary conditions and use a more flexible tool 
case with slightly modified boundary conditions and then we use a more flexible tool 
35 
to generate to generate the geometry. Lets look at the geometry first. 
to generate the geometry. Lets look at the geometry first. 
36 


37 
We want to define a rectangular domain of width $5 km$ and depth $6 km$ below the surface of the Earth. Under the assumption of a known temperature at the surface, a known heat flux at the bottom and 
We want to define a rectangular domain of width $5 km$ and depth $6 km$ below the surface of the Earth. The domain is subject to a few conditions. The temperature is known at the surface and the basement has a known heat flux. Each side of the domain is insulated and the aim is to calculate the final temperature distribution. 

insulation to both sides we want to calculate the steadystate temperature distribution. 

38 


39 
In \pycad there are a few primary constructors that build upon each other to define domains and boundaries; 
In \pycad there are a few primary constructors that build upon each other to define domains and boundaries; 
40 
the ones we use are: 
the ones we use are: 
45 
CurveLoop() #Creates a closed loop from a number of lines. 
CurveLoop() #Creates a closed loop from a number of lines. 
46 
PlaneSurface() #Creates a surface based on a CurveLoop 
PlaneSurface() #Creates a surface based on a CurveLoop 
47 
\end{python} 
\end{python} 
48 
So to buildup our domain as shown in \reffig{fig:pycad rec} we first need to create 
So to construct our domain as shown in \reffig{fig:pycad rec}, we first need to create 
49 
the corner points. From the corner points we build the four edges of the rectangle. The four edges 
the corner points. From the corner points we build the four edges of the rectangle. The four edges 
50 
form then a closed loop which defines our domain as a surface. 
then form a closed loop which defines our domain as a surface. 
51 
We start by inputting the variables we need to construct the model. 
We start by inputting the variables we need to construct the model. 
52 
\begin{python} 
\begin{python} 
53 
width=5000.0*m #width of model 
width=5000.0*m #width of model 