FieldAbstractGaussianContributionContext.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.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
  21. import org.orekit.time.AbsoluteDate;

  22. /**
  23.  * This class is a container for the common "field" parameters used in {@link AbstractGaussianContribution}.
  24.  * <p>
  25.  * It performs parameters initialization at each integration step for the Gaussian contributions
  26.  * </p>
  27.  * @author Bryan Cazabonne
  28.  * @since 10.0
  29.  * @param <T> type of the field elements
  30.  */
  31. public class FieldAbstractGaussianContributionContext<T extends CalculusFieldElement<T>> extends FieldForceModelContext<T> {

  32.     // CHECKSTYLE: stop VisibilityModifier check

  33.     /** 2 / (n² * a) . */
  34.     protected T ton2a;

  35.     /** 1 / A . */
  36.     protected T ooA;

  37.     /** 1 / (A * B) . */
  38.     protected T ooAB;

  39.     /** C / (2 * A * B) . */
  40.     protected T co2AB;

  41.     /** 1 / (1 + B) . */
  42.     protected T ooBpo;

  43.     /** 1 / μ . */
  44.     protected T ooMu;

  45.     /** A = sqrt(μ * a). */
  46.     private final T A;

  47.     /** Keplerian mean motion. */
  48.     private final T n;

  49.     /** Central attraction coefficient. */
  50.     private T mu;

  51.     // CHECKSTYLE: resume VisibilityModifier check

  52.     /**
  53.      * Simple constructor.
  54.      *
  55.      * @param auxiliaryElements auxiliary elements related to the current orbit
  56.      * @param parameters        parameters values of the force model parameters
  57.      *                          (only 1 values for each parameters corresponding
  58.      *                          to state date) obtained by calling the extract
  59.      *                          parameter method {@link #extractParameters(double[], AbsoluteDate)}
  60.      *                          to selected the right value for state date or by
  61.      *                          getting the parameters for a specific date.
  62.      */
  63.     FieldAbstractGaussianContributionContext(final FieldAuxiliaryElements<T> auxiliaryElements, final T[] parameters) {

  64.         super(auxiliaryElements);

  65.         // mu driver corresponds to the last term of parameters driver array
  66.         mu = parameters[parameters.length - 1];

  67.         // Keplerian mean motion
  68.         final T absA = FastMath.abs(auxiliaryElements.getSma());
  69.         n = FastMath.sqrt(mu.divide(absA)).divide(absA);
  70.         // sqrt(μ * a)
  71.         A = FastMath.sqrt(mu.multiply(auxiliaryElements.getSma()));
  72.         // 1 / A
  73.         ooA = A.reciprocal();
  74.         // 1 / AB
  75.         ooAB = ooA.divide(auxiliaryElements.getB());
  76.         // C / 2AB
  77.         co2AB = auxiliaryElements.getC().multiply(ooAB).divide(2.);
  78.         // 1 / (1 + B)
  79.         ooBpo = auxiliaryElements.getB().add(1.).reciprocal();
  80.         // 2 / (n² * a)
  81.         ton2a = (n.multiply(n).multiply(auxiliaryElements.getSma())).divide(2.).reciprocal();
  82.         // 1 / mu
  83.         ooMu = mu.reciprocal();

  84.     }

  85.     /** Get central attraction coefficient.
  86.      * @return mu
  87.      */
  88.     public T getMu() {
  89.         return mu;
  90.     }

  91.     /** Get A = sqrt(μ * a).
  92.      * @return A
  93.      */
  94.     public T getA() {
  95.         return A;
  96.     }

  97.     /** Get ooA = 1 / A.
  98.      * @return ooA
  99.      */
  100.     public T getOOA() {
  101.         return ooA;
  102.     }

  103.     /** Get ooAB = 1 / (A * B).
  104.      * @return ooAB
  105.      */
  106.     public T getOOAB() {
  107.         return ooAB;
  108.     }

  109.     /** Get co2AB = C / 2AB.
  110.      * @return co2AB
  111.      */
  112.     public T getCo2AB() {
  113.         return co2AB;
  114.     }

  115.     /** Get ooBpo = 1 / (B + 1).
  116.      * @return ooBpo
  117.      */
  118.     public T getOoBpo() {
  119.         return ooBpo;
  120.     }

  121.     /** Get ton2a = 2 / (n² * a).
  122.      * @return ton2a
  123.      */
  124.     public T getTon2a() {
  125.         return ton2a;
  126.     }

  127.     /** Get ooMu = 1 / mu.
  128.      * @return ooMu
  129.      */
  130.     public T getOoMU() {
  131.         return ooMu;
  132.     }

  133.     /** Get the Keplerian mean motion.
  134.      * <p>The Keplerian mean motion is computed directly from semi major axis
  135.      * and central acceleration constant.</p>
  136.      * @return Keplerian mean motion in radians per second
  137.      */
  138.     public T getMeanMotion() {
  139.         return n;
  140.     }

  141. }