Own planetary bodies?

Hello there!

I’m new to Orekit and I am working on a pure Java project for school.
The project is basically an imaginary solar system but with real physics. I’m now wondering if it is possible to make celestial Bodies without ephemerides.

for everyone who is wondering why I am using Orekit in the first place: I need a library with integrated orbital mechanics.

thank you for reading :slight_smile:

Hi @Foirent,

Welcome to the Orekit’s forum!

What do you mean by ephemeris? Are you talking about the planetary ephemerides of the celestial bodies? For example those provided by the JPL (i.e. DE-4XX). Because at some point you will need this data to handle the celestial bodies. For instance, to create one (See example below).

All the needed data are available inside the orekit-data. You can download the orekit-data here.

Here, an example on how to initialize a celestial body using Orekit and orekit-data:

    // Configure Orekit
    final File home       = new File(System.getProperty("user.home"));
    final File orekitData = new File(home, "orekit-data");
    final DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
    manager.addProvider(new DirectoryCrawler(orekitData));

    // Access the celestial body information (reference frame, name, GM)
    final CelestialBody marsData = CelestialBodyFactory.getMars();
    // Create the "Physical" body.
    final double MARS_EQUATORIAL_RADIUS = 3394200;
    final double MARS_FLATTENING = 0.00589;
    final OneAxisEllipsoid mars = new OneAxisEllipsoid(MARS_EQUATORIAL_RADIUS,

That’s the line CelestialBodyFactory.getMars() that needs first the celestial body ephemeris. However, I don’t see any other way to deal without the ephemeris data if you want to use real physics.

Kind regards,

You should be able to implement CelestialBody with your own class. It would probably be easier to just implement PVCoordinatesProvider if you only need PVCoordinates. Propagator already implements this interface.

As for simulating a solar system, I don’t think Orekit can do that currently. I don’t think there is currently a way to make the acceleration for one propagator dependent on the position of another propagator as it is in the n-body problem. You could directly use a Hipparchus ODEIntegrator to simulate the n-body problem and computing the acceleration would be straight forward since it is all third body effects. Another option is to assume the acceleration due to the sun is much greater than that of other planets. In that case just use a KeplerianPropagator.

I think you should use the new DataContext feature that was added in release 10.1. The documentation is here. This will allow you to set up a custom factory for CelestialBody implementations, and this custom factory wil create instances of a class you can design by yourself:

public class MyFictitiousCelestialBody implements CelestialBody {
    public Frame getInertiallyOrientedFrame() {
       // create a moving frame with inertial orientation, the centre of the frame
       // following any trajectory you want, for example a Keplerian motion
       // about your fictitious central star

   public Frame getBodyOrientedFrame() {
     // implement this by using getInertiallyOrientedFrame() as the parent of the
    // frame, and adding some rotation to represent planet proper rotation
    // for simplicity you can also directly return getInertiallyOrientedFrame(), this
   // would represent a planet that has no rotation at all

  public String getName() {
    return someNamePassedAsConstructorArgument;

  public double getGM() {
    return someGMPassedAsConstructorArgument;

Thank you all for your answers!