Fluid-mechanics / app.py
MuhammadHananKhan123's picture
Update app.py
855e841 verified
# app.py
import streamlit as st
def main():
st.title("Fluid Mechanics Concepts and Formulas")
st.sidebar.title("Navigation")
menu = ["Home", "Concepts", "Formulas"]
choice = st.sidebar.radio("Select a section:", menu)
if choice == "Home":
st.subheader("Welcome to the Fluid Mechanics App")
st.write("""
This app provides key concepts and formulas for fluid mechanics.
Use the sidebar to navigate between different sections.
""")
elif choice == "Concepts":
st.subheader("Key Concepts in Fluid Mechanics")
st.write("### 1. Fluid Properties")
st.write("""- **Density (\(\rho\))**: Mass per unit volume.
\[\rho = \frac{m}{V}\]
- **Viscosity (\(\mu\))**: A measure of a fluid's resistance to deformation.
- **Pressure**: Force exerted per unit area.
""")
st.write("### 2. Flow Types")
st.write("""- **Laminar Flow**: Smooth, orderly flow.
- **Turbulent Flow**: Irregular, chaotic flow.
""")
st.write("### 3. Bernoulli's Principle")
st.write("""In a streamline flow, the total energy per unit volume remains constant:
\[P + \frac{1}{2}\rho v^2 + \rho gh = \text{constant}\]
""")
elif choice == "Formulas":
st.subheader("Fluid Mechanics Formulas")
st.write("### 1. Continuity Equation")
st.latex(r"A_1 v_1 = A_2 v_2")
st.write("""The product of cross-sectional area and velocity is constant for an incompressible fluid.
""")
st.write("### 2. Bernoulli's Equation")
st.latex(r"P + \frac{1}{2}\rho v^2 + \rho gh = \text{constant}")
st.write("""Relates pressure, velocity, and height in a flowing fluid.
""")
st.write("### 3. Reynolds Number")
st.latex(r"Re = \frac{\rho v D}{\mu}")
st.write("""Determines whether flow is laminar or turbulent.
""")
st.write("### 4. Hydrostatic Pressure")
st.latex(r"P = \rho g h")
st.write("""Pressure at a depth \(h\) in a fluid of density \(\rho\).
""")
if __name__ == '__main__':
main()