1 /* Copyright 2002-2021 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.hipparchus.util.FastMath;
21 import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
22 import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
23
24 /**
25 * This class is a container for the common "field" parameters used in {@link DSSTZonal}.
26 * <p>
27 * It performs parameters initialization at each integration step for the Zonal contribution
28 * to the central body gravitational perturbation.
29 * <p>
30 * @author Bryan Cazabonne
31 * @since 10.0
32 */
33 public class FieldDSSTZonalContext<T extends CalculusFieldElement<T>> extends FieldForceModelContext<T> {
34
35 // Common factors for potential computation
36 /** A = sqrt(μ * a). */
37 private final T A;
38 /** Χ = 1 / sqrt(1 - e²) = 1 / B. */
39 private T X;
40 /** Χ². */
41 private T XX;
42 /** Χ³. */
43 private T XXX;
44 /** 1 / (A * B) . */
45 private T ooAB;
46 /** B / A . */
47 private T BoA;
48 /** B / A(1 + B) . */
49 private T BoABpo;
50 /** -C / (2 * A * B) . */
51 private T mCo2AB;
52 /** -2 * a / A . */
53 private T m2aoA;
54 /** μ / a . */
55 private T muoa;
56 /** R / a . */
57 private T roa;
58
59 /** Keplerian mean motion. */
60 private final T n;
61
62 // Short period terms
63 /** h * k. */
64 private T hk;
65 /** k² - h². */
66 private T k2mh2;
67 /** (k² - h²) / 2. */
68 private T k2mh2o2;
69 /** 1 / (n² * a²). */
70 private T oon2a2;
71 /** 1 / (n² * a) . */
72 private T oon2a;
73 /** χ³ / (n² * a). */
74 private T x3on2a;
75 /** χ / (n² * a²). */
76 private T xon2a2;
77 /** (C * χ) / ( 2 * n² * a² ). */
78 private T cxo2n2a2;
79 /** (χ²) / (n² * a² * (χ + 1 ) ). */
80 private T x2on2a2xp1;
81 /** B * B. */
82 private T BB;
83
84 /**
85 * Simple constructor.
86 *
87 * @param auxiliaryElements auxiliary elements related to the current orbit
88 * @param provider provider for spherical harmonics
89 * @param parameters values of the force model parameters
90 */
91 FieldDSSTZonalContext(final FieldAuxiliaryElements<T> auxiliaryElements,
92 final UnnormalizedSphericalHarmonicsProvider provider,
93 final T[] parameters) {
94
95 super(auxiliaryElements);
96
97 final T mu = parameters[0];
98
99 // Keplerian mean motion
100 final T absA = FastMath.abs(auxiliaryElements.getSma());
101 n = FastMath.sqrt(mu.divide(absA)).divide(absA);
102
103 A = FastMath.sqrt(mu.multiply(auxiliaryElements.getSma()));
104
105 // Χ = 1 / B
106 X = auxiliaryElements.getB().reciprocal();
107 XX = X.multiply(X);
108 XXX = X.multiply(XX);
109
110 // 1 / AB
111 ooAB = (A.multiply(auxiliaryElements.getB())).reciprocal();
112 // B / A
113 BoA = auxiliaryElements.getB().divide(A);
114 // -C / 2AB
115 mCo2AB = auxiliaryElements.getC().multiply(ooAB).divide(2.).negate();
116 // B / A(1 + B)
117 BoABpo = BoA.divide(auxiliaryElements.getB().add(1.));
118 // -2 * a / A
119 m2aoA = auxiliaryElements.getSma().divide(A).multiply(2.).negate();
120 // μ / a
121 muoa = mu.divide(auxiliaryElements.getSma());
122 // R / a
123 roa = auxiliaryElements.getSma().divide(provider.getAe()).reciprocal();
124
125 // Short period terms
126
127 // h * k.
128 hk = auxiliaryElements.getH().multiply(auxiliaryElements.getK());
129 // k² - h².
130 k2mh2 = auxiliaryElements.getK().multiply(auxiliaryElements.getK()).subtract(auxiliaryElements.getH().multiply(auxiliaryElements.getH()));
131 // (k² - h²) / 2.
132 k2mh2o2 = k2mh2.divide(2.);
133 // 1 / (n² * a²) = 1 / (n * A)
134 oon2a2 = (A.multiply(n)).reciprocal();
135 // 1 / (n² * a) = a / (n * A)
136 oon2a = auxiliaryElements.getSma().multiply(oon2a2);
137 // χ³ / (n² * a)
138 x3on2a = XXX.multiply(oon2a);
139 // χ / (n² * a²)
140 xon2a2 = X.multiply(oon2a2);
141 // (C * χ) / ( 2 * n² * a² )
142 cxo2n2a2 = xon2a2.multiply(auxiliaryElements.getC()).divide(2.);
143 // (χ²) / (n² * a² * (χ + 1 ) )
144 x2on2a2xp1 = xon2a2.multiply(X).divide(X.add(1.));
145 // B * B
146 BB = auxiliaryElements.getB().multiply(auxiliaryElements.getB());
147
148 }
149
150 /** Get Χ = 1 / sqrt(1 - e²) = 1 / B.
151 * @return Χ
152 */
153 public T getX() {
154 return X;
155 }
156
157 /** Get Χ².
158 * @return Χ².
159 */
160 public T getXX() {
161 return XX;
162 }
163
164 /** Get Χ³.
165 * @return Χ³
166 */
167 public T getXXX() {
168 return XXX;
169 }
170
171 /** Get m2aoA = -2 * a / A.
172 * @return m2aoA
173 */
174 public T getM2aoA() {
175 return m2aoA;
176 }
177
178 /** Get B / A.
179 * @return BoA
180 */
181 public T getBoA() {
182 return BoA;
183 }
184
185 /** Get ooAB = 1 / (A * B).
186 * @return ooAB
187 */
188 public T getOoAB() {
189 return ooAB;
190 }
191
192 /** Get mCo2AB = -C / 2AB.
193 * @return mCo2AB
194 */
195 public T getMCo2AB() {
196 return mCo2AB;
197 }
198
199 /** Get BoABpo = B / A(1 + B).
200 * @return BoABpo
201 */
202 public T getBoABpo() {
203 return BoABpo;
204 }
205
206 /** Get μ / a .
207 * @return muoa
208 */
209 public T getMuoa() {
210 return muoa;
211 }
212
213 /** Get roa = R / a.
214 * @return roa
215 */
216 public T getRoa() {
217 return roa;
218 }
219
220 /** Get the Keplerian mean motion.
221 * <p>The Keplerian mean motion is computed directly from semi major axis
222 * and central acceleration constant.</p>
223 * @return Keplerian mean motion in radians per second
224 */
225 public T getMeanMotion() {
226 return n;
227 }
228
229 /** Get h * k.
230 * @return hk
231 */
232 public T getHK() {
233 return hk;
234 }
235
236 /** Get k² - h².
237 * @return k2mh2
238 */
239 public T getK2MH2() {
240 return k2mh2;
241 }
242
243 /** Get (k² - h²) / 2.
244 * @return k2mh2o2
245 */
246 public T getK2MH2O2() {
247 return k2mh2o2;
248 }
249
250 /** Get 1 / (n² * a²).
251 * @return oon2a2
252 */
253 public T getOON2A2() {
254 return oon2a2;
255 }
256
257 /** Get χ³ / (n² * a).
258 * @return x3on2a
259 */
260 public T getX3ON2A() {
261 return x3on2a;
262 }
263
264 /** Get χ / (n² * a²).
265 * @return xon2a2
266 */
267 public T getXON2A2() {
268 return xon2a2;
269 }
270
271 /** Get (C * χ) / ( 2 * n² * a² ).
272 * @return cxo2n2a2
273 */
274 public T getCXO2N2A2() {
275 return cxo2n2a2;
276 }
277
278 /** Get (χ²) / (n² * a² * (χ + 1 ) ).
279 * @return x2on2a2xp1
280 */
281 public T getX2ON2A2XP1() {
282 return x2on2a2xp1;
283 }
284
285 /** Get B * B.
286 * @return BB
287 */
288 public T getBB() {
289 return BB;
290 }
291
292 }