Search in sources :

Example 1 with NSKey

use of org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey in project Orekit by CS-SI.

the class CoefficientFactoryTest method getQnsPolynomialValue.

/**
 * Get the Q<sub>ns</sub> value from 2.8.1-(4) evaluated in γ This method is using the
 * Legendre polynomial to compute the Q<sub>ns</sub>'s one. This direct computation method
 * allows to store the polynomials value in a static map. If the Q<sub>ns</sub> had been
 * computed already, they just will be evaluated at γ
 *
 * @param gamma γ angle for which Q<sub>ns</sub> is evaluated
 * @param n n value
 * @param s s value
 * @return the polynomial value evaluated at γ
 */
private static double getQnsPolynomialValue(final double gamma, final int n, final int s) {
    PolynomialFunction derivative;
    if (QNS_MAP.containsKey(new NSKey(n, s))) {
        derivative = QNS_MAP.get(new NSKey(n, s));
    } else {
        final PolynomialFunction legendre = PolynomialsUtils.createLegendrePolynomial(n);
        derivative = legendre;
        for (int i = 0; i < s; i++) {
            derivative = (PolynomialFunction) derivative.polynomialDerivative();
        }
        QNS_MAP.put(new NSKey(n, s), derivative);
    }
    return derivative.value(gamma);
}
Also used : NSKey(org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey) PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction)

Example 2 with NSKey

use of org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey in project Orekit by CS-SI.

the class DSSTThirdBody method computeUDerivatives.

/**
 * Compute potential derivatives.
 *  @return derivatives of the potential with respect to orbital parameters
 */
private double[] computeUDerivatives() {
    // Gs and Hs coefficients
    final double[][] GsHs = CoefficientsFactory.computeGsHs(k, h, alpha, beta, maxEccPow);
    // Initialise U.
    U = 0.;
    // Potential derivatives
    double dUda = 0.;
    double dUdk = 0.;
    double dUdh = 0.;
    double dUdAl = 0.;
    double dUdBe = 0.;
    double dUdGa = 0.;
    for (int s = 0; s <= maxEccPow; s++) {
        // initialise the Hansen roots
        this.hansenObjects[s].computeInitValues(B, BB, BBB);
        // Get the current Gs coefficient
        final double gs = GsHs[0][s];
        // Compute Gs partial derivatives from 3.1-(9)
        double dGsdh = 0.;
        double dGsdk = 0.;
        double dGsdAl = 0.;
        double dGsdBe = 0.;
        if (s > 0) {
            // First get the G(s-1) and the H(s-1) coefficients
            final double sxGsm1 = s * GsHs[0][s - 1];
            final double sxHsm1 = s * GsHs[1][s - 1];
            // Then compute derivatives
            dGsdh = beta * sxGsm1 - alpha * sxHsm1;
            dGsdk = alpha * sxGsm1 + beta * sxHsm1;
            dGsdAl = k * sxGsm1 - h * sxHsm1;
            dGsdBe = h * sxGsm1 + k * sxHsm1;
        }
        // Kronecker symbol (2 - delta(0,s))
        final double delta0s = (s == 0) ? 1. : 2.;
        for (int n = FastMath.max(2, s); n <= maxAR3Pow; n++) {
            // (n - s) must be even
            if ((n - s) % 2 == 0) {
                // Extract data from previous computation :
                final double kns = this.hansenObjects[s].getValue(n, B);
                final double dkns = this.hansenObjects[s].getDerivative(n, B);
                final double vns = Vns.get(new NSKey(n, s));
                final double coef0 = delta0s * aoR3Pow[n] * vns;
                final double coef1 = coef0 * Qns[n][s];
                final double coef2 = coef1 * kns;
                // dQns/dGamma = Q(n, s + 1) from Equation 3.1-(8)
                // for n = s, Q(n, n + 1) = 0. (Cefola & Broucke, 1975)
                final double dqns = (n == s) ? 0. : Qns[n][s + 1];
                // Compute U:
                U += coef2 * gs;
                // Compute dU / da :
                dUda += coef2 * n * gs;
                // Compute dU / dh
                dUdh += coef1 * (kns * dGsdh + hXXX * gs * dkns);
                // Compute dU / dk
                dUdk += coef1 * (kns * dGsdk + kXXX * gs * dkns);
                // Compute dU / dAlpha
                dUdAl += coef2 * dGsdAl;
                // Compute dU / dBeta
                dUdBe += coef2 * dGsdBe;
                // Compute dU / dGamma
                dUdGa += coef0 * kns * dqns * gs;
            }
        }
    }
    // multiply by mu3 / R3
    U *= muoR3;
    return new double[] { dUda * muoR3 / a, dUdk * muoR3, dUdh * muoR3, dUdAl * muoR3, dUdBe * muoR3, dUdGa * muoR3 };
}
Also used : NSKey(org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey)

Example 3 with NSKey

use of org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey in project Orekit by CS-SI.

the class DSSTZonal method computeUDerivatives.

/**
 * Compute the derivatives of the gravitational potential U [Eq. 3.1-(6)].
 *  <p>
 *  The result is the array
 *  [dU/da, dU/dk, dU/dh, dU/dα, dU/dβ, dU/dγ]
 *  </p>
 *  @param date current date
 *  @return potential derivatives
 *  @throws OrekitException if an error occurs in hansen computation
 */
private double[] computeUDerivatives(final AbsoluteDate date) throws OrekitException {
    final UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
    // Reset U
    U = 0.;
    // Gs and Hs coefficients
    final double[][] GsHs = CoefficientsFactory.computeGsHs(k, h, alpha, beta, maxEccPowMeanElements);
    // Qns coefficients
    final double[][] Qns = CoefficientsFactory.computeQns(gamma, maxDegree, maxEccPowMeanElements);
    final double[] roaPow = new double[maxDegree + 1];
    roaPow[0] = 1.;
    for (int i = 1; i <= maxDegree; i++) {
        roaPow[i] = roa * roaPow[i - 1];
    }
    // Potential derivatives
    double dUda = 0.;
    double dUdk = 0.;
    double dUdh = 0.;
    double dUdAl = 0.;
    double dUdBe = 0.;
    double dUdGa = 0.;
    for (int s = 0; s <= maxEccPowMeanElements; s++) {
        // Initialize the Hansen roots
        this.hansenObjects[s].computeInitValues(X);
        // Get the current Gs coefficient
        final double gs = GsHs[0][s];
        // Compute Gs partial derivatives from 3.1-(9)
        double dGsdh = 0.;
        double dGsdk = 0.;
        double dGsdAl = 0.;
        double dGsdBe = 0.;
        if (s > 0) {
            // First get the G(s-1) and the H(s-1) coefficients
            final double sxgsm1 = s * GsHs[0][s - 1];
            final double sxhsm1 = s * GsHs[1][s - 1];
            // Then compute derivatives
            dGsdh = beta * sxgsm1 - alpha * sxhsm1;
            dGsdk = alpha * sxgsm1 + beta * sxhsm1;
            dGsdAl = k * sxgsm1 - h * sxhsm1;
            dGsdBe = h * sxgsm1 + k * sxhsm1;
        }
        // Kronecker symbol (2 - delta(0,s))
        final double d0s = (s == 0) ? 1 : 2;
        for (int n = s + 2; n <= maxDegree; n++) {
            // (n - s) must be even
            if ((n - s) % 2 == 0) {
                // Extract data from previous computation :
                final double kns = this.hansenObjects[s].getValue(-n - 1, X);
                final double dkns = this.hansenObjects[s].getDerivative(-n - 1, X);
                final double vns = Vns.get(new NSKey(n, s));
                final double coef0 = d0s * roaPow[n] * vns * -harmonics.getUnnormalizedCnm(n, 0);
                final double coef1 = coef0 * Qns[n][s];
                final double coef2 = coef1 * kns;
                final double coef3 = coef2 * gs;
                // dQns/dGamma = Q(n, s + 1) from Equation 3.1-(8)
                final double dqns = Qns[n][s + 1];
                // Compute U
                U += coef3;
                // Compute dU / da :
                dUda += coef3 * (n + 1);
                // Compute dU / dEx
                dUdk += coef1 * (kns * dGsdk + k * XXX * gs * dkns);
                // Compute dU / dEy
                dUdh += coef1 * (kns * dGsdh + h * XXX * gs * dkns);
                // Compute dU / dAlpha
                dUdAl += coef2 * dGsdAl;
                // Compute dU / dBeta
                dUdBe += coef2 * dGsdBe;
                // Compute dU / dGamma
                dUdGa += coef0 * kns * dqns * gs;
            }
        }
    }
    // Multiply by -(μ / a)
    U *= -muoa;
    return new double[] { dUda * muoa / a, dUdk * -muoa, dUdh * -muoa, dUdAl * -muoa, dUdBe * -muoa, dUdGa * -muoa };
}
Also used : NSKey(org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey) UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics)

Aggregations

NSKey (org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey)3 PolynomialFunction (org.hipparchus.analysis.polynomials.PolynomialFunction)1 UnnormalizedSphericalHarmonics (org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics)1