Search in sources :

Example 1 with HansenTesseralLinear

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

the class DSSTTesseral method createHansenObjects.

/**
 * Create the objects needed for linear transformation.
 *
 * <p>
 * Each {@link org.orekit.propagation.semianalytical.dsst.utilities.hansenHansenTesseralLinear HansenTesseralLinear} uses
 * a fixed value for s and j. Since j varies from -maxJ to +maxJ and s varies from -maxDegree to +maxDegree,
 * a 2 * maxDegree + 1 x 2 * maxJ + 1 matrix of objects should be created. The size of this matrix can be reduced
 * by taking into account the expression (2.7.3-2). This means that is enough to create the objects for  positive
 * values of j and all values of s.
 * </p>
 *
 * @param meanOnly create only the objects required for the mean contribution
 */
private void createHansenObjects(final boolean meanOnly) {
    // Allocate the two dimensional array
    final int rows = 2 * maxDegree + 1;
    final int columns = maxFrequencyShortPeriodics + 1;
    this.hansenObjects = new HansenTesseralLinear[rows][columns];
    if (meanOnly) {
        // loop through the resonant orders
        for (int m : resOrders) {
            // Compute the corresponding j term
            final int j = FastMath.max(1, (int) FastMath.round(ratio * m));
            // Compute the sMin and sMax values
            final int sMin = FastMath.min(maxEccPow - j, maxDegree);
            final int sMax = FastMath.min(maxEccPow + j, maxDegree);
            // loop through the s values
            for (int s = 0; s <= sMax; s++) {
                // Compute the n0 value
                final int n0 = FastMath.max(FastMath.max(2, m), s);
                // Create the object for the pair j, s
                this.hansenObjects[s + maxDegree][j] = new HansenTesseralLinear(maxDegree, s, j, n0, maxHansen);
                if (s > 0 && s <= sMin) {
                    // Also create the object for the pair j, -s
                    this.hansenObjects[maxDegree - s][j] = new HansenTesseralLinear(maxDegree, -s, j, n0, maxHansen);
                }
            }
        }
    } else {
        // create all objects
        for (int j = 0; j <= maxFrequencyShortPeriodics; j++) {
            for (int s = -maxDegree; s <= maxDegree; s++) {
                // Compute the n0 value
                final int n0 = FastMath.max(2, FastMath.abs(s));
                this.hansenObjects[s + maxDegree][j] = new HansenTesseralLinear(maxDegree, s, j, n0, maxHansen);
            }
        }
    }
}
Also used : HansenTesseralLinear(org.orekit.propagation.semianalytical.dsst.utilities.hansen.HansenTesseralLinear)

Example 2 with HansenTesseralLinear

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

the class DSSTTesseral method computeNSum.

/**
 * Compute the n-SUM for potential derivatives components.
 *  @param date current date
 *  @param j resonant index <i>j</i>
 *  @param m resonant order <i>m</i>
 *  @param s d'Alembert characteristic <i>s</i>
 *  @param maxN maximum possible value for <i>n</i> index
 *  @param roaPow powers of R/a up to degree <i>n</i>
 *  @param ghMSJ G<sup>j</sup><sub>m,s</sub> and H<sup>j</sup><sub>m,s</sub> polynomials
 *  @param gammaMNS &Gamma;<sup>m</sup><sub>n,s</sub>(γ) function
 *  @return Components of U<sub>n</sub> derivatives for fixed j, m, s
 * @throws OrekitException if some error occurred
 */
private double[][] computeNSum(final AbsoluteDate date, final int j, final int m, final int s, final int maxN, final double[] roaPow, final GHmsjPolynomials ghMSJ, final GammaMnsFunction gammaMNS) throws OrekitException {
    // spherical harmonics
    final UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
    // Potential derivatives components
    double dUdaCos = 0.;
    double dUdaSin = 0.;
    double dUdhCos = 0.;
    double dUdhSin = 0.;
    double dUdkCos = 0.;
    double dUdkSin = 0.;
    double dUdlCos = 0.;
    double dUdlSin = 0.;
    double dUdAlCos = 0.;
    double dUdAlSin = 0.;
    double dUdBeCos = 0.;
    double dUdBeSin = 0.;
    double dUdGaCos = 0.;
    double dUdGaSin = 0.;
    // I^m
    @SuppressWarnings("unused") final int Im = I > 0 ? 1 : (m % 2 == 0 ? 1 : -1);
    // jacobi v, w, indices from 2.7.1-(15)
    final int v = FastMath.abs(m - s);
    final int w = FastMath.abs(m + s);
    // Initialise lower degree nmin = (Max(2, m, |s|)) for summation over n
    final int nmin = FastMath.max(FastMath.max(2, m), FastMath.abs(s));
    // Get the corresponding Hansen object
    final int sIndex = maxDegree + (j < 0 ? -s : s);
    final int jIndex = FastMath.abs(j);
    final HansenTesseralLinear hans = this.hansenObjects[sIndex][jIndex];
    // n-SUM from nmin to N
    for (int n = nmin; n <= maxN; n++) {
        // If (n - s) is odd, the contribution is null because of Vmns
        if ((n - s) % 2 == 0) {
            // Vmns coefficient
            final double vMNS = CoefficientsFactory.getVmns(m, n, s);
            // Inclination function Gamma and derivative
            final double gaMNS = gammaMNS.getValue(m, n, s);
            final double dGaMNS = gammaMNS.getDerivative(m, n, s);
            // Hansen kernel value and derivative
            final double kJNS = hans.getValue(-n - 1, chi);
            final double dkJNS = hans.getDerivative(-n - 1, chi);
            // Gjms, Hjms polynomials and derivatives
            final double gMSJ = ghMSJ.getGmsj(m, s, j);
            final double hMSJ = ghMSJ.getHmsj(m, s, j);
            final double dGdh = ghMSJ.getdGmsdh(m, s, j);
            final double dGdk = ghMSJ.getdGmsdk(m, s, j);
            final double dGdA = ghMSJ.getdGmsdAlpha(m, s, j);
            final double dGdB = ghMSJ.getdGmsdBeta(m, s, j);
            final double dHdh = ghMSJ.getdHmsdh(m, s, j);
            final double dHdk = ghMSJ.getdHmsdk(m, s, j);
            final double dHdA = ghMSJ.getdHmsdAlpha(m, s, j);
            final double dHdB = ghMSJ.getdHmsdBeta(m, s, j);
            // Jacobi l-index from 2.7.1-(15)
            final int l = FastMath.min(n - m, n - FastMath.abs(s));
            // Jacobi polynomial and derivative
            final DerivativeStructure jacobi = JacobiPolynomials.getValue(l, v, w, factory.variable(0, gamma));
            // Geopotential coefficients
            final double cnm = harmonics.getUnnormalizedCnm(n, m);
            final double snm = harmonics.getUnnormalizedSnm(n, m);
            // Common factors from expansion of equations 3.3-4
            final double cf_0 = roaPow[n] * Im * vMNS;
            final double cf_1 = cf_0 * gaMNS * jacobi.getValue();
            final double cf_2 = cf_1 * kJNS;
            final double gcPhs = gMSJ * cnm + hMSJ * snm;
            final double gsMhc = gMSJ * snm - hMSJ * cnm;
            final double dKgcPhsx2 = 2. * dkJNS * gcPhs;
            final double dKgsMhcx2 = 2. * dkJNS * gsMhc;
            final double dUdaCoef = (n + 1) * cf_2;
            final double dUdlCoef = j * cf_2;
            final double dUdGaCoef = cf_0 * kJNS * (jacobi.getValue() * dGaMNS + gaMNS * jacobi.getPartialDerivative(1));
            // dU / da components
            dUdaCos += dUdaCoef * gcPhs;
            dUdaSin += dUdaCoef * gsMhc;
            // dU / dh components
            dUdhCos += cf_1 * (kJNS * (cnm * dGdh + snm * dHdh) + h * dKgcPhsx2);
            dUdhSin += cf_1 * (kJNS * (snm * dGdh - cnm * dHdh) + h * dKgsMhcx2);
            // dU / dk components
            dUdkCos += cf_1 * (kJNS * (cnm * dGdk + snm * dHdk) + k * dKgcPhsx2);
            dUdkSin += cf_1 * (kJNS * (snm * dGdk - cnm * dHdk) + k * dKgsMhcx2);
            // dU / dLambda components
            dUdlCos += dUdlCoef * gsMhc;
            dUdlSin += -dUdlCoef * gcPhs;
            // dU / alpha components
            dUdAlCos += cf_2 * (dGdA * cnm + dHdA * snm);
            dUdAlSin += cf_2 * (dGdA * snm - dHdA * cnm);
            // dU / dBeta components
            dUdBeCos += cf_2 * (dGdB * cnm + dHdB * snm);
            dUdBeSin += cf_2 * (dGdB * snm - dHdB * cnm);
            // dU / dGamma components
            dUdGaCos += dUdGaCoef * gcPhs;
            dUdGaSin += dUdGaCoef * gsMhc;
        }
    }
    return new double[][] { { dUdaCos, dUdaSin }, { dUdhCos, dUdhSin }, { dUdkCos, dUdkSin }, { dUdlCos, dUdlSin }, { dUdAlCos, dUdAlSin }, { dUdBeCos, dUdBeSin }, { dUdGaCos, dUdGaSin } };
}
Also used : DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) HansenTesseralLinear(org.orekit.propagation.semianalytical.dsst.utilities.hansen.HansenTesseralLinear)

Aggregations

HansenTesseralLinear (org.orekit.propagation.semianalytical.dsst.utilities.hansen.HansenTesseralLinear)2 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)1 UnnormalizedSphericalHarmonics (org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics)1