AbstractGaussianContributionContext.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.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. public 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.      *                          only 1 value for each parameterDriver
  55.      */
  56.     AbstractGaussianContributionContext(final AuxiliaryElements auxiliaryElements, final double[] 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 double absA = FastMath.abs(auxiliaryElements.getSma());
  62.         n = FastMath.sqrt(mu / absA) / absA;

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

  77.     }

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

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

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

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

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

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

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

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