/[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 2719 by gross, Wed Oct 14 06:38:03 2009 UTC revision 2793 by gross, Tue Dec 1 06:10:10 2009 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 46  class Test_StokesProblemCartesian2D(unit Line 46  class Test_StokesProblemCartesian2D(unit
46     def setUp(self):     def setUp(self):
47         NE=6         NE=6
48         self.TOL=1e-3         self.TOL=1e-3
49         self.domain=Rectangle(NE,NE,order=2,useFullElementOrder=True)         self.domain=Rectangle(NE,NE,order=-1)
50     def tearDown(self):     def tearDown(self):
51         del self.domain         del self.domain
52     def test_PCG_P_0(self):     def test_PCG_P_0(self):
# Line 66  class Test_StokesProblemCartesian2D(unit Line 66  class Test_StokesProblemCartesian2D(unit
66         u0=(1-x[0])*x[0]*[0.,1.]         u0=(1-x[0])*x[0]*[0.,1.]
67         p0=Scalar(-P1,ReducedSolution(self.domain))         p0=Scalar(-P1,ReducedSolution(self.domain))
68         sp.setTolerance(self.TOL)         sp.setTolerance(self.TOL)
69         u,p=sp.solve(u0,p0,verbose=VERBOSE,max_iter=100,usePCG=True)         u,p=sp.solve(u0*mask,p0,verbose=VERBOSE,max_iter=100,usePCG=True)
70                
71         error_v0=Lsup(u[0]-u0[0])         error_v0=Lsup(u[0]-u0[0])
72         error_v1=Lsup(u[1]-u0[1])/0.25         error_v1=Lsup(u[1]-u0[1])/0.25
# Line 210  class Test_StokesProblemCartesian3D(unit Line 210  class Test_StokesProblemCartesian3D(unit
210     def setUp(self):     def setUp(self):
211         NE=6         NE=6
212         self.TOL=1e-4         self.TOL=1e-4
213         self.domain=Brick(NE,NE,NE,order=2,useFullElementOrder=True)         self.domain=Brick(NE,NE,NE,order=-1)
214     def tearDown(self):     def tearDown(self):
215         del self.domain         del self.domain
216     def test_PCG_P_0(self):     def test_PCG_P_0(self):
# Line 915  class Test_Rheologies(unittest.TestCase) Line 915  class Test_Rheologies(unittest.TestCase)
915    
916  class Test_IncompressibleIsotropicFlowCartesian(unittest.TestCase):  class Test_IncompressibleIsotropicFlowCartesian(unittest.TestCase):
917     TOL=1.e-6     TOL=1.e-6
918     VERBOSE=False     VERBOSE=False or True
919     A=1.     A=1.
920     P_max=100     P_max=100
921     NE=2*getMPISizeWorld()     NE=2*getMPISizeWorld()*2
922     tau_Y=10.     tau_Y=10.
923     N_dt=10     N_dt=10
924    
# Line 967  class Test_IncompressibleIsotropicFlowCa Line 967  class Test_IncompressibleIsotropicFlowCa
967        mod.setElasticShearModulus(self.mu)        mod.setElasticShearModulus(self.mu)
968        mod.setPowerLaws([self.eta_0, self.eta_1, self.eta_2], [ 1., self.tau_1, self.tau_2],  [1.,self.N_1,self.N_2])        mod.setPowerLaws([self.eta_0, self.eta_1, self.eta_2], [ 1., self.tau_1, self.tau_2],  [1.,self.N_1,self.N_2])
969        mod.setTolerance(self.TOL)        mod.setTolerance(self.TOL)
970        mod.setFlowTolerance(self.TOL)        mod.setEtaTolerance(self.TOL*1.e-3)
971    
972        BF=Vector(self.P_max,Function(self.dom))        BF=Vector(self.P_max,Function(self.dom))
973        for d in range(self.dom.getDim()):        for d in range(self.dom.getDim()):
# Line 992  class Test_IncompressibleIsotropicFlowCa Line 992  class Test_IncompressibleIsotropicFlowCa
992           t_ref=t+dt           t_ref=t+dt
993           v_ref, s_ref,p_ref=self.getReference(t_ref)           v_ref, s_ref,p_ref=self.getReference(t_ref)
994           mod.setExternals(f=matrixmult(s_ref,n)-p_ref*n, v_boundary=v_ref)           mod.setExternals(f=matrixmult(s_ref,n)-p_ref*n, v_boundary=v_ref)
995           mod.update(dt, iter_max=100, inner_iter_max=20, verbose=self.VERBOSE, usePCG=True)           mod.update(dt, eta_iter_max=10, iter_max=50, verbose=self.VERBOSE, usePCG=True, max_correction_steps=30)
996           self.check(N_t,mod,t_ref,v_ref, s_ref,p_ref)           self.check(N_t,mod,t_ref,v_ref, s_ref,p_ref)
997           t+=dt           t+=dt
998           N_t+=1           N_t+=1
# Line 1734  class Test_FaultSystem(unittest.TestCase Line 1734  class Test_FaultSystem(unittest.TestCase
1734    
1735  if __name__ == '__main__':  if __name__ == '__main__':
1736     suite = unittest.TestSuite()     suite = unittest.TestSuite()
1737     suite.addTest(unittest.makeSuite(Test_FaultSystem))     # suite.addTest(unittest.makeSuite(Test_FaultSystem))
1738     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian2D))     # suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian2D))
1739     suite.addTest(unittest.makeSuite(Test_Darcy3D))     # suite.addTest(unittest.makeSuite(Test_Darcy3D))
1740     suite.addTest(unittest.makeSuite(Test_Darcy2D))     # suite.addTest(unittest.makeSuite(Test_Darcy2D))
1741     suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))     # suite.addTest(unittest.makeSuite(Test_StokesProblemCartesian3D))
1742     suite.addTest(unittest.makeSuite(Test_Mountains3D))     # suite.addTest(unittest.makeSuite(Test_Mountains3D))
1743     suite.addTest(unittest.makeSuite(Test_Mountains2D))     # suite.addTest(unittest.makeSuite(Test_Mountains2D))
1744     suite.addTest(unittest.makeSuite(Test_Rheologies))     # suite.addTest(unittest.makeSuite(Test_Rheologies))
1745     suite.addTest(unittest.makeSuite(Test_IncompressibleIsotropicFlowCartesian))     suite.addTest(Test_IncompressibleIsotropicFlowCartesian("test_D2_Fixed_Mu"))
1746       # suite.addTest(unittest.makeSuite(Test_IncompressibleIsotropicFlowCartesian))
1747     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
1748     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)
1749    

Legend:
Removed from v.2719  
changed lines
  Added in v.2793

  ViewVC Help
Powered by ViewVC 1.1.26