/[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 2233 by gross, Mon Jan 12 06:37:07 2009 UTC revision 2234 by artak, Mon Feb 2 05:30:30 2009 UTC
# Line 39  from esys.escript import * Line 39  from esys.escript import *
39  from esys.escript.models import StokesProblemCartesian  from esys.escript.models import StokesProblemCartesian
40  from esys.finley import Rectangle, Brick  from esys.finley import Rectangle, Brick
41    
42    from esys.escript.models import Mountains
43    from math import pi
44    
45  #====================================================================================================================  #====================================================================================================================
46  class Test_StokesProblemCartesian2D(unittest.TestCase):  class Test_StokesProblemCartesian2D(unittest.TestCase):
47     def setUp(self):     def setUp(self):
# Line 674  class Test_Darcy3D(Test_Darcy): Line 677  class Test_Darcy3D(Test_Darcy):
677          del self.dom          del self.dom
678    
679    
680    class Test_Mountains3D(unittest.TestCase):
681       def setUp(self):
682           NE=16
683           self.TOL=1e-4
684           self.domain=Brick(NE,NE,NE,order=1,useFullElementOrder=True)
685       def tearDown(self):
686           del self.domain
687       def test_periodic(self):
688           EPS=0.01
689    
690           x=self.domain.getX()
691           v = Vector(0.0, Solution(self.domain))
692           a0=1
693           a1=1
694           n0=2
695           n1=2
696           n2=0.5
697           a2=-(a0*n0+a1*n1)/n2
698           v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])* cos(pi*n2*x[2])
699           v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])* cos(pi*n2*x[2])
700           v[2]=a2*cos(pi*n0*x[0])* cos(pi*n1*x[1])* sin(pi*n2*x[2])
701    
702           H_t=Scalar(0.0, Solution(self.domain))
703           mts=Mountains(self.domain,v,eps=EPS,z=1)
704           u,Z=mts.update(u=v,H_t=H_t)
705          
706           error_int=integrate(Z)
707           self.failUnless(error_int<self.TOL, "Boundary intergral is too large.")
708    
709    class Test_Mountains2D(unittest.TestCase):
710       def setUp(self):
711           NE=16
712           self.TOL=1e-4
713           self.domain=Rectangle(NE,NE,order=1,useFullElementOrder=True)
714       def tearDown(self):
715           del self.domain
716       def test_periodic(self):
717           EPS=0.01
718    
719           x=self.domain.getX()
720           v = Vector(0.0, Solution(self.domain))
721           a0=1
722           n0=1
723           n1=0.5
724           a1=-(a0*n0)/n1
725           v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])
726           v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])
727          
728           H_t=Scalar(0.0, Solution(self.domain))
729           mts=Mountains(self.domain,v,eps=EPS,z=1)
730           u,Z=mts.update(u=v,H_t=H_t)
731          
732           error_int=integrate(Z)
733           self.failUnless(error_int<self.TOL, "Boundary intergral is too large.")
734          
735  if __name__ == '__main__':  if __name__ == '__main__':
736     suite = unittest.TestSuite()     suite = unittest.TestSuite()
737      
738     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian2D))     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian2D))
739     suite.addTest(unittest.makeSuite(Test_Darcy3D))     suite.addTest(unittest.makeSuite(Test_Darcy3D))
740     suite.addTest(unittest.makeSuite(Test_Darcy2D))     suite.addTest(unittest.makeSuite(Test_Darcy2D))
741     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))
742       suite.addTest(unittest.makeSuite(Test_Mountains3D))
743       suite.addTest(unittest.makeSuite(Test_Mountains2D))
744     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
745     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)
746    

Legend:
Removed from v.2233  
changed lines
  Added in v.2234

  ViewVC Help
Powered by ViewVC 1.1.26