/[ascend]/trunk/test.py
ViewVC logotype

Diff of /trunk/test.py

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

revision 1756 by jpye, Thu Feb 7 23:58:06 2008 UTC revision 1757 by jpye, Wed Feb 27 05:40:40 2008 UTC
# Line 1338  class TestIDASPGMR:#(Ascend): Line 1338  class TestIDASPGMR:#(Ascend):
1338    
1339  class TestDOPRI5(Ascend):  class TestDOPRI5(Ascend):
1340      def testlotka(self):      def testlotka(self):
1341          self.L.load('johnpye/dopri5/dopri5test.a4c')          self.L.load('test/dopri5/dopri5test.a4c')
1342          M = self.L.findType('dopri5test').getSimulation('sim')          M = self.L.findType('dopri5test').getSimulation('sim')
1343          M.setSolver(ascpy.Solver("QRSlv"))          M.setSolver(ascpy.Solver("QRSlv"))
1344          M.solve(ascpy.Solver("QRSlv"),ascpy.SolverReporter())            M.solve(ascpy.Solver("QRSlv"),ascpy.SolverReporter())  
# Line 1351  class TestDOPRI5(Ascend): Line 1351  class TestDOPRI5(Ascend):
1351          assert I.getNumVars()==1          assert I.getNumVars()==1
1352          I.solve()          I.solve()
1353      def testaren(self):      def testaren(self):
1354          self.L.load('johnpye/dopri5/aren.a4c')          self.L.load('test/dopri5/aren.a4c')
1355          M = self.L.findType('aren').getSimulation('sim')          M = self.L.findType('aren').getSimulation('sim')
1356          M.setSolver(ascpy.Solver("QRSlv"))          M.setSolver(ascpy.Solver("QRSlv"))
1357          M.solve(ascpy.Solver("QRSlv"),ascpy.SolverReporter())          M.solve(ascpy.Solver("QRSlv"),ascpy.SolverReporter())
# Line 1368  class TestDOPRI5(Ascend): Line 1368  class TestDOPRI5(Ascend):
1368          I.setInitialSubStep(0);          I.setInitialSubStep(0);
1369          I.analyse()          I.analyse()
1370          I.solve()          I.solve()
1371            print "y[0] = %f" % float(M.y[0])
1372          assert abs(float(M.y[0]) - 0.994) < 1e-5          assert abs(float(M.y[0]) - 0.994) < 1e-5
1373          assert abs(float(M.y[1]) - 0.0) < 1e-5          assert abs(float(M.y[1]) - 0.0) < 1e-5
1374    
# Line 1454  if __name__=='__main__': Line 1455  if __name__=='__main__':
1455          SEP = ":"          SEP = ":"
1456    
1457      solverdir = os.path.abspath(os.path.join(sys.path[0],"solvers"))      solverdir = os.path.abspath(os.path.join(sys.path[0],"solvers"))
1458      solverdirs = [os.path.join(solverdir,s) for s in "qrslv","cmslv","lrslv","conopt","ida","lsode","ipopt"]      solverdirs = [os.path.join(solverdir,s) for s in "qrslv","cmslv","lrslv","conopt","ida","lsode","ipopt","dopri5"]
1459    
1460      if not os.environ.get('ASCENDSOLVERS'):      if not os.environ.get('ASCENDSOLVERS'):
1461          os.environ['ASCENDSOLVERS'] = SEP.join(solverdirs)          os.environ['ASCENDSOLVERS'] = SEP.join(solverdirs)

Legend:
Removed from v.1756  
changed lines
  Added in v.1757

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22