Search in sources :

Example 31 with DormandPrince853FieldIntegrator

use of org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator in project Orekit by CS-SI.

the class FieldNumericalPropagatorTest method doTestKepler.

private <T extends RealFieldElement<T>> void doTestKepler(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    // setup
    final FieldAbsoluteDate<T> initDate = FieldAbsoluteDate.getJ2000Epoch(field);
    FieldSpacecraftState<T> initialState;
    FieldNumericalPropagator<T> propagator;
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(7.0e6), zero.add(1.0e6), zero.add(4.0e6));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-500.0), zero.add(8000.0), zero.add(1000.0));
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    initialState = new FieldSpacecraftState<>(orbit);
    OrbitType type = OrbitType.EQUINOCTIAL;
    double[][] tolerance = NumericalPropagator.tolerances(0.001, orbit.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(type);
    propagator.setInitialState(initialState);
    // Propagation of the initial at t + dt
    final double dt = 3200;
    final FieldSpacecraftState<T> finalState = propagator.propagate(initDate.shiftedBy(-60), initDate.shiftedBy(dt));
    // Check results
    final double n = FastMath.sqrt(initialState.getMu() / initialState.getA().getReal()) / initialState.getA().getReal();
    Assert.assertEquals(initialState.getA().getReal(), finalState.getA().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getEquinoctialEx().getReal(), finalState.getEquinoctialEx().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getEquinoctialEy().getReal(), finalState.getEquinoctialEy().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getHx().getReal(), finalState.getHx().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getHy().getReal(), finalState.getHy().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getLM().getReal() + n * dt, finalState.getLM().getReal(), 2.0e-9);
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) OrbitType(org.orekit.orbits.OrbitType)

Example 32 with DormandPrince853FieldIntegrator

use of org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator in project Orekit by CS-SI.

the class FieldNumericalPropagatorTest method createPropagator.

private <T extends RealFieldElement<T>> FieldNumericalPropagator<T> createPropagator(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(7.0e6), zero.add(1.0e6), zero.add(4.0e6));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-500.0), zero.add(8000.0), zero.add(1000.0));
    FieldAbsoluteDate<T> initDate = FieldAbsoluteDate.getJ2000Epoch(field);
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    FieldSpacecraftState<T> initialState = new FieldSpacecraftState<>(orbit);
    OrbitType type = OrbitType.EQUINOCTIAL;
    double[][] tolerance = FieldNumericalPropagator.tolerances(zero.add(0.001), orbit, type);
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    FieldNumericalPropagator<T> propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(type);
    propagator.setInitialState(initialState);
    return propagator;
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) OrbitType(org.orekit.orbits.OrbitType)

Aggregations

DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)32 OrbitType (org.orekit.orbits.OrbitType)27 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)20 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)17 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)14 Frame (org.orekit.frames.Frame)14 SpacecraftState (org.orekit.propagation.SpacecraftState)14 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)13 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)13 FieldEquinoctialOrbit (org.orekit.orbits.FieldEquinoctialOrbit)13 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)13 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)13 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)12 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)12 Test (org.junit.Test)12 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)12 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)12 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)12 PVCoordinates (org.orekit.utils.PVCoordinates)12 GaussianRandomGenerator (org.hipparchus.random.GaussianRandomGenerator)7