use of org.orekit.data.BodiesElements 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);
}
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingTest method doTestOnsala.
private void doTestOnsala(boolean patchEarthRotation, double tolerance) throws OrekitException {
OceanLoadingCoefficientsBLQFactory factory = new OceanLoadingCoefficientsBLQFactory("^hardisp\\.blq$");
OceanLoadingCoefficients coefficients = factory.getCoefficients("Onsala");
Vector3D refPoint = earth.transform(coefficients.getSiteLocation());
OceanLoading loading = new OceanLoading(earth, coefficients);
TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
if (patchEarthRotation) {
TideTest.patchEarthRotationModel(fna, ut1);
}
AbsoluteDate t0 = new AbsoluteDate("2009-06-25T01:10:45", ut1);
double[][] ref = new double[][] { { 0.003094, -0.001538, -0.000895 }, { 0.001812, -0.000950, -0.000193 }, { 0.000218, -0.000248, 0.000421 }, { -0.001104, 0.000404, 0.000741 }, { -0.001668, 0.000863, 0.000646 }, { -0.001209, 0.001042, 0.000137 }, { 0.000235, 0.000926, -0.000667 }, { 0.002337, 0.000580, -0.001555 }, { 0.004554, 0.000125, -0.002278 }, { 0.006271, -0.000291, -0.002615 }, { 0.006955, -0.000537, -0.002430 }, { 0.006299, -0.000526, -0.001706 }, { 0.004305, -0.000244, -0.000559 }, { 0.001294, 0.000245, 0.000793 }, { -0.002163, 0.000819, 0.002075 }, { -0.005375, 0.001326, 0.003024 }, { -0.007695, 0.001622, 0.003448 }, { -0.008669, 0.001610, 0.003272 }, { -0.008143, 0.001262, 0.002557 }, { -0.006290, 0.000633, 0.001477 }, { -0.003566, -0.000155, 0.000282 }, { -0.000593, -0.000941, -0.000766 }, { 0.001992, -0.001561, -0.001457 }, { 0.003689, -0.001889, -0.001680 } };
for (int i = 0; i < ref.length; ++i) {
BodiesElements elements = fna.evaluateAll(t0.shiftedBy(i * 3600.0));
final Vector3D d = loading.displacement(elements, earth.getBodyFrame(), refPoint);
Assert.assertEquals(ref[i][0], Vector3D.dotProduct(d, coefficients.getSiteLocation().getZenith()), tolerance);
Assert.assertEquals(ref[i][1], Vector3D.dotProduct(d, coefficients.getSiteLocation().getSouth()), tolerance);
Assert.assertEquals(ref[i][2], Vector3D.dotProduct(d, coefficients.getSiteLocation().getWest()), tolerance);
}
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingTest method testTidesRatesFutureInversion.
@Test
public void testTidesRatesFutureInversion() throws OrekitException {
// on 56824-11-02, the rates for semidiurnal tides 274554 (R₂) and 274556 cross over
final TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
final FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
final Tide tide1 = new Tide(274554);
final Tide tide2 = new Tide(274556);
final AbsoluteDate t1700 = new AbsoluteDate(56824, 11, 2, 17, 0, 0.0, TimeScalesFactory.getTAI());
final BodiesElements el1700 = fna.evaluateAll(t1700);
Assert.assertTrue(tide1.getRate(el1700) < tide2.getRate(el1700));
final AbsoluteDate t1800 = t1700.shiftedBy(3600.0);
final BodiesElements el1800 = fna.evaluateAll(t1800);
Assert.assertTrue(tide1.getRate(el1800) > tide2.getRate(el1800));
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingTest method testStableRates.
@Test
public void testStableRates() throws OrekitException {
// this test checks that tides sort order is date-independent for a large time range
// (almost 180000 years long)
// tides sort-order is based on rate, but the rates varies slightly with dates
// (because Delaunay nutation arguments are polynomials)
// The variations are however small and we want to make sure
// that if rate(tideA) < rate(tideB) at time t0, this order remains
// the same for t1 a few millenia around t0
final TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
final FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
// initial sort at J2000.0
final BodiesElements el2000 = fna.evaluateAll(AbsoluteDate.J2000_EPOCH);
List<Tide> tides = getTides();
Collections.sort(tides, (t1, t2) -> Double.compare(t1.getRate(el2000), t2.getRate(el2000)));
for (double dt = -122000; dt < 54000; dt += 100) {
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt * Constants.JULIAN_YEAR);
final BodiesElements el = fna.evaluateAll(date);
for (int i = 1; i < tides.size(); ++i) {
final Tide t1 = tides.get(i - 1);
final Tide t2 = tides.get(i);
Assert.assertTrue(t1.getRate(el) < t2.getRate(el));
}
}
}
use of org.orekit.data.BodiesElements in project Orekit by CS-SI.
the class OceanLoadingTest method doTestReykjavik.
private void doTestReykjavik(boolean patchEarthRotation, double tolerance) throws OrekitException {
// the coordinates for Reykjavik are *known* to be wrong in this test file
// these test data have been extracted from the HARDISP.F file in September 2017
// and it seems longitude and latitude have been exchanged...
// With the file coordinates, Reykjavik would be somewhere in the Indian Ocean, about 1800km East of Madagascar
// The error has been reported to IERS conventions center.
OceanLoadingCoefficientsBLQFactory factory = new OceanLoadingCoefficientsBLQFactory("^hardisp\\.blq$");
OceanLoadingCoefficients coefficients = factory.getCoefficients("Reykjavik");
Vector3D refPoint = earth.transform(coefficients.getSiteLocation());
OceanLoading loading = new OceanLoading(earth, coefficients);
TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
FundamentalNutationArguments fna = IERSConventions.IERS_2010.getNutationArguments(ut1);
if (patchEarthRotation) {
TideTest.patchEarthRotationModel(fna, ut1);
}
AbsoluteDate t0 = new AbsoluteDate("2009-06-25T01:10:45", ut1);
double[][] ref = new double[][] { { -0.005940, -0.001245, -0.000278 }, { 0.013516, -0.001086, 0.003212 }, { 0.029599, -0.000353, 0.005483 }, { 0.038468, 0.000699, 0.005997 }, { 0.038098, 0.001721, 0.004690 }, { 0.028780, 0.002363, 0.001974 }, { 0.013016, 0.002371, -0.001369 }, { -0.005124, 0.001653, -0.004390 }, { -0.021047, 0.000310, -0.006225 }, { -0.030799, -0.001383, -0.006313 }, { -0.032056, -0.003048, -0.004549 }, { -0.024698, -0.004288, -0.001314 }, { -0.010814, -0.004794, 0.002623 }, { 0.005849, -0.004416, 0.006291 }, { 0.020857, -0.003208, 0.008766 }, { 0.030226, -0.001413, 0.009402 }, { 0.031437, 0.000594, 0.007996 }, { 0.024079, 0.002389, 0.004844 }, { 0.009945, 0.003606, 0.000663 }, { -0.007426, 0.004022, -0.003581 }, { -0.023652, 0.003601, -0.006911 }, { -0.034618, 0.002505, -0.008585 }, { -0.037515, 0.001044, -0.008270 }, { -0.031544, -0.000402, -0.006125 } };
for (int i = 0; i < ref.length; ++i) {
BodiesElements elements = fna.evaluateAll(t0.shiftedBy(i * 3600.0));
final Vector3D d = loading.displacement(elements, earth.getBodyFrame(), refPoint);
Assert.assertEquals(ref[i][0], Vector3D.dotProduct(d, coefficients.getSiteLocation().getZenith()), tolerance);
Assert.assertEquals(ref[i][1], Vector3D.dotProduct(d, coefficients.getSiteLocation().getSouth()), tolerance);
Assert.assertEquals(ref[i][2], Vector3D.dotProduct(d, coefficients.getSiteLocation().getWest()), tolerance);
}
}
Aggregations