DSSTJ2SquaredClosedFormContext.java

  1. /* Copyright 2022 Bryan Cazabonne
  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.  * Bryan Cazabonne 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.hipparchus.util.SinCos;
  20. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  21. import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;

  22. /**
  23.  * This class is a container for the common parameters used in {@link DSSTJ2SquaredClosedForm}.
  24.  * <p>
  25.  * It performs parameters initialization at each integration step for the second-order J2-squared
  26.  * contribution to the central body gravitational perturbation.
  27.  * </p>
  28.  * @author Bryan Cazabonne
  29.  * @since 12.0
  30.  */
  31. public class DSSTJ2SquaredClosedFormContext extends ForceModelContext {

  32.     /** Equatorial radius of the central body to the power 4. */
  33.     private final double alpha4;

  34.     /** Semi major axis to the power 4. */
  35.     private final double a4;

  36.     /** sqrt(1 - e * e). */
  37.     private final double eta;

  38.     /** Cosine of the inclination. */
  39.     private final double c;

  40.     /** Sine of the inclination to the power 2. */
  41.     private final double s2;

  42.     /**
  43.      * Simple constructor.
  44.      *
  45.      * @param auxiliaryElements auxiliary elements related to the current orbit
  46.      * @param provider          provider for spherical harmonics
  47.      */
  48.     public DSSTJ2SquaredClosedFormContext(final AuxiliaryElements auxiliaryElements,
  49.                                           final UnnormalizedSphericalHarmonicsProvider provider) {
  50.         super(auxiliaryElements);

  51.         // Sine and cosine of the inclination
  52.         final double inc = auxiliaryElements.getOrbit().getI();
  53.         final SinCos scI = FastMath.sinCos(inc);

  54.         // Other parameters
  55.         this.c = scI.cos();
  56.         this.s2 = scI.sin() * scI.sin();

  57.         final double alpha2 = provider.getAe() * provider.getAe();
  58.         this.alpha4 = alpha2 * alpha2;

  59.         this.eta = FastMath.sqrt(1.0 - auxiliaryElements.getEcc() * auxiliaryElements.getEcc());

  60.         final double a2 = auxiliaryElements.getSma() * auxiliaryElements.getSma();
  61.         this.a4 = a2 * a2;
  62.     }

  63.     /**
  64.      * Get the equatorial radius of the central body to the power 4.
  65.      * @return the equatorial radius of the central body to the power 4
  66.      */
  67.     public double getAlpha4() {
  68.         return alpha4;
  69.     }

  70.     /**
  71.      * Get the semi major axis to the power 4.
  72.      * @return the semi major axis to the power 4
  73.      */
  74.     public double getA4() {
  75.         return a4;
  76.     }

  77.     /**
  78.      * Get the eta value.
  79.      * @return sqrt(1 - e * e)
  80.      */
  81.     public double getEta() {
  82.         return eta;
  83.     }

  84.     /**
  85.      * Get the cosine of the inclination.
  86.      * @return the cosine of the inclination
  87.      */
  88.     public double getC() {
  89.         return c;
  90.     }

  91.     /**
  92.      * Get the sine of the inclination to the power 2.
  93.      * @return the sine of the inclination to the power 2
  94.      */
  95.     public double getS2() {
  96.         return s2;
  97.     }

  98. }