# Contents of /trunk/finley/test/python/run_models.py

Revision 1488 - (show annotations)
Fri Apr 11 00:22:31 2008 UTC (12 years, 5 months ago) by artak
File MIME type: text/x-python
File size: 15864 byte(s)
```restart parameter is changed in GMRES(m)
```
 1 ####################################################### 2 # 3 # Copyright 2003-2007 by ACceSS MNRF 4 # Copyright 2007 by University of Queensland 5 # 6 7 # Primary Business: Queensland, Australia 8 # Licensed under the Open Software License version 3.0 9 10 # 11 ####################################################### 12 # 13 14 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF 15 16 Primary Business: Queensland, Australia""" 17 __license__="""Licensed under the Open Software License version 3.0 18 19 import unittest 20 import tempfile 21 22 from esys.escript import * 23 from esys.finley import Rectangle 24 import sys 25 import os 26 try: 27 FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR'] 28 except KeyError: 29 FINLEY_WORKDIR='.' 30 31 32 NE=6 33 TOL=1.e-5 34 VERBOSE=False 35 36 from esys.escript import * 37 from esys.escript.models import StokesProblemCartesian 38 from esys.finley import Rectangle, Brick 39 class Test_Simple2DModels(unittest.TestCase): 40 def setUp(self): 41 self.domain=Rectangle(NE,NE,order=2,useFullElementOrder=True) 42 def tearDown(self): 43 del self.domain 44 def test_StokesProblemCartesian_PCG_P_0(self): 45 ETA=1. 46 P1=0. 47 48 x=self.domain.getX() 49 F=-P1*x[1]*[1.,0]+(2*ETA-P1*x[0])*[0.,1.] 50 mask=whereZero(x[0]) * [1.,1.] \ 51 +whereZero(x[0]-1) * [1.,1.] \ 52 +whereZero(x[1]) * [1.,0.] \ 53 +whereZero(x[1]-1) * [1.,1.] 54 55 sp=StokesProblemCartesian(self.domain) 56 57 sp.initialize(f=F,fixed_u_mask=mask,eta=ETA) 58 u0=(1-x[0])*x[0]*[0.,1.] 59 p0=Scalar(P1,ReducedSolution(self.domain)) 60 u,p=sp.solve(u0,p0,show_details=VERBOSE, verbose=VERBOSE,max_iter=100,solver="PCG") 61 62 error_v0=Lsup(u[0]-u0[0]) 63 error_v1=Lsup(u[1]-u0[1])/0.25 64 zz=P1*x[0]*x[1]-p 65 error_p=Lsup(zz-integrate(zz)) 66 # print error_p, error_v0,error_v1 67 self.failUnless(error_p