FieldAbstractGaussianContributionContext.java

  1. /* Copyright 2002-2022 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. /**
  22.  * This class is a container for the common "field" parameters used in {@link AbstractGaussianContribution}.
  23.  * <p>
  24.  * It performs parameters initialization at each integration step for the Gaussian contributions
  25.  * </p>
  26.  * @author Bryan Cazabonne
  27.  * @since 10.0
  28.  */
  29. public class FieldAbstractGaussianContributionContext<T extends CalculusFieldElement<T>> extends FieldForceModelContext<T> {

  30.     // CHECKSTYLE: stop VisibilityModifier check

  31.     /** 2 / (n² * a) . */
  32.     protected T ton2a;

  33.     /** 1 / A . */
  34.     protected T ooA;

  35.     /** 1 / (A * B) . */
  36.     protected T ooAB;

  37.     /** C / (2 * A * B) . */
  38.     protected T co2AB;

  39.     /** 1 / (1 + B) . */
  40.     protected T ooBpo;

  41.     /** 1 / μ . */
  42.     protected T ooMu;

  43.     /** A = sqrt(μ * a). */
  44.     private final T A;

  45.     /** Keplerian mean motion. */
  46.     private final T n;

  47.     /** Central attraction coefficient. */
  48.     private T mu;

  49.     // CHECKSTYLE: resume VisibilityModifier check

  50.     /**
  51.      * Simple constructor.
  52.      *
  53.      * @param auxiliaryElements auxiliary elements related to the current orbit
  54.      * @param parameters        parameters values of the force model parameters
  55.      */
  56.     FieldAbstractGaussianContributionContext(final FieldAuxiliaryElements<T> auxiliaryElements, final T[] parameters) {

  57.         super(auxiliaryElements);

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

  60.         // Keplerian mean motion
  61.         final T absA = FastMath.abs(auxiliaryElements.getSma());
  62.         n = FastMath.sqrt(mu.divide(absA)).divide(absA);
  63.         // sqrt(μ * a)
  64.         A = FastMath.sqrt(mu.multiply(auxiliaryElements.getSma()));
  65.         // 1 / A
  66.         ooA = A.reciprocal();
  67.         // 1 / AB
  68.         ooAB = ooA.divide(auxiliaryElements.getB());
  69.         // C / 2AB
  70.         co2AB = auxiliaryElements.getC().multiply(ooAB).divide(2.);
  71.         // 1 / (1 + B)
  72.         ooBpo = auxiliaryElements.getB().add(1.).reciprocal();
  73.         // 2 / (n² * a)
  74.         ton2a = (n.multiply(n).multiply(auxiliaryElements.getSma())).divide(2.).reciprocal();
  75.         // 1 / mu
  76.         ooMu = mu.reciprocal();

  77.     }

  78.     /** Get central attraction coefficient.
  79.      * @return mu
  80.      */
  81.     public T getMu() {
  82.         return mu;
  83.     }

  84.     /** Get A = sqrt(μ * a).
  85.      * @return A
  86.      */
  87.     public T getA() {
  88.         return A;
  89.     }

  90.     /** Get ooA = 1 / A.
  91.      * @return ooA
  92.      */
  93.     public T getOOA() {
  94.         return ooA;
  95.     }

  96.     /** Get ooAB = 1 / (A * B).
  97.      * @return ooAB
  98.      */
  99.     public T getOOAB() {
  100.         return ooAB;
  101.     }

  102.     /** Get co2AB = C / 2AB.
  103.      * @return co2AB
  104.      */
  105.     public T getCo2AB() {
  106.         return co2AB;
  107.     }

  108.     /** Get ooBpo = 1 / (B + 1).
  109.      * @return ooBpo
  110.      */
  111.     public T getOoBpo() {
  112.         return ooBpo;
  113.     }

  114.     /** Get ton2a = 2 / (n² * a).
  115.      * @return ton2a
  116.      */
  117.     public T getTon2a() {
  118.         return ton2a;
  119.     }

  120.     /** Get ooMu = 1 / mu.
  121.      * @return ooMu
  122.      */
  123.     public T getOoMU() {
  124.         return ooMu;
  125.     }

  126.     /** Get the Keplerian mean motion.
  127.      * <p>The Keplerian mean motion is computed directly from semi major axis
  128.      * and central acceleration constant.</p>
  129.      * @return Keplerian mean motion in radians per second
  130.      */
  131.     public T getMeanMotion() {
  132.         return n;
  133.     }

  134. }