FieldDSSTZonalContext.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.propagation.semianalytical.dsst.forces;

  18. import org.hipparchus.RealFieldElement;
  19. import org.hipparchus.util.FastMath;
  20. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  21. import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;

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

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

  55.     /** Keplerian mean motion. */
  56.     private final T n;

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

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

  88.         super(auxiliaryElements);

  89.         final T mu = parameters[0];

  90.         // Keplerian mean motion
  91.         final T absA = FastMath.abs(auxiliaryElements.getSma());
  92.         n = FastMath.sqrt(mu.divide(absA)).divide(absA);

  93.         A = FastMath.sqrt(mu.multiply(auxiliaryElements.getSma()));

  94.         // &Chi; = 1 / B
  95.         X   = auxiliaryElements.getB().reciprocal();
  96.         XX  = X.multiply(X);
  97.         XXX = X.multiply(XX);

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

  112.         // Short period terms

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

  133.     }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  256. }