/[escript]/trunk/doc/user/examples/diffusion.py
ViewVC logotype

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

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

revision 326 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 327 by gross, Wed Dec 7 04:32:28 2005 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2  from mytools import Helmholtz  from mytools import Helmholtz
3  from esys.escript import Lsup,length  from esys.escript import Lsup,length,whereNegative,saveVTK
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 21  mydomain = Rectangle(l0=0.05,l1=0.01,n0= Line 21  mydomain = Rectangle(l0=0.05,l1=0.01,n0=
21  mypde=Helmholtz(mydomain)  mypde=Helmholtz(mydomain)
22  # ... set heat source: ....  # ... set heat source: ....
23  x=mydomain.getX()  x=mydomain.getX()
24  q=qc*(length(x-xc)-r).whereNegative()  q=qc*whereNegative(length(x-xc)-r)
25  # ... set initial temperature ....  # ... set initial temperature ....
26  T=Tref  T=Tref
27  # ... start iteration:  # ... start iteration:
# Line 31  while t<tend: Line 31  while t<tend:
31        print "time step :",t        print "time step :",t
32        mypde.setValue(kappa=kappa,omega=rhocp/h,f=q+rhocp/h*T,eta=eta,g=eta*Tref)        mypde.setValue(kappa=kappa,omega=rhocp/h,f=q+rhocp/h*T,eta=eta,g=eta*Tref)
33        T=mypde.getSolution()        T=mypde.getSolution()
34        T.saveDX("T%d.dx"%i)        saveVTK("T%d.xml"%i,temp=T)

Legend:
Removed from v.326  
changed lines
  Added in v.327

  ViewVC Help
Powered by ViewVC 1.1.26