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);
}
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;
}
Aggregations