/[escript]/trunk/doc/cookbook/example02.tex
ViewVC logotype

Diff of /trunk/doc/cookbook/example02.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2658 by ahallam, Thu Sep 10 02:58:44 2009 UTC revision 2801 by ahallam, Thu Dec 3 01:45:48 2009 UTC
# Line 23  Line 23 
23  \end{figure}  \end{figure}
24    
25  By modifying our previous code it is possible to solve this new problem. In doing so we will also try to tackle a real world example and as a result, introduce and discuss some new variables. The linear model of the two blocks is very similar to the effect a large magmatic intrusion would have on a cold country rock. It is however, simpler at this stage to have both materials the same and for this example we will use granite \reffig{fig:onedgbmodel}.  The intrusion will have an initial temperature defined by \verb Tref  and the granite properties required are:  By modifying our previous code it is possible to solve this new problem. In doing so we will also try to tackle a real world example and as a result, introduce and discuss some new variables. The linear model of the two blocks is very similar to the effect a large magmatic intrusion would have on a cold country rock. It is however, simpler at this stage to have both materials the same and for this example we will use granite \reffig{fig:onedgbmodel}.  The intrusion will have an initial temperature defined by \verb Tref  and the granite properties required are:
26  \begin{verbatim}  \begin{python}
27  #PDE related  #PDE related
28  mx = 500*m #meters - model length  mx = 500*m #meters - model length
29  my = 100*m #meters - model width  my = 100*m #meters - model width
# Line 37  cp = 790.*J/(kg*K) #j/Kg.K thermal capac Line 37  cp = 790.*J/(kg*K) #j/Kg.K thermal capac
37  rhocp = rho*cp  #DENSITY * SPECIFIC HEAT  rhocp = rho*cp  #DENSITY * SPECIFIC HEAT
38  eta=0.  # RADIATION CONDITION  eta=0.  # RADIATION CONDITION
39  kappa=2.2*W/m/K #watts/m.K thermal conductivity  kappa=2.2*W/m/K #watts/m.K thermal conductivity
40  \end{verbatim}  \end{python}
41    
42  Since the scale and values involved in our problem have changed, the length and step size of the iteration must be considered. Instead of seconds which our units are in, it may be more prudent to decide the number of days or years we would like to run the simulation over.  Since the scale and values involved in our problem have changed, the length and step size of the iteration must be considered. Instead of seconds which our units are in, it may be more prudent to decide the number of days or years we would like to run the simulation over.
43  \begin{verbatim}  \begin{python}
44  #Script/Iteration Related  #Script/Iteration Related
45  t=0. #our start time, usually zero  t=0. #our start time, usually zero
46  tend=10*yr #the time we want to end the simulation in years  tend=10*yr #the time we want to end the simulation in years
47  outputs = 400 # number of time steps required.  outputs = 400 # number of time steps required.
48  h=(tend-t)/outputs #size of time step  h=(tend-t)/outputs #size of time step
49  \end{verbatim}  \end{python}
50    
51  If we assume that the dimensions of the blocks are continuous and extremely large compared with the model size then we need only model a small proportion of the boundary. It is practical to locate the boundary between the two blocks at the center of our model. As there is no heat source our \verb q variable can be set to zero. The new initial conditions are defined using the following:  If we assume that the dimensions of the blocks are continuous and extremely large compared with the model size then we need only model a small proportion of the boundary. It is practical to locate the boundary between the two blocks at the center of our model. As there is no heat source our \verb q  variable can be set to zero. The new initial conditions are defined using the following:
52  \begin{verbatim}  \begin{python}
53  #establish location of boundary between two blocks  #establish location of boundary between two blocks
54  bound = x[0]-boundloc  bound = x[0]-boundloc
55  #set initial temperature  #set initial temperature
56  T= 0*Tref*whereNegative(bound)+Tref*wherePositive(bound)  T= 0*Tref*whereNegative(bound)+Tref*wherePositive(bound)
57  \end{verbatim}  \end{python}
58  The \verb bound statement sets the boundary to the location along the \textit{x-axis} defined by \verb boundloc  .  The \verb bound statement sets the boundary to the location along the \textit{x-axis} defined by \verb boundloc  .
59  The PDE can then be solved as before.  The PDE can then be solved as before.
60    

Legend:
Removed from v.2658  
changed lines
  Added in v.2801

  ViewVC Help
Powered by ViewVC 1.1.26