Search in sources :

Example 1 with PoissonSeries

use of org.orekit.data.PoissonSeries in project Orekit by CS-SI.

the class SolidTidesFieldTest method testK1Example.

@Test
public void testK1Example() throws OrekitException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
    // the reference for this test is the example at the bottom of page 86, IERS conventions 2010 section 6.2.1
    final PoissonSeriesParser k21Parser = new PoissonSeriesParser(18).withOptionalColumn(1).withDoodson(4, 3).withFirstDelaunay(10);
    final String name = "/tides/tab6.5a-only-K1.txt";
    final double pico = 1.0e-12;
    final PoissonSeries c21Series = k21Parser.withSinCos(0, 17, pico, 18, pico).parse(getClass().getResourceAsStream(name), name);
    final PoissonSeries s21Series = k21Parser.withSinCos(0, 18, -pico, 17, pico).parse(getClass().getResourceAsStream(name), name);
    final UT1Scale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, false);
    final TimeScalarFunction gmstFunction = IERSConventions.IERS_2010.getGMSTFunction(ut1);
    Method getNA = IERSConventions.class.getDeclaredMethod("getNutationArguments", TimeScale.class);
    getNA.setAccessible(true);
    final FundamentalNutationArguments arguments = (FundamentalNutationArguments) getNA.invoke(IERSConventions.IERS_2010, ut1);
    TimeVectorFunction deltaCSFunction = new TimeVectorFunction() {

        public double[] value(final AbsoluteDate date) {
            final BodiesElements elements = arguments.evaluateAll(date);
            return new double[] { 0.0, c21Series.value(elements), s21Series.value(elements), 0.0, 0.0 };
        }

        public <T extends RealFieldElement<T>> T[] value(final FieldAbsoluteDate<T> date) {
            // never called in this test
            throw new OrekitInternalError(null);
        }
    };
    SolidTidesField tf = new SolidTidesField(IERSConventions.IERS_2010.getLoveNumbers(), deltaCSFunction, IERSConventions.IERS_2010.getPermanentTide(), IERSConventions.IERS_2010.getSolidPoleTide(ut1.getEOPHistory()), FramesFactory.getITRF(IERSConventions.IERS_2010, false), Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, TideSystem.ZERO_TIDE, CelestialBodyFactory.getSun(), CelestialBodyFactory.getMoon());
    Method frequencyDependentPart = SolidTidesField.class.getDeclaredMethod("frequencyDependentPart", AbsoluteDate.class, double[][].class, double[][].class);
    frequencyDependentPart.setAccessible(true);
    double[][] cachedCNM = new double[5][5];
    double[][] cachedSNM = new double[5][5];
    AbsoluteDate t0 = new AbsoluteDate(2003, 5, 6, 13, 43, 32.125, TimeScalesFactory.getUTC());
    for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 300) {
        AbsoluteDate date = t0.shiftedBy(dt);
        for (int i = 0; i < cachedCNM.length; ++i) {
            Arrays.fill(cachedCNM[i], 0.0);
            Arrays.fill(cachedSNM[i], 0.0);
        }
        frequencyDependentPart.invoke(tf, date, cachedCNM, cachedSNM);
        double thetaPlusPi = gmstFunction.value(date) + FastMath.PI;
        Assert.assertEquals(470.9e-12 * FastMath.sin(thetaPlusPi) - 30.2e-12 * FastMath.cos(thetaPlusPi), cachedCNM[2][1], 2.0e-25);
        Assert.assertEquals(470.9e-12 * FastMath.cos(thetaPlusPi) + 30.2e-12 * FastMath.sin(thetaPlusPi), cachedSNM[2][1], 2.0e-25);
    }
}
Also used : FundamentalNutationArguments(org.orekit.data.FundamentalNutationArguments) OrekitInternalError(org.orekit.errors.OrekitInternalError) RealFieldElement(org.hipparchus.RealFieldElement) Method(java.lang.reflect.Method) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) TimeVectorFunction(org.orekit.time.TimeVectorFunction) UT1Scale(org.orekit.time.UT1Scale) BodiesElements(org.orekit.data.BodiesElements) PoissonSeries(org.orekit.data.PoissonSeries) PoissonSeriesParser(org.orekit.data.PoissonSeriesParser) TimeScalarFunction(org.orekit.time.TimeScalarFunction) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 RealFieldElement (org.hipparchus.RealFieldElement)1 Test (org.junit.Test)1 BodiesElements (org.orekit.data.BodiesElements)1 FundamentalNutationArguments (org.orekit.data.FundamentalNutationArguments)1 PoissonSeries (org.orekit.data.PoissonSeries)1 PoissonSeriesParser (org.orekit.data.PoissonSeriesParser)1 OrekitInternalError (org.orekit.errors.OrekitInternalError)1 AbsoluteDate (org.orekit.time.AbsoluteDate)1 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)1 TimeScalarFunction (org.orekit.time.TimeScalarFunction)1 TimeVectorFunction (org.orekit.time.TimeVectorFunction)1 UT1Scale (org.orekit.time.UT1Scale)1