Skip to content
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

Fix Error in Ball-Ball Frictional Inelastic No-Slip Velocity Calculation (Again) #177

Merged

Conversation

derek-mcblane
Copy link
Collaborator

I found an algebra mistake in my work. Third time is the charm, I hope.

I did a more thorough evaluation and found that the stun-shot plots matched Dr. Dave's TP A-14 if his friction model is used. Most importantly, the no-slip/slip case intersection happens at the same point.

@derek-mcblane derek-mcblane requested a review from ekiefl as a code owner January 6, 2025 00:54
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 44.62%. Comparing base (0e89b7f) to head (e3af2d0).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...resolve/ball_ball/frictional_inelastic/__init__.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #177      +/-   ##
==========================================
+ Coverage   44.22%   44.62%   +0.40%     
==========================================
  Files         127      127              
  Lines        8554     8587      +33     
==========================================
+ Hits         3783     3832      +49     
+ Misses       4771     4755      -16     
Flag Coverage Δ
service 44.62% <0.00%> (+0.40%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@derek-mcblane
Copy link
Collaborator Author

Needs a test for no-slip case; maybe a gearing english cut shot, which should result in no throw.

ekiefl
ekiefl previously approved these changes Jan 7, 2025
Copy link
Owner

@ekiefl ekiefl left a comment

Choose a reason for hiding this comment

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

I agree it would be nice to have tests, but I think the proof is in the pudding with these comparisons to experimental data:

image

image

Great job!

@derek-mcblane
Copy link
Collaborator Author

derek-mcblane commented Jan 7, 2025

Great job!

All thanks to David Alciatore and Bob Jewett!

@@ -90,7 +90,7 @@ def test_translating_head_on_zero_spin_inelastic(
cb_f, ob_f = model.resolve(cb_i, ob_i, inplace=False)

# Balls should still be moving together in +y direction
assert np.isclose(cb_f.vel[1], ob_f.vel[1], atol=1e-10)
assert abs(cb_f.vel[1] - ob_f.vel[1]) < 1e-10
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 changed this to a manual floating point comparison so that the pytest output is easier to read if it fails.



@pytest.mark.parametrize(
"model", [FrictionalInelastic(), FrictionalMathavan(num_iterations=int(1e5))]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mathavan takes this many iterations to meet requirements for no throw and no induced english.

assert abs(ob_f.avel[2]) < 1e-3, "Gearing english shouldn't cause induced side-spin"


@pytest.mark.parametrize("model", [FrictionalInelastic()])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test is pretty specific to FrictionalInelastic. Mathavan doesn't really work for this one even with 10e5 iterations, nor would I expect it to.

@derek-mcblane derek-mcblane requested a review from ekiefl January 7, 2025 05:57
Copy link
Owner

@ekiefl ekiefl left a comment

Choose a reason for hiding this comment

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

The "gearing english" is a great test. Also super illustrative of Mathavan's high iteration requirements... I think we should consider replacing the Mathavan model with this.

One request: Can you update the docstrings of those two tests?

  • The spin is in the -z direction
  • A mathematical definition of the gearing english condition would be useful because it's hard to follow from the code alone.
  • A description of what test_low_relative_surface_velocity tests would be helpful

It is a cruel experience to have your PR approved, then you improve the code further with tests, then your reviewer requests more changes 😄

@derek-mcblane
Copy link
Collaborator Author

It is a cruel experience to have your PR approved, then you improve the code further with tests, then your reviewer requests more changes 😄

No biggie. I was rushing a little when I added those tests, so I'm glad you caught that stuff.

Copy link
Owner

@ekiefl ekiefl left a comment

Choose a reason for hiding this comment

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

This is much clearer, thank you!

You haven't retagged me for review, but it looks finished to me, so I've approved just in case you forgot to retag.

@derek-mcblane derek-mcblane merged commit 9069d7f into ekiefl:main Jan 7, 2025
8 of 9 checks passed
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.

2 participants