amuse icon indicating copy to clipboard operation
amuse copied to clipboard

Lost connection to Fi when recommitting particles

Open JStroo2000 opened this issue 2 years ago • 6 comments

When adding new SPF particles to a running Fi hydro code, the code crashes

time = 0|units.yr end_time = 10|units.yr while time <= end_time: time += timestep new_wind = wind.create_wind(star) cloud.add_particles(new_wind) cloud.synchronize_to(hydro.gas_particles) hydro.evolve_model(time) channel_hydro_to_gas.copy() print(time) Error message: CodeException: Exception when calling function 'recommit_particles', of code 'FiInterface', exception was 'lost connection to code'

@GijsVermarien

JStroo2000 avatar Nov 29 '23 14:11 JStroo2000

Can you try starting Fi with hydro = Fi(redirection='none')? The code above can crash for any number of reasons, I can't immediately see what could cause it.

rieder avatar Nov 29 '23 14:11 rieder

Can you try starting Fi with hydro = Fi(redirection='none')? The code above can crash for any number of reasons, I can't immediately see what could cause it.

Setting redirection to none gives a 'timestep too small' message, for timesteps up to 1 Myr. It also gives the same error message as above.

JStroo2000 avatar Nov 29 '23 15:11 JStroo2000

Thanks. I’ve seen this error before then, I’ll get back to you soon.

rieder avatar Nov 29 '23 16:11 rieder

Hello! I am having the same error when I trying to use timestep in yr, it works for timesteps of a few days when the total evolution time is couple of hundred of days but when the evolution time is in hundred of years and timestep is in yr, it gives timestep too small error. Strangely, it also gave me timestep way too small error when I increased the timestep.

prashant050701 avatar Dec 16 '23 14:12 prashant050701

Thanks. I’ve seen this error before then, I’ll get back to you soon.

I saw it before in #670. It's probably not the same solution here, but the underlying cause is probably the same.

As a potential workaround, could you try manually setting hydro.parameters.timestep = 1 | units.s, calling hydro.evolve_model(hydro.model_time + (1 | units.s)) and then setting the timestep back to its original value, e.g.:

timestep_old = hydro.parameters.timestep
hydro.parameters.timestep = 1 | units.s
hydro.evolve_model(hydro.model_time + (1 | units.s))
hydro.parameters.timestep = timestep_old
hydro.evolve_model(time)

Please let me know if this works.

rieder avatar Dec 17 '23 09:12 rieder