FieldDSSTJ2SquaredClosedFormContext.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.CalculusFieldElement;
  19. import org.hipparchus.util.FastMath;
  20. import org.hipparchus.util.FieldSinCos;
  21. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  22. import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;

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

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

  36.     /** Semi major axis to the power 4. */
  37.     private final T a4;

  38.     /** sqrt(1 - e * e). */
  39.     private final T eta;

  40.     /** Cosine of the inclination. */
  41.     private final T c;

  42.     /** Sine of the inclination to the power 2. */
  43.     private final T s2;

  44.     /**
  45.      * Simple constructor.
  46.      *
  47.      * @param auxiliaryElements auxiliary elements related to the current orbit
  48.      * @param provider          provider for spherical harmonics
  49.      */
  50.     public FieldDSSTJ2SquaredClosedFormContext(final FieldAuxiliaryElements<T> auxiliaryElements,
  51.                                                final UnnormalizedSphericalHarmonicsProvider provider) {
  52.         super(auxiliaryElements);

  53.         // Sine and cosine of the inclination
  54.         final T inc = auxiliaryElements.getOrbit().getI();
  55.         final FieldSinCos<T> scI = FastMath.sinCos(inc);

  56.         // Other parameters
  57.         this.c = scI.cos();
  58.         this.s2 = scI.sin().multiply(scI.sin());

  59.         final double alpha2 = provider.getAe() * provider.getAe();
  60.         this.alpha4 = alpha2 * alpha2;

  61.         this.eta = FastMath.sqrt(auxiliaryElements.getEcc().multiply(auxiliaryElements.getEcc()).negate().add(1.0));

  62.         final T a2 = auxiliaryElements.getSma().multiply(auxiliaryElements.getSma());
  63.         this.a4 = a2.multiply(a2);
  64.     }

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

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

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

  86.     /**
  87.      * Get the cosine of the inclination.
  88.      * @return the cosine of the inclination
  89.      */
  90.     public T getC() {
  91.         return c;
  92.     }

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

  100. }