Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
|
| 4 |
+
def main():
|
| 5 |
+
st.title("Fluid Mechanics Concepts and Formulas")
|
| 6 |
+
st.sidebar.title("Navigation")
|
| 7 |
+
|
| 8 |
+
menu = ["Home", "Concepts", "Formulas"]
|
| 9 |
+
choice = st.sidebar.radio("Select a section:", menu)
|
| 10 |
+
|
| 11 |
+
if choice == "Home":
|
| 12 |
+
st.subheader("Welcome to the Fluid Mechanics App")
|
| 13 |
+
st.write("""
|
| 14 |
+
This app provides key concepts and formulas for fluid mechanics.
|
| 15 |
+
Use the sidebar to navigate between different sections.
|
| 16 |
+
""")
|
| 17 |
+
|
| 18 |
+
elif choice == "Concepts":
|
| 19 |
+
st.subheader("Key Concepts in Fluid Mechanics")
|
| 20 |
+
st.write("### 1. Fluid Properties")
|
| 21 |
+
st.write("""- **Density (\(\rho\))**: Mass per unit volume.
|
| 22 |
+
\[\rho = \frac{m}{V}\]
|
| 23 |
+
- **Viscosity (\(\mu\))**: A measure of a fluid's resistance to deformation.
|
| 24 |
+
- **Pressure**: Force exerted per unit area.
|
| 25 |
+
""")
|
| 26 |
+
st.write("### 2. Flow Types")
|
| 27 |
+
st.write("""- **Laminar Flow**: Smooth, orderly flow.
|
| 28 |
+
- **Turbulent Flow**: Irregular, chaotic flow.
|
| 29 |
+
""")
|
| 30 |
+
st.write("### 3. Bernoulli's Principle")
|
| 31 |
+
st.write("""In a streamline flow, the total energy per unit volume remains constant:
|
| 32 |
+
\[P + \frac{1}{2}\rho v^2 + \rho gh = \text{constant}\]
|
| 33 |
+
""")
|
| 34 |
+
|
| 35 |
+
elif choice == "Formulas":
|
| 36 |
+
st.subheader("Fluid Mechanics Formulas")
|
| 37 |
+
|
| 38 |
+
st.write("### 1. Continuity Equation")
|
| 39 |
+
st.latex(r"A_1 v_1 = A_2 v_2")
|
| 40 |
+
st.write("""The product of cross-sectional area and velocity is constant for an incompressible fluid.
|
| 41 |
+
""")
|
| 42 |
+
|
| 43 |
+
st.write("### 2. Bernoulli's Equation")
|
| 44 |
+
st.latex(r"P + \frac{1}{2}\rho v^2 + \rho gh = \text{constant}")
|
| 45 |
+
st.write("""Relates pressure, velocity, and height in a flowing fluid.
|
| 46 |
+
""")
|
| 47 |
+
|
| 48 |
+
st.write("### 3. Reynolds Number")
|
| 49 |
+
st.latex(r"Re = \frac{\rho v D}{\mu}")
|
| 50 |
+
st.write("""Determines whether flow is laminar or turbulent.
|
| 51 |
+
""")
|
| 52 |
+
|
| 53 |
+
st.write("### 4. Hydrostatic Pressure")
|
| 54 |
+
st.latex(r"P = \rho g h")
|
| 55 |
+
st.write("""Pressure at a depth \(h\) in a fluid of density \(\rho\).
|
| 56 |
+
""")
|
| 57 |
+
|
| 58 |
+
if __name__ == '__main__':
|
| 59 |
+
main()
|
| 60 |
+
|