Skip to content

Conversation

@swiggins8
Copy link
Collaborator

Made a very small change to GenerateDEMfromSPHGenerator.py in NodeGenerators, that adds functionality for easy iteration of list of radii for more complex particle generation. Also added simple rotation to some DEM boundary classes.

Summary

  • This PR is a feature.
  • It does the following:
    • Adds the ability to have a list of radii read in to GenerateDEMfromSPHGenerator.py's GenerateDEMfromSPHGenerator3d class.
      • Before the class could only accept floats, ints, and functions for particleRadius.
      • This change allows the user to more easily implement more complicated generators for DEM, rather than having to come up with their own methods for each individual problem.
    • Further adds to the DEM physics package, by adding very simple rotation to most of the solid boundary classes.
      • Before most classes had no rotation.
      • Now the classes can have very simple rotation, such as the cylinder class now having rotation around its central axis.

ToDo :

  • Annotate RELEASE_NOTES.md with notable changes.
  • Create LLNLSpheral PR pointing at this branch. (PR#)
  • LLNLSpheral PR has passed all tests.

…s for easy iteration of list of radii. Also added simple rotation to some DEM boundary classes.
@swiggins8 swiggins8 requested a review from jmpearl September 5, 2025 20:32
const auto p = position - mPoint;
const auto pnMag = p.dot(mAxis);
const auto pn = pnMag * mAxis;
const auto r = p - pn; // Radial vector from the axis to the position
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the radial component here on the position, would that assume that mAngularVelocity and mAxis are aligned?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I assume that the angular velocity is always around the central axis

const Vector& axis,
const Scalar radius,
const Scalar length,
const RotationType& angularVelocity):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If angularVelocity must be aligned with the axis this should be enforced somehow

Copy link
Collaborator Author

@swiggins8 swiggins8 Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you suggest for enforcement of that? I feel like keeping it a simple vector makes sense for conveying that it can't do complex rotation. But I'm open to ideas.

#--------------------------------------------------
if type(particleRadius) in [float,int]:
if isinstance(particleRadius, list):
radii = list(particleRadius)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ln 36 might not be need? its already a list right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way it seemed to be working before was that if you input in a "particleRadius" argument it had to be a float, int, or function. So if you already have an exact list of particle dimensions that you want to be consistent from sph generation to dem generation it would not accept that list.
In particular I created a list of radii that fit a gaussian distribution from a custom sph generator, but without feeding in that list the sph-to-dem generator would overwrite the particle sizes with the radius guess from h below. Adding in the capability to just drop in a list of radii just seemed easier and more straightforward for future use than having to create a function for potentially every simulation.

if isinstance(particleRadius, list):
radii = list(particleRadius)
counter = {"i" : 0}
def radiusFunc(position):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this pattern work for SPH generators that are parallel?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only tested for serial generation, but I would imagine that the list would have to be globally concatenated before passing it in for it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants