Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.5
-
None
-
None
Description
Multistep ODE integrators like Adams-Bashforth and Adams-Moulton require a starter procedure.
If the starter integrator is not configured properly, it will not create the necessary number of initial points and the multistep integrator will not be initialized correctly. This results in NullPointErException when the scaling array is referenced later on.
The following test case (with an intentionally wrong starter configuration) shows the problem.
@Test public void testStartFailure() { TestProblem1 pb = new TestProblem1(); double minStep = 0.0001 * (pb.getFinalTime() - pb.getInitialTime()); double maxStep = pb.getFinalTime() - pb.getInitialTime(); double scalAbsoluteTolerance = 1.0e-6; double scalRelativeTolerance = 1.0e-7; MultistepIntegrator integ = new AdamsBashforthIntegrator(4, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); integ.setStarterIntegrator(new DormandPrince853Integrator(0.2 * (pb.getFinalTime() - pb.getInitialTime()), pb.getFinalTime() - pb.getInitialTime(), 0.1, 0.1)); TestProblemHandler handler = new TestProblemHandler(pb, integ); integ.addStepHandler(handler); integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); }
Failure to start the integrator should be detected and an appropriate exception should be triggered.