# Diff of /trunk/doc/examples/diffusion.py

trunk/esys2/doc/user/examples/diffusion.py revision 108 by jgs, Thu Jan 27 06:21:59 2005 UTC trunk/doc/user/examples/diffusion.py revision 569 by gross, Tue Feb 28 05:34:37 2006 UTC
# Line 1  Line 1
1  # \$Id\$  # \$Id\$
2  from mytools import Helmholtz  from esys.escript import *
3  from esys.escript import Lsup  from esys.escript.linearPDEs import LinearPDE
4  from esys.finley import Rectangle  from esys.finley import Rectangle
5  #... set some parameters ...  #... set some parameters ...
6  xc=[0.02,0.002]  xc=[0.02,0.002]
# Line 18  i=0 Line 18  i=0
18  #... generate domain ...  #... generate domain ...
19  mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)  mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
20  #... open PDE ...  #... open PDE ...
21  mypde=Helmholtz(mydomain)  mypde=LinearPDE(mydomain)
22    mypde.setSymmetryOn()
23    mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
24  # ... set heat source: ....  # ... set heat source: ....
25  x=mydomain.getX()  x=mydomain.getX()
26  q=qc*(length(x-xc)-r).whereNegative()  q=qc*whereNegative(length(x-xc)-r)
27  # ... set initial temperature ....  # ... set initial temperature ....
28  T=Tref  T=Tref
29  # ... start iteration:  # ... start iteration:
# Line 29  while t<tend: Line 31  while t<tend:
31        i+=1        i+=1
32        t+=h        t+=h
33        print "time step :",t        print "time step :",t
34        mypde.setValue(kappa=kappa,omega=rhocp/h,f=q+rhocp/h*T,eta=eta,g=eta*Tref)        mypde.setValue(Y=q+rhocp/h*T)
35        T=mypde.getSolution()        T=mypde.getSolution()
T.saveDX("T%d.dx"%i)
36          saveVTK("T.%d.xml"%i,temp=T)

Legend:
 Removed from v.108 changed lines Added in v.569