pypr / pysph

A framework for Smoothed Particle Hydrodynamics in Python
http://pysph.readthedocs.io
Other
456 stars 138 forks source link

Some confusion about using pysph #379

Open Ordinaryxian opened 1 year ago

Ordinaryxian commented 1 year ago

Hello, I met two problems when I used the pysph framework to write the simulation of planetary collision: (1) How to delete the particles that have little effect on the system during operation; (2) How to calculate the gravity, my current practice is to traverse all the particles and then calculate, such equation takes a long time to calculate, is there any other method to calculate the gravity

nauaneed commented 1 year ago

I have not simulated planetary collisions with pysph but,

(1) You could use the remove_particles method to remove particles from a particle array. There is a remove_tagged_particles method as well. You can search the pysph codebase for usage of this method, and you will find plenty of occurrences that could serve as an example. (2) I assume you are describing a non-pysph implementation when you mention,

my current practice is to traverse all the particles and then calculate such equation takes a long time to calculate

In fact, pysph's nearest neighbour search capabilities lets you traverse only the particles that are near enough to a given particle to be able to influence it significantly.

I think this is better suited in Discussions as it is not an Issue.