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

trunk/esys2/doc/user/examples/helmholtztest.py revision 108 by jgs, Thu Jan 27 06:21:59 2005 UTC temp_trunk_copy/doc/examples/helmholtz.py revision 1384 by phornby, Fri Jan 11 02:29:38 2008 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  kappa=1.  kappa=1.
7  omega=0.1  omega=0.1
8  eta=10.  eta=10.
9  #... generate domain ...  #... generate domain ...
10  mydomain = esys.finley.Rectangle(l0=5.,l1=1.,n0=50, n1=10)  mydomain = Rectangle(l0=5.,l1=1.,n0=50, n1=10)
11  #... open PDE and set coefficients ...  #... open PDE and set coefficients ...
12  mypde=Helmholtz(mydomain)  mypde=LinearPDE(mydomain)
13    mypde.setSymmetryOn()
14  n=mydomain.getNormal()  n=mydomain.getNormal()
15  x=mydomain.getX()  x=mydomain.getX()
16  mypde.setValue(kappa,omega,omega*x[0],eta,kappa*n[0]+eta*x[0])  mypde.setValue(A=kappa*kronecker(mydomain),D=omega,Y=omega*x[0], \
17                   d=eta,y=kappa*n[0]+eta*x[0])
18  #... calculate error of the PDE solution ...  #... calculate error of the PDE solution ...
19  u=mypde.getSolution()  u=mypde.getSolution()
20  print "error is ",Lsup(u-x[0])  print "error is ",Lsup(u-x[0])
# output should be similar to "error is 1.e-7"
21    # output should be similar to "error is 1.e-7"
22    saveVTK("x0.xml",sol=u)
23

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