1   /* Copyright 2002-2026 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  
19  import org.hipparchus.CalculusFieldElement;
20  import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
21  import org.orekit.frames.Frame;
22  import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
23  import org.orekit.time.AbsoluteDate;
24  
25  /**
26   * This class is a container for the common "field" parameters used in {@link DSSTZonal}.
27   * <p>
28   * It performs parameters initialization at each integration step for the Zonal contribution
29   * to the central body gravitational perturbation.
30   * </p>
31   * @author Bryan Cazabonne
32   * @since 10.0
33   * @param <T> type of the field elements
34   */
35  public class FieldDSSTZonalContext<T extends CalculusFieldElement<T>> extends FieldDSSTGravityContext<T> {
36  
37      /** &Chi;³ = 1 / B³. */
38      private final T chi3;
39  
40      // Short period terms
41      /** h * k. */
42      private final T hk;
43      /** k² - h². */
44      private final T k2mh2;
45      /** (k² - h²) / 2. */
46      private final T k2mh2o2;
47      /** 1 / (n² * a²). */
48      private final T oon2a2;
49      /** 1 / (n² * a) . */
50      private final T oon2a;
51      /** χ³ / (n² * a). */
52      private final T x3on2a;
53      /** χ / (n² * a²). */
54      private final T xon2a2;
55      /** (C * χ) / ( 2 * n² * a² ). */
56      private final T cxo2n2a2;
57      /** (χ²) / (n² * a² * (χ + 1 ) ). */
58      private final T x2on2a2xp1;
59      /** B * B. */
60      private final T BB;
61  
62      /** Constructor with central body frame potentially different from orbit frame.
63       *
64       * @param auxiliaryElements auxiliary elements related to the current orbit
65       * @param centralBodyFrame  rotating body frame
66       * @param provider          provider for spherical harmonics
67       * @param parameters        values of the force model parameters (only 1 values
68       * for each parameters corresponding to state date) obtained by calling the extract
69       * parameter method {@link #extractParameters(double[], AbsoluteDate)}
70       * to selected the right value for state date or by getting the parameters for a specific date
71       * @since 12.2
72       */
73      FieldDSSTZonalContext(final FieldAuxiliaryElements<T> auxiliaryElements,
74                            final Frame centralBodyFrame,
75                            final UnnormalizedSphericalHarmonicsProvider provider,
76                            final T[] parameters) {
77  
78          super(auxiliaryElements, centralBodyFrame, provider, parameters);
79  
80          // Chi3
81          final T chi = getChi();
82          this.chi3 = chi.multiply(getChi2());
83  
84          // Short period terms
85          // -----
86  
87          // h * k.
88          hk = auxiliaryElements.getH().multiply(auxiliaryElements.getK());
89          // k² - h².
90          k2mh2 = auxiliaryElements.getK().multiply(auxiliaryElements.getK()).subtract(auxiliaryElements.getH().multiply(auxiliaryElements.getH()));
91          // (k² - h²) / 2.
92          k2mh2o2 = k2mh2.divide(2.);
93          // 1 / (n² * a²) = 1 / (n * A)
94          oon2a2 = (getA().multiply(getMeanMotion())).reciprocal();
95          // 1 / (n² * a) = a / (n * A)
96          oon2a = auxiliaryElements.getSma().multiply(oon2a2);
97          // χ³ / (n² * a)
98          x3on2a = chi3.multiply(oon2a);
99          // χ / (n² * a²)
100         xon2a2 = chi.multiply(oon2a2);
101         // (C * χ) / ( 2 * n² * a² )
102         cxo2n2a2 = xon2a2.multiply(auxiliaryElements.getC()).divide(2.);
103         // (χ²) / (n² * a² * (χ + 1 ) )
104         x2on2a2xp1 = xon2a2.multiply(chi).divide(chi.add(1.));
105         // B * B
106         BB = auxiliaryElements.getB().multiply(auxiliaryElements.getB());
107     }
108 
109 
110     /** Getter for the &Chi;³.
111      * @return the &Chi;³
112      */
113     public T getChi3() {
114         return chi3;
115     }
116 
117     /** Get h * k.
118      * @return hk
119      */
120     public T getHK() {
121         return hk;
122     }
123 
124     /** Get k² - h².
125      * @return k2mh2
126      */
127     public T getK2MH2() {
128         return k2mh2;
129     }
130 
131     /** Get (k² - h²) / 2.
132      * @return k2mh2o2
133      */
134     public T getK2MH2O2() {
135         return k2mh2o2;
136     }
137 
138     /** Get 1 / (n² * a²).
139      * @return oon2a2
140      */
141     public T getOON2A2() {
142         return oon2a2;
143     }
144 
145     /** Get χ³ / (n² * a).
146      * @return x3on2a
147      */
148     public T getX3ON2A() {
149         return x3on2a;
150     }
151 
152     /** Get χ / (n² * a²).
153      * @return xon2a2
154      */
155     public T getXON2A2() {
156         return xon2a2;
157     }
158 
159     /** Get (C * χ) / ( 2 * n² * a² ).
160      * @return cxo2n2a2
161      */
162     public T getCXO2N2A2() {
163         return cxo2n2a2;
164     }
165 
166     /** Get (χ²) / (n² * a² * (χ + 1 ) ).
167      * @return x2on2a2xp1
168      */
169     public T getX2ON2A2XP1() {
170         return x2on2a2xp1;
171     }
172 
173     /** Get B * B.
174      * @return BB
175      */
176     public T getBB() {
177         return BB;
178     }
179 
180 }