LenseThirringRelativity.java

  1. /* Copyright 2002-2022 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.forces.gravity;

  18. import java.util.Collections;
  19. import java.util.List;
  20. import java.util.stream.Stream;

  21. import org.hipparchus.Field;
  22. import org.hipparchus.CalculusFieldElement;
  23. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  24. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  25. import org.hipparchus.util.FastMath;
  26. import org.orekit.forces.AbstractForceModel;
  27. import org.orekit.frames.FieldTransform;
  28. import org.orekit.frames.Frame;
  29. import org.orekit.frames.Transform;
  30. import org.orekit.propagation.FieldSpacecraftState;
  31. import org.orekit.propagation.SpacecraftState;
  32. import org.orekit.propagation.events.EventDetector;
  33. import org.orekit.propagation.events.FieldEventDetector;
  34. import org.orekit.utils.Constants;
  35. import org.orekit.utils.FieldPVCoordinates;
  36. import org.orekit.utils.PVCoordinates;
  37. import org.orekit.utils.ParameterDriver;

  38. /**
  39.  * Lense-Thirring post-Newtonian correction force due to general relativity.
  40.  * <p>
  41.  * Lense-Thirring term causes a precession of the orbital plane at a rate of
  42.  * the order of 0.8 mas per year (geostationary) to 180 mas per year (low orbit).
  43.  * </p>
  44.  * @see "Petit, G. and Luzum, B. (eds.), IERS Conventions (2010), Chapter 10,
  45.  * General relativistic models for space-time coordinates and equations of motion (2010)"
  46.  *
  47.  * @author Bryan Cazabonne
  48.  * @since 10.3
  49.  */
  50. public class LenseThirringRelativity extends AbstractForceModel {

  51.     /** Intensity of the Earth's angular momentum per unit mass [m²/s]. */
  52.     private static final double J = 9.8e8;

  53.     /** Central attraction scaling factor.
  54.      * <p>
  55.      * We use a power of 2 to avoid numeric noise introduction
  56.      * in the multiplications/divisions sequences.
  57.      * </p>
  58.      */
  59.     private static final double MU_SCALE = FastMath.scalb(1.0, 32);

  60.     /** Driver for gravitational parameter. */
  61.     private final ParameterDriver gmParameterDriver;

  62.     /** Central body frame. */
  63.     private final Frame bodyFrame;

  64.     /**
  65.      * Constructor.
  66.      * @param gm Earth's gravitational parameter.
  67.      * @param bodyFrame central body frame
  68.      */
  69.     public LenseThirringRelativity(final double gm, final Frame bodyFrame) {
  70.         gmParameterDriver = new ParameterDriver(NewtonianAttraction.CENTRAL_ATTRACTION_COEFFICIENT,
  71.                                                 gm, MU_SCALE,
  72.                                                 0.0, Double.POSITIVE_INFINITY);
  73.         this.bodyFrame = bodyFrame;
  74.     }

  75.     /** {@inheritDoc} */
  76.     @Override
  77.     public boolean dependsOnPositionOnly() {
  78.         return false;
  79.     }

  80.     /** {@inheritDoc} */
  81.     @Override
  82.     public Vector3D acceleration(final SpacecraftState s, final double[] parameters) {

  83.         // Useful constant
  84.         final double c2 = Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT;

  85.         // Earth's gravitational parameter
  86.         final double gm = parameters[0];

  87.         // Satellite position and velocity with respect to the Earth
  88.         final PVCoordinates pv = s.getPVCoordinates();
  89.         final Vector3D p = pv.getPosition();
  90.         final Vector3D v = pv.getVelocity();

  91.         // Radius
  92.         final double r  = p.getNorm();
  93.         final double r2 = r * r;

  94.         // Earth’s angular momentum per unit mass
  95.         final Transform t = bodyFrame.getTransformTo(s.getFrame(), s.getDate());
  96.         final Vector3D  j = t.transformVector(Vector3D.PLUS_K).scalarMultiply(J);

  97.         // Eq. 10.12
  98.         return new Vector3D(3.0 * p.dotProduct(j) / r2,
  99.                             p.crossProduct(v),
  100.                             1.0,
  101.                             v.crossProduct(j))
  102.                             .scalarMultiply((2.0 * gm) / (r2 * r * c2));
  103.     }

  104.     /** {@inheritDoc} */
  105.     @Override
  106.     public <T extends CalculusFieldElement<T>> FieldVector3D<T> acceleration(final FieldSpacecraftState<T> s,
  107.                                                                          final T[] parameters) {

  108.         // Useful constant
  109.         final double c2 = Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT;

  110.         // Earth's gravitational parameter
  111.         final T gm = parameters[0];

  112.         // Satellite position and velocity with respect to the Earth
  113.         final FieldPVCoordinates<T> pv = s.getPVCoordinates();
  114.         final FieldVector3D<T> p = pv.getPosition();
  115.         final FieldVector3D<T> v = pv.getVelocity();

  116.         // Radius
  117.         final T r  = p.getNorm();
  118.         final T r2 = r.multiply(r);

  119.         // Earth’s angular momentum per unit mass
  120.         final FieldTransform<T> t = bodyFrame.getTransformTo(s.getFrame(), s.getDate());
  121.         final FieldVector3D<T>  j = t.transformVector(Vector3D.PLUS_K).scalarMultiply(J);

  122.         return new FieldVector3D<>(p.dotProduct(j).multiply(3.0).divide(r2),
  123.                                    p.crossProduct(v),
  124.                                    r.getField().getOne(),
  125.                                    v.crossProduct(j))
  126.                                    .scalarMultiply(gm.multiply(2.0).divide(r2.multiply(r).multiply(c2)));
  127.     }

  128.     /** {@inheritDoc} */
  129.     @Override
  130.     public Stream<EventDetector> getEventsDetectors() {
  131.         return Stream.empty();
  132.     }

  133.     /** {@inheritDoc} */
  134.     @Override
  135.     public <T extends CalculusFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventsDetectors(final Field<T> field) {
  136.         return Stream.empty();
  137.     }

  138.     /** {@inheritDoc} */
  139.     @Override
  140.     public List<ParameterDriver> getParametersDrivers() {
  141.         return Collections.singletonList(gmParameterDriver);
  142.     }

  143. }