Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running simulations in a loop #4

Open
s4ksb opened this issue Jan 5, 2023 · 0 comments
Open

Running simulations in a loop #4

s4ksb opened this issue Jan 5, 2023 · 0 comments

Comments

@s4ksb
Copy link

s4ksb commented Jan 5, 2023

Hi there,

I have been trying to run simulations using various initial conditions however I find that this causes an error. Using your orbits_formation_example.py, I have placed lines 89-202 inside a function which takes values for a particles starting velocity and I then call this function within a loop, changing the initial velocities. I find that when I do this the first iteration runs fine but then after that I start getting errors, which I believe is a result of

`    for i in range(0,n):        
        par[i].fnacc.x = par[i].facc.x(pos)
        par[i].fnacc.y = par[i].facc.y(pos)
        f.append(par[i].fnacc.x)
        f.append(par[i].fnacc.y)`

producing nan's, which then causes errors with odeint. Do you know how to fix this?

Many thanks
Karl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant