-
-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Tortilla #7201
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
Tortilla #7201
Changes from 1 commit
bdc7cbb
6f70b42
7540a77
30accf1
235dc75
ef73755
9552161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,41 @@ | ||||||
""" | ||||||
Calculates velocity of fluid from Potential Gravitational Energy | ||||||
|
||||||
Equation for finding velocity | ||||||
V = sqrt(2 * gravity * Δy) | ||||||
|
||||||
Source: | ||||||
- https://en.wikipedia.org/wiki/Archimedes%27_principle | ||||||
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.
Suggested change
|
||||||
""" | ||||||
|
||||||
|
||||||
# Acceleration Constant on Earth (unit m/s^2) | ||||||
g = 9.80665 | ||||||
|
||||||
|
||||||
def torricelli_theorem(height: float, gravity: float = g) -> float: | ||||||
""" | ||||||
Args: | ||||||
height: The change in height between initial and point of flow (where, | ||||||
velocity is being measured) | ||||||
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. Please mention the unit of height used. |
||||||
gravity: Acceleration from gravity. Gravitational force on system, | ||||||
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.
Suggested change
|
||||||
Default is Earth Gravity | ||||||
returns: | ||||||
velocity of exiting fluid. | ||||||
|
||||||
>>> torricelli_theorem(height=5) | ||||||
9.90285312422637 | ||||||
>>> torricelli_theorem(height=3, gravity=9.8) | ||||||
7.6681158050723255 | ||||||
""" | ||||||
if gravity <= 0: | ||||||
raise ValueError("Impossible Gravity") | ||||||
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.
Suggested change
|
||||||
|
||||||
return (2 * height * gravity)**0.5 | ||||||
|
||||||
|
||||||
if __name__ == "__main__": | ||||||
import doctest | ||||||
|
||||||
# run doctest | ||||||
doctest.testmod() |
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.