DSSTThirdBodyDynamicContext.java

  1. /* Copyright 2002-2023 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.propagation.semianalytical.dsst.forces;

  18. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.hipparchus.util.FastMath;
  20. import org.orekit.bodies.CelestialBody;
  21. import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;

  22. /**
  23.  * This class is a container for the common parameters used in
  24.  * {@link DSSTThirdBody}.
  25.  * <p>
  26.  * It performs parameters initialization at each integration step for the third
  27.  * body attraction perturbation. These parameters change for each integration
  28.  * step.
  29.  * </p>
  30.  * @author Bryan Cazabonne
  31.  * @since 11.3.3
  32.  */
  33. public class DSSTThirdBodyDynamicContext extends ForceModelContext {

  34.     /** Standard gravitational parameter μ for the body in m³/s². */
  35.     private double gm;

  36.     /** Distance from center of mass of the central body to the 3rd body. */
  37.     private double R3;

  38.     /** A = sqrt(μ * a). */
  39.     private double A;

  40.     /** α. */
  41.     private double alpha;

  42.     /** β. */
  43.     private double beta;

  44.     /** γ. */
  45.     private double gamma;

  46.     /** B². */
  47.     private double BB;

  48.     /** B³. */
  49.     private double BBB;

  50.     /** &Chi; = 1 / sqrt(1 - e²) = 1 / B. */
  51.     private double X;

  52.     /** &Chi;². */
  53.     private double XX;

  54.     /** &Chi;³. */
  55.     private double XXX;

  56.     /** -2 * a / A. */
  57.     private double m2aoA;

  58.     /** B / A. */
  59.     private double BoA;

  60.     /** 1 / (A * B). */
  61.     private double ooAB;

  62.     /** -C / (2 * A * B). */
  63.     private double mCo2AB;

  64.     /** B / A(1 + B). */
  65.     private double BoABpo;

  66.     /** mu3 / R3. */
  67.     private double muoR3;

  68.     /** b = 1 / (1 + sqrt(1 - e²)) = 1 / (1 + B). */
  69.     private double b;

  70.     /** h * &Chi;³. */
  71.     private double hXXX;

  72.     /** k * &Chi;³. */
  73.     private double kXXX;

  74.     /** Keplerian mean motion. */
  75.     private double motion;

  76.     /** Constructor.
  77.      * @param aux auxiliary elements related to the current orbit
  78.      * @param body body the 3rd body to consider
  79.      * @param parameters values of the force model parameters
  80.      */
  81.     public DSSTThirdBodyDynamicContext(final AuxiliaryElements aux,
  82.                                        final CelestialBody body,
  83.                                        final double[] parameters) {
  84.         super(aux);

  85.         // Parameters related to force model drivers
  86.         final double mu = parameters[1];
  87.         A = FastMath.sqrt(mu * aux.getSma());
  88.         this.gm = parameters[0];
  89.         final double absA = FastMath.abs(aux.getSma());
  90.         motion = FastMath.sqrt(mu / absA) / absA;

  91.         // Distance from center of mass of the central body to the 3rd body
  92.         final Vector3D bodyPos = body.getPosition(aux.getDate(), aux.getFrame());
  93.         R3 = bodyPos.getNorm();

  94.         // Direction cosines
  95.         final Vector3D bodyDir = bodyPos.normalize();
  96.         alpha = bodyDir.dotProduct(aux.getVectorF());
  97.         beta = bodyDir.dotProduct(aux.getVectorG());
  98.         gamma = bodyDir.dotProduct(aux.getVectorW());

  99.         // &Chi;<sup>-2</sup>.
  100.         BB = aux.getB() * aux.getB();
  101.         // &Chi;<sup>-3</sup>.
  102.         BBB = BB * aux.getB();

  103.         // b = 1 / (1 + B)
  104.         b = 1. / (1. + aux.getB());

  105.         // &Chi;
  106.         X = 1. / aux.getB();
  107.         XX = X * X;
  108.         XXX = X * XX;
  109.         // -2 * a / A
  110.         m2aoA = -2. * aux.getSma() / A;
  111.         // B / A
  112.         BoA = aux.getB() / A;
  113.         // 1 / AB
  114.         ooAB = 1. / (A * aux.getB());
  115.         // -C / 2AB
  116.         mCo2AB = -aux.getC() * ooAB / 2.;
  117.         // B / A(1 + B)
  118.         BoABpo = BoA / (1. + aux.getB());

  119.         // mu3 / R3
  120.         muoR3 = gm / R3;

  121.         // h * &Chi;³
  122.         hXXX = aux.getH() * XXX;
  123.         // k * &Chi;³
  124.         kXXX = aux.getK() * XXX;

  125.     }

  126.     /** Get A = sqrt(μ * a).
  127.      * @return A
  128.      */
  129.     public double getA() {
  130.         return A;
  131.     }

  132.     /** Get the distance from center of mass of the central body to the 3rd body.
  133.      * @return the distance from center of mass of the central body to the 3rd body
  134.      */
  135.     public double getR3() {
  136.         return R3;
  137.     }

  138.     /** Get direction cosine α for central body.
  139.      * @return α
  140.      */
  141.     public double getAlpha() {
  142.         return alpha;
  143.     }

  144.     /** Get direction cosine β for central body.
  145.      * @return β
  146.      */
  147.     public double getBeta() {
  148.         return beta;
  149.     }

  150.     /** Get direction cosine γ for central body.
  151.      * @return γ
  152.      */
  153.     public double getGamma() {
  154.         return gamma;
  155.     }

  156.     /** Get B².
  157.      * @return B²
  158.      */
  159.     public double getBB() {
  160.         return BB;
  161.     }

  162.     /** Get B³.
  163.      * @return B³
  164.      */
  165.     public double getBBB() {
  166.         return BBB;
  167.     }

  168.     /** Get b = 1 / (1 + sqrt(1 - e²)) = 1 / (1 + B).
  169.      * @return b
  170.      */
  171.     public double getb() {
  172.         return b;
  173.     }

  174.     /** Get &Chi; = 1 / sqrt(1 - e²) = 1 / B.
  175.      * @return &Chi;
  176.      */
  177.     public double getX() {
  178.         return X;
  179.     }

  180.     /** Get &Chi;².
  181.      * @return &Chi;²
  182.      */
  183.     public double getXX() {
  184.         return XX;
  185.     }

  186.     /** Get m2aoA = -2 * a / A.
  187.      * @return m2aoA
  188.      */
  189.     public double getM2aoA() {
  190.         return m2aoA;
  191.     }

  192.     /** Get B / A.
  193.      * @return BoA
  194.      */
  195.     public double getBoA() {
  196.         return BoA;
  197.     }

  198.     /** Get ooAB = 1 / (A * B).
  199.      * @return ooAB
  200.      */
  201.     public double getOoAB() {
  202.         return ooAB;
  203.     }

  204.     /** Get mCo2AB = -C / 2AB.
  205.      * @return mCo2AB
  206.      */
  207.     public double getMCo2AB() {
  208.         return mCo2AB;
  209.     }

  210.     /** Get BoABpo = B / A(1 + B).
  211.      * @return BoABpo
  212.      */
  213.     public double getBoABpo() {
  214.         return BoABpo;
  215.     }

  216.     /** Get muoR3 = mu3 / R3.
  217.      * @return muoR3
  218.      */
  219.     public double getMuoR3() {
  220.         return muoR3;
  221.     }

  222.     /** Get hXXX = h * &Chi;³.
  223.      * @return hXXX
  224.      */
  225.     public double getHXXX() {
  226.         return hXXX;
  227.     }

  228.     /** Get kXXX = h * &Chi;³.
  229.      * @return kXXX
  230.      */
  231.     public double getKXXX() {
  232.         return kXXX;
  233.     }

  234.     /** Get the Keplerian mean motion.
  235.      * <p>The Keplerian mean motion is computed directly from semi major axis
  236.      * and central acceleration constant.</p>
  237.      * @return Keplerian mean motion in radians per second
  238.      */
  239.     public double getMeanMotion() {
  240.         return motion;
  241.     }

  242. }