Diff of /trunk/doc/examples/cookbook/onedheatdiff001.py

revision 2534 by caltinay, Thu Jul 16 06:49:19 2009 UTC revision 2589 by ahallam, Wed Aug 5 23:06:35 2009 UTC
# Line 28  from esys.escript import * # This import Line 28  from esys.escript import * # This import
28  from esys.escript.linearPDEs import LinearPDE # This defines LinearPDE as LinearPDE  from esys.escript.linearPDEs import LinearPDE # This defines LinearPDE as LinearPDE
29  from esys.finley import Rectangle # This imports the rectangle domain function from finley  from esys.finley import Rectangle # This imports the rectangle domain function from finley
30  from esys.escript.unitsSI import * # A useful unit handling package which will make sure all our units match up in the equations.  from esys.escript.unitsSI import * # A useful unit handling package which will make sure all our units match up in the equations.
31    import pylab as pl
32    import numpy as np
33  import os #This package is necessary to handle saving our data.  import os #This package is necessary to handle saving our data.
34  #plotting tools  #plotting tools
35  #import matplotlib as ptool  #import matplotlib as ptool
# Line 75  T=Tref Line 77  T=Tref
77
78  # ... start iteration:  # ... start iteration:
79  while t<=tend:  while t<=tend:
80        i+=1      i+=1
81        t+=h      t+=h
82        mypde.setValue(Y=qH+rhocp/h*T)      mypde.setValue(Y=qH+rhocp/h*T)
83        T=mypde.getSolution()      T=mypde.getSolution()
84        #ptool.plot(T)      #ptool.plot(T)
85        saveVTK(os.path.join(save_path,"data%03d.vtu") %i,sol=T)      saveVTK(os.path.join(save_path,"data%03d.vtu") %i,sol=T)
86              plx = x.toListOfTuples()
87        plx = np.array(plx)
88        plx = plx[:,0]
89        tempT = T.toListOfTuples(scalarastuple=False)
90        pl.plot(plx,tempT)
91        pl.title("Temperatuer accross Rod")
92        #~ pl.axis([0.0,1.0,0.0,0.004*2.73146e2])
93        pl.savefig(os.path.join(save_path,"rodpyplot%03d.png") %i)
94        pl.clf()
95

Legend:
 Removed from v.2534 changed lines Added in v.2589