Written and maintained by CASRAI Editorial Board
Published
On this page
J2 perturbation is the orbital effect represented by the oblateness coefficient in a body’s gravity model. Researchers can model its secular effects with SatelliteToolboxPropagators.jl or add its acceleration to a numerical propagator in poliastro. The crucial choices are the initial element convention, gravity constants and units: a mean-element J2 solution and an instantaneous Cartesian acceleration are different mathematical outputs.
What SatelliteToolboxPropagators.jl is used for in research
SatelliteToolboxPropagators.jl provides an analytical J2 propagator for studies of mean orbital elements. Its developers describe this model as a low-precision tool useful during mission design, including preliminary studies of Sun-synchronous remote-sensing missions. It includes secular changes in the right ascension of the ascending node, or RAAN, the argument of perigee and mean motion. It does not turn a simplified force model into a complete operational trajectory.
There are two useful entry points into a J2 calculation. The Julia model starts with mean Keplerian elements and evolves their secular behaviour. The poliastro perturbations API instead evaluates a Cartesian acceleration that can be added to two-body dynamics. Its official example integrates those dynamics and plots RAAN over time. Choose the mathematical representation before comparing results between the implementations.
This distinction also separates propagation from estimation. Propagation advances an initial orbit under the selected model; the Julia package additionally supplies a fitting routine that estimates mean elements from position and velocity samples. An orbital-data workflow may begin with a catalogue service such as CelesTrak, but the initial elements must still match the chosen propagator. Keep the input data’s provenance with the calculation.
How to install or access SatelliteToolboxPropagators.jl
Use the package’s official installation instructions. In a Julia session, run the following two commands in order:
using Pkg
Pkg.add("SatelliteToolboxPropagators")
Then load the package with using SatelliteToolboxPropagators. Its propagation functions are available through the exported Propagators module. The usage guide also loads using Dates for calls expressed with calendar periods rather than numeric elapsed seconds.
The package contains separate J2, J2 osculating, J4, J4 osculating, SGP4/SDP4 and two-body analytical propagators. In the documented API these have distinct symbols: :J2, :J2osc, :J4, :J4osc, :SGP4 and :TwoBody. Selecting :J2 is therefore an explicit model choice. Installing the package alone does not select a force model or convert an external element set to the required convention.
How to model J2 perturbation step by step
The following walkthrough follows the official Julia J2 and usage examples. The numerical values are the documentation’s demonstration orbit, rather than observations of a named spacecraft. Preserve the same constants when reproducing its output.
-
Load the documented modules. Run
using SatelliteToolboxPropagatorsandusing Dates. The latter supports the period-based calls used below. -
Construct the initial elements. The documented example uses an epoch of 2023-01-01 at 00:00:00, a semi-major axis of 7190.982 kilometres, eccentricity 0.001111, inclination 98.405°, RAAN 100°, argument of perigee 90° and true anomaly 19°. Its constructor supplies the axis in metres and the angles in radians:
orb = KeplerianElements(date_to_jd(2023, 1, 1, 0, 0, 0), 7190.982e3, 0.001111, 98.405 |> deg2rad, 100 |> deg2rad, 90 |> deg2rad, 19 |> deg2rad) -
Initialize the mean-element J2 model. Run
orbp = Propagators.init(Val(:J2), orb). The default constants are J2C_EGM2008. The J2 reference page also demonstratesorbp = Propagators.init(Val(:J2), orb; j2c = J2C_JGM03). Keep these as separate reproducibility cases: they intentionally select different constant sets. -
Propagate to an elapsed time. With the initialized propagator, run
Propagators.propagate!(orbp, 6000). The numeric argument is seconds from the initial orbit epoch. The default result is a tuple containing position and velocity vectors in the input inertial reference frame, using metres and metres per second. -
Request a series or an absolute epoch. The documented call
Propagators.propagate!(orbp, 0:300:3600)produces samples every five minutes for one hour. For a calendar target, usePropagators.propagate_to_epoch!(orbp, DateTime("2023-01-02")). This avoids treating an absolute date as an elapsed-second argument. -
Inspect the propagated elements and timing. Use
Propagators.mean_elements(orbp)for the latest propagated mean elements,Propagators.epoch(orbp)for the initial Julian-day epoch andPropagators.last_instant(orbp)for the last elapsed propagation time in seconds. Record the initial state as well as the requested output times.
The usage reference also accepts Propagators.propagate!(orbp, Dates.Hour(1)). This evaluates one hour after the original epoch, even if an earlier call requested 6000 seconds. The argument is not an instruction to advance one further hour from the last returned state.
How to read the output
Read the mean-element summary, secular rates and Cartesian state as separate parts of the result. In the JGM03 example, the initial true anomaly of 19° appears as a mean anomaly of approximately 18.95858415° in the initialized propagator. That change of anomaly label matters when reproducing an element list. The displayed mean motion is approximately 14.2285532 revolutions per day.
J2 perturbation formula for the secular rates
The Julia documentation defines p = a(1 − e²), where a is mean semi-major axis and e is eccentricity. Its perturbed mean motion is n̄ = n₀[1 + (3/4)J2(R/p)²√(1 − e²)(2 − 3 sin²i)]. Here n₀ is the unperturbed mean motion, R is Earth’s equatorial radius and i is inclination. Its secular angular rates are:
RAAN rate: dΩ/dt = −(3/2)J2(R/p)²n̄ cos i.
Perigee rate: dω/dt = (3/4)J2(R/p)²n̄(4 − 5 sin²i).
Ω denotes RAAN and ω denotes argument of perigee. Multiply the relevant rate by elapsed time and add the initial angle to obtain the model’s evolving angle. Use consistent time units for n̄ and the elapsed time. These are the equations of this documented secular model; a numerical J2 acceleration calculation has a different form.
A worked check using the documented orbit
The J2 reference example selects J2C_JGM03 and prints a RAAN rate of 0.9565453748° per day and a perigee rate of −2.922500732° per day. Applying those printed rates for two days gives a RAAN change of 1.9130907496° and a perigee change of −5.845001464°. Starting from the demonstration angles, the resulting angles are approximately 101.9131° and 84.1550°, respectively.
This is an arithmetic check of the stated secular rates, not a prediction of a particular satellite’s measured position. The usage page’s default EGM2008 example prints a slightly different RAAN rate, 0.9565368878° per day. A small difference between those examples is expected because they select different constants; use the exact configuration when checking agreement.
The Cartesian J2 acceleration formula
In poliastro, let r = √(x² + y² + z²), let μ be the gravitational parameter and define F = 3J2μR²/(2r⁵). The documented acceleration can then be written as ax = Fx(5z²/r² − 1), ay = Fy(5z²/r² − 1) and az = Fz(5z²/r² − 3). J2 is the oblateness factor, R is the attractor radius and x, y and z are position coordinates. The API takes a six-component state [x, y, z, vx, vy, vz].
The acceleration is a perturbation term. The official poliastro example adds [0, 0, 0, ax, ay, az] to the derivative returned by func_twobody and passes the combined function to CowellPropagator. It then recovers RAAN from the resulting position and velocity series. Calling J2_perturbation alone does not return a propagated orbit.
Troubleshooting SatelliteToolboxPropagators.jl
Start by checking the input convention and units against the API you actually called. The cross-implementation data table below compares the documented input and output contracts. It is especially useful when moving a calculation between Julia’s SI state vectors and poliastro’s kilometre-based core functions.
- Position is off by a factor of 1000. The Julia constructor example enters 7190.982e3, although its formatted output labels the axis in kilometres. Julia propagation tuples return metres; poliastro’s perturbation state uses kilometres and kilometres per second. Check the numeric arrays rather than inferring units from a formatted display.
- The next sample has an unexpected timestamp. Numeric propagate! arguments are measured from the initial epoch. Use last_instant to inspect the requested instant, or use propagate_to_epoch! with an absolute date.
- A fitted orbit has residual error despite convergence. The documented J2 fitting example reports converged = true while its position RMSE is about 4341 metres. Convergence describes the fitting algorithm’s stopping condition. It does not assert that a simplified J2 model reproduces all supplied positions exactly.
- The initial state is an instantaneous position and velocity. The documented fit_mean_elements routine accepts inertial position samples in metres, velocity samples in metres per second and Julian-day epochs. It returns fitted mean elements, a covariance matrix and fitting statistics. Use that documented estimation pathway when the task requires fitting mean elements from a sampled trajectory.
- The model lacks drag or another force. The Julia J2 page describes a secular model retaining only J2. Poliastro demonstrates separate atmospheric-drag, third-body and radiation-pressure functions, and an example combining J2 with atmospheric drag. Those effects require explicit modelling.
For catalogue inputs, retain the distinction between a source element set and the mean elements required here; the two-line element sets guide explains that exchange format. Selecting a similarly named orbital element is not evidence that two propagators use identical initial-state conventions.
Free alternatives to SatelliteToolboxPropagators.jl
Poliastro is a Python alternative distributed under the MIT license. Its documentation provides two relevant numerical workflows, compared below. Both use the same library; the distinction is which acceleration terms the user includes. This is useful when the research question requires an integrated state history rather than the Julia model’s secular mean-element evolution.
| Python workflow | Documented implementation | What it produces |
|---|---|---|
| J2-only perturbation with two-body dynamics | J2_perturbation added to func_twobody, integrated with CowellPropagator | A position and velocity series from which the example calculates RAAN |
| J2 plus atmospheric drag | J2_perturbation and atmospheric_drag_exponential combined in the derivative function | An orbit history used to compare altitude evolution with a drag-only calculation |
The poliastro installation page recommends a new environment and documents conda install -c conda-forge poliastro. Its stable documentation is for version 0.17.0 and lists Python 3.8 through 3.10 as supported. Match that documented environment when reproducing its examples. A newer local Python interpreter is not covered by that compatibility statement.
The Julia package also exposes :TwoBody, :J2osc, :J4 and :J4osc through its common API. These are additional models inside the same package. Their existence does not establish that they are interchangeable with :J2, and the usage reference directs users to each algorithm’s initialization documentation.
Citing and reporting a J2 perturbation calculation
For a reproducible methods description, identify the software, selected algorithm, initial epoch, initial elements, gravity constants, unit convention and output times. These recommendations follow directly from the documented differences between the implementations. A statement that a calculation “included J2” leaves unresolved whether the result was a secular mean-element trajectory, an acceleration evaluation or a numerical integration with additional forces.
The Julia repository supplies the software DOI 10.5281/zenodo.11285127. Cite the software record alongside the algorithm documentation; the J2 page identifies Vallado and Kozai as its algorithm references. Cite a particular paper’s derivation only after consulting that paper directly. For a poliastro calculation, identify the documented version and the perturbation functions included in the derivative.
Preserving these choices supports computational reproducibility. With a fitted initial orbit, also preserve the observation epochs, fitting settings and returned statistics. Report covariance and residual summaries as outputs of that fit, alongside the force-model scope, rather than treating the existence of a covariance matrix as proof of trajectory accuracy.
Sources
- JuliaSpace: SatelliteToolboxPropagators.jl home and installation, checked 2026-12-03.
- JuliaSpace: J2 Analytical Orbit Propagator, checked 2026-12-03.
- JuliaSpace: Usage, checked 2026-12-03.
- JuliaSpace: SatelliteToolboxPropagators.jl README and software DOI, checked 2026-12-03.
- poliastro: Core perturbations API, checked 2026-12-03.
- poliastro: Natural and artificial perturbations, checked 2026-12-03.
- poliastro: Installation, checked 2026-12-03.
- poliastro: MIT license, checked 2026-12-03.
Data: J2 software workflow input scales and result types
Original comparison compiled from the JuliaSpace J2 and usage documentation and the poliastro core perturbations reference. The numeric scale expresses how many metres one position or radius unit represents in each documented workflow; outputs are classified by their mathematical role.
| Workflow | Metres per input length unit (m) | Entry point | Result type |
|---|---|---|---|
| Julia J2 initialization | 1 | Propagators.init(Val(:J2), orb) | Mean-element analytical propagator |
| Julia J2 state propagation | 1 | Propagators.propagate!(orbp, elapsed_seconds) | Position and velocity vectors |
| Julia mean-element fitting | 1 | Propagators.fit_mean_elements(Val(:J2), vjd, vr_i, vv_i) | Mean elements, covariance and fit statistics |
| poliastro J2 acceleration | 1000 | J2_perturbation(t0, state, k, J2, R) | Cartesian perturbing acceleration |
Sources
- J2 · SatelliteToolboxPropagators.jl (accessed 2026-12-03)
- Usage · SatelliteToolboxPropagators.jl (accessed 2026-12-03)
- poliastro.core.perturbations — poliastro 0.17.0 documentation (accessed 2026-12-03)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







