Private Sub reynolds_number_Click()
Dim flow As String, rate As Single, re As Single, p As Single, d As Single, u As Single, pi As Single
flow = InputBox("Select which flow rate is being used", "Flow Rate", "kg/sec, m/sec, m³/sec")
Select Case flow
Case "kg/sec", "m/sec", "m³/sec"
'Do nothing
Case Else
MsgBox "Invalid flow rate specified!", 16, "Invalid Units"
Exit Sub
End Select
If flow = "kg/sec" Then
rate = InputBox("Input a numeric value for the flow rate", "Flow Rate", "number")
u = InputBox("What is the viscosity?", "Viscosity", "kg/m·sec")
d = InputBox("What is the diameter of the inside of the tube?", "Diameter", " in meters")
Else
rate = InputBox("Input a numeric value for the flow rate", "Flow Rate", "number")
u = InputBox("What is the viscosity?", "Viscosity", "kg/m·sec")
p = InputBox("What is the density?", "Density", "kg/m³")
d = InputBox("What is the diameter of the inside of the tube?", "Diameter", " in meters")
End If
pi = 4 * Atn(1)
re = ((4 * rate) / (pi * d * u))
re = ((d * rate * p) / u)
re = ((4 * rate * p) / (pi * d * u))
Select Case (re)
Case Is < 0
MsgBox "You have inputed a incorrect number causing the answer to be negative", 16, "Error"
Exit Sub
Case Is < 2100
MsgBox "The flow is laminar", , "Fluid Flow"
Case Is > 2100
MsgBox "The flow is in transition", , "Fluid Flow"
Case Is < 6000
MsgBox "The flow is in transition", , "Fluid Flow"
Case Else
MsgBox "The flow is turbulent", , "Fluid Flow"
End Select
If flow = "kg/sec" Then
MsgBox "The Reynolds Number is " & ((4 * rate) / (pi * d * u)), , "Reynolds number if volumetric flow rate was specified"
ElseIf flow = "m/sec" Then
MsgBox "The Reynolds Number is " & ((d * rate * p) / u), , "Reynolds number if velocity specified"
ElseIf flow = "m³/sec" Then
MsgBox "The Reynolds Number is " & ((4 * rate * p) / (pi * d * u)), , "Reynolds number using volumetric flow rate"
End If
End Sub
Bookmarks