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.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
22
23 /**
24 * This class is a container for the common "field" parameters used in {@link AbstractGaussianContribution}.
25 * <p>
26 * It performs parameters initialization at each integration step for the Gaussian contributions
27 * </p>
28 * @author Bryan Cazabonne
29 * @since 10.0
30 */
31 public class FieldAbstractGaussianContributionContext<T extends CalculusFieldElement<T>> extends FieldForceModelContext<T> {
32
33 // CHECKSTYLE: stop VisibilityModifier check
34
35 /** 2 / (n² * a) . */
36 protected T ton2a;
37
38 /** 1 / A . */
39 protected T ooA;
40
41 /** 1 / (A * B) . */
42 protected T ooAB;
43
44 /** C / (2 * A * B) . */
45 protected T co2AB;
46
47 /** 1 / (1 + B) . */
48 protected T ooBpo;
49
50 /** 1 / μ . */
51 protected T ooMu;
52
53 /** A = sqrt(μ * a). */
54 private final T A;
55
56 /** Keplerian mean motion. */
57 private final T n;
58
59 /** Central attraction coefficient. */
60 private T mu;
61
62 // CHECKSTYLE: resume VisibilityModifier check
63
64 /**
65 * Simple constructor.
66 *
67 * @param auxiliaryElements auxiliary elements related to the current orbit
68 * @param parameters parameters values of the force model parameters
69 */
70 FieldAbstractGaussianContributionContext(final FieldAuxiliaryElements<T> auxiliaryElements, final T[] parameters) {
71
72 super(auxiliaryElements);
73
74 // mu driver corresponds to the last term of parameters driver array
75 mu = parameters[parameters.length - 1];
76
77 // Keplerian mean motion
78 final T absA = FastMath.abs(auxiliaryElements.getSma());
79 n = FastMath.sqrt(mu.divide(absA)).divide(absA);
80 // sqrt(μ * a)
81 A = FastMath.sqrt(mu.multiply(auxiliaryElements.getSma()));
82 // 1 / A
83 ooA = A.reciprocal();
84 // 1 / AB
85 ooAB = ooA.divide(auxiliaryElements.getB());
86 // C / 2AB
87 co2AB = auxiliaryElements.getC().multiply(ooAB).divide(2.);
88 // 1 / (1 + B)
89 ooBpo = auxiliaryElements.getB().add(1.).reciprocal();
90 // 2 / (n² * a)
91 ton2a = (n.multiply(n).multiply(auxiliaryElements.getSma())).divide(2.).reciprocal();
92 // 1 / mu
93 ooMu = mu.reciprocal();
94
95 }
96
97 /** Get central attraction coefficient.
98 * @return mu
99 */
100 public T getMu() {
101 return mu;
102 }
103
104 /** Get A = sqrt(μ * a).
105 * @return A
106 */
107 public T getA() {
108 return A;
109 }
110
111 /** Get ooA = 1 / A.
112 * @return ooA
113 */
114 public T getOOA() {
115 return ooA;
116 }
117
118 /** Get ooAB = 1 / (A * B).
119 * @return ooAB
120 */
121 public T getOOAB() {
122 return ooAB;
123 }
124
125 /** Get co2AB = C / 2AB.
126 * @return co2AB
127 */
128 public T getCo2AB() {
129 return co2AB;
130 }
131
132 /** Get ooBpo = 1 / (B + 1).
133 * @return ooBpo
134 */
135 public T getOoBpo() {
136 return ooBpo;
137 }
138
139 /** Get ton2a = 2 / (n² * a).
140 * @return ton2a
141 */
142 public T getTon2a() {
143 return ton2a;
144 }
145
146 /** Get ooMu = 1 / mu.
147 * @return ooMu
148 */
149 public T getOoMU() {
150 return ooMu;
151 }
152
153 /** Get the Keplerian mean motion.
154 * <p>The Keplerian mean motion is computed directly from semi major axis
155 * and central acceleration constant.</p>
156 * @return Keplerian mean motion in radians per second
157 */
158 public T getMeanMotion() {
159 return n;
160 }
161
162 }