AbstractGaussianContributionContext.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.util.FastMath;
  19. import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;

  20. /**
  21.  * This class is a container for the common parameters used in {@link AbstractGaussianContribution}.
  22.  * <p>
  23.  * It performs parameters initialization at each integration step for the Gaussian contributions
  24.  * </p>
  25.  * @author Bryan Cazabonne
  26.  * @since 10.0
  27.  */
  28. class AbstractGaussianContributionContext extends ForceModelContext {

  29.     // CHECKSTYLE: stop VisibilityModifier check

  30.     /** 2 / (n² * a) . */
  31.     protected double ton2a;

  32.     /** 1 / A .*/
  33.     protected double ooA;

  34.     /** 1 / (A * B) .*/
  35.     protected double ooAB;

  36.     /** C / (2 * A * B) .*/
  37.     protected double co2AB;

  38.     /** 1 / (1 + B) .*/
  39.     protected double ooBpo;

  40.     /** 1 / μ .*/
  41.     protected double ooMu;

  42.     /** A = sqrt(μ * a). */
  43.     private final double A;

  44.     /** Keplerian mean motion. */
  45.     private final double n;

  46.     /** Central attraction coefficient. */
  47.     private double mu;

  48.     // CHECKSTYLE: resume VisibilityModifier check

  49.     /**
  50.      * Simple constructor.
  51.      *
  52.      * @param auxiliaryElements auxiliary elements related to the current orbit
  53.      * @param parameters parameters values of the force model parameters
  54.      */
  55.     AbstractGaussianContributionContext(final AuxiliaryElements auxiliaryElements, final double[] parameters) {

  56.         super(auxiliaryElements);

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

  59.         // Keplerian Mean Motion
  60.         final double absA = FastMath.abs(auxiliaryElements.getSma());
  61.         n = FastMath.sqrt(mu / absA) / absA;

  62.         // sqrt(μ * a)
  63.         A = FastMath.sqrt(mu * auxiliaryElements.getSma());
  64.         // 1 / A
  65.         ooA = 1. / A;
  66.         // 1 / AB
  67.         ooAB = ooA / auxiliaryElements.getB();
  68.         // C / 2AB
  69.         co2AB = auxiliaryElements.getC() * ooAB / 2.;
  70.         // 1 / (1 + B)
  71.         ooBpo = 1. / (1. + auxiliaryElements.getB());
  72.         // 2 / (n² * a)
  73.         ton2a = 2. / (n * n * auxiliaryElements.getSma());
  74.         // 1 / mu
  75.         ooMu  = 1. / mu;

  76.     }

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

  83.     /** Get ooA = 1 / A.
  84.      * @return ooA
  85.      */
  86.     public double getOOA() {
  87.         return ooA;
  88.     }

  89.     /** Get ooAB = 1 / (A * B).
  90.      * @return ooAB
  91.      */
  92.     public double getOOAB() {
  93.         return ooAB;
  94.     }

  95.     /** Get co2AB = C / 2AB.
  96.      * @return co2AB
  97.      */
  98.     public double getCo2AB() {
  99.         return co2AB;
  100.     }

  101.     /** Get ooBpo = 1 / (B + 1).
  102.      * @return ooBpo
  103.      */
  104.     public double getOoBpo() {
  105.         return ooBpo;
  106.     }

  107.     /** Get ton2a = 2 / (n² * a).
  108.      * @return ton2a
  109.      */
  110.     public double getTon2a() {
  111.         return ton2a;
  112.     }

  113.     /** Get ooMu = 1 / mu.
  114.      * @return ooMu
  115.      */
  116.     public double getOoMU() {
  117.         return ooMu;
  118.     }

  119.     /** Get the Keplerian mean motion.
  120.      * <p>The Keplerian mean motion is computed directly from semi major axis
  121.      * and central acceleration constant.</p>
  122.      * @return Keplerian mean motion in radians per second
  123.      */
  124.     public double getMeanMotion() {
  125.         return n;
  126.     }
  127. }