Class J2OnlyPerturbation

  • All Implemented Interfaces:
    ForceModel, EventDetectorsProvider, ParameterDriversProvider

    public class J2OnlyPerturbation
    extends Object
    implements ForceModel
    J2-only force model. This class models the oblateness part alone of the central body's potential (degree 2 and order 0), whilst avoiding the computational overhead of generic NxM spherical harmonics.

    This J2 coefficient has same magnitude and opposite sign than the so-called unnormalized C20 coefficient.

    This class should not be used in combination of HolmesFeatherstoneAttractionModel, otherwise the J2 term would be taken into account twice.

    Author:
    Romain Serra
    • Constructor Detail

      • J2OnlyPerturbation

        public J2OnlyPerturbation​(double mu,
                                  double rEq,
                                  TimeScalarFunction j2OverTime,
                                  Frame frame)
        Constructor with TimeScalarFunction. It is the user's responsibility to make sure the Field and double versions are consistent with each other.
        Parameters:
        mu - central body's gravitational constant
        rEq - central body's equatorial radius
        j2OverTime - J2 coefficient as a function of time.
        frame - frame where J2 applies
      • J2OnlyPerturbation

        public J2OnlyPerturbation​(double mu,
                                  double rEq,
                                  double constantJ2,
                                  Frame frame)
        Constructor with constant J2.
        Parameters:
        mu - central body gravitational constant
        rEq - central body's equatorial radius
        constantJ2 - constant J2 coefficient
        frame - frame where J2 applies
      • J2OnlyPerturbation

        public J2OnlyPerturbation​(UnnormalizedSphericalHarmonicsProvider harmonicsProvider,
                                  Frame frame)
        Constructor with spherical harmonics provider.
        Parameters:
        harmonicsProvider - spherical harmonics provider of unnormalized coefficients
        frame - frame where J2 applies
    • Method Detail

      • getMu

        public double getMu()
        Getter for mu.
        Returns:
        mu
      • getrEq

        public double getrEq()
        Getter for equatorial radius.
        Returns:
        equatorial radius
      • getFrame

        public Frame getFrame()
        Getter for frame.
        Returns:
        frame
      • getJ2

        public double getJ2​(AbsoluteDate date)
        Return J2 at requested date.
        Parameters:
        date - epoch at which J2 coefficient should be retrieved
        Returns:
        J2 coefficient
      • getJ2

        public <T extends CalculusFieldElement<T>> T getJ2​(FieldAbsoluteDate<T> date)
        Return J2 at requested date (Field version).
        Type Parameters:
        T - field
        Parameters:
        date - epoch at which J2 coefficient should be retrieved
        Returns:
        J2 coefficient
      • dependsOnPositionOnly

        public boolean dependsOnPositionOnly()
        Check if force model depends on position only at a given, fixed date.
        Specified by:
        dependsOnPositionOnly in interface ForceModel
        Returns:
        true if force model depends on position only, false if it depends on velocity, either directly or due to a dependency on attitude
      • acceleration

        public Vector3D acceleration​(SpacecraftState state,
                                     double[] parameters)
        Compute acceleration.
        Specified by:
        acceleration in interface ForceModel
        Parameters:
        state - current state information: date, kinematics, attitude
        parameters - values of the force model parameters at state date, only 1 value for each parameterDriver
        Returns:
        acceleration in same frame as state
      • computeAccelerationInJ2Frame

        public static Vector3D computeAccelerationInJ2Frame​(Vector3D positionInJ2Frame,
                                                            double mu,
                                                            double rEq,
                                                            double j2)
        Compute acceleration in J2 frame.
        Parameters:
        positionInJ2Frame - position in J2 frame@
        mu - gravitational parameter
        rEq - equatorial radius
        j2 - J2 coefficient
        Returns:
        acceleration in J2 frame
      • acceleration

        public <T extends CalculusFieldElement<T>> FieldVector3D<T> acceleration​(FieldSpacecraftState<T> state,
                                                                                 T[] parameters)
        Compute acceleration.
        Specified by:
        acceleration in interface ForceModel
        Type Parameters:
        T - type of the elements
        Parameters:
        state - current state information: date, kinematics, attitude
        parameters - values of the force model parameters at state date, only 1 value for each parameterDriver
        Returns:
        acceleration in same frame as state
      • computeAccelerationInJ2Frame

        public static <T extends CalculusFieldElement<T>> FieldVector3D<T> computeAccelerationInJ2Frame​(FieldVector3D<T> positionInJ2Frame,
                                                                                                        double mu,
                                                                                                        double rEq,
                                                                                                        T j2)
        Compute acceleration in J2 frame. Field version.
        Type Parameters:
        T - field type
        Parameters:
        positionInJ2Frame - position in J2 frame@
        mu - gravitational parameter
        rEq - equatorial radius
        j2 - J2 coefficient
        Returns:
        acceleration in J2 frame