/[escript]/trunk/finley/test/python/run_models.py
ViewVC logotype

Diff of /trunk/finley/test/python/run_models.py

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

revision 2156 by gross, Mon Dec 15 05:09:02 2008 UTC revision 2208 by gross, Mon Jan 12 06:37:07 2009 UTC
# Line 43  from esys.finley import Rectangle, Brick Line 43  from esys.finley import Rectangle, Brick
43  class Test_StokesProblemCartesian2D(unittest.TestCase):  class Test_StokesProblemCartesian2D(unittest.TestCase):
44     def setUp(self):     def setUp(self):
45         NE=6         NE=6
46         self.TOL=1.e-5         self.TOL=1e-3
47         self.domain=Rectangle(NE,NE,order=2,useFullElementOrder=True)         self.domain=Rectangle(NE,NE,order=2,useFullElementOrder=True)
48     def tearDown(self):     def tearDown(self):
49         del self.domain         del self.domain
# Line 206  class Test_StokesProblemCartesian2D(unit Line 206  class Test_StokesProblemCartesian2D(unit
206  class Test_StokesProblemCartesian3D(unittest.TestCase):  class Test_StokesProblemCartesian3D(unittest.TestCase):
207     def setUp(self):     def setUp(self):
208         NE=6         NE=6
209         self.TOL=1.e-4         self.TOL=1e-4
210         self.domain=Brick(NE,NE,NE,order=2,useFullElementOrder=True)         self.domain=Brick(NE,NE,NE,order=2,useFullElementOrder=True)
211     def tearDown(self):     def tearDown(self):
212         del self.domain         del self.domain
# Line 462  class Test_Darcy(unittest.TestCase): Line 462  class Test_Darcy(unittest.TestCase):
462                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
463                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
464                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
465          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
466            v,p=df.solve(u_ref,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
467          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
468          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
469    
# Line 478  class Test_Darcy(unittest.TestCase): Line 479  class Test_Darcy(unittest.TestCase):
479                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
480                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
481                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
482          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
483          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          v,p=df.solve(u,p,max_iter=100, verbose=VERBOSE ,sub_rtol=self.TOL/200)
484          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
485            self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
486    
487      def testConstF_FixedBottom_largeK(self):      def testConstF_FixedBottom_largeK(self):
488          k=1.e10          k=1.e10
# Line 494  class Test_Darcy(unittest.TestCase): Line 496  class Test_Darcy(unittest.TestCase):
496                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
497                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
498                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
499          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL*self.TOL)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
500            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
501          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
502          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
503    
# Line 510  class Test_Darcy(unittest.TestCase): Line 513  class Test_Darcy(unittest.TestCase):
513                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
514                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
515                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
516          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
517            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
518          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
519          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
520    
# Line 526  class Test_Darcy(unittest.TestCase): Line 530  class Test_Darcy(unittest.TestCase):
530                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
531                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
532                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
533          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
534            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
535          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
536          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
537    
# Line 542  class Test_Darcy(unittest.TestCase): Line 547  class Test_Darcy(unittest.TestCase):
547                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
548                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
549                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
550          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
551            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
552          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
553          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
554    
# Line 555  class Test_Darcy(unittest.TestCase): Line 561  class Test_Darcy(unittest.TestCase):
561          u=u_ref*mv          u=u_ref*mv
562          df=DarcyFlow(self.dom)          df=DarcyFlow(self.dom)
563          df.setValue(g=f,          df.setValue(g=f,
564                        location_of_fixed_pressure=mp,                      location_of_fixed_pressure=mp,
565                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
566                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
567          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
568            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
569          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
570          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
571    
# Line 574  class Test_Darcy(unittest.TestCase): Line 581  class Test_Darcy(unittest.TestCase):
581                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
582                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
583                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
584          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
585            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
586          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
587          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
588    
# Line 590  class Test_Darcy(unittest.TestCase): Line 598  class Test_Darcy(unittest.TestCase):
598                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
599                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
600                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
601          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
602            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
603          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
604          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
605    
# Line 606  class Test_Darcy(unittest.TestCase): Line 615  class Test_Darcy(unittest.TestCase):
615                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
616                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
617                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
618          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
619          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
620          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*25.*Lsup(u_ref), "flux error too big.")  # 25 because of disc. error.
621            self.failUnless(Lsup(p-p_ref)<self.TOL*25.*Lsup(p_ref), "pressure error too big.")
622    
623      def testVarioF_FreeBottom_mediumK(self):      def testVarioF_FreeBottom_mediumK(self):
624          k=1.          k=1.
# Line 622  class Test_Darcy(unittest.TestCase): Line 632  class Test_Darcy(unittest.TestCase):
632                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
633                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
634                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
635          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
636            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
637          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
638          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
639    
# Line 638  class Test_Darcy(unittest.TestCase): Line 649  class Test_Darcy(unittest.TestCase):
649                        location_of_fixed_pressure=mp,                        location_of_fixed_pressure=mp,
650                        location_of_fixed_flux=mv,                        location_of_fixed_flux=mv,
651                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
652          v,p=df.solve(u,p,atol=0,rtol=self.TOL, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)          df.setTolerance(rtol=self.TOL,p_ref=p_ref,v_ref=u_ref)
653            v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE,sub_rtol=self.TOL/200)
654          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")
655          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")
656    
657  class Test_Darcy2D(Test_Darcy):  class Test_Darcy2D(Test_Darcy):
658      TOL=1e-5      TOL=1e-4
659      WIDTH=1.      WIDTH=1.
660      def setUp(self):      def setUp(self):
661          NE=60  # wrning smaller NE may case a failure for VarioF tests due to discretization errors.          NE=40  # wrning smaller NE may case a failure for VarioF tests due to discretization errors.
662          self.dom = Rectangle(NE,NE)          self.dom = Rectangle(NE,NE)
663          self.rescaleDomain()          self.rescaleDomain()
664      def tearDown(self):      def tearDown(self):

Legend:
Removed from v.2156  
changed lines
  Added in v.2208

  ViewVC Help
Powered by ViewVC 1.1.26