rehanafzal commited on
Commit
56142c6
·
verified ·
1 Parent(s): 82246cb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import math
3
+
4
+ # App title
5
+ st.title("Pipe Sizing Helper")
6
+ st.write("This app suggests pipe sizes for a given flow rate and permissible velocity.")
7
+
8
+ # Input fields
9
+ flow_rate = st.number_input("Enter Flow Rate (m³/s):", min_value=0.0, step=0.01)
10
+ velocity = st.number_input("Enter Permissible Velocity (m/s):", min_value=0.1, step=0.01)
11
+
12
+ # Calculate pipe diameter
13
+ if st.button("Calculate"):
14
+ if velocity > 0:
15
+ # Pipe diameter formula: D = sqrt(4 * Q / (π * V))
16
+ diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity))
17
+ diameter_mm = diameter * 1000 # Convert meters to mm
18
+ st.success(f"Recommended Pipe Diameter: {diameter_mm:.2f} mm")
19
+ else:
20
+ st.error("Velocity must be greater than zero.")
21
+