Added support for random sphere packing in a conical container. #3739
+340
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have not (yet) checked off the documentation item because I am unsure if I need to add the above equations to the methods section of the documentation. The
_Coneclass does have docstrings, made by editing the_Cylinderdocstring as needed.Checklist