1 /* Copyright 2002-2025 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.utilities;
18
19 import org.hipparchus.Field;
20 import org.hipparchus.CalculusFieldElement;
21
22 /** Compute the G<sub>js</sub>, H<sub>js</sub>, I<sub>js</sub> and J<sub>js</sub>
23 * polynomials in the equinoctial elements h, k and the direction cosines α and β
24 * and their partial derivatives with respect to k, h, α and β.
25 * <p>
26 * The expressions used are equations 4.1-(10) from the Danielson paper.
27 * </p>
28 * @author Lucian Barbulescu
29 * @author Bryan Cazabonne (field translation)
30 * @param <T> type of the field elements
31 */
32 public class FieldGHIJjsPolynomials<T extends CalculusFieldElement<T>> {
33
34 /** C<sub>j</sub>(k, h), S<sub>j</sub>(k, h) coefficient.
35 * (k, h) are the (x, y) component of the eccentricity vector in equinoctial elements
36 */
37 private final FieldCjSjCoefficient<T> cjsjKH;
38
39 /** C<sub>j</sub>(α, β), S<sub>j</sub>(α, β) coefficient.
40 * (α, β) are the direction cosines
41 */
42 private final FieldCjSjCoefficient<T> cjsjAB;
43
44 /** Create a set of G<sub>js</sub>, H<sub>js</sub>, I<sub>js</sub> and J<sub>js</sub> polynomials.
45 * @param k X component of the eccentricity vector
46 * @param h Y component of the eccentricity vector
47 * @param alpha direction cosine α
48 * @param beta direction cosine β
49 **/
50 public FieldGHIJjsPolynomials(final T k, final T h,
51 final T alpha, final T beta) {
52 final Field<T> field = k.getField();
53 this.cjsjKH = new FieldCjSjCoefficient<>(k, h, field);
54 this.cjsjAB = new FieldCjSjCoefficient<>(alpha, beta, field);
55 }
56
57 /** Get the G<sub>js</sub> coefficient.
58 * @param j j subscript
59 * @param s s subscript
60 * @return the G<sub>js</sub>
61 */
62 public T getGjs(final int j, final int s) {
63 return cjsjKH.getCj(j).multiply(cjsjAB.getCj(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getSj(s)));
64 }
65
66 /** Get the dG<sub>js</sub> / dk coefficient.
67 * @param j j subscript
68 * @param s s subscript
69 * @return the dG<sub>js</sub> / dk
70 */
71 public T getdGjsdk(final int j, final int s) {
72 return cjsjKH.getDcjDk(j).multiply(cjsjAB.getCj(s)).add(cjsjKH.getDsjDk(j).multiply(cjsjAB.getSj(s)));
73 }
74
75 /** Get the dG<sub>js</sub> / dh coefficient.
76 * @param j j subscript
77 * @param s s subscript
78 * @return the dG<sub>js</sub> / dh
79 */
80 public T getdGjsdh(final int j, final int s) {
81 return cjsjKH.getDcjDh(j).multiply(cjsjAB.getCj(s)).add(cjsjKH.getDsjDh(j).multiply(cjsjAB.getSj(s)));
82 }
83
84 /** Get the dG<sub>js</sub> / dα coefficient.
85 * @param j j subscript
86 * @param s s subscript
87 * @return the dG<sub>js</sub> / dα
88 */
89 public T getdGjsdAlpha(final int j, final int s) {
90 return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDk(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDk(s)));
91 }
92
93 /** Get the dG<sub>js</sub> / dβ coefficient.
94 * @param j j subscript
95 * @param s s subscript
96 * @return the dG<sub>js</sub> / dβ
97 */
98 public T getdGjsdBeta(final int j, final int s) {
99 return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDh(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDh(s)));
100 }
101
102 /** Get the H<sub>js</sub> coefficient.
103 * @param j j subscript
104 * @param s s subscript
105 * @return the H<sub>js</sub>
106 */
107 public T getHjs(final int j, final int s) {
108 return cjsjKH.getCj(j).multiply(cjsjAB.getSj(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getCj(s)));
109 }
110
111 /** Get the dH<sub>js</sub> / dk coefficient.
112 * @param j j subscript
113 * @param s s subscript
114 * @return the H<sub>js</sub> / dk
115 */
116 public T getdHjsdk(final int j, final int s) {
117 return cjsjKH.getDcjDk(j).multiply(cjsjAB.getSj(s)).subtract(cjsjKH.getDsjDk(j).multiply(cjsjAB.getCj(s)));
118 }
119
120 /** Get the dH<sub>js</sub> / dh coefficient.
121 * @param j j subscript
122 * @param s s subscript
123 * @return the H<sub>js</sub> / dh
124 */
125 public T getdHjsdh(final int j, final int s) {
126 return cjsjKH.getDcjDh(j).multiply(cjsjAB.getSj(s)).subtract(cjsjKH.getDsjDh(j).multiply(cjsjAB.getCj(s)));
127 }
128
129 /** Get the dH<sub>js</sub> / dα coefficient.
130 * @param j j subscript
131 * @param s s subscript
132 * @return the H<sub>js</sub> / dα
133 */
134 public T getdHjsdAlpha(final int j, final int s) {
135 return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDk(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDk(s)));
136 }
137
138 /** Get the dH<sub>js</sub> / dβ coefficient.
139 * @param j j subscript
140 * @param s s subscript
141 * @return the H<sub>js</sub> / dβ
142 */
143 public T getdHjsdBeta(final int j, final int s) {
144 return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDh(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDh(s)));
145 }
146
147 /** Get the I<sub>js</sub> coefficient.
148 * @param j j subscript
149 * @param s s subscript
150 * @return the I<sub>js</sub>
151 */
152 public T getIjs(final int j, final int s) {
153 return cjsjKH.getCj(j).multiply(cjsjAB.getSj(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getCj(s)));
154 }
155
156 /** Get the dI<sub>js</sub> / dk coefficient.
157 * @param j j subscript
158 * @param s s subscript
159 * @return the I<sub>js</sub> / dk
160 */
161 public T getdIjsdk(final int j, final int s) {
162 return cjsjKH.getDcjDk(j).multiply(cjsjAB.getSj(s)).add(cjsjKH.getDsjDk(j).multiply(cjsjAB.getCj(s)));
163 }
164
165 /** Get the dI<sub>js</sub> / dh coefficient.
166 * @param j j subscript
167 * @param s s subscript
168 * @return the I<sub>js</sub> / dh
169 */
170 public T getdIjsdh(final int j, final int s) {
171 return cjsjKH.getDcjDh(j).multiply(cjsjAB.getSj(s)).add(cjsjKH.getDsjDh(j).multiply(cjsjAB.getCj(s)));
172 }
173
174 /** Get the dI<sub>js</sub> / dα coefficient.
175 * @param j j subscript
176 * @param s s subscript
177 * @return the I<sub>js</sub> / dα
178 */
179 public T getdIjsdAlpha(final int j, final int s) {
180 return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDk(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDk(s)));
181 }
182
183 /** Get the dI<sub>js</sub> / dβ coefficient.
184 * @param j j subscript
185 * @param s s subscript
186 * @return the I<sub>js</sub> / dβ
187 */
188 public T getdIjsdBeta(final int j, final int s) {
189 return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDh(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDh(s)));
190 }
191
192 /** Get the J<sub>js</sub> coefficient.
193 * @param j j subscript
194 * @param s s subscript
195 * @return the J<sub>js</sub>
196 */
197 public T getJjs(final int j, final int s) {
198 return cjsjKH.getCj(j).multiply(cjsjAB.getCj(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getSj(s)));
199 }
200
201 /** Get the dJ<sub>js</sub> / dk coefficient.
202 * @param j j subscript
203 * @param s s subscript
204 * @return the J<sub>js</sub> / dk
205 */
206 public T getdJjsdk(final int j, final int s) {
207 return cjsjKH.getDcjDk(j).multiply(cjsjAB.getCj(s)).subtract(cjsjKH.getDsjDk(j).multiply(cjsjAB.getSj(s)));
208 }
209 /** Get the dJ<sub>js</sub> / dh coefficient.
210 * @param j j subscript
211 * @param s s subscript
212 * @return the J<sub>js</sub> / dh
213 */
214 public T getdJjsdh(final int j, final int s) {
215 return cjsjKH.getDcjDh(j).multiply(cjsjAB.getCj(s)).subtract(cjsjKH.getDsjDh(j).multiply(cjsjAB.getSj(s)));
216 }
217 /** Get the dJ<sub>js</sub> / dα coefficient.
218 * @param j j subscript
219 * @param s s subscript
220 * @return the J<sub>js</sub> / dα
221 */
222 public T getdJjsdAlpha(final int j, final int s) {
223 return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDk(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDk(s)));
224 }
225 /** Get the dJ<sub>js</sub> / dβ coefficient.
226 * @param j j subscript
227 * @param s s subscript
228 * @return the J<sub>js</sub> / dβ
229 */
230 public T getdJjsdBeta(final int j, final int s) {
231 return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDh(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDh(s)));
232 }
233
234 }