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

revision 97 by jgs, Tue Dec 14 05:39:33 2004 UTC revision 100 by jgs, Wed Dec 15 03:48:48 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 linearPDEs import *  from linearPDE import *
14
15  import finley  import finley
import numarray
16
17  #  #
18  # this test the assemblage of problems with periodic boundary conditions:  # this test the assemblage of problems with periodic boundary conditions:
19  #  #
20  numElements=15  numElements=11
21  sml=0.1  sml=0.1
22  #  #
23  #    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 30  def TheTest(msh,constraints,reduce): Line 29  def TheTest(msh,constraints,reduce):
29      u_ex=Scalar(1,what=n)      u_ex=Scalar(1,what=n)
30      for i in range(msh.getDim()):      for i in range(msh.getDim()):
31        u_ex*=sin(2*Pi*x[i])        u_ex*=sin(2*Pi*x[i])
32      mypde=LinearPDE(A=numarray.identity(msh.getDim()),D=sml,Y=(sml+4*Pi**2*msh.getDim())*u_ex,q=constraints,r=u_ex)      mypde=linearPDE(A=Id(msh.getDim()),D=sml,Y=(sml+4*Pi**2*msh.getDim())*u_ex,q=constraints,r=u_ex)
33      mypde.setSymmetryOn()      mypde.setReducedOrderForEquationsTo(reduce)
mypde.setDebugOn()
mypde.setReducedOrderTo(reduce)
34      return Lsup(mypde.getSolution()-u_ex)/Lsup(u_ex)      return Lsup(mypde.getSolution()-u_ex)/Lsup(u_ex)
35
36  max_error=0  max_error=0
max_text="none"
37  for onElements in [False,True]:  for onElements in [False,True]:
38   if onElements==True:   if onElements==True:
39      onElmtext=", with elements on faces"      onElmtext=", with elements on faces"
# Line 51  for onElements in [False,True]: Line 47  for onElements in [False,True]:
47         redtext=""         redtext=""
48      for dim in [2,3]:      for dim in [2,3]:
49          if dim==2:          if dim==2:
50            # for i0 in [True,False]:            for i0 in [True,False]:
51            #  for i1 in [True,False]:              for i1 in [True,False]:
for i0 in [True,True]:
for i1 in [True,True]:
52                msh=finley.Rectangle(numElements,numElements,order,periodic0=i0,periodic1=i1,useElementsOnFace=onElements)                msh=finley.Rectangle(numElements,numElements,order,periodic0=i0,periodic1=i1,useElementsOnFace=onElements)
53                n=ContinuousFunction(msh)                n=ContinuousFunction(msh)
54                x=n.getX()                x=n.getX()

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