FieldDSSTZonalContext.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.CalculusFieldElement;
  19. import org.hipparchus.util.FastMath;
  20. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  21. import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
  22. import org.orekit.time.AbsoluteDate;

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

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

  57.     /** Keplerian mean motion. */
  58.     private final T n;

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

  80.     /**
  81.      * Simple constructor.
  82.      *
  83.      * @param auxiliaryElements auxiliary elements related to the current orbit
  84.      * @param provider          provider for spherical harmonics
  85.      * @param parameters        values of the force model parameters (only 1 values
  86.      * for each parameters corresponding to state date) obtained by calling the extract
  87.      * parameter method {@link #extractParameters(double[], AbsoluteDate)}
  88.      * to selected the right value for state date or by getting the parameters for a specific date
  89.      */
  90.     FieldDSSTZonalContext(final FieldAuxiliaryElements<T> auxiliaryElements,
  91.                                  final UnnormalizedSphericalHarmonicsProvider provider,
  92.                                  final T[] parameters) {

  93.         super(auxiliaryElements);

  94.         final T mu = parameters[0];

  95.         // Keplerian mean motion
  96.         final T absA = FastMath.abs(auxiliaryElements.getSma());
  97.         n = FastMath.sqrt(mu.divide(absA)).divide(absA);

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

  99.         // &Chi; = 1 / B
  100.         X = auxiliaryElements.getB().reciprocal();
  101.         XX = X.multiply(X);
  102.         XXX = X.multiply(XX);

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

  117.         // Short period terms

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

  138.     }

  139.     /** Get &Chi; = 1 / sqrt(1 - e²) = 1 / B.
  140.      * @return &Chi;
  141.      */
  142.     public T getX() {
  143.         return X;
  144.     }

  145.     /** Get &Chi;².
  146.      * @return &Chi;².
  147.      */
  148.     public T getXX() {
  149.         return XX;
  150.     }

  151.     /** Get &Chi;³.
  152.      * @return &Chi;³
  153.      */
  154.     public T getXXX() {
  155.         return XXX;
  156.     }

  157.     /** Get m2aoA = -2 * a / A.
  158.      * @return m2aoA
  159.      */
  160.     public T getM2aoA() {
  161.         return m2aoA;
  162.     }

  163.     /** Get B / A.
  164.      * @return BoA
  165.      */
  166.     public T getBoA() {
  167.         return BoA;
  168.     }

  169.     /** Get ooAB = 1 / (A * B).
  170.      * @return ooAB
  171.      */
  172.     public T getOoAB() {
  173.         return ooAB;
  174.     }

  175.     /** Get mCo2AB = -C / 2AB.
  176.      * @return mCo2AB
  177.      */
  178.     public T getMCo2AB() {
  179.         return mCo2AB;
  180.     }

  181.     /** Get BoABpo = B / A(1 + B).
  182.      * @return BoABpo
  183.      */
  184.     public T getBoABpo() {
  185.         return BoABpo;
  186.     }

  187.     /** Get μ / a .
  188.      * @return muoa
  189.      */
  190.     public T getMuoa() {
  191.         return muoa;
  192.     }

  193.     /** Get roa = R / a.
  194.      * @return roa
  195.      */
  196.     public T getRoa() {
  197.         return roa;
  198.     }

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

  207.     /** Get h * k.
  208.      * @return hk
  209.      */
  210.     public T getHK() {
  211.         return hk;
  212.     }

  213.     /** Get k² - h².
  214.      * @return k2mh2
  215.      */
  216.     public T getK2MH2() {
  217.         return k2mh2;
  218.     }

  219.     /** Get (k² - h²) / 2.
  220.      * @return k2mh2o2
  221.      */
  222.     public T getK2MH2O2() {
  223.         return k2mh2o2;
  224.     }

  225.     /** Get 1 / (n² * a²).
  226.      * @return oon2a2
  227.      */
  228.     public T getOON2A2() {
  229.         return oon2a2;
  230.     }

  231.     /** Get χ³ / (n² * a).
  232.      * @return x3on2a
  233.      */
  234.     public T getX3ON2A() {
  235.         return x3on2a;
  236.     }

  237.     /** Get χ / (n² * a²).
  238.      * @return xon2a2
  239.      */
  240.     public T getXON2A2() {
  241.         return xon2a2;
  242.     }

  243.     /** Get (C * χ) / ( 2 * n² * a² ).
  244.      * @return cxo2n2a2
  245.      */
  246.     public T getCXO2N2A2() {
  247.         return cxo2n2a2;
  248.     }

  249.     /** Get (χ²) / (n² * a² * (χ + 1 ) ).
  250.      * @return x2on2a2xp1
  251.      */
  252.     public T getX2ON2A2XP1() {
  253.         return x2on2a2xp1;
  254.     }

  255.     /** Get B * B.
  256.      * @return BB
  257.      */
  258.     public T getBB() {
  259.         return BB;
  260.     }

  261. }