How can I force the integration step

Hello!

I use

DormandPrince853Integrator integrator = new DormandPrince853Integrator(0.0001, 30, tolerances[0], tolerances[1]);

integrator.setInitialStepSize(30);

NumericalPropagator propagator = new NumericalPropagator(integrator);

SpacecraftState one_state = propagator.propagate(initialDate, start_date);

propagator.setInitialState(one_state);

AbsoluteDate finish_date = end_date;

propagator.propagate(one_state.getDate(), end_date);

I want to change the integration step before

propagator.setInitialState(one_state) as follows:

integrator.setInitialStepSize(1);

But the integration step does not change - there are 30 seconds left. How can I force the integration step?

Hi @arletty,

Are you sure ? I’ve tested your code and it does what is asked.
Beware that using integrator.setInitialStepSize changes the initial step size of the integrator (so only for the first step).
Is this what you want or do you want to change the maximum step size ?

Hello, @MaximeJ

I want to change the integration step in the middle of calculations (no matter which one)
Code works - but the step does not change
I tried to initialize a new integrator with a different step, adding all the forces - and added a new integrator to the same propagator (one propagator) - also does not work
The new propagator doesn’t work either - But there are a lot of events in my propagater, it’s better not to change it

This is not possible.
A propagator uses only one integrator and a variable step integrator manages the steps by itself, using the threshold to estimate errors and deducing next step size. There are currently no way to force a step size change at integrator level during integration.

In order to change step size, you should probably change the errors settings (i.e. the threshold) and restart propagation. For many embedded Runge-Kutta integrators like Dormand-Prince 8 (5, 3), this is not really costly, next step involve only one right hand side function evaluation less than first step (because most of these integrators are FSAL: First Same As Last). The overhead in restarting integration is mainly on initialization of events handlers, but this is ofter a small amount of computation relatively to right hand side evaluation.

If all you need is change the output step (i.e. not the internal integration step), then you could rely on a step handler that uses the interpolator, and decide by yourself when you switch to finer or broader sampling, but I am not sure this is what you need.

@luc Thank you, I knew you’d answer like that - and that’s also exactly my thoughts. Now I’m looking for a way to change the integration step - to make the calculation faster with a large integration step - and the subsequent one with a small integration step.

It is possible to break my propogator into two propagators that will be similar to everyone except the integration step and the beginning and end times. I’m still thinking

I know that Dorman Prince himself changes the integration step depending on how we set them - that’s not what I need right now.

If you need to switch just once, then set up a custom function to build the propagators taking tolerance as input parameters and call it twice to have two propagators. Then when the first one stops, use the final state as the initial state of the second one.

If you need to switch back and forth between two configurations, then set up two different NumericalPropagatorBuilder instances, one with each settings, and create the propagators as needed, each time using the final state of one propagator as the initial state of the next one.

Hi again @arletty,

I reckon @luc already solved your issue.
But if you’re ok with calling two successive propagate methods (as in your first example) you can use method integrator.setStepSizeControl to change the min/max step of your integrator between two consecutive propagations.

Here is an example :
ChangeIntegrationStep.java (4.1 KB)

I’ve used the initial orbit from NumericalPropagation tutorial and your setup for the integration.
First propagation of 100s with initial step (step0) = 30s and max step 30s.
Second propagation of 2400s with initial step = 1s and max step 600s.
Here is the output (t0: step start date, tf: step end date, dt: step size)

First propag with step0 = 30 and maxStep = 30

	t0 = 2004-01-01T23:30:00.000Z
	tf = 2004-01-01T23:30:30.000Z
	dt = 30.0

	t0 = 2004-01-01T23:30:30.000Z
	tf = 2004-01-01T23:31:00.000Z
	dt = 30.0

	t0 = 2004-01-01T23:31:00.000Z
	tf = 2004-01-01T23:31:30.000Z
	dt = 30.0

	t0 = 2004-01-01T23:31:30.000Z
	tf = 2004-01-01T23:31:40.000Z
	dt = 10.0

Second propag with step0 = 1 and maxStep = 600

	t0 = 2004-01-01T23:31:40.000Z
	tf = 2004-01-01T23:31:41.000Z
	dt = 1.0

	t0 = 2004-01-01T23:31:41.000Z
	tf = 2004-01-01T23:31:51.000Z
	dt = 10.0

	t0 = 2004-01-01T23:31:51.000Z
	tf = 2004-01-01T23:33:31.000Z
	dt = 100.0

	t0 = 2004-01-01T23:33:31.000Z
	tf = 2004-01-01T23:43:31.000Z
	dt = 600.0

	t0 = 2004-01-01T23:43:31.000Z
	tf = 2004-01-01T23:53:31.000Z
	dt = 600.0

	t0 = 2004-01-01T23:53:31.000Z
	tf = 2004-01-02T00:03:31.000Z
	dt = 600.0

	t0 = 2004-01-02T00:03:31.000Z
	tf = 2004-01-02T00:10:00.000Z
	dt = 389.0

The first 3 points of the second propagation are the initial step set to 1s and two “warm up” steps. But then it manages to use the 600s max step.

Does that help ?

Maxime

@MaximeJ , Thank you, I’ll test it now

Breaking the code for me is not a way out - I have a lot of lines of code and events - you will need to remember many states of one propagator to go to another

Yes, it works good :blush:

Thanks @MaximeJ

In the description of the method, resetting the integration step is called a “side effect” - I would call it a very useful effect :muscle: