1 /* Copyright 2022-2025 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
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.util.FastMath;
21 import org.hipparchus.util.FieldSinCos;
22 import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
23 import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
24
25 /**
26 * This class is a container for the common parameters used in {@link DSSTJ2SquaredClosedForm}.
27 * <p>
28 * It performs parameters initialization at each integration step for the second-order J2-squared
29 * contribution to the central body gravitational perturbation.
30 * </p>
31 * @author Bryan Cazabonne
32 * @since 12.0
33 * @param <T> type of the field elements
34 */
35 public class FieldDSSTJ2SquaredClosedFormContext<T extends CalculusFieldElement<T>> extends FieldForceModelContext<T> {
36
37 /** Equatorial radius of the central body to the power 4. */
38 private final double alpha4;
39
40 /** Semi major axis to the power 4. */
41 private final T a4;
42
43 /** sqrt(1 - e * e). */
44 private final T eta;
45
46 /** Cosine of the inclination. */
47 private final T c;
48
49 /** Sine of the inclination to the power 2. */
50 private final T s2;
51
52 /**
53 * Simple constructor.
54 *
55 * @param auxiliaryElements auxiliary elements related to the current orbit
56 * @param provider provider for spherical harmonics
57 */
58 public FieldDSSTJ2SquaredClosedFormContext(final FieldAuxiliaryElements<T> auxiliaryElements,
59 final UnnormalizedSphericalHarmonicsProvider provider) {
60 super(auxiliaryElements);
61
62 // Sine and cosine of the inclination
63 final T inc = auxiliaryElements.getOrbit().getI();
64 final FieldSinCos<T> scI = FastMath.sinCos(inc);
65
66 // Other parameters
67 this.c = scI.cos();
68 this.s2 = scI.sin().multiply(scI.sin());
69
70 final double alpha2 = provider.getAe() * provider.getAe();
71 this.alpha4 = alpha2 * alpha2;
72
73 this.eta = FastMath.sqrt(auxiliaryElements.getEcc().multiply(auxiliaryElements.getEcc()).negate().add(1.0));
74
75 final T a2 = auxiliaryElements.getSma().multiply(auxiliaryElements.getSma());
76 this.a4 = a2.square();
77 }
78
79 /**
80 * Get the equatorial radius of the central body to the power 4.
81 * @return the equatorial radius of the central body to the power 4
82 */
83 public double getAlpha4() {
84 return alpha4;
85 }
86
87 /**
88 * Get the semi major axis to the power 4.
89 * @return the semi major axis to the power 4
90 */
91 public T getA4() {
92 return a4;
93 }
94
95 /**
96 * Get the eta value.
97 * @return sqrt(1 - e * e)
98 */
99 public T getEta() {
100 return eta;
101 }
102
103 /**
104 * Get the cosine of the inclination.
105 * @return the cosine of the inclination
106 */
107 public T getC() {
108 return c;
109 }
110
111 /**
112 * Get the sine of the inclination to the power 2.
113 * @return the sine of the inclination to the power 2
114 */
115 public T getS2() {
116 return s2;
117 }
118
119 }