-
Notifications
You must be signed in to change notification settings - Fork 73
Stronge as the default ball-cushion model #256
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
Open
ekiefl
wants to merge
7
commits into
main
Choose a base branch
from
ek/stronge-as-default
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
808a4ea
Set stronge as default
ekiefl 3eb3cd6
Add docstrings
ekiefl 0e90754
Add Poisson ratio conversion fns
ekiefl b498279
Add omega_ratio as model parameter
ekiefl 31a695d
Add comment on independence from k_n
ekiefl 25e6c90
Up default to 1.8
ekiefl 3043b23
Update docs
ekiefl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,51 @@ | |
|
|
||
| @jit(nopython=True, cache=const.use_numba_cache) | ||
| def normal_tangent_stiffness_ratio(poisson_ratio): | ||
| """Calculate eta_squared from Poisson ratio. | ||
|
|
||
| Args: | ||
| poisson_ratio: Poisson's ratio of the cushion. | ||
|
|
||
| Returns: | ||
| eta_squared: Ratio of normal to tangential stiffness. | ||
| """ | ||
| return (2 - poisson_ratio) / (2 * (1 - poisson_ratio)) | ||
|
|
||
|
|
||
| def poisson_ratio_from_omega_ratio( | ||
| omega_ratio: float, beta_t: float = 3.5, beta_n: float = 1.0 | ||
| ) -> float: | ||
| """Convert from tangential/normal frequency ratio to Poisson ratio. | ||
|
|
||
| Args: | ||
| omega_ratio: Frequency ratio omega_t/omega_n. Must be in range (1, 2). | ||
| beta_t: Tangential mass-matrix coefficient for sphere-half-space collision. | ||
| beta_n: Normal mass-matrix coefficient for sphere-half-space collision. | ||
|
|
||
| Returns: | ||
| Poisson's ratio. | ||
| """ | ||
| eta_squared = (beta_t / beta_n) / (omega_ratio**2) | ||
| return (2 * eta_squared - 2) / (2 * eta_squared - 1) | ||
|
|
||
|
|
||
| def omega_ratio_from_poisson_ratio( | ||
| poisson_ratio: float, beta_t: float = 3.5, beta_n: float = 1.0 | ||
| ) -> float: | ||
| """Convert Poisson ratio to the tangential/normal frequency ratio. | ||
|
|
||
| Args: | ||
| poisson_ratio: Poisson's ratio of the cushion. | ||
| beta_t: Tangential mass-matrix coefficient for sphere-half-space collision. | ||
| beta_n: Normal mass-matrix coefficient for sphere-half-space collision. | ||
|
|
||
| Returns: | ||
| Frequency ratio omega_t/omega_n. | ||
| """ | ||
| eta_squared = normal_tangent_stiffness_ratio(poisson_ratio) | ||
| return np.sqrt((beta_t / beta_n) / eta_squared) | ||
|
|
||
|
|
||
| @jit(nopython=True, cache=const.use_numba_cache) | ||
| def t_c_shift(e_n): | ||
| return (math.pi / 2) * (1 - 1 / e_n) | ||
|
|
@@ -431,16 +473,40 @@ def collision_duration(t_c, e_n): | |
|
|
||
|
|
||
| def resolve_collinear_compliant_frictional_inelastic_collision( | ||
| v_t_0: float, # tangential velocity (must be <= 0) | ||
| v_n_0: float, # normal velocity (must be <0) | ||
| m: float, # collision effective mass | ||
| beta_t: float, # mass-matrix coefficient | ||
| beta_n: float, # mass-matrix coefficient | ||
| mu: float, # friction coefficient | ||
| e_n: float, # coefficient of restitution | ||
| k_n: float, # normal spring stiffness | ||
| eta_squared: float, # ratio of normal spring stiffness to tangential spring stiffness | ||
| v_t_0: float, | ||
| v_n_0: float, | ||
| m: float, | ||
| beta_t: float, | ||
| beta_n: float, | ||
| mu: float, | ||
| e_n: float, | ||
| k_n: float, | ||
| eta_squared: float, | ||
| ) -> tuple[float, float]: | ||
| """Resolve a collinear compliant frictional inelastic collision. | ||
|
|
||
| Computes the post-collision tangential and normal velocities for a sphere | ||
| colliding with a half-space, accounting for friction, compliance (spring-like | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually general enough to do any two-body planar collinear collision. The beta_t and beta_n arguments come from the moments of inertia for the two bodies. |
||
| deformation), and inelastic energy loss. | ||
|
|
||
| Args: | ||
| v_t_0: Initial tangential velocity, must be <= 0. | ||
| v_n_0: Initial normal velocity, must be < 0. | ||
| m: Collision effective mass. | ||
| beta_t: Tangential mass-matrix coefficient. | ||
| beta_n: Normal mass-matrix coefficient. | ||
| mu: Friction coefficient. | ||
| e_n: Coefficient of restitution in the normal direction. | ||
| k_n: Normal spring stiffness. This value is arbitrary as only the frequency | ||
| ratio omega_t/omega_n affects the result, which depends on the ratio | ||
| beta_t/beta_n/eta_squared. | ||
| eta_squared: Ratio of normal to tangential spring stiffness. Together with | ||
| beta_t and beta_n, this determines the frequency ratio omega_t/omega_n, | ||
| which must be in the range (1, 2). | ||
|
|
||
| Returns: | ||
| Final tangential and normal velocities after collision. | ||
| """ | ||
| assert v_t_0 <= 0 | ||
| assert v_n_0 < 0 | ||
|
|
||
|
|
||
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.
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.
Just a small note: if we ever want to use the spring deformation to approximate cushion deformation and duration, this parameter affects that duration.