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