/[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 2959 by jfenwick, Thu Jan 28 02:03:15 2010 UTC revision 2960 by gross, Tue Mar 2 07:54:11 2010 UTC
# Line 24  import tempfile Line 24  import tempfile
24                
25    
26    
27  VERBOSE=False # or True  VERBOSE=False  # or True
28    
29  from esys.escript import *  from esys.escript import *
30  from esys.escript.models import StokesProblemCartesian, PowerLaw, IncompressibleIsotropicFlowCartesian, FaultSystem, DarcyFlow  from esys.escript.models import StokesProblemCartesian, PowerLaw, IncompressibleIsotropicFlowCartesian, FaultSystem, DarcyFlow
# Line 466  class Test_Darcy(unittest.TestCase): Line 466  class Test_Darcy(unittest.TestCase):
466                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
467          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
468          v,p=df.solve(u_ref,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u_ref,p, max_iter=100, verbose=VERBOSE)
469          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
470          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
471      def testConstF_FixedBottom_mediumK(self):      def testConstF_FixedBottom_mediumK(self):
472          k=1.          k=1.
473          mp=self.getScalarMask(include_bottom=True)          mp=self.getScalarMask(include_bottom=True)
# Line 482  class Test_Darcy(unittest.TestCase): Line 482  class Test_Darcy(unittest.TestCase):
482                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
483          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
484          v,p=df.solve(u,p,max_iter=100, verbose=VERBOSE )          v,p=df.solve(u,p,max_iter=100, verbose=VERBOSE )
485          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
486          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
487    
488      def testConstF_FixedBottom_largeK(self):      def testConstF_FixedBottom_largeK(self):
489          k=1.e10          k=1.e10
# Line 499  class Test_Darcy(unittest.TestCase): Line 499  class Test_Darcy(unittest.TestCase):
499                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
500          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
501          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
502          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
503          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
504    
505      def testVarioF_FixedBottom_smallK(self):      def testVarioF_FixedBottom_smallK(self):
506          k=1.e-10          k=1.e-10
# Line 516  class Test_Darcy(unittest.TestCase): Line 516  class Test_Darcy(unittest.TestCase):
516                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
517          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
518          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
519          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
520          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
521    
522      def testVarioF_FixedBottom_mediumK(self):      def testVarioF_FixedBottom_mediumK(self):
523          k=1.          k=1.
# Line 533  class Test_Darcy(unittest.TestCase): Line 533  class Test_Darcy(unittest.TestCase):
533                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
534          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
535          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
536          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
537          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
538    
539      def testVarioF_FixedBottom_largeK(self):      def testVarioF_FixedBottom_largeK(self):
540          k=1.e10          k=1.e10
# Line 550  class Test_Darcy(unittest.TestCase): Line 550  class Test_Darcy(unittest.TestCase):
550                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
551          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
552          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
553          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
554          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
555    
556      def testConstF_FreeBottom_smallK(self):      def testConstF_FreeBottom_smallK(self):
557          k=1.e-10          k=1.e-10
# Line 567  class Test_Darcy(unittest.TestCase): Line 567  class Test_Darcy(unittest.TestCase):
567                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
568          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
569          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
570          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
571          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
572    
573      def testConstF_FreeBottom_mediumK(self):      def testConstF_FreeBottom_mediumK(self):
574          k=1.          k=1.
# Line 584  class Test_Darcy(unittest.TestCase): Line 584  class Test_Darcy(unittest.TestCase):
584                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
585          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
586          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
587          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
588          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
589    
590      def testConstF_FreeBottom_largeK(self):      def testConstF_FreeBottom_largeK(self):
591          k=1.e10          k=1.e10
# Line 601  class Test_Darcy(unittest.TestCase): Line 601  class Test_Darcy(unittest.TestCase):
601                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
602          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
603          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
604          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
605          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
606    
607      def testVarioF_FreeBottom_smallK(self):      def testVarioF_FreeBottom_smallK(self):
608          k=1.e-10          k=1.e-10
# Line 618  class Test_Darcy(unittest.TestCase): Line 618  class Test_Darcy(unittest.TestCase):
618                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
619          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
620          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
621          self.failUnless(Lsup(v-u_ref)<self.TOL*25.*Lsup(u_ref), "flux error too big.")  # 25 because of disc. error.          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")  
622          self.failUnless(Lsup(p-p_ref)<self.TOL*25.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
623    
624      def testVarioF_FreeBottom_mediumK(self):      def testVarioF_FreeBottom_mediumK(self):
625          k=1.          k=1.
# Line 635  class Test_Darcy(unittest.TestCase): Line 635  class Test_Darcy(unittest.TestCase):
635                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
636          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
637          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
638          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
639          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
640    
641      def testVarioF_FreeBottom_largeK(self):      def testVarioF_FreeBottom_largeK(self):
642          k=1.e10          k=1.e10
# Line 652  class Test_Darcy(unittest.TestCase): Line 652  class Test_Darcy(unittest.TestCase):
652                        permeability=Scalar(k,Function(self.dom)))                        permeability=Scalar(k,Function(self.dom)))
653          df.setTolerance(rtol=self.TOL)          df.setTolerance(rtol=self.TOL)
654          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)          v,p=df.solve(u,p, max_iter=100, verbose=VERBOSE)
655          self.failUnless(Lsup(v-u_ref)<self.TOL*10.*Lsup(u_ref), "flux error too big.")          self.failUnless(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
656          self.failUnless(Lsup(p-p_ref)<self.TOL*10.*Lsup(p_ref), "pressure error too big.")          self.failUnless(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
657    
658  class Test_Darcy2D(Test_Darcy):  class Test_Darcy2D(Test_Darcy):
659      TOL=1e-4      TOL=1e-6
660        TEST_TOL=2.e-3
661      WIDTH=1.      WIDTH=1.
662      def setUp(self):      def setUp(self):
663          NE=40  # 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.
# Line 665  class Test_Darcy2D(Test_Darcy): Line 666  class Test_Darcy2D(Test_Darcy):
666      def tearDown(self):      def tearDown(self):
667          del self.dom          del self.dom
668  class Test_Darcy3D(Test_Darcy):  class Test_Darcy3D(Test_Darcy):
669      TOL=1e-4      TOL=1e-6
670      WIDTH=1.      WIDTH=1.
671        TEST_TOL=4.e-3
672      def setUp(self):      def setUp(self):
673          NE=25  # wrning smaller NE may case a failure for VarioF tests due to discretization errors.          NE=25  # wrning smaller NE may case a failure for VarioF tests due to discretization errors.
674          self.dom = Brick(NE,NE,NE)          self.dom = Brick(NE,NE,NE)
# Line 1740  if __name__ == '__main__': Line 1742  if __name__ == '__main__':
1742     suite.addTest(unittest.makeSuite(Test_Darcy3D))     suite.addTest(unittest.makeSuite(Test_Darcy3D))
1743     suite.addTest(unittest.makeSuite(Test_Darcy2D))     suite.addTest(unittest.makeSuite(Test_Darcy2D))
1744     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))
1745     # suite.addTest(Test_StokesProblemCartesian3D("test_PCG_P_large"))     ## suite.addTest(Test_StokesProblemCartesian3D("test_PCG_P_large"))
1746     suite.addTest(unittest.makeSuite(Test_Mountains3D))     suite.addTest(unittest.makeSuite(Test_Mountains3D))
1747     suite.addTest(unittest.makeSuite(Test_Mountains2D))     suite.addTest(unittest.makeSuite(Test_Mountains2D))
1748     suite.addTest(unittest.makeSuite(Test_Rheologies))     suite.addTest(unittest.makeSuite(Test_Rheologies))
1749     # suite.addTest(Test_IncompressibleIsotropicFlowCartesian("test_D2_Fixed_MuNone"))     ## suite.addTest(Test_IncompressibleIsotropicFlowCartesian("test_D2_Fixed_MuNone"))
1750     suite.addTest(unittest.makeSuite(Test_IncompressibleIsotropicFlowCartesian))     suite.addTest(unittest.makeSuite(Test_IncompressibleIsotropicFlowCartesian))
1751     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
1752     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)

Legend:
Removed from v.2959  
changed lines
  Added in v.2960

  ViewVC Help
Powered by ViewVC 1.1.26