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()) |
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()) |
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 |
|
|
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) |