# Diff of /trunk/finley/test/python/RecTest.py

revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC revision 102 by jgs, Wed Dec 15 07:08:39 2004 UTC
# Line 10  sys.path.append(esys_root+'/escript/py_s Line 10  sys.path.append(esys_root+'/escript/py_s
10
11  from escript import *  from escript import *
12  from util import *  from util import *
13  from linearPDE import *  from linearPDEs import *
14
15  import finley  import finley
16    import numarray
17
18  #  #
19  # this test the assemblage of problems with periodic boundary conditions:  # this test the assemblage of problems with periodic boundary conditions:
20  #  #
21  numElements=11  numElements=15
22  sml=0.1  sml=0.1
23  #  #
24  #    test solution is u_ex=sin(2*Pi*n*x0)*...*sin(2*Pi*n*x_dim)  #    test solution is u_ex=sin(2*Pi*n*x0)*...*sin(2*Pi*n*x_dim)
# Line 29  def TheTest(msh,constraints,reduce): Line 30  def TheTest(msh,constraints,reduce):
30      u_ex=Scalar(1,what=n)      u_ex=Scalar(1,what=n)
31      for i in range(msh.getDim()):      for i in range(msh.getDim()):
32        u_ex*=sin(2*Pi*x[i])        u_ex*=sin(2*Pi*x[i])
33      mypde=linearPDE(A=Id(msh.getDim()),D=sml,Y=(sml+4*Pi**2*msh.getDim())*u_ex,q=constraints,r=u_ex)      mypde=LinearPDE(A=numarray.identity(msh.getDim()),D=sml,Y=(sml+4*Pi**2*msh.getDim())*u_ex,q=constraints,r=u_ex)
34      mypde.setReducedOrderForEquationsTo(reduce)      mypde.setSymmetryOn()
35        mypde.setDebugOn()
36        mypde.setReducedOrderTo(reduce)
37      return Lsup(mypde.getSolution()-u_ex)/Lsup(u_ex)      return Lsup(mypde.getSolution()-u_ex)/Lsup(u_ex)
38
39  max_error=0  max_error=0
40    max_text="none"
41  for onElements in [False,True]:  for onElements in [False,True]:
42   if onElements==True:   if onElements==True:
43      onElmtext=", with elements on faces"      onElmtext=", with elements on faces"
# Line 47  for onElements in [False,True]: Line 51  for onElements in [False,True]:
51         redtext=""         redtext=""
52      for dim in [2,3]:      for dim in [2,3]:
53          if dim==2:          if dim==2:
54            for i0 in [True,False]:            # for i0 in [True,False]:
55              for i1 in [True,False]:            #  for i1 in [True,False]:
56              for i0 in [True,True]:
57                for i1 in [True,True]:
58                msh=finley.Rectangle(numElements,numElements,order,periodic0=i0,periodic1=i1,useElementsOnFace=onElements)                msh=finley.Rectangle(numElements,numElements,order,periodic0=i0,periodic1=i1,useElementsOnFace=onElements)
59                n=ContinuousFunction(msh)                n=ContinuousFunction(msh)
60                x=n.getX()                x=n.getX()

Legend:
 Removed from v.100 changed lines Added in v.102