/[escript]/trunk/escript/test/python/test_linearPDEs.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_linearPDEs.py

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

revision 1841 by gross, Fri Oct 3 03:57:52 2008 UTC revision 1859 by gross, Wed Oct 8 03:03:37 2008 UTC
# Line 46  __author__="Lutz Gross, l.gross@uq.edu.a Line 46  __author__="Lutz Gross, l.gross@uq.edu.a
46    
47  from esys.escript.util import Lsup,kronecker,interpolate,whereZero  from esys.escript.util import Lsup,kronecker,interpolate,whereZero
48  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor
49  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient
50  import numarray  import numarray
51  import unittest  import unittest
52    
# Line 182  class Test_LinearPDE_noLumping(Test_line Line 182  class Test_LinearPDE_noLumping(Test_line
182      N=4      N=4
183      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
184          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
185          try:          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))
186             success=True  
187             mypde.setValue(C=Vector(0.,FunctionOnBoundary(self.domain)))      def test_setCoefficient_WithWrongName(self):
188          except IllegalCoefficientFunctionSpace:          mypde=LinearPDE(self.domain,debug=self.DEBUG)
189             success=False          self.failUnlessRaises(IllegalCoefficient, mypde.setValue, ROMA=0.)
190          self.failUnless(not success,'inapropraite function space accepted')  
           
191      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
192          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)
193          try:          self.failUnlessRaises(IllegalCoefficientValue, mypde.setValue, C=0.)
194             success=True  
            mypde.setValue(C=0.)  
         except IllegalCoefficientValue:  
            success=False  
         self.failUnless(not success,'illegal shape accepted')  
195      def test_reducedOn(self):      def test_reducedOn(self):
196          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
197          x=self.domain.getX()          x=self.domain.getX()
# Line 208  class Test_LinearPDE_noLumping(Test_line Line 203  class Test_LinearPDE_noLumping(Test_line
203      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
204          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
205          mypde.setValue(D=1.)          mypde.setValue(D=1.)
206          try:          self.failUnlessRaises(RuntimeError,mypde.setReducedOrderOn)
            success=True  
            mypde.setReducedOrderOn()  
         except RuntimeError:  
            success=False  
         self.failUnless(not success,'alterion of order after coefficient is changed not detected.')  
207    
208      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
209          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 817  class Test_LinearPDE_noLumping(Test_line Line 807  class Test_LinearPDE_noLumping(Test_line
807          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)
808          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
809          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
810        def test_PCG_RILU(self):
811            mypde=LinearPDE(self.domain,debug=self.DEBUG)
812            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
813            mypde.setSolverMethod(mypde.PCG,mypde.RILU)
814            u=mypde.getSolution(verbose=self.VERBOSE)
815            self.failUnless(self.check(u,1.),'solution is wrong.')
816      def test_DIRECT(self):      def test_DIRECT(self):
817          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
818          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 835  class Test_LinearPDE_noLumping(Test_line Line 831  class Test_LinearPDE_noLumping(Test_line
831      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)
832          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
833          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
834        def test_BICGSTAB_RILU(self):
835            mypde=LinearPDE(self.domain,debug=self.DEBUG)
836            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
837        mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)
838            u=mypde.getSolution(verbose=self.VERBOSE)
839            self.failUnless(self.check(u,1.),'solution is wrong.')
840        def Off_test_MINRES_JACOBI(self):
841            mypde=LinearPDE(self.domain,debug=self.DEBUG)
842        mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)
843            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
844            u=mypde.getSolution(verbose=self.VERBOSE)
845            self.failUnless(self.check(u,1.),'solution is wrong.')
846        def Off_test_MINRES_ILU0(self):
847            mypde=LinearPDE(self.domain,debug=self.DEBUG)
848            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
849        mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)
850            u=mypde.getSolution(verbose=self.VERBOSE)
851            self.failUnless(self.check(u,1.),'solution is wrong.')
852        def Off_test_MINRES_RILU(self):
853            mypde=LinearPDE(self.domain,debug=self.DEBUG)
854            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
855        mypde.setSolverMethod(mypde.MINRES,mypde.RILU)
856            u=mypde.getSolution(verbose=self.VERBOSE)
857            self.failUnless(self.check(u,1.),'solution is wrong.')
858        def test_TFQMR_JACOBI(self):
859            mypde=LinearPDE(self.domain,debug=self.DEBUG)
860        mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)
861            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
862            u=mypde.getSolution(verbose=self.VERBOSE)
863            self.failUnless(self.check(u,1.),'solution is wrong.')
864        def test_TFQMR_ILU0(self):
865            mypde=LinearPDE(self.domain,debug=self.DEBUG)
866            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
867        mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)
868            u=mypde.getSolution(verbose=self.VERBOSE)
869            self.failUnless(self.check(u,1.),'solution is wrong.')
870        def test_TFQMR_RILU(self):
871            mypde=LinearPDE(self.domain,debug=self.DEBUG)
872            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
873        mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)
874            u=mypde.getSolution(verbose=self.VERBOSE)
875            self.failUnless(self.check(u,1.),'solution is wrong.')
876      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
877          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
878          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 847  class Test_LinearPDE_noLumping(Test_line Line 885  class Test_LinearPDE_noLumping(Test_line
885      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)
886          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
887          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
888        def test_PRES20_RILU(self):
889            mypde=LinearPDE(self.domain,debug=self.DEBUG)
890            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
891        mypde.setSolverMethod(mypde.PRES20,mypde.RILU)
892            u=mypde.getSolution(verbose=self.VERBOSE)
893            self.failUnless(self.check(u,1.),'solution is wrong.')
894      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
895          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
896          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
897      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)
898          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)
         u=mypde.getSolution(verbose=self.VERBOSE)  
899          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
900      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
901          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
902          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
903      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
904          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)
905            u=mypde.getSolution(verbose=self.VERBOSE)
906            self.failUnless(self.check(u,1.),'solution is wrong.')
907        def test_GMRESnoRestart_RILU(self):
908            mypde=LinearPDE(self.domain,debug=self.DEBUG)
909            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
910        mypde.setSolverMethod(mypde.GMRES,mypde.RILU)
911            u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)
912          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
913          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
914      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
# Line 873  class Test_LinearPDE_noLumping(Test_line Line 923  class Test_LinearPDE_noLumping(Test_line
923      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
924          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
925          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
926        def test_GMRES_RILU(self):
927            mypde=LinearPDE(self.domain,debug=self.DEBUG)
928            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
929        mypde.setSolverMethod(mypde.GMRES,mypde.RILU)
930            u=mypde.getSolution(verbose=self.VERBOSE)
931            self.failUnless(self.check(u,1.),'solution is wrong.')
932      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
933          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
934          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 885  class Test_LinearPDE_noLumping(Test_line Line 941  class Test_LinearPDE_noLumping(Test_line
941      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
942          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)
943          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
944        def test_GMRES_truncation_restart_RILU(self):
945            mypde=LinearPDE(self.domain,debug=self.DEBUG)
946            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
947        mypde.setSolverMethod(mypde.GMRES,mypde.RILU)
948            u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)
949            self.failUnless(self.check(u,1.),'solution is wrong.')
950      #      #
951      #   solver checks (PDE system)      #   solver checks (PDE system)
952      #      #
# Line 1197  class Test_LinearPDE(Test_LinearPDE_noLu Line 1259  class Test_LinearPDE(Test_LinearPDE_noLu
1259          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1260          self.failUnless(self.check(u,0.5),'second solution is wrong.')          self.failUnless(self.check(u,0.5),'second solution is wrong.')
1261    
1262    
1263    class Test_TransportPDE(Test_linearPDEs):
1264        N=4
1265        def test_init_theta(self):
1266            mypde=TransportPDE(self.domain,debug=self.DEBUG, theta=1.)
1267            self.failUnless(mypde.getTheta()==1.,'wrong theta')
1268        def test_init_invalid_theta(self):
1269            self.failUnlessRaises(ValueError,TransportPDE,self.domain,debug=self.DEBUG, theta=-1.)
1270    
1271        def test_setCoefficient_WithWrongName(self):
1272            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1273            self.failUnlessRaises(IllegalCoefficient,mypde.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))
1274    
1275        def test_setCoefficient_WithIllegalFunctionSpace(self):
1276            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1277            self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))
1278            
1279        def test_resetCoefficient_WithWrongShape(self):
1280            mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)
1281            self.failUnlessRaises(IllegalCoefficientValue, mypde.setValue, C=0.)
1282    
1283        def test_setInitialSolution_scalar(self):
1284            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1285            mypde.setInitialSolution(1.)
1286    
1287        def test_setInitialSolution_scalar_negative(self):
1288            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1289            self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,-1.)
1290    
1291        def test_setInitialSolution_scalar_WithWrongShape(self):
1292            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1293            self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])
1294    
1295        def test_setInitialSolution_system(self):
1296            mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
1297            mypde.setInitialSolution([1.,2.])
1298    
1299        def test_setInitialSolution_system(self):
1300            mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
1301            self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,[-1,2.])
1302    
1303        def test_setInitialSolution_system_WithWrongShape(self):
1304            mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
1305            self.failUnlessRaises(ValueError,mypde.setInitialSolution,1.)
1306    
1307    
1308        def test_attemptToChangeOrderAfterDefinedCoefficient(self):
1309            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1310            mypde.setValue(D=1.)
1311            self.failUnlessRaises(RuntimeError, mypde.setReducedOrderOn)
1312    
1313        def test_reducedOnConfig(self):
1314            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1315            mypde.setReducedOrderOn()
1316            self.failUnlessEqual((mypde.getFunctionSpaceForSolution(),mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")
1317        #
1318        #  set coefficients for scalars:
1319        #
1320        def test_setCoefficient_M_Scalar(self):
1321            d=self.domain.getDim()
1322            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1323            mypde.setValue(M=1.)
1324            coeff=mypde.getCoefficient("M")
1325            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))
1326        def test_setCoefficient_A_Scalar(self):
1327            d=self.domain.getDim()
1328            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1329            mypde.setValue(A=numarray.ones((d,d)))
1330            coeff=mypde.getCoefficient("A")
1331            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),Function(self.domain),1,1))
1332        def test_setCoefficient_B_Scalar(self):
1333            d=self.domain.getDim()
1334            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1335            mypde.setValue(B=numarray.ones((d,)))
1336            coeff=mypde.getCoefficient("B")
1337            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))
1338        def test_setCoefficient_C_Scalar(self):
1339            d=self.domain.getDim()
1340            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1341            mypde.setValue(C=numarray.ones((d,)))
1342            coeff=mypde.getCoefficient("C")
1343            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))
1344        def test_setCoefficient_D_Scalar(self):
1345            d=self.domain.getDim()
1346            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1347            mypde.setValue(D=1.)
1348            coeff=mypde.getCoefficient("D")
1349            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))
1350        def test_setCoefficient_X_Scalar(self):
1351            d=self.domain.getDim()
1352            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1353            mypde.setValue(X=numarray.ones((d,)))
1354            coeff=mypde.getCoefficient("X")
1355            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),Function(self.domain),1))
1356        def test_setCoefficient_Y_Scalar(self):
1357            d=self.domain.getDim()
1358            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1359            mypde.setValue(Y=1.)
1360            coeff=mypde.getCoefficient("Y")
1361            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))
1362        def test_setCoefficient_y_Scalar(self):
1363            d=self.domain.getDim()
1364            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1365            mypde.setValue(y=1.)
1366            coeff=mypde.getCoefficient("y")
1367            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
1368        def test_setCoefficient_d_Scalar(self):
1369            d=self.domain.getDim()
1370            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1371            mypde.setValue(d=1.)
1372            coeff=mypde.getCoefficient("d")
1373            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
1374        def test_setCoefficient_m_Scalar(self):
1375            d=self.domain.getDim()
1376            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1377            mypde.setValue(m=1.)
1378            coeff=mypde.getCoefficient("m")
1379            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
1380        def test_setCoefficient_d_contact_Scalar(self):
1381            d=self.domain.getDim()
1382            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1383            mypde.setValue(d_contact=1.)
1384            coeff=mypde.getCoefficient("d_contact")
1385            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
1386        def test_setCoefficient_y_contact_Scalar(self):
1387            d=self.domain.getDim()
1388            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1389            mypde.setValue(y_contact=1.)
1390            coeff=mypde.getCoefficient("y_contact")
1391            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
1392    
1393        def test_setCoefficient_M_reduced_Scalar(self):
1394            d=self.domain.getDim()
1395            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1396            mypde.setValue(M_reduced=1.)
1397            coeff=mypde.getCoefficient("M_reduced")
1398            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1399        def test_setCoefficient_A_reduced_Scalar(self):
1400            d=self.domain.getDim()
1401            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1402            mypde.setValue(A_reduced=numarray.ones((d,d)))
1403            coeff=mypde.getCoefficient("A_reduced")
1404            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1405        def test_setCoefficient_B_reduced_Scalar(self):
1406            d=self.domain.getDim()
1407            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1408            mypde.setValue(B_reduced=numarray.ones((d,)))
1409            coeff=mypde.getCoefficient("B_reduced")
1410            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1411        def test_setCoefficient_C_reduced_Scalar(self):
1412            d=self.domain.getDim()
1413            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1414            mypde.setValue(C_reduced=numarray.ones((d,)))
1415            coeff=mypde.getCoefficient("C_reduced")
1416            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1417        def test_setCoefficient_D_reduced_Scalar(self):
1418            d=self.domain.getDim()
1419            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1420            mypde.setValue(D_reduced=1.)
1421            coeff=mypde.getCoefficient("D_reduced")
1422            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1423        def test_setCoefficient_X_reduced_Scalar(self):
1424            d=self.domain.getDim()
1425            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1426            mypde.setValue(X_reduced=numarray.ones((d,)))
1427            coeff=mypde.getCoefficient("X_reduced")
1428            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1429        def test_setCoefficient_Y_reduced_Scalar(self):
1430            d=self.domain.getDim()
1431            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1432            mypde.setValue(Y_reduced=1.)
1433            coeff=mypde.getCoefficient("Y_reduced")
1434            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1435        def test_setCoefficient_y_reduced_Scalar(self):
1436            d=self.domain.getDim()
1437            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1438            mypde.setValue(y_reduced=1.)
1439            coeff=mypde.getCoefficient("y_reduced")
1440            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1441        def test_setCoefficient_m_reduced_Scalar(self):
1442            d=self.domain.getDim()
1443            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1444            mypde.setValue(m_reduced=1.)
1445            coeff=mypde.getCoefficient("m_reduced")
1446            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1447        def test_setCoefficient_d_reduced_Scalar(self):
1448            d=self.domain.getDim()
1449            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1450            mypde.setValue(d_reduced=1.)
1451            coeff=mypde.getCoefficient("d_reduced")
1452            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1453        def test_setCoefficient_d_contact_reduced_Scalar(self):
1454            d=self.domain.getDim()
1455            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1456            mypde.setValue(d_contact_reduced=1.)
1457            coeff=mypde.getCoefficient("d_contact_reduced")
1458            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1459        def test_setCoefficient_y_contact_reduced_Scalar(self):
1460            d=self.domain.getDim()
1461            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1462            mypde.setValue(y_contact_reduced=1.)
1463            coeff=mypde.getCoefficient("y_contact_reduced")
1464            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1465        def test_setCoefficient_r_Scalar(self):
1466            d=self.domain.getDim()
1467            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1468            mypde.setValue(r=1.)
1469            coeff=mypde.getCoefficient("r")
1470            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))
1471        def test_setCoefficient_q_Scalar(self):
1472            d=self.domain.getDim()
1473            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1474            mypde.setValue(q=1.)
1475            coeff=mypde.getCoefficient("q")
1476            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))
1477        def test_setCoefficient_r_Scalar_reducedOn(self):
1478            d=self.domain.getDim()
1479            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1480            mypde.setReducedOrderOn()
1481            mypde.setValue(r=1.)
1482            coeff=mypde.getCoefficient("r")
1483            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1484        def test_setCoefficient_q_Scalar_reducedOn(self):
1485            d=self.domain.getDim()
1486            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1487            mypde.setReducedOrderOn()
1488            mypde.setValue(q=1.)
1489            coeff=mypde.getCoefficient("q")
1490            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1491    
1492        def test_setCoefficient_M_reduced_Scalar_usingM(self):
1493            d=self.domain.getDim()
1494            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1495            mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))
1496            coeff=mypde.getCoefficient("M_reduced")
1497            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1498        def test_setCoefficient_A_reduced_Scalar_usingA(self):
1499            d=self.domain.getDim()
1500            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1501            mypde.setValue(A=Data(numarray.ones((d,d)),ReducedFunction(self.domain)))
1502            coeff=mypde.getCoefficient("A_reduced")
1503            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1504        def test_setCoefficient_B_reduced_Scalar_usingB(self):
1505            d=self.domain.getDim()
1506            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1507            mypde.setValue(B=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
1508            coeff=mypde.getCoefficient("B_reduced")
1509            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1510        def test_setCoefficient_C_reduced_Scalar_usingC(self):
1511            d=self.domain.getDim()
1512            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1513            mypde.setValue(C=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
1514            coeff=mypde.getCoefficient("C_reduced")
1515            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1516        def test_setCoefficient_D_reduced_Scalar_usingD(self):
1517            d=self.domain.getDim()
1518            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1519            mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
1520            coeff=mypde.getCoefficient("D_reduced")
1521            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1522        def test_setCoefficient_X_reduced_Scalar_usingX(self):
1523            d=self.domain.getDim()
1524            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1525            mypde.setValue(X_reduced=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
1526            coeff=mypde.getCoefficient("X_reduced")
1527            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1528        def test_setCoefficient_Y_reduced_Scalar_usingY(self):
1529            d=self.domain.getDim()
1530            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1531            mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
1532            coeff=mypde.getCoefficient("Y_reduced")
1533            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1534        def test_setCoefficient_y_reduced_Scalar_using_y(self):
1535            d=self.domain.getDim()
1536            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1537            mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1538            coeff=mypde.getCoefficient("y_reduced")
1539            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1540        def test_setCoefficient_m_reduced_Scalar_using_m(self):
1541            d=self.domain.getDim()
1542            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1543            mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1544            coeff=mypde.getCoefficient("d_reduced")
1545            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1546        def test_setCoefficient_d_reduced_Scalar_using_d(self):
1547            d=self.domain.getDim()
1548            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1549            mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1550            coeff=mypde.getCoefficient("m_reduced")
1551            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1552        def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
1553            d=self.domain.getDim()
1554            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1555            mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1556            coeff=mypde.getCoefficient("d_contact_reduced")
1557            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1558        def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
1559            d=self.domain.getDim()
1560            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1561            mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1562            coeff=mypde.getCoefficient("y_contact_reduced")
1563            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1564        #
1565        #  set coefficients for systems:
1566        #
1567        def test_setCoefficient_M_System(self):
1568            d=self.domain.getDim()
1569            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1570            mypde.setValue(M=numarray.ones((self.N,self.N)))
1571            coeff=mypde.getCoefficient("M")
1572            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
1573        def test_setCoefficient_A_System(self):
1574            d=self.domain.getDim()
1575            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1576            mypde.setValue(A=numarray.ones((self.N,d,self.N,d)))
1577            coeff=mypde.getCoefficient("A")
1578            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))
1579        def test_setCoefficient_B_System(self):
1580            d=self.domain.getDim()
1581            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1582            mypde.setValue(B=numarray.ones((self.N,d,self.N)))
1583            coeff=mypde.getCoefficient("B")
1584            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))
1585        def test_setCoefficient_C_System(self):
1586            d=self.domain.getDim()
1587            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1588            mypde.setValue(C=numarray.ones((self.N,self.N,d)))
1589            coeff=mypde.getCoefficient("C")
1590            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))
1591        def test_setCoefficient_D_System(self):
1592            d=self.domain.getDim()
1593            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1594            mypde.setValue(D=numarray.ones((self.N,self.N)))
1595            coeff=mypde.getCoefficient("D")
1596            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
1597        def test_setCoefficient_X_System(self):
1598            d=self.domain.getDim()
1599            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1600            mypde.setValue(X=numarray.ones((self.N,d)))
1601            coeff=mypde.getCoefficient("X")
1602            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))
1603        def test_setCoefficient_Y_System(self):
1604            d=self.domain.getDim()
1605            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1606            mypde.setValue(Y=numarray.ones((self.N,)))
1607            coeff=mypde.getCoefficient("Y")
1608            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))
1609        def test_setCoefficient_y_System(self):
1610            d=self.domain.getDim()
1611            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1612            mypde.setValue(y=numarray.ones((self.N,)))
1613            coeff=mypde.getCoefficient("y")
1614            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))
1615        def test_setCoefficient_m_System(self):
1616            d=self.domain.getDim()
1617            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1618            mypde.setValue(m=numarray.ones((self.N,self.N)))
1619            coeff=mypde.getCoefficient("m")
1620            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
1621        def test_setCoefficient_d_System(self):
1622            d=self.domain.getDim()
1623            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1624            mypde.setValue(d=numarray.ones((self.N,self.N)))
1625            coeff=mypde.getCoefficient("d")
1626            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
1627        def test_setCoefficient_d_contact_System(self):
1628            d=self.domain.getDim()
1629            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1630            mypde.setValue(d_contact=numarray.ones((self.N,self.N)))
1631            coeff=mypde.getCoefficient("d_contact")
1632            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
1633        def test_setCoefficient_y_contact_System(self):
1634            d=self.domain.getDim()
1635            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1636            mypde.setValue(y_contact=numarray.ones((self.N,)))
1637            coeff=mypde.getCoefficient("y_contact")
1638            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
1639        def test_setCoefficient_M_System_reduced(self):
1640            d=self.domain.getDim()
1641            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1642            mypde.setValue(M_reduced=numarray.ones((self.N,self.N)))
1643            coeff=mypde.getCoefficient("M_reduced")
1644            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1645        def test_setCoefficient_A_reduced_System(self):
1646            d=self.domain.getDim()
1647            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1648            mypde.setValue(A_reduced=numarray.ones((self.N,d,self.N,d)))
1649            coeff=mypde.getCoefficient("A_reduced")
1650            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1651        def test_setCoefficient_B_reduced_System(self):
1652            d=self.domain.getDim()
1653            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1654            mypde.setValue(B_reduced=numarray.ones((self.N,d,self.N)))
1655            coeff=mypde.getCoefficient("B_reduced")
1656            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
1657        def test_setCoefficient_C_reduced_System(self):
1658            d=self.domain.getDim()
1659            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1660            mypde.setValue(C_reduced=numarray.ones((self.N,self.N,d)))
1661            coeff=mypde.getCoefficient("C_reduced")
1662            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1663        def test_setCoefficient_D_System_reduced(self):
1664            d=self.domain.getDim()
1665            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1666            mypde.setValue(D_reduced=numarray.ones((self.N,self.N)))
1667            coeff=mypde.getCoefficient("D_reduced")
1668            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1669        def test_setCoefficient_X_System_reduced(self):
1670            d=self.domain.getDim()
1671            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1672            mypde.setValue(X_reduced=numarray.ones((self.N,d)))
1673            coeff=mypde.getCoefficient("X_reduced")
1674            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
1675        def test_setCoefficient_Y_System_reduced(self):
1676            d=self.domain.getDim()
1677            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1678            mypde.setValue(Y_reduced=numarray.ones((self.N,)))
1679            coeff=mypde.getCoefficient("Y_reduced")
1680            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
1681        def test_setCoefficient_y_System_reduced(self):
1682            d=self.domain.getDim()
1683            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1684            mypde.setValue(y_reduced=numarray.ones((self.N,)))
1685            coeff=mypde.getCoefficient("y_reduced")
1686            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
1687        def test_setCoefficient_m_reduced_System(self):
1688            d=self.domain.getDim()
1689            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1690            mypde.setValue(m_reduced=numarray.ones((self.N,self.N)))
1691            coeff=mypde.getCoefficient("m_reduced")
1692            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1693        def test_setCoefficient_d_reduced_System(self):
1694            d=self.domain.getDim()
1695            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1696            mypde.setValue(d_reduced=numarray.ones((self.N,self.N)))
1697            coeff=mypde.getCoefficient("d_reduced")
1698            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1699        def test_setCoefficient_d_contact_reduced_System(self):
1700            d=self.domain.getDim()
1701            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1702            mypde.setValue(d_contact_reduced=numarray.ones((self.N,self.N)))
1703            coeff=mypde.getCoefficient("d_contact_reduced")
1704            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1705        def test_setCoefficient_y_contact_reduced_System(self):
1706            d=self.domain.getDim()
1707            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1708            mypde.setValue(y_contact_reduced=numarray.ones((self.N,)))
1709            coeff=mypde.getCoefficient("y_contact_reduced")
1710            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1711        def test_setCoefficient_r_System(self):
1712            d=self.domain.getDim()
1713            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1714            mypde.setValue(r=numarray.ones((self.N,)))
1715            coeff=mypde.getCoefficient("r")
1716            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
1717        def test_setCoefficient_q_System(self):
1718            d=self.domain.getDim()
1719            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1720            mypde.setValue(q=numarray.ones((self.N,)))
1721            coeff=mypde.getCoefficient("q")
1722            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
1723        def test_setCoefficient_r_System_reducedOn(self):
1724            d=self.domain.getDim()
1725            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1726            mypde.setReducedOrderOn()
1727            mypde.setValue(r=numarray.ones((self.N,)))
1728            coeff=mypde.getCoefficient("r")
1729            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
1730        def test_setCoefficient_q_System_reducedOn(self):
1731            d=self.domain.getDim()
1732            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1733            mypde.setReducedOrderOn()
1734            mypde.setValue(q=numarray.ones((self.N,)))
1735            coeff=mypde.getCoefficient("q")
1736            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
1737    
1738        def test_setCoefficient_M_System_reduced_using_D(self):
1739            d=self.domain.getDim()
1740            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1741            mypde.setValue(M=Data(numarray.ones((self.N,self.N)),ReducedFunction(self.domain)))
1742            coeff=mypde.getCoefficient("M_reduced")
1743            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1744        def test_setCoefficient_A_reduced_System_using_A(self):
1745            d=self.domain.getDim()
1746            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1747            mypde.setValue(A=Data(numarray.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))
1748            coeff=mypde.getCoefficient("A_reduced")
1749            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1750        def test_setCoefficient_B_reduced_System_using_B(self):
1751            d=self.domain.getDim()
1752            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1753            mypde.setValue(B=Data(numarray.ones((self.N,d,self.N)),ReducedFunction(self.domain)))
1754            coeff=mypde.getCoefficient("B_reduced")
1755            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
1756        def test_setCoefficient_C_reduced_System_using_C(self):
1757            d=self.domain.getDim()
1758            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1759            mypde.setValue(C=Data(numarray.ones((self.N,self.N,d)),ReducedFunction(self.domain)))
1760            coeff=mypde.getCoefficient("C_reduced")
1761            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1762        def test_setCoefficient_D_System_reduced_using_D(self):
1763            d=self.domain.getDim()
1764            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1765            mypde.setValue(D=Data(numarray.ones((self.N,self.N)),ReducedFunction(self.domain)))
1766            coeff=mypde.getCoefficient("D_reduced")
1767            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1768        def test_setCoefficient_X_System_reduced_using_X(self):
1769            d=self.domain.getDim()
1770            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1771            mypde.setValue(X=Data(numarray.ones((self.N,d)),ReducedFunction(self.domain)))
1772            coeff=mypde.getCoefficient("X_reduced")
1773            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
1774        def test_setCoefficient_Y_System_reduced_using_Y(self):
1775            d=self.domain.getDim()
1776            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1777            mypde.setValue(Y=Data(numarray.ones((self.N,)),ReducedFunction(self.domain)))
1778            coeff=mypde.getCoefficient("Y_reduced")
1779            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
1780        def test_setCoefficient_y_reduced_System_using_y(self):
1781            d=self.domain.getDim()
1782            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1783            mypde.setValue(y=Data(numarray.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
1784            coeff=mypde.getCoefficient("y_reduced")
1785            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
1786        def test_setCoefficient_m_reduced_System_using_m(self):
1787            d=self.domain.getDim()
1788            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1789            mypde.setValue(m=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
1790            coeff=mypde.getCoefficient("m_reduced")
1791            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1792        def test_setCoefficient_d_reduced_System_using_d(self):
1793            d=self.domain.getDim()
1794            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1795            mypde.setValue(d=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
1796            coeff=mypde.getCoefficient("d_reduced")
1797            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1798        def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
1799            d=self.domain.getDim()
1800            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1801            mypde.setValue(d_contact=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
1802            coeff=mypde.getCoefficient("d_contact_reduced")
1803            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1804        def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
1805            d=self.domain.getDim()
1806            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1807            mypde.setValue(y_contact=Data(numarray.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
1808            coeff=mypde.getCoefficient("y_contact_reduced")
1809            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1810    
1811        def test_symmetryCheckTrue_System(self):
1812            d=self.domain.getDim()
1813            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1814            M=100*numarray.ones((self.N,self.N))
1815            A=numarray.ones((self.N,d,self.N,d))
1816            C=2*numarray.ones((self.N,self.N,d))
1817            B=2*numarray.ones((self.N,d,self.N))
1818            D=3*numarray.ones((self.N,self.N))
1819            d=4*numarray.ones((self.N,self.N))
1820            m=64*numarray.ones((self.N,self.N))
1821            d_contact=5*numarray.ones((self.N,self.N))
1822            mypde.setValue(M=M,A=A,B=B,C=C,D=D,d=d,d_contact=d_contact,m=m,M_reduced=-M,A_reduced=-A,B_reduced=-B,C_reduced=-C,D_reduced=-D,d_reduced=-d,d_contact_reduced=-d_contact, m_reduced=-m)
1823            self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")
1824    
1825        def test_symmetryCheckFalse_M_System(self):
1826            d=self.domain.getDim()
1827            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1828            M=numarray.ones((self.N,self.N))
1829            M[1,0]=0.
1830            mypde.setValue(M=M)
1831            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1832    
1833        def test_symmetryCheckFalse_A_System(self):
1834            d=self.domain.getDim()
1835            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1836            A=numarray.ones((self.N,d,self.N,d))
1837            A[1,1,1,0]=0.
1838            mypde.setValue(A=A)
1839            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1840    
1841        def test_symmetryCheckFalse_BC_System(self):
1842            d=self.domain.getDim()
1843            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1844            C=2*numarray.ones((self.N,self.N,d))
1845            B=2*numarray.ones((self.N,d,self.N))
1846            B[0,0,1]=1.
1847            mypde.setValue(B=B,C=C)
1848            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1849    
1850        def test_symmetryCheckFalse_D_System(self):
1851            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1852            D=3*numarray.ones((self.N,self.N))
1853            D[0,1]=0.
1854            mypde.setValue(D=D)
1855            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1856    
1857        def test_symmetryCheckFalse_m_System(self):
1858            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1859            m=4*numarray.ones((self.N,self.N))
1860            m[0,1]=0.
1861            mypde.setValue(m=m)
1862            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1863    
1864        def test_symmetryCheckFalse_d_System(self):
1865            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1866            d=4*numarray.ones((self.N,self.N))
1867            d[0,1]=0.
1868            mypde.setValue(d=d)
1869            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1870    
1871        def test_symmetryCheckFalse_d_contact_System(self):
1872            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1873            d_contact=5*numarray.ones((self.N,self.N))
1874            d_contact[0,1]=0.
1875            mypde.setValue(d_contact=d_contact)
1876            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1877    
1878        def test_symmetryCheckFalse_M_reduced_System(self):
1879            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1880            M=3*numarray.ones((self.N,self.N))
1881            M[0,1]=0.
1882            mypde.setValue(M_reduced=M)
1883            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1884    
1885        def test_symmetryCheckFalse_A_reduced_System(self):
1886            d=self.domain.getDim()
1887            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1888            A=numarray.ones((self.N,d,self.N,d))
1889            A[1,1,1,0]=0.
1890            mypde.setValue(A_reduced=A)
1891            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1892    
1893        def test_symmetryCheckFalse_BC_reduced_System(self):
1894            d=self.domain.getDim()
1895            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1896            C=2*numarray.ones((self.N,self.N,d))
1897            B=2*numarray.ones((self.N,d,self.N))
1898            B[0,0,1]=1.
1899            mypde.setValue(B_reduced=B,C_reduced=C)
1900            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1901    
1902        def test_symmetryCheckFalse_D_reduced_System(self):
1903            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1904            D=3*numarray.ones((self.N,self.N))
1905            D[0,1]=0.
1906            mypde.setValue(D_reduced=D)
1907            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1908    
1909        def test_symmetryCheckFalse_m_reduced_System(self):
1910            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1911            m=4*numarray.ones((self.N,self.N))
1912            m[0,1]=0.
1913            mypde.setValue(m_reduced=m)
1914            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1915    
1916        def test_symmetryCheckFalse_d_reduced_System(self):
1917            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1918            d=4*numarray.ones((self.N,self.N))
1919            d[0,1]=0.
1920            mypde.setValue(d_reduced=d)
1921            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1922    
1923        def test_symmetryCheckFalse_d_contact_reduced_System(self):
1924            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1925            d_contact=5*numarray.ones((self.N,self.N))
1926            d_contact[0,1]=0.
1927            mypde.setValue(d_contact_reduced=d_contact)
1928            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1929    
1930        #==============================================================
1931        def test_symmetryCheckTrue_Scalar(self):
1932            d=self.domain.getDim()
1933            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1934            M=100
1935            A=numarray.ones((d,d))
1936            C=2*numarray.ones((d,))
1937            B=2*numarray.ones((d,))
1938            D=3
1939            m=10
1940            d=4
1941            d_contact=5
1942            mypde.setValue(M=M,A=A,B=B,C=C,D=D,d=d,m=m,d_contact=d_contact,M_reduced=-M,A_reduced=-A,B_reduced=-B,C_reduced=-C,D_reduced=-D,d_reduced=-d,d_contact_reduced=-d_contact,m_reduced=-m)
1943            self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")
1944    
1945        def test_symmetryCheckFalse_A_Scalar(self):
1946            d=self.domain.getDim()
1947            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1948            A=numarray.ones((d,d))
1949            A[1,0]=0.
1950            mypde.setValue(A=A)
1951            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1952        def test_symmetryCheckFalse_BC_Scalar(self):
1953            d=self.domain.getDim()
1954            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1955            C=2*numarray.ones((d,))
1956            B=2*numarray.ones((d,))
1957            B[0]=1.
1958            mypde.setValue(B=B,C=C)
1959            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1960        def test_symmetryCheckFalse_A_reduced_Scalar(self):
1961            d=self.domain.getDim()
1962            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1963            A=numarray.ones((d,d))
1964            A[1,0]=0.
1965            mypde.setValue(A_reduced=A)
1966            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1967        def test_symmetryCheckFalse_BC_reduced_Scalar(self):
1968            d=self.domain.getDim()
1969            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1970            C=2*numarray.ones((d,))
1971            B=2*numarray.ones((d,))
1972            B[0]=1.
1973            mypde.setValue(B_reduced=B,C_reduced=C)
1974            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1975    
1976        def test_reducedOn(self):
1977            dt=0.1
1978            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1979            mypde.setReducedOrderOn()
1980            mypde.setInitialSolution(10.)
1981            mypde.setValue(M=1.,Y=1)
1982            u=mypde.getSolution(dt)
1983            self.failUnless(u.getFunctionSpace() == ReducedSolution(self.domain), "wrong function space")
1984            self.failUnless(self.check(u,10.+dt),'solution is wrong.')
1985    
1986        def Off_test_reducedOff(self):
1987            dt=0.1
1988            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1989            mypde.setInitialSolution(10.)
1990            mypde.setValue(M=1.,Y=1.)
1991            u=mypde.getSolution(0.1)
1992            self.failUnless(u.getFunctionSpace() == Solution(self.domain), "wrong function space")
1993            self.failUnless(self.check(u,10.+dt),'solution is wrong.')

Legend:
Removed from v.1841  
changed lines
  Added in v.1859

  ViewVC Help
Powered by ViewVC 1.1.26