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