# Diff of /trunk/doc/examples/cookbook/example01c.py

revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 3374 by ahallam, Tue Nov 23 00:30:20 2010 UTC
# Line 54  ndx = 100 # mesh steps in x direction Line 54  ndx = 100 # mesh steps in x direction
54  ndy = 1 # mesh steps in y direction - one dimension means one element  ndy = 1 # mesh steps in y direction - one dimension means one element
55  boundloc = mx/2 # location of boundary between the two blocks  boundloc = mx/2 # location of boundary between the two blocks
56  #PDE related  #PDE related
57  rho = 7874. *kg/m**3 #kg/m^{3} density of iron  rho = 2750. *kg/m**3 #kg/m{3} density of iron
58  cp = 449.*J/(kg*K) # J/Kg.K thermal capacity  cp = 790.*J/(kg*K) # J/Kg.K thermal capacity
59  rhocp = rho*cp  rhocp = rho*cp
60  kappa = 80.*W/m/K   # watts/m.Kthermal conductivity  kappa = 2.2*W/m/K # watts/m.Kthermal conductivity
61  qH=0 * J/(sec*m**3) # J/(sec.m^{3}) no heat source  qH=0 * J/(sec*m**3) # J/(sec.m{3}) no heat source
62  T1=20 * Celsius # initial temperature at Block 1  T1=20 * Celsius # initial temperature at Block 1
63  T2=2273. * Celsius # initial temperature at Block 2  T2=2273. * Celsius # base temperature at Block 2
64
65  ################################################ESTABLISHING PARAMETERS  ################################################ESTABLISHING PARAMETERS
66  t=0 * day  # our start time, usually zero  t=0 * day  # our start time, usually zero
# Line 114  while t<tend: Line 114  while t<tend:
115        pl.axis([0,mx,T1*.9,T2*1.1])        pl.axis([0,mx,T1*.9,T2*1.1])
116        pl.title("Temperature across blocks at time %d days"%(t/day))        pl.title("Temperature across blocks at time %d days"%(t/day))
117          pl.ylabel('Temperature (K)')
118          pl.xlabel("Length (m)")
119        #save figure to file        #save figure to file
120        pl.savefig(os.path.join(save_path,"tempT", "blockspyplot%03d.png"%i))        pl.savefig(os.path.join(save_path,"tempT", "blockspyplot%03d.png"%i))
121        pl.clf() #clear figure        pl.clf() #clear figure
# Line 124  pl.figure(2) Line 126  pl.figure(2)
126  pl.plot(t_list,E_list)  pl.plot(t_list,E_list)
127  pl.title("Total Energy")  pl.title("Total Energy")
128  pl.axis([0,max(t_list),0,max(E_list)*1.1])  pl.axis([0,max(t_list),0,max(E_list)*1.1])
129  pl.savefig(os.path.join(save_path,"totE.png"))  pl.ylabel('Energy (W)')
130    pl.xlabel('Time (s)')
131    pl.savefig(os.path.join(save_path,"totE_ex01c.png"))
132  pl.clf()  pl.clf()
133
134  ###########################################################MAKE A MOVIE  ###########################################################MAKE A MOVIE

Legend:
 Removed from v.3259 changed lines Added in v.3374