Please login with a confirmed email address before reporting spam
Posted:
3 years ago
22 sept. 2021, 10:46 UTC−4
I crawled so you could run. In the end I solved this myself. I wrote a program externally in MatLab which created a text file with three columns. The first column contained the timesteps while the second and third columns contained the x and y components of the force vector.
Then I imported this text file into two interpolation functions (Component>Definitions), one for the Force x-component and one for the y-component. The functions were named "Force_x" and "Force_y". Both of these functions accepts "s" as an Argument and outputs "N" as the function.
Finally, I added a generic Force to one of the physics modules, chose Specify force>directly, and then simply specified the forces as Force_x(t) and Force_y(t) which I had set up in the last step.
If needed, different forces can be applied to each particle in the simulation. To do this, define the generic force as above and use the particle index (unique to each particle) to seed a random function which picks a random row (i.e. time) within the text file from which to start.
For example, for the x component this might look like:
F=Force_x(t+random offset)
where the random offset is a function that you specify to choose a random row of the text file.
Be careful to have a long enough text file that there isn't any overlap between the sections that will be "sampled" by your generic force for different particles. In other words, you want (t+random offset) for particle i to be different for (t+random offset) for any other particle j, keeping in mind that the text file will be sampled from rows (t_1 + random offset) to (t_2 + random offset), where t_1 and t_2 are the first and final timesteps of your entire simulation.
If you have difficulty, contact me and I can help replicate this solution for you.
I crawled so you could run. In the end I solved this myself. I wrote a program externally in MatLab which created a text file with three columns. The first column contained the timesteps while the second and third columns contained the x and y components of the force vector.
Then I imported this text file into two interpolation functions (Component>Definitions), one for the Force x-component and one for the y-component. The functions were named "Force_x" and "Force_y". Both of these functions accepts "s" as an Argument and outputs "N" as the function.
Finally, I added a generic Force to one of the physics modules, chose Specify force>directly, and then simply specified the forces as Force_x(t) and Force_y(t) which I had set up in the last step.
If needed, different forces can be applied to each particle in the simulation. To do this, define the generic force as above and use the particle index (unique to each particle) to seed a random function which picks a random row (i.e. time) within the text file from which to start.
For example, for the x component this might look like:
F=Force_x(t+random offset)
where the random offset is a function that you specify to choose a random row of the text file.
Be careful to have a long enough text file that there isn't any overlap between the sections that will be "sampled" by your generic force for different particles. In other words, you want (t+random offset) for particle i to be different for (t+random offset) for any other particle j, keeping in mind that the text file will be sampled from rows (t_1 + random offset) to (t_2 + random offset), where t_1 and t_2 are the first and final timesteps of your entire simulation.
If you have difficulty, contact me and I can help replicate this solution for you.