Search in sources :

Example 1 with AbstractIntegrator

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

the class HolmesFeatherstoneAttractionModelTest method createEphemeris.

private BoundedPropagator createEphemeris(double dP, SpacecraftState initialState, double duration, NormalizedSphericalHarmonicsProvider provider) throws OrekitException {
    double[][] tol = NumericalPropagator.tolerances(dP, initialState.getOrbit(), OrbitType.CARTESIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(0.001, 120.0, tol[0], tol[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setEphemerisMode();
    propagator.setOrbitType(OrbitType.CARTESIAN);
    propagator.addForceModel(new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider));
    propagator.setInitialState(initialState);
    propagator.propagate(initialState.getDate().shiftedBy(duration));
    return propagator.getGeneratedEphemeris();
}
Also used : NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator)

Example 2 with AbstractIntegrator

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

the class OceanTidesTest method propagate.

private SpacecraftState propagate(Orbit orbit, AbsoluteDate target, ForceModel... forceModels) throws OrekitException {
    double[][] tolerances = NumericalPropagator.tolerances(10, orbit, OrbitType.KEPLERIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(1.0e-3, 300, tolerances[0], tolerances[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    for (ForceModel forceModel : forceModels) {
        propagator.addForceModel(forceModel);
    }
    propagator.setInitialState(new SpacecraftState(orbit));
    return propagator.propagate(target);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ForceModel(org.orekit.forces.ForceModel) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator)

Example 3 with AbstractIntegrator

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

the class RelativityTest method testSmallEffectOnOrbit.

/**
 * check against example in Tapley, Schutz, and Born, p 65-66. They predict a
 * progression of perigee of 11 arcsec/year. To get the same results we must set the
 * propagation tolerances to 1e-5.
 *
 * @throws OrekitException on error
 */
@Test
public void testSmallEffectOnOrbit() throws OrekitException {
    // setup
    final double gm = Constants.EIGEN5C_EARTH_MU;
    Orbit orbit = new KeplerianOrbit(7500e3, 0.025, FastMath.toRadians(41.2), 0, 0, 0, PositionAngle.TRUE, frame, date, gm);
    double[][] tol = NumericalPropagator.tolerances(0.00001, orbit, OrbitType.CARTESIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(1, 3600, tol[0], tol[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(OrbitType.CARTESIAN);
    propagator.addForceModel(new Relativity(gm));
    propagator.setInitialState(new SpacecraftState(orbit));
    // action: propagate a period
    AbsoluteDate end = orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY);
    PVCoordinates actual = propagator.getPVCoordinates(end, frame);
    // verify
    KeplerianOrbit endOrbit = new KeplerianOrbit(actual, frame, end, gm);
    KeplerianOrbit startOrbit = new KeplerianOrbit(orbit);
    double dp = endOrbit.getPerigeeArgument() - startOrbit.getPerigeeArgument();
    double dtYears = end.durationFrom(orbit.getDate()) / Constants.JULIAN_YEAR;
    double dpDeg = FastMath.toDegrees(dp);
    // change in argument of perigee in arcseconds per year
    double arcsecPerYear = dpDeg * 3600 / dtYears;
    Assert.assertEquals(11, arcsecPerYear, 0.5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 4 with AbstractIntegrator

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

the class SolidTidesTest method propagate.

private SpacecraftState propagate(Orbit orbit, AbsoluteDate target, ForceModel... forceModels) throws OrekitException {
    double[][] tolerances = NumericalPropagator.tolerances(10, orbit, OrbitType.KEPLERIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(1.0e-3, 300, tolerances[0], tolerances[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    for (ForceModel forceModel : forceModels) {
        propagator.addForceModel(forceModel);
    }
    propagator.setInitialState(new SpacecraftState(orbit));
    return propagator.propagate(target);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) ForceModel(org.orekit.forces.ForceModel) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator)

Example 5 with AbstractIntegrator

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

the class SolarBodyTest method testPropagationVsEphemeris.

@Test
public void testPropagationVsEphemeris() throws OrekitException {
    Utils.setDataRoot("regular-data");
    // Creation of the celestial bodies of the solar system
    final CelestialBody sun = CelestialBodyFactory.getSun();
    final CelestialBody mercury = CelestialBodyFactory.getMercury();
    final CelestialBody venus = CelestialBodyFactory.getVenus();
    final CelestialBody earth = CelestialBodyFactory.getEarth();
    final CelestialBody mars = CelestialBodyFactory.getMars();
    final CelestialBody jupiter = CelestialBodyFactory.getJupiter();
    final CelestialBody saturn = CelestialBodyFactory.getSaturn();
    final CelestialBody uranus = CelestialBodyFactory.getUranus();
    final CelestialBody neptune = CelestialBodyFactory.getNeptune();
    final CelestialBody pluto = CelestialBodyFactory.getPluto();
    // Starting and end dates
    final AbsoluteDate startingDate = new AbsoluteDate(2000, 1, 2, TimeScalesFactory.getUTC());
    AbsoluteDate endDate = startingDate.shiftedBy(30 * Constants.JULIAN_DAY);
    final Frame icrf = FramesFactory.getICRF();
    // fake orbit around negligible point mass at solar system barycenter
    double negligibleMu = 1.0e-3;
    SpacecraftState initialState = new SpacecraftState(new CartesianOrbit(venus.getPVCoordinates(startingDate, icrf), icrf, startingDate, negligibleMu));
    // Creation of the numerical propagator
    final double[][] tol = NumericalPropagator.tolerances(1000, initialState.getOrbit(), OrbitType.CARTESIAN);
    AbstractIntegrator dop1 = new DormandPrince853Integrator(1.0, 1.0e5, tol[0], tol[1]);
    NumericalPropagator propag = new NumericalPropagator(dop1);
    propag.setOrbitType(OrbitType.CARTESIAN);
    propag.setInitialState(initialState);
    propag.setMu(negligibleMu);
    // Creation of the ForceModels
    propag.addForceModel(new BodyAttraction(sun));
    propag.addForceModel(new BodyAttraction(mercury));
    propag.addForceModel(new BodyAttraction(earth));
    propag.addForceModel(new BodyAttraction(mars));
    propag.addForceModel(new BodyAttraction(jupiter));
    propag.addForceModel(new BodyAttraction(saturn));
    propag.addForceModel(new BodyAttraction(uranus));
    propag.addForceModel(new BodyAttraction(neptune));
    propag.addForceModel(new BodyAttraction(pluto));
    // checks are done within the step handler
    propag.setMasterMode(1000.0, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) throws OrekitException {
            // propagated position should remain within 1400m of ephemeris for one month
            Vector3D propagatedP = currentState.getPVCoordinates(icrf).getPosition();
            Vector3D ephemerisP = venus.getPVCoordinates(currentState.getDate(), icrf).getPosition();
            Assert.assertEquals(0, Vector3D.distance(propagatedP, ephemerisP), 1400.0);
        }
    });
    propag.propagate(startingDate, endDate);
}
Also used : Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) OrekitException(org.orekit.errors.OrekitException) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) Test(org.junit.Test)

Aggregations

AbstractIntegrator (org.hipparchus.ode.AbstractIntegrator)10 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)9 SpacecraftState (org.orekit.propagation.SpacecraftState)8 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)8 AbsoluteDate (org.orekit.time.AbsoluteDate)5 Frame (org.orekit.frames.Frame)4 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)4 Orbit (org.orekit.orbits.Orbit)4 Test (org.junit.Test)3 OrekitException (org.orekit.errors.OrekitException)3 ForceModel (org.orekit.forces.ForceModel)3 CartesianOrbit (org.orekit.orbits.CartesianOrbit)3 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)3 File (java.io.File)2 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)2 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)2 ClassicalRungeKuttaIntegrator (org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator)2 DataProvidersManager (org.orekit.data.DataProvidersManager)2 DirectoryCrawler (org.orekit.data.DirectoryCrawler)2 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)2