DSSTZonalContext.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.util.FastMath;
  19. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  20. import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;

  21. /**
  22.  * This class is a container for the common parameters used in {@link DSSTZonal}.
  23.  * <p>
  24.  * It performs parameters initialization at each integration step for the Zonal contribution
  25.  * to the central body gravitational perturbation.
  26.  * </p>
  27.  * @author Bryan Cazabonne
  28.  * @since 10.0
  29.  */
  30. public class DSSTZonalContext extends ForceModelContext {

  31.     // Common factors for potential computation
  32.     /** A = sqrt(μ * a). */
  33.     private final double A;
  34.     /** &Chi; = 1 / sqrt(1 - e²) = 1 / B. */
  35.     private double X;
  36.     /** &Chi;². */
  37.     private double XX;
  38.     /** &Chi;³. */
  39.     private double XXX;
  40.     /** 1 / (A * B) . */
  41.     private double ooAB;
  42.     /** B / A . */
  43.     private double BoA;
  44.     /** B / A(1 + B) . */
  45.     private double BoABpo;
  46.     /** -C / (2 * A * B) . */
  47.     private double mCo2AB;
  48.     /** -2 * a / A . */
  49.     private double m2aoA;
  50.     /** μ / a . */
  51.     private double muoa;
  52.     /** R / a . */
  53.     private double roa;

  54.     /** Keplerian mean motion. */
  55.     private final double n;

  56.     // Short period terms
  57.     /** h * k. */
  58.     private double hk;
  59.     /** k² - h². */
  60.     private double k2mh2;
  61.     /** (k² - h²) / 2. */
  62.     private double k2mh2o2;
  63.     /** 1 / (n² * a²). */
  64.     private double oon2a2;
  65.     /** 1 / (n² * a) . */
  66.     private double oon2a;
  67.     /** χ³ / (n² * a). */
  68.     private double x3on2a;
  69.     /** χ / (n² * a²). */
  70.     private double xon2a2;
  71.     /** (C * χ) / ( 2 * n² * a² ). */
  72.     private double cxo2n2a2;
  73.     /** (χ²) / (n² * a² * (χ + 1 ) ). */
  74.     private double x2on2a2xp1;
  75.     /** B * B. */
  76.     private double BB;

  77.     /**
  78.      * Simple constructor.
  79.      *
  80.      * @param auxiliaryElements auxiliary elements related to the current orbit
  81.      * @param provider          provider for spherical harmonics
  82.      * @param parameters        values of the force model parameters
  83.      */
  84.     DSSTZonalContext(final AuxiliaryElements auxiliaryElements,
  85.                      final UnnormalizedSphericalHarmonicsProvider provider,
  86.             final double[] parameters) {

  87.         super(auxiliaryElements);

  88.         final double mu = parameters[0];

  89.         // Keplerian Mean Motion
  90.         final double absA = FastMath.abs(auxiliaryElements.getSma());
  91.         n = FastMath.sqrt(mu / absA) / absA;

  92.         A = FastMath.sqrt(mu * auxiliaryElements.getSma());

  93.         // &Chi; = 1 / B
  94.         X = 1. / auxiliaryElements.getB();
  95.         XX = X * X;
  96.         XXX = X * XX;

  97.         // 1 / AB
  98.         ooAB = 1. / (A * auxiliaryElements.getB());
  99.         // B / A
  100.         BoA = auxiliaryElements.getB() / A;
  101.         // -C / 2AB
  102.         mCo2AB = -auxiliaryElements.getC() * ooAB / 2.;
  103.         // B / A(1 + B)
  104.         BoABpo = BoA / (1. + auxiliaryElements.getB());
  105.         // -2 * a / A
  106.         m2aoA = -2 * auxiliaryElements.getSma() / A;
  107.         // μ / a
  108.         muoa = mu / auxiliaryElements.getSma();
  109.         // R / a
  110.         roa = provider.getAe() / auxiliaryElements.getSma();

  111.         // Short period terms

  112.         // h * k.
  113.         hk = auxiliaryElements.getH() * auxiliaryElements.getK();
  114.         // k² - h².
  115.         k2mh2 = auxiliaryElements.getK() * auxiliaryElements.getK() - auxiliaryElements.getH() * auxiliaryElements.getH();
  116.         // (k² - h²) / 2.
  117.         k2mh2o2 = k2mh2 / 2.;
  118.         // 1 / (n² * a²) = 1 / (n * A)
  119.         oon2a2 = 1 / (A * n);
  120.         // 1 / (n² * a) = a / (n * A)
  121.         oon2a = auxiliaryElements.getSma() * oon2a2;
  122.         // χ³ / (n² * a)
  123.         x3on2a = XXX * oon2a;
  124.         // χ / (n² * a²)
  125.         xon2a2 = X * oon2a2;
  126.         // (C * χ) / ( 2 * n² * a² )
  127.         cxo2n2a2 = xon2a2 * auxiliaryElements.getC() / 2;
  128.         // (χ²) / (n² * a² * (χ + 1 ) )
  129.         x2on2a2xp1 = xon2a2 * X / (X + 1);
  130.         // B * B
  131.         BB = auxiliaryElements.getB() * auxiliaryElements.getB();
  132.     }

  133.     /** Get &Chi; = 1 / sqrt(1 - e²) = 1 / B.
  134.      * @return &Chi;
  135.      */
  136.     public double getX() {
  137.         return X;
  138.     }

  139.     /** Get &Chi;².
  140.      * @return &Chi;².
  141.      */
  142.     public double getXX() {
  143.         return XX;
  144.     }

  145.     /** Get &Chi;³.
  146.      * @return &Chi;³
  147.      */
  148.     public double getXXX() {
  149.         return XXX;
  150.     }

  151.     /** Get m2aoA = -2 * a / A.
  152.      * @return m2aoA
  153.      */
  154.     public double getM2aoA() {
  155.         return m2aoA;
  156.     }

  157.     /** Get B / A.
  158.      * @return BoA
  159.      */
  160.     public double getBoA() {
  161.         return BoA;
  162.     }

  163.     /** Get ooAB = 1 / (A * B).
  164.      * @return ooAB
  165.      */
  166.     public double getOoAB() {
  167.         return ooAB;
  168.     }

  169.     /** Get mCo2AB = -C / 2AB.
  170.      * @return mCo2AB
  171.      */
  172.     public double getMCo2AB() {
  173.         return mCo2AB;
  174.     }

  175.     /** Get BoABpo = B / A(1 + B).
  176.      * @return BoABpo
  177.      */
  178.     public double getBoABpo() {
  179.         return BoABpo;
  180.     }

  181.     /** Get μ / a .
  182.      * @return muoa
  183.      */
  184.     public double getMuoa() {
  185.         return muoa;
  186.     }

  187.     /** Get roa = R / a.
  188.      * @return roa
  189.      */
  190.     public double getRoa() {
  191.         return roa;
  192.     }

  193.     /** Get the Keplerian mean motion.
  194.      * <p>The Keplerian mean motion is computed directly from semi major axis
  195.      * and central acceleration constant.</p>
  196.      * @return Keplerian mean motion in radians per second
  197.      */
  198.     public double getMeanMotion() {
  199.         return n;
  200.     }

  201.     /** Get h * k.
  202.      * @return hk
  203.      */
  204.     public double getHK() {
  205.         return hk;
  206.     }

  207.     /** Get k² - h².
  208.      * @return k2mh2
  209.      */
  210.     public double getK2MH2() {
  211.         return k2mh2;
  212.     }

  213.     /** Get (k² - h²) / 2.
  214.      * @return k2mh2o2
  215.      */
  216.     public double getK2MH2O2() {
  217.         return k2mh2o2;
  218.     }

  219.     /** Get 1 / (n² * a²).
  220.      * @return oon2a2
  221.      */
  222.     public double getOON2A2() {
  223.         return oon2a2;
  224.     }

  225.     /** Get χ³ / (n² * a).
  226.      * @return x3on2a
  227.      */
  228.     public double getX3ON2A() {
  229.         return x3on2a;
  230.     }

  231.     /** Get χ / (n² * a²).
  232.      * @return xon2a2
  233.      */
  234.     public double getXON2A2() {
  235.         return xon2a2;
  236.     }

  237.     /** Get (C * χ) / ( 2 * n² * a² ).
  238.      * @return cxo2n2a2
  239.      */
  240.     public double getCXO2N2A2() {
  241.         return cxo2n2a2;
  242.     }

  243.     /** Get (χ²) / (n² * a² * (χ + 1 ) ).
  244.      * @return x2on2a2xp1
  245.      */
  246.     public double getX2ON2A2XP1() {
  247.         return x2on2a2xp1;
  248.     }

  249.     /** Get B * B.
  250.      * @return BB
  251.      */
  252.     public double getBB() {
  253.         return BB;
  254.     }

  255. }