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

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

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

revision 4983 by jfenwick, Wed May 14 01:13:23 2014 UTC revision 4984 by sshaw, Mon Jun 2 02:50:34 2014 UTC
# Line 24  http://www.opensource.org/licenses/osl-3 Line 24  http://www.opensource.org/licenses/osl-3
24  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
25    
26  import esys.escriptcore.utestselect as unittest  import esys.escriptcore.utestselect as unittest
27  import tempfile  from esys.escriptcore.testing import *
28                
29    VERBOSE = False
   
 VERBOSE=False  and True  
30    
31  from esys.escript import *  from esys.escript import *
32  from esys.escript.models import StokesProblemCartesian, PowerLaw, IncompressibleIsotropicFlowCartesian, FaultSystem, DarcyFlow  from esys.escript.models import StokesProblemCartesian, PowerLaw, IncompressibleIsotropicFlowCartesian, FaultSystem, DarcyFlow
# Line 36  from esys.escript.models import Mountain Line 34  from esys.escript.models import Mountain
34  from esys.dudley import Rectangle, Brick  from esys.dudley import Rectangle, Brick
35    
36  from math import pi  from math import pi
37  import numpy  import numpy, os, sys, tempfile
38  import sys  #==============================================================================
 import os  
 #====================================================================================================================  
39  try:  try:
40       DUDLEY_WORKDIR=os.environ['DUDLEY_WORKDIR']       DUDLEY_WORKDIR=os.environ['DUDLEY_WORKDIR']
41  except KeyError:  except KeyError:
42       DUDLEY_WORKDIR='.'       DUDLEY_WORKDIR='.'
43    
44  #====================================================================================================================  #==============================================================================
45    @unittest.skip("Test not previously tested")
46  class Test_StokesProblemCartesian2D(unittest.TestCase):  class Test_StokesProblemCartesian2D(unittest.TestCase):
47     def setUp(self):     def setUp(self):
48         NE=6         NE=6
# Line 209  class Test_StokesProblemCartesian2D(unit Line 206  class Test_StokesProblemCartesian2D(unit
206         self.assertTrue(error_p<10*self.TOL, "pressure error too large.")         self.assertTrue(error_p<10*self.TOL, "pressure error too large.")
207         self.assertTrue(error_v0<10*self.TOL, "0-velocity error too large.")         self.assertTrue(error_v0<10*self.TOL, "0-velocity error too large.")
208         self.assertTrue(error_v1<10*self.TOL, "1-velocity error too large.")         self.assertTrue(error_v1<10*self.TOL, "1-velocity error too large.")
209  #====================================================================================================================  #==============================================================================
210    @unittest.skip("Test not previously tested")
211  class Test_StokesProblemCartesian3D(unittest.TestCase):  class Test_StokesProblemCartesian3D(unittest.TestCase):
212     def setUp(self):     def setUp(self):
213         NE=6         NE=6
# Line 401  class Test_StokesProblemCartesian3D(unit Line 399  class Test_StokesProblemCartesian3D(unit
399         self.assertTrue(error_v0<10*self.TOL, "0-velocity error too large.")         self.assertTrue(error_v0<10*self.TOL, "0-velocity error too large.")
400         self.assertTrue(error_v1<10*self.TOL, "1-velocity error too large.")         self.assertTrue(error_v1<10*self.TOL, "1-velocity error too large.")
401         self.assertTrue(error_v2<10*self.TOL, "2-velocity error too large.")         self.assertTrue(error_v2<10*self.TOL, "2-velocity error too large.")
402  #====================================================================================================================  #==============================================================================
403  class Test_Darcy(unittest.TestCase):  class Darcy(unittest.TestCase):
404      # this is a simple test for the darcy flux problem      # this is a simple test for the darcy flux problem
405      #      #
406      #      #
# Line 663  class Test_Darcy(unittest.TestCase): Line 661  class Test_Darcy(unittest.TestCase):
661          self.assertTrue(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")          self.assertTrue(Lsup(v-u_ref)<self.TEST_TOL*Lsup(u_ref), "flux error too big.")
662          self.assertTrue(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")          self.assertTrue(Lsup(p-p_ref)<self.TEST_TOL*Lsup(p_ref), "pressure error too big.")
663    
664  class Test_Darcy2D(Test_Darcy):  class Darcy2D(Darcy):
665      TOL=1e-6      TOL=1e-6
666      TEST_TOL=2.e-3      TEST_TOL=2.e-3
667      WIDTH=1.      WIDTH=1.
# Line 673  class Test_Darcy2D(Test_Darcy): Line 671  class Test_Darcy2D(Test_Darcy):
671          self.rescaleDomain()          self.rescaleDomain()
672      def tearDown(self):      def tearDown(self):
673          del self.dom          del self.dom
674  class Test_Darcy3D(Test_Darcy):  
675    class Darcy3D(Darcy):
676      TOL=1e-6      TOL=1e-6
677      WIDTH=1.      WIDTH=1.
678      TEST_TOL=4.e-3      TEST_TOL=4.e-3
# Line 1503  class Test_FaultSystem(unittest.TestCase Line 1502  class Test_FaultSystem(unittest.TestCase
1502        self.assertTrue( abs(d-2.*0.70710678118654757)<self.EPS, "wrong distance.")        self.assertTrue( abs(d-2.*0.70710678118654757)<self.EPS, "wrong distance.")
1503    
1504  if __name__ == '__main__':  if __name__ == '__main__':
1505     suite = unittest.TestSuite()      run_tests(__name__, exit_on_failure=True)
    suite.addTest(unittest.makeSuite(Test_FaultSystem))  
 #   suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian2D))  
    suite.addTest(unittest.makeSuite(Test_Darcy3D))  
    suite.addTest(unittest.makeSuite(Test_Darcy2D))  
 #   suite.addTest(Test_StokesProblemCartesian2D("test_PCG_P_small"))  
 #   suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))  
    suite.addTest(unittest.makeSuite(Test_Rheologies))  
    s=unittest.TextTestRunner(verbosity=2).run(suite)  
    if not s.wasSuccessful(): sys.exit(1)  
1506    

Legend:
Removed from v.4983  
changed lines
  Added in v.4984

  ViewVC Help
Powered by ViewVC 1.1.26