FieldDSSTZonalContext.java

  1. /* Copyright 2002-2025 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.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  20. import org.orekit.frames.Frame;
  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 FieldDSSTGravityContext<T> {

  34.     /** &Chi;³ = 1 / B³. */
  35.     private final T chi3;

  36.     // Short period terms
  37.     /** h * k. */
  38.     private T hk;
  39.     /** k² - h². */
  40.     private T k2mh2;
  41.     /** (k² - h²) / 2. */
  42.     private T k2mh2o2;
  43.     /** 1 / (n² * a²). */
  44.     private T oon2a2;
  45.     /** 1 / (n² * a) . */
  46.     private T oon2a;
  47.     /** χ³ / (n² * a). */
  48.     private T x3on2a;
  49.     /** χ / (n² * a²). */
  50.     private T xon2a2;
  51.     /** (C * χ) / ( 2 * n² * a² ). */
  52.     private T cxo2n2a2;
  53.     /** (χ²) / (n² * a² * (χ + 1 ) ). */
  54.     private T x2on2a2xp1;
  55.     /** B * B. */
  56.     private T BB;

  57.     /** Constructor with central body frame equals orbit frame.
  58.      *
  59.      * @param auxiliaryElements auxiliary elements related to the current orbit
  60.      * @param provider          provider for spherical harmonics
  61.      * @param parameters        values of the force model parameters (only 1 values
  62.      * for each parameters corresponding to state date) obtained by calling the extract
  63.      * parameter method {@link #extractParameters(double[], AbsoluteDate)}
  64.      * to selected the right value for state date or by getting the parameters for a specific date
  65.      * @deprecated since 12.2 and issue 1104, should be removed in 13.0
  66.      */
  67.     @Deprecated
  68.     FieldDSSTZonalContext(final FieldAuxiliaryElements<T> auxiliaryElements,
  69.                           final UnnormalizedSphericalHarmonicsProvider provider,
  70.                           final T[] parameters) {

  71.         this(auxiliaryElements, auxiliaryElements.getFrame(), provider, parameters);
  72.     }

  73.     /** Constructor with central body frame potentially different from orbit frame.
  74.      *
  75.      * @param auxiliaryElements auxiliary elements related to the current orbit
  76.      * @param centralBodyFrame  rotating body frame
  77.      * @param provider          provider for spherical harmonics
  78.      * @param parameters        values of the force model parameters (only 1 values
  79.      * for each parameters corresponding to state date) obtained by calling the extract
  80.      * parameter method {@link #extractParameters(double[], AbsoluteDate)}
  81.      * to selected the right value for state date or by getting the parameters for a specific date
  82.      * @since 12.2
  83.      */
  84.     FieldDSSTZonalContext(final FieldAuxiliaryElements<T> auxiliaryElements,
  85.                           final Frame centralBodyFrame,
  86.                           final UnnormalizedSphericalHarmonicsProvider provider,
  87.                           final T[] parameters) {

  88.         super(auxiliaryElements, centralBodyFrame, provider, parameters);

  89.         // Chi3
  90.         final T chi = getChi();
  91.         this.chi3 = chi.multiply(getChi2());

  92.         // Short period terms
  93.         // -----

  94.         // h * k.
  95.         hk = auxiliaryElements.getH().multiply(auxiliaryElements.getK());
  96.         // k² - h².
  97.         k2mh2 = auxiliaryElements.getK().multiply(auxiliaryElements.getK()).subtract(auxiliaryElements.getH().multiply(auxiliaryElements.getH()));
  98.         // (k² - h²) / 2.
  99.         k2mh2o2 = k2mh2.divide(2.);
  100.         // 1 / (n² * a²) = 1 / (n * A)
  101.         oon2a2 = (getA().multiply(getMeanMotion())).reciprocal();
  102.         // 1 / (n² * a) = a / (n * A)
  103.         oon2a = auxiliaryElements.getSma().multiply(oon2a2);
  104.         // χ³ / (n² * a)
  105.         x3on2a = chi3.multiply(oon2a);
  106.         // χ / (n² * a²)
  107.         xon2a2 = chi.multiply(oon2a2);
  108.         // (C * χ) / ( 2 * n² * a² )
  109.         cxo2n2a2 = xon2a2.multiply(auxiliaryElements.getC()).divide(2.);
  110.         // (χ²) / (n² * a² * (χ + 1 ) )
  111.         x2on2a2xp1 = xon2a2.multiply(chi).divide(chi.add(1.));
  112.         // B * B
  113.         BB = auxiliaryElements.getB().multiply(auxiliaryElements.getB());
  114.     }


  115.     /** Getter for the &Chi;³.
  116.      * @return the &Chi;³
  117.      */
  118.     public T getChi3() {
  119.         return chi3;
  120.     }

  121.     /** Get h * k.
  122.      * @return hk
  123.      */
  124.     public T getHK() {
  125.         return hk;
  126.     }

  127.     /** Get k² - h².
  128.      * @return k2mh2
  129.      */
  130.     public T getK2MH2() {
  131.         return k2mh2;
  132.     }

  133.     /** Get (k² - h²) / 2.
  134.      * @return k2mh2o2
  135.      */
  136.     public T getK2MH2O2() {
  137.         return k2mh2o2;
  138.     }

  139.     /** Get 1 / (n² * a²).
  140.      * @return oon2a2
  141.      */
  142.     public T getOON2A2() {
  143.         return oon2a2;
  144.     }

  145.     /** Get χ³ / (n² * a).
  146.      * @return x3on2a
  147.      */
  148.     public T getX3ON2A() {
  149.         return x3on2a;
  150.     }

  151.     /** Get χ / (n² * a²).
  152.      * @return xon2a2
  153.      */
  154.     public T getXON2A2() {
  155.         return xon2a2;
  156.     }

  157.     /** Get (C * χ) / ( 2 * n² * a² ).
  158.      * @return cxo2n2a2
  159.      */
  160.     public T getCXO2N2A2() {
  161.         return cxo2n2a2;
  162.     }

  163.     /** Get (χ²) / (n² * a² * (χ + 1 ) ).
  164.      * @return x2on2a2xp1
  165.      */
  166.     public T getX2ON2A2XP1() {
  167.         return x2on2a2xp1;
  168.     }

  169.     /** Get B * B.
  170.      * @return BB
  171.      */
  172.     public T getBB() {
  173.         return BB;
  174.     }

  175. }