-
Notifications
You must be signed in to change notification settings - Fork 599
Added support for random sphere packing in a conical container. #3739
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
base: develop
Are you sure you want to change the base?
Conversation
|
I think it is mathematically possible to use a similar approach with equations for lines and the perpendicular distance between them to work with more complex surfaces. I'm not sure of the general interest in expanding the available containers further, though - and I haven't thought as deeply about the implementation. |
paulromano
left a comment
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.
@ZoeRichter Thanks for proposing this addition. I've also had the thought of extending pack_spheres to support a generic bounded Region. I'm going to see if I can get something working and if so, it might be better to adopt that for use cases like this unless the performance is significantly worse then a specialized version. I'll let you know how it goes!
|
Thanks Paul! A single method that can apply to a generic surface would certainly be more elegant than creating subclasses for each container. I'd also be happy to help with developing/testing such a feature. |
|
Hello @ZoeRichter and @paulromano. I’m interested in packing spheres in an annular cylinder. It looks like |
|
I think there would need to be a discussion around the method going forward (individual subclasses for each shape vs a generic container that can work for an arbitrary (but realistic) region), but, I'm definitely open to collaborating to improve this feature, either within this PR, or in a new one, if that is preferred. For what it's worth, I think the change to allow a cylindrical shell would actually be fairly straight forward - the cylinder would have a minimum r in its limits, and the checks that count the number of regions would need to allow 1 or 2 cylinders. |
|
Also - I am a bit confused on why the checks are failing after changing a documentation page, but it's not failing in a documentation check. It passed all checks before I made the documentation change - is there possibly some dependency issue? |
|
Just submitted a PR for packing on generic regions in #3759! Let me know what you think |
Description
Currently,
model.pack_spheres()only supports rectangular prisms, cylinders, and spheres as container. This PR adds a_Conesubclass to_Containerthat allows the user to randomly pack truncated conical containers usingmodel.pack_spheres(). This is useful for modeling pebble-bed reactors, which often use a cone in the outlet chute.It uses the
_Cylindercontainer as a guide because it is the closest to the cone, and I stuck as close as I could to the approach/style there as I could. The biggest deviation from the other_Containersubclasses is the way it stores its limits.The radial limit is a linear function dependent upon the z-coordinate of the pebble. It is the equation of a line that is parallel to the side of the cone, but a perpendicular distance further into the cone equal to the radius of the spheres being packed.
Two parallel lines of the form
Have a perpendicular distance, d, of
With the above naming convention, the line for the edge of the cone is
With$d = r_{sph}$ and $m = \frac{2z}{r_{major}-r_{minor}}$ , the constant for the $r_{lim}$ line can be back-calculated:
Plugging the constant back in, solving for$r_{lim}(z_{sph})$ , and simplifying, we get to the equation of the radial limit in the cone:
Because the limit depends on the specific sphere you are checking, but I wanted to use a similar data structure to the other containers, the radial limit is broken into a 2 element list, with the first being the coefficient of$z_{sph}$ , and the second being the constant in the $r_{lim}$ equation. As far as I have been able to tell, the only place this caused an issue was in updating the domain limits (line 1596 of triso.py). I got the data structure I used to work with a try/except, but there's probably a more elegant/foolproof way to do that.
I added a new section to the theory section of the docs explaining the above, and I included the discussion of the Jodrey-Tory algorithm, which is currently part of the
pack_spheres()docstring, in this section as well. I have not removed the theory from the docstring, but I can if that is desired.I also did a little test plot so I could check the sphere placement visually, in addition to the unit tests. This uses a packing fraction of 0.4, so it should be in the range that automatically uses the JT algorithm.

Checklist