-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdwf_Moody.bas
26 lines (22 loc) · 1.01 KB
/
dwf_Moody.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Attribute VB_Name = "DWf_Moody"
Function f_Moody(D As Double, Re As Double, aRou As Double) As Double
' Calculates the Darcy-Weisbach friction factor for pressure loss calculations
' based on Moody correlation
' by Tol,Hakan Ibrahim from the PhD study at Technical University of Denmark
' PhD Topic: District Heating in Areas with Low-Energy Houses
' INPUTS
' aRou : Absolute roughness of pipe [mm]
' D : Inner diameter of the pipe [mm]
' Re : Reynolds Number [-]
' Checking algorithm limitations
If Re < 4000 Or Re > 500000000 Then
'MsgBox "Error: Moody algorithm is valid for a Reynold range as in 4000<Re<5e8"
f_Moody = CVErr(xlErrNA)
End If
If aRou / D > 0.01 Then
'MsgBox "Error: Moody algorithm is valid for a relative roughness range as eps/D<0.01"
f_Moody = CVErr(xlErrNA)
End If
' Fasten your seat belts - Formulation in Run
f_Moody = 0.0055 * (1 + (20000 * (aRou / D) + 1000000 / Re) ^ (1 / 3))
End Function