 # Gravity force models

Hi all,

I have a question on the gravity forces defined in Orekit. I’m mainly trying to understand which one should be used in which situations. I’m currently trying to propagate trajectories between the Earth and the Moon representing the gravity attraction of the Earth, the Moon and the Sun.

But depending on which model I use I get very different results. I start by defining my propagator as follows:

``````final double minStep = 1e-9;
final double maxStep = 10000;
Orbit initialOrbit = new CartesianOrbit(initialPVJ2000, j2000, initialDate, CelestialBodyFactory.getEarth().getGM());
double[][] tolerance = NumericalPropagator.tolerances(0.001, initialOrbit, OrbitType.CARTESIAN);

// Defining the numerical integrator that will be used by the propagator
final AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tolerance, tolerance);

// Creating the numerical propagator
NumericalPropagator propagator = new NumericalPropagator(integrator);

propagator.setOrbitType(null);
propagator.setIgnoreCentralAttraction(true);
propagator.setEphemerisMode();
``````

And then I started defining the forces like I used to for elliptical orbits around the Earth:

``````// Non Keplerian propagation
NewtonianAttraction earthGravity = new NewtonianAttraction(CelestialBodyFactory.getEarth().getGM());
ThirdBodyAttraction moon3rdBodyGravity = new ThirdBodyAttraction(CelestialBodyFactory.getMoon());
ThirdBodyAttraction sun3rdBodyGravity = new ThirdBodyAttraction(CelestialBodyFactory.getSun());
``````

But I thought I could probably define each object with the same force model so I set each gravity pull as a `SingleBodyAbsoluteAttraction`.

``````SingleBodyAbsoluteAttraction earthGravity = new SingleBodyAbsoluteAttraction(CelestialBodyFactory.getEarth());
SingleBodyAbsoluteAttraction moon3rdBodyGravity = new SingleBodyAbsoluteAttraction(CelestialBodyFactory.getMoon());
SingleBodyAbsoluteAttraction sun3rdBodyGravity = new SingleBodyAbsoluteAttraction(CelestialBodyFactory.getSun());
``````

Which led me to very different results to what I was getting with the `NewtonianAttraction` + `ThirdBodyAttraction`.

I wondered if any of you could enlighten me on the difference between the two cases and which should be best.

Thank you very much for your help!

Kind regards,

B.

Hi @benoist

I think you have to perform a propagation in non inertial frame. For that, you have to add the inertial forces to the `SingleBodyAbsoluteAttraction`.

Here an example available on the Orekit tutorials repository: https://gitlab.orekit.org/orekit/orekit-tutorials/-/blob/develop/src/main/java/org/orekit/tutorials/propagation/PropagationInNonInertialFrame.java

Regards,
Bryan