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

revision 297 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 298 by gross, Fri Dec 2 05:42:11 2005 UTC
# Line 50  u_ex=Scalar(1,n,True) Line 50  u_ex=Scalar(1,n,True)
50  print "x=e.getX():"  print "x=e.getX():"
51  x=e.getX()  x=e.getX()
52
53  print "norm_u_ex=u_ex.Lsup():"  print "norm_u_ex=Lsup(u_ex):"
54  norm_u_ex=u_ex.Lsup()  norm_u_ex=Lsup(u_ex)
55
56  print "\nGenerate a test solution (1)"  print "\nGenerate a test solution (1)"
57  print "----------------------------"  print "----------------------------"
# Line 74  u_d=mypde.getSolution(verbose=True) Line 74  u_d=mypde.getSolution(verbose=True)
74
75  print "\n***************************************************************"  print "\n***************************************************************"
76  error=u_ex-u_d  error=u_ex-u_d
77  error_norm=error.Lsup()/norm_u_ex  error_norm=Lsup(error)/norm_u_ex
78  print "norm of the error for direct solver is   : ",error_norm  print "norm of the error for direct solver is   : ",error_norm
79  if error_norm > error_tol:  if error_norm > error_tol:
80    print "### error norm exceeded maximum tolerance ###"    print "### error norm exceeded maximum tolerance ###"
81    sys.exit(1)    sys.exit(1)
82  error=u_ex-u_i  error=u_ex-u_i
83  error_norm=error.Lsup()/norm_u_ex  error_norm=Lsup(error)/norm_u_ex
84  print "norm of the error for iterative solver is: ",error_norm  print "norm of the error for iterative solver is: ",error_norm
85  if error_norm > error_tol:  if error_norm > error_tol:
86    print "### error norm exceeded maximum tolerance ###"    print "### error norm exceeded maximum tolerance ###"
# Line 95  print "--------------------------------- Line 95  print "---------------------------------
95  print "x=n.getX():"  print "x=n.getX():"
96  x=n.getX()  x=n.getX()
97
98  print "msk=x[0].whereZero()+(x[0]-1.).whereZero()"  print " msk=whereZero(x[0])+whereZero(x[0]-1.)"
99  msk=x[0].whereZero()+(x[0]-1.).whereZero()  msk=whereZero(x[0])+whereZero(x[0]-1.)
100
101  print "mypde=LinearPDE(A=[[1.,0.],[0.,1.]],q=msk,r=u_ex)"  print "mypde=LinearPDE(A=[[1.,0.],[0.,1.]],q=msk,r=u_ex)"
102  mypde=LinearPDE(mydomain)  mypde=LinearPDE(mydomain)
# Line 128  u_i=mypde.getSolution(verbose=True,iter_ Line 128  u_i=mypde.getSolution(verbose=True,iter_
128
129  print "\n******************************************************************"  print "\n******************************************************************"
130  error=u_ex-u_d  error=u_ex-u_d
131  error_norm=error.Lsup()/norm_u_ex  error_norm=Lsup(error)/norm_u_ex
132  print "norm of the error for direct solver is   : ",error_norm  print "norm of the error for direct solver is   : ",error_norm
133  if error_norm > error_tol:  if error_norm > error_tol:
134    print "### error norm exceeded maximum tolerance ###"    print "### error norm exceeded maximum tolerance ###"
135    sys.exit(1)    sys.exit(1)
136  error=u_ex-u_i  error=u_ex-u_i
137  error_norm=error.Lsup()/norm_u_ex  error_norm=Lsup(error)/norm_u_ex
138  print "norm of the error for iterative solver is: ",error_norm  print "norm of the error for iterative solver is: ",error_norm
139  if error_norm >  error_tol:  if error_norm >  error_tol:
140    print "### error norm exceeded maximum tolerance ###"    print "### error norm exceeded maximum tolerance ###"

Legend:
 Removed from v.297 changed lines Added in v.298