LenseThirringRelativity.java

  1. /* Copyright 2002-2020 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.stream.Stream;

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

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

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

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

  58.     /** Driver for gravitational parameter. */
  59.     private final ParameterDriver gmParameterDriver;

  60.     /** Central body frame. */
  61.     private final Frame bodyFrame;

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

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

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

  81.         // Useful constant
  82.         final double c2 = Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT;

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

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

  89.         // Radius
  90.         final double r  = p.getNorm();
  91.         final double r2 = r * r;

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

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

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

  106.         // Useful constant
  107.         final double c2 = Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT;

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

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

  114.         // Radius
  115.         final T r  = p.getNorm();
  116.         final T r2 = r.multiply(r);

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

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

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

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

  136.     /** {@inheritDoc} */
  137.     @Override
  138.     public ParameterDriver[] getParametersDrivers() {
  139.         return new ParameterDriver[] {
  140.             gmParameterDriver
  141.         };
  142.     }

  143. }