Skip to content

Running simulations in a loop #4

@s4ksb

Description

@s4ksb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions