-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add helper method for running a simulation with grids of particles #270
base: master
Are you sure you want to change the base?
Conversation
@hscannell maybe you could have a look at this since you are doing particles with pyqg? |
… each fluid layer
b21c283
to
30fc70a
Compare
30fc70a
to
2510b9d
Compare
Let me know if this looks good to merge @hscannell! I also added a quick animated demo of this feature to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome. One minor API suggestion which can also be ignored for now.
@@ -233,6 +237,35 @@ def __init__( | |||
self._initialize_inversion_matrix() | |||
self._initialize_diagnostics(diagnostics_list) | |||
|
|||
def add_particles(self, initial_coords=None, order=1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def add_particles(self, initial_coords=None, order=1): | |
def add_particles(self, density=0.125, initial_coords=None, order=1): |
|
||
Parameters | ||
---------- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
density : float | |
How many particles to put per grid cell. Mutually exclusive with ``initial_coords``. |
""" | ||
|
||
if initial_coords is None: | ||
n = self.nx // 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n = self.nx // 8 | |
n = int(self.nx * density) |
or maybe something even better (non-discretized, using linspace)
While using particle classes to help visualize the results of pyqg simulations, I ended up writing some helper methods for running simulations with particles together, that seemed like they might be a useful feature for the main library. Here's an initial pass at how this might be incorporated, let me know what you think!