Propagation With NRLMSISE00 force model throw Exception after upgrade to orekit 12.0

It’s great to find that orekit released version 12.0. I try to upgrade my application with orekit 12.0 and I got some propagation exception (which is not exist with version 11) as following :

Caused by: org.hipparchus.exception.MathIllegalArgumentException: -0 out of [0, 1] range
        at org.hipparchus.util.MathUtils.checkRangeInclusive(MathUtils.java:356)
        at org.hipparchus.analysis.polynomials.PolynomialSplineFunction.value(PolynomialSplineFunction.java:137)
        at org.orekit.models.earth.atmosphere.data.MarshallSolarActivityFutureEstimation.getAverageFlux(MarshallSolarActivityFutureEstimation.java:366)
        at org.orekit.models.earth.atmosphere.NRLMSISE00.getDensity(NRLMSISE00.java:1176)
        at org.orekit.forces.drag.DragForce.acceleration(DragForce.java:77)
        at org.orekit.forces.ForceModel.addContribution(ForceModel.java:120)
        at org.orekit.propagation.numerical.NumericalPropagator$Main.computeDerivatives(NumericalPropagator.java:949)
        at org.orekit.propagation.integration.AbstractIntegratedPropagator$ConvertedMainStateEquations.computeDerivatives(AbstractIntegratedPropagator.java:755)
        at org.hipparchus.ode.ExpandableODE.computeDerivatives(ExpandableODE.java:134)
        at org.hipparchus.ode.AbstractIntegrator.computeDerivatives(AbstractIntegrator.java:259)
        at org.hipparchus.ode.nonstiff.EmbeddedRungeKuttaIntegrator.integrate(EmbeddedRungeKuttaIntegrator.java:251)
        at org.orekit.propagation.integration.AbstractIntegratedPropagator.integrateDynamics(AbstractIntegratedPropagator.java:476)

I changed constructor of MarshallSolarActivityFutureEstimationLoader from StrengthLevel.AVERAGE to StrengthLevel.WEAK(or Strong) and the error is gone.

Maybe the Hipparchus or MarshallSolarActivityFutureEstimation changed in version 12.0, or something
else?

I did another try to fix this. My propagator uses DormandPrince853Integrator before. I changed the integrator to ClassicalRungeKuttaIntegrator,the error was gone too.

By debug step into the code line before the exception was thrown, I found that there is a Duration compute between current state and prev state, and the these two state datetime is exactly the same
the code lines before exception thrown as following :

public double getAverageFlux(final AbsoluteDate date) {
        // Extract closest neighbours average
        final List<TimeStampedDouble> neighbors = averageFluxCache.getNeighbors(date).collect(Collectors.toList());

        // Create linear interpolating function
        final double[] x = new double[] { 0, 1 };
        final double[] y = neighbors.stream().map(TimeStampedDouble::getValue).mapToDouble(Double::doubleValue).toArray();

        final LinearInterpolator interpolator          = new LinearInterpolator();
        final UnivariateFunction interpolatingFunction = interpolator.interpolate(x, y);

        // Interpolate
        final AbsoluteDate previousDate = neighbors.get(0).getDate();
        final AbsoluteDate nextDate     = neighbors.get(1).getDate();
        return interpolatingFunction.value(date.durationFrom(previousDate) / nextDate.durationFrom(previousDate));
    }

interpolatingFunction.value() did this: MathUtils.checkRangeInclusive(v, knots[0], knots[n]) and throws the exception
org.hipparchus.exception.MathIllegalArgumentException: -0 out of [0, 1] range

hope some one gives some help

thanks

Hi @youngcle

Regressions are always annoying issues. Could you provide a runnable unit test in order to reproduce this issue? It will be very helpful to fix it.

Thank you,
Bryan

I spend a a whole day to try to use numpropagation in offical tutorial to reproduce the issue.
It is very frustrating that I cannot reproduce it and I have no idea about it.
The issue is likely existing only in my program .

I will continue work on it and report as long as I got some progress.

1 Like

Hi @youngcle, i hope you can work it out, this would be very useful to fix this issue !

Good luck,
Vincent