Fittings
Overview
In piping systems, fittings and valves are essential components that enable direction changes, flow branching, area transitions, and flow regulation. While straight pipe friction is distributed along the pipe length and calculated using the Darcy-Weisbach equation, fittings create localized pressure drops often termed “minor losses” (though they can dominate in complex networks with many fittings). Accurately quantifying these losses is critical for pump sizing, energy efficiency analysis, and overall system design.
Loss Coefficient (K). The pressure drop across a fitting is typically expressed using a loss coefficient K, where the pressure drop is \Delta p = K \frac{\rho v^2}{2}. Here, \rho is the fluid density and v is the velocity. The K value depends on the fitting geometry, Reynolds number, and surface roughness, and is determined through empirical correlations or experimental data. These tools implement correlations from authoritative sources such as Crane Technical Paper 410, Idelchik’s Handbook, and peer-reviewed studies.
Bends and Elbows. Pipe bends redirect flow, creating secondary flows and increased turbulence. BEND_ROUNDED calculates K for smooth elbows using correlations that account for bend radius and angle, while BEND_MITER handles miter bends (segmented elbows) which have higher losses. Special geometries like HELIX and SPIRAL account for coiled pipes used in heat exchangers and compact installations.
Contractions and Expansions. Area changes create losses due to flow acceleration or deceleration and associated turbulence. CONTRACTION_SHARP and CONTRACTION_ROUND compute K for reducers (decreasing diameter), while DIFFUSER_SHARP and DIFFUSER_CONICAL handle expansions (increasing diameter). Sharp transitions have higher losses than gradual, tapered transitions.
Entrances and Exits. Pipe entrances from reservoirs and exits to reservoirs represent special boundary conditions. ENTRANCE_SHARP, ENTRANCE_ROUNDED, ENTRANCE_BEVELED, and ENTRANCE_ANGLED calculate K for various entrance geometries, with sharp-edged entrances producing the highest losses. EXIT_NORMAL computes the loss when fluid discharges from a pipe into a large reservoir (typically K ≈ 1.0).
Valves. Valves regulate flow and create pressure drops that vary with valve type and opening position. Tools for common industrial valves include K_GATE_VALVE, K_GLOBE_VALVE, K_BALL_VALVE, K_BUTTERFLY_VALVE, and K_SWING_CHECK_VALVE. These use the Crane method, which relates K to an equivalent length of straight pipe.
Flow Coefficient Conversions. Valve manufacturers often specify performance using flow coefficients rather than K values. The imperial Cv and metric Kv coefficients represent the flow rate (in GPM or m³/h) at a 1 psi or 1 bar pressure drop, respectively. CV_TO_K, KV_TO_K, K_TO_CV, and K_TO_KV convert between these representations, enabling integration of manufacturer data into system hydraulic calculations.
These tools are implemented using the fluids library, which provides a comprehensive collection of correlations for fitting and valve losses validated against experimental data and industry standards.
BEND_MITER
Calculate the loss coefficient (K) for a single-joint miter bend in a pipe.
Excel Usage
=BEND_MITER(angle, miter_method)
angle(float, required): Angle of miter bend [degrees]miter_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the miter bend [-]
Example 1: 90 degree miter bend
Inputs:
| angle |
|---|
| 90 |
Excel formula:
=BEND_MITER(90)
Expected output:
1.20208
Example 2: 45 degree miter bend
Inputs:
| angle |
|---|
| 45 |
Excel formula:
=BEND_MITER(45)
Expected output:
0.304196
Example 3: 150 degree miter bend
Inputs:
| angle |
|---|
| 150 |
Excel formula:
=BEND_MITER(150)
Expected output:
2.71281
Example 4: 120 degree miter bend
Inputs:
| angle |
|---|
| 120 |
Excel formula:
=BEND_MITER(120)
Expected output:
2.0265
Python Code
Show Code
from fluids.fittings import bend_miter as fluids_bend_miter
def bend_miter(angle, miter_method='Rennels'):
"""
Calculate the loss coefficient (K) for a single-joint miter bend in a pipe.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.bend_miter
This example function is provided as-is without any representation of accuracy.
Args:
angle (float): Angle of miter bend [degrees]
miter_method (str, optional): Calculation method Valid options: Rennels, Crane, Blevins. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the miter bend [-]
"""
try:
try:
angle = float(angle)
except (ValueError, TypeError):
return "Error: Angle must be a number."
if angle <= 0:
return "Error: Angle must be greater than 0 degrees."
angle_limits = {
'Rennels': 150,
'Crane': 90,
'Blevins': 120,
}
max_angle = angle_limits.get(miter_method)
if max_angle is None:
return "Error: Invalid miter_method."
if angle > max_angle:
return f"Error: Angle must be between 0 and {max_angle} degrees for {miter_method} method."
result = fluids_bend_miter(angle=angle, method=miter_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
BEND_ROUNDED
Calculate the loss coefficient (K) for a rounded pipe bend (elbow) using various methods.
Excel Usage
=BEND_ROUNDED(Di, angle, rc, Re, bend_method)
Di(float, required): Inside diameter of pipe [m]angle(float, required): Angle of bend [degrees]rc(float, required): Radius of curvature of the bend [m]Re(float, optional, default: 100000): Reynolds number of the pipe flow [-]bend_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the rounded bend [-]
Example 1: 90 degree bend with Rennels method
Inputs:
| Di | angle | rc | Re |
|---|---|---|---|
| 0.1 | 90 | 0.15 | 100000 |
Excel formula:
=BEND_ROUNDED(0.1, 90, 0.15, 100000)
Expected output:
0.225316
Example 2: 45 degree bend
Inputs:
| Di | angle | rc | Re |
|---|---|---|---|
| 0.1 | 45 | 0.15 | 100000 |
Excel formula:
=BEND_ROUNDED(0.1, 45, 0.15, 100000)
Expected output:
0.155242
Example 3: 90 degree bend with Crane method
Inputs:
| Di | angle | rc | Re | bend_method |
|---|---|---|---|---|
| 0.1 | 90 | 0.15 | 100000 | Crane |
Excel formula:
=BEND_ROUNDED(0.1, 90, 0.15, 100000, "Crane")
Expected output:
0.229023
Example 4: 90 degree bend with Swamee method
Inputs:
| Di | angle | rc | Re | bend_method |
|---|---|---|---|---|
| 0.1 | 90 | 0.15 | 100000 | Swamee |
Excel formula:
=BEND_ROUNDED(0.1, 90, 0.15, 100000, "Swamee")
Expected output:
0.371729
Python Code
Show Code
from fluids.fittings import bend_rounded as fluids_bend_rounded
def bend_rounded(Di, angle, rc, Re=100000, bend_method='Rennels'):
"""
Calculate the loss coefficient (K) for a rounded pipe bend (elbow) using various methods.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.bend_rounded
This example function is provided as-is without any representation of accuracy.
Args:
Di (float): Inside diameter of pipe [m]
angle (float): Angle of bend [degrees]
rc (float): Radius of curvature of the bend [m]
Re (float, optional): Reynolds number of the pipe flow [-] Default is 100000.
bend_method (str, optional): Calculation method Valid options: Rennels, Miller, Crane, Ito, Swamee. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the rounded bend [-]
"""
try:
try:
Di = float(Di)
angle = float(angle)
rc = float(rc)
Re = float(Re)
except (ValueError, TypeError):
return "Error: Di, angle, rc, and Re must be numbers."
if Di <= 0:
return "Error: Di must be positive."
if angle <= 0 or angle > 180:
return "Error: Angle must be between 0 and 180 degrees."
if rc <= 0:
return "Error: Rc must be positive."
if Re <= 0:
return "Error: Re must be positive."
kwargs = {'Di': Di, 'angle': angle, 'Re': Re, 'method': bend_method}
if bend_method == 'Crane':
kwargs['bend_diameters'] = rc / Di
else:
kwargs['rc'] = rc
result = fluids_bend_rounded(**kwargs)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
CONTRACTION_ROUND
Calculate the loss coefficient (K) for a rounded pipe contraction (reducer).
Excel Usage
=CONTRACTION_ROUND(Di_large, Di_small, rc, con_rnd_method)
Di_large(float, required): Inside diameter of original (larger) pipe [m]Di_small(float, required): Inside diameter of following (smaller) pipe [m]rc(float, required): Radius of curvature of the contraction [m]con_rnd_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the rounded contraction [-]
Example 1: Basic rounded contraction
Inputs:
| Di_large | Di_small | rc |
|---|---|---|
| 1 | 0.4 | 0.04 |
Excel formula:
=CONTRACTION_ROUND(1, 0.4, 0.04)
Expected output:
0.178333
Example 2: Rounded contraction with Miller method
Inputs:
| Di_large | Di_small | rc | con_rnd_method |
|---|---|---|---|
| 1 | 0.4 | 0.04 | Miller |
Excel formula:
=CONTRACTION_ROUND(1, 0.4, 0.04, "Miller")
Expected output:
0.0856595
Example 3: Large radius of curvature
Inputs:
| Di_large | Di_small | rc |
|---|---|---|
| 0.5 | 0.2 | 0.1 |
Excel formula:
=CONTRACTION_ROUND(0.5, 0.2, 0.1)
Expected output:
0.037392
Example 4: Small radius of curvature
Inputs:
| Di_large | Di_small | rc |
|---|---|---|
| 0.5 | 0.2 | 0.01 |
Excel formula:
=CONTRACTION_ROUND(0.5, 0.2, 0.01)
Expected output:
0.267168
Python Code
Show Code
from fluids.fittings import contraction_round as fluids_contraction_round
def contraction_round(Di_large, Di_small, rc, con_rnd_method='Rennels'):
"""
Calculate the loss coefficient (K) for a rounded pipe contraction (reducer).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.contraction_round
This example function is provided as-is without any representation of accuracy.
Args:
Di_large (float): Inside diameter of original (larger) pipe [m]
Di_small (float): Inside diameter of following (smaller) pipe [m]
rc (float): Radius of curvature of the contraction [m]
con_rnd_method (str, optional): Calculation method Valid options: Rennels, Miller, Idelchik. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the rounded contraction [-]
"""
try:
try:
Di1 = float(Di_large)
Di2 = float(Di_small)
rc = float(rc)
except (ValueError, TypeError):
return "Error: Di_large, Di_small, and rc must be numbers."
if Di1 <= 0 or Di2 <= 0:
return "Error: Diameters must be positive."
if Di2 >= Di1:
return "Error: Di_small must be less than Di_large."
if rc < 0:
return "Error: Rc must be non-negative."
result = fluids_contraction_round(Di1=Di1, Di2=Di2, rc=rc, method=con_rnd_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
CONTRACTION_SHARP
Calculate the loss coefficient (K) for a sharp edged pipe contraction (reducer).
Excel Usage
=CONTRACTION_SHARP(Di_large, Di_small, Re, con_sharp_method)
Di_large(float, required): Inside diameter of original (larger) pipe [m]Di_small(float, required): Inside diameter of following (smaller) pipe [m]Re(float, optional, default: 100000): Reynolds number in the original pipe (used for Hooper method) [-]con_sharp_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the sharp contraction (based on smaller pipe) [-]
Example 1: Basic sharp contraction (1m to 0.4m)
Inputs:
| Di_large | Di_small |
|---|---|
| 1 | 0.4 |
Excel formula:
=CONTRACTION_SHARP(1, 0.4)
Expected output:
0.530127
Example 2: Small contraction ratio
Inputs:
| Di_large | Di_small |
|---|---|
| 0.1 | 0.08 |
Excel formula:
=CONTRACTION_SHARP(0.1, 0.08)
Expected output:
0.230341
Example 3: Sharp contraction with Crane method
Inputs:
| Di_large | Di_small | con_sharp_method |
|---|---|---|
| 0.3 | 0.2 | Crane |
Excel formula:
=CONTRACTION_SHARP(0.3, 0.2, "Crane")
Expected output:
0.277778
Example 4: Sharp contraction with Hooper method
Inputs:
| Di_large | Di_small | Re | con_sharp_method |
|---|---|---|---|
| 1 | 0.4 | 100000 | Hooper |
Excel formula:
=CONTRACTION_SHARP(1, 0.4, 100000, "Hooper")
Expected output:
0.511253
Python Code
Show Code
from fluids.fittings import contraction_sharp as fluids_contraction_sharp
def contraction_sharp(Di_large, Di_small, Re=100000, con_sharp_method='Rennels'):
"""
Calculate the loss coefficient (K) for a sharp edged pipe contraction (reducer).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.contraction_sharp
This example function is provided as-is without any representation of accuracy.
Args:
Di_large (float): Inside diameter of original (larger) pipe [m]
Di_small (float): Inside diameter of following (smaller) pipe [m]
Re (float, optional): Reynolds number in the original pipe (used for Hooper method) [-] Default is 100000.
con_sharp_method (str, optional): Calculation method Valid options: Rennels, Crane, Hooper. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the sharp contraction (based on smaller pipe) [-]
"""
try:
try:
Di1 = float(Di_large)
Di2 = float(Di_small)
Re = float(Re)
except (ValueError, TypeError):
return "Error: Di_large, Di_small, and Re must be numbers."
if Di1 <= 0 or Di2 <= 0:
return "Error: Diameters must be positive."
if Di2 >= Di1:
return "Error: Di_small must be less than Di_large."
if Re <= 0:
return "Error: Re must be positive."
kwargs = {'Di1': Di1, 'Di2': Di2, 'method': con_sharp_method}
if con_sharp_method == 'Hooper':
kwargs['Re'] = Re
result = fluids_contraction_sharp(**kwargs)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
CV_TO_K
Convert imperial valve flow coefficient (Cv) to loss coefficient (K).
Excel Usage
=CV_TO_K(Cv, D)
Cv(float, required): Imperial Cv valve flow coefficient [gallons/minute]D(float, required): Inside diameter of the valve [m]
Returns (float): Loss coefficient K [-]
Example 1: Basic Cv to K conversion
Inputs:
| Cv | D |
|---|---|
| 2.712 | 0.015 |
Excel formula:
=CV_TO_K(2.712, 0.015)
Expected output:
14.7196
Example 2: Larger Cv value
Inputs:
| Cv | D |
|---|---|
| 10 | 0.025 |
Excel formula:
=CV_TO_K(10, 0.025)
Expected output:
8.35353
Example 3: Small valve diameter
Inputs:
| Cv | D |
|---|---|
| 1.5 | 0.01 |
Excel formula:
=CV_TO_K(1.5, 0.01)
Expected output:
9.50447
Example 4: Large valve diameter
Inputs:
| Cv | D |
|---|---|
| 100 | 0.1 |
Excel formula:
=CV_TO_K(100, 0.1)
Expected output:
21.385
Python Code
Show Code
from fluids.fittings import Cv_to_K as fluids_cv_to_k
def cv_to_k(Cv, D):
"""
Convert imperial valve flow coefficient (Cv) to loss coefficient (K).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.Cv_to_K
This example function is provided as-is without any representation of accuracy.
Args:
Cv (float): Imperial Cv valve flow coefficient [gallons/minute]
D (float): Inside diameter of the valve [m]
Returns:
float: Loss coefficient K [-]
"""
try:
try:
Cv = float(Cv)
D = float(D)
except (ValueError, TypeError):
return "Error: Cv and D must be numbers."
if Cv <= 0:
return "Error: Cv must be positive."
if D <= 0:
return "Error: D must be positive."
result = fluids_cv_to_k(Cv=Cv, D=D)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
DIFFUSER_CONICAL
Calculate the loss coefficient (K) for a conical pipe expansion (diffuser).
Excel Usage
=DIFFUSER_CONICAL(Di_small, Di_large, angle, Re, diff_con_method)
Di_small(float, required): Inside diameter of original (smaller) pipe [m]Di_large(float, required): Inside diameter of following (larger) pipe [m]angle(float, required): Angle of expansion [degrees]Re(float, optional, default: 1000000): Reynolds number of the pipe flow [-]diff_con_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the conical diffuser [-]
Example 1: Basic conical diffuser at 50 degrees
Inputs:
| Di_small | Di_large | angle | Re |
|---|---|---|---|
| 0.333 | 1 | 50 | 1000000 |
Excel formula:
=DIFFUSER_CONICAL(0.333, 1, 50, 1000000)
Expected output:
0.803061
Example 2: Small angle diffuser (10 degrees)
Inputs:
| Di_small | Di_large | angle | Re |
|---|---|---|---|
| 0.1 | 0.2 | 10 | 100000 |
Excel formula:
=DIFFUSER_CONICAL(0.1, 0.2, 10, 100000)
Expected output:
0.0898963
Example 3: Conical diffuser with Crane method
Inputs:
| Di_small | Di_large | angle | Re | diff_con_method |
|---|---|---|---|---|
| 0.333 | 1 | 50 | 1000000 | Crane |
Excel formula:
=DIFFUSER_CONICAL(0.333, 1, 50, 1000000, "Crane")
Expected output:
0.790518
Example 4: Conical diffuser with Swamee method
Inputs:
| Di_small | Di_large | angle | Re | diff_con_method |
|---|---|---|---|---|
| 0.333 | 1 | 50 | 1000000 | Swamee |
Excel formula:
=DIFFUSER_CONICAL(0.333, 1, 50, 1000000, "Swamee")
Expected output:
1.82177
Python Code
Show Code
from fluids.fittings import diffuser_conical as fluids_diffuser_conical
def diffuser_conical(Di_small, Di_large, angle, Re=1000000, diff_con_method='Rennels'):
"""
Calculate the loss coefficient (K) for a conical pipe expansion (diffuser).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.diffuser_conical
This example function is provided as-is without any representation of accuracy.
Args:
Di_small (float): Inside diameter of original (smaller) pipe [m]
Di_large (float): Inside diameter of following (larger) pipe [m]
angle (float): Angle of expansion [degrees]
Re (float, optional): Reynolds number of the pipe flow [-] Default is 1000000.
diff_con_method (str, optional): Calculation method Valid options: Rennels, Crane, Miller, Swamee, Idelchik, Hooper. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the conical diffuser [-]
"""
try:
try:
Di1 = float(Di_small)
Di2 = float(Di_large)
angle = float(angle)
Re = float(Re)
except (ValueError, TypeError):
return "Error: All parameters must be numbers."
if Di1 <= 0 or Di2 <= 0:
return "Error: Diameters must be positive."
if Di1 >= Di2:
return "Error: Di_small must be less than Di_large."
if angle <= 0 or angle > 180:
return "Error: Angle must be between 0 and 180 degrees."
if Re <= 0:
return "Error: Re must be positive."
result = fluids_diffuser_conical(Di1=Di1, Di2=Di2, angle=angle, Re=Re, method=diff_con_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
DIFFUSER_SHARP
Calculate the loss coefficient (K) for a sudden pipe expansion (diffuser).
Excel Usage
=DIFFUSER_SHARP(Di_small, Di_large, diff_sharp_method)
Di_small(float, required): Inside diameter of original (smaller) pipe [m]Di_large(float, required): Inside diameter of following (larger) pipe [m]diff_sharp_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the sudden expansion [-]
Example 1: Basic sudden expansion (0.5m to 1m)
Inputs:
| Di_small | Di_large |
|---|---|
| 0.5 | 1 |
Excel formula:
=DIFFUSER_SHARP(0.5, 1)
Expected output:
0.5625
Example 2: Small expansion ratio
Inputs:
| Di_small | Di_large |
|---|---|
| 0.08 | 0.1 |
Excel formula:
=DIFFUSER_SHARP(0.08, 0.1)
Expected output:
0.1296
Example 3: Large expansion ratio
Inputs:
| Di_small | Di_large |
|---|---|
| 0.1 | 0.5 |
Excel formula:
=DIFFUSER_SHARP(0.1, 0.5)
Expected output:
0.9216
Example 4: Medium expansion ratio
Inputs:
| Di_small | Di_large |
|---|---|
| 0.2 | 0.3 |
Excel formula:
=DIFFUSER_SHARP(0.2, 0.3)
Expected output:
0.308642
Python Code
Show Code
from fluids.fittings import diffuser_sharp as fluids_diffuser_sharp
def diffuser_sharp(Di_small, Di_large, diff_sharp_method='Rennels'):
"""
Calculate the loss coefficient (K) for a sudden pipe expansion (diffuser).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.diffuser_sharp
This example function is provided as-is without any representation of accuracy.
Args:
Di_small (float): Inside diameter of original (smaller) pipe [m]
Di_large (float): Inside diameter of following (larger) pipe [m]
diff_sharp_method (str, optional): Calculation method Valid options: Rennels, Hooper. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the sudden expansion [-]
"""
try:
try:
Di1 = float(Di_small)
Di2 = float(Di_large)
except (ValueError, TypeError):
return "Error: Di_small and Di_large must be numbers."
if Di1 <= 0 or Di2 <= 0:
return "Error: Diameters must be positive."
if Di1 >= Di2:
return "Error: Di_small must be less than Di_large."
result = fluids_diffuser_sharp(Di1=Di1, Di2=Di2, method=diff_sharp_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ENTRANCE_ANGLED
Calculate the loss coefficient (K) for an angled sharp entrance to a pipe flush with a reservoir wall.
Excel Usage
=ENTRANCE_ANGLED(angle)
angle(float, required): Angle of inclination (90° = straight, 0° = parallel), [degrees]
Returns (float): Loss coefficient K for the angled entrance [-]
Example 1: 30 degree angle entrance
Inputs:
| angle |
|---|
| 30 |
Excel formula:
=ENTRANCE_ANGLED(30)
Expected output:
0.979808
Example 2: 45 degree angle entrance
Inputs:
| angle |
|---|
| 45 |
Excel formula:
=ENTRANCE_ANGLED(45)
Expected output:
0.882132
Example 3: 60 degree angle entrance
Inputs:
| angle |
|---|
| 60 |
Excel formula:
=ENTRANCE_ANGLED(60)
Expected output:
0.77
Example 4: 90 degree (straight) entrance
Inputs:
| angle |
|---|
| 90 |
Excel formula:
=ENTRANCE_ANGLED(90)
Expected output:
0.57
Python Code
Show Code
from fluids.fittings import entrance_angled as fluids_entrance_angled
def entrance_angled(angle):
"""
Calculate the loss coefficient (K) for an angled sharp entrance to a pipe flush with a reservoir wall.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.entrance_angled
This example function is provided as-is without any representation of accuracy.
Args:
angle (float): Angle of inclination (90° = straight, 0° = parallel), [degrees]
Returns:
float: Loss coefficient K for the angled entrance [-]
"""
try:
try:
angle = float(angle)
except (ValueError, TypeError):
return "Error: Angle must be a number."
if angle < 0 or angle > 90:
return "Error: Angle must be between 0 and 90 degrees."
result = fluids_entrance_angled(angle=angle, method='Idelchik')
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ENTRANCE_BEVELED
Calculate the loss coefficient (K) for a beveled or chamfered entrance to a pipe flush with a reservoir wall.
Excel Usage
=ENTRANCE_BEVELED(Di, l, angle, ent_bev_method)
Di(float, required): Inside diameter of pipe [m]l(float, required): Length of bevel measured parallel to pipe length [m]angle(float, required): Angle of bevel with respect to pipe length [degrees]ent_bev_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the beveled entrance [-]
Example 1: 45 degree bevel with Rennels method
Inputs:
| Di | l | angle |
|---|---|---|
| 0.1 | 0.003 | 45 |
Excel formula:
=ENTRANCE_BEVELED(0.1, 0.003, 45)
Expected output:
0.450869
Example 2: 45 degree bevel with Idelchik method
Inputs:
| Di | l | angle | ent_bev_method |
|---|---|---|---|
| 0.1 | 0.003 | 45 | Idelchik |
Excel formula:
=ENTRANCE_BEVELED(0.1, 0.003, 45, "Idelchik")
Expected output:
0.3995
Example 3: Steep 60 degree bevel
Inputs:
| Di | l | angle |
|---|---|---|
| 0.1 | 0.005 | 60 |
Excel formula:
=ENTRANCE_BEVELED(0.1, 0.005, 60)
Expected output:
0.43695
Example 4: Shallow 30 degree bevel
Inputs:
| Di | l | angle |
|---|---|---|
| 0.1 | 0.005 | 30 |
Excel formula:
=ENTRANCE_BEVELED(0.1, 0.005, 30)
Expected output:
0.432835
Python Code
Show Code
from fluids.fittings import entrance_beveled as fluids_entrance_beveled
def entrance_beveled(Di, l, angle, ent_bev_method='Rennels'):
"""
Calculate the loss coefficient (K) for a beveled or chamfered entrance to a pipe flush with a reservoir wall.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.entrance_beveled
This example function is provided as-is without any representation of accuracy.
Args:
Di (float): Inside diameter of pipe [m]
l (float): Length of bevel measured parallel to pipe length [m]
angle (float): Angle of bevel with respect to pipe length [degrees]
ent_bev_method (str, optional): Calculation method Valid options: Rennels, Idelchik. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the beveled entrance [-]
"""
try:
try:
Di = float(Di)
l = float(l)
angle = float(angle)
except (ValueError, TypeError):
return "Error: Di, l, and angle must be numbers."
if Di <= 0:
return "Error: Di must be positive."
if l < 0:
return "Error: L must be non-negative."
if angle <= 0 or angle > 90:
return "Error: Angle must be between 0 and 90 degrees."
result = fluids_entrance_beveled(Di=Di, l=l, angle=angle, method=ent_bev_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ENTRANCE_ROUNDED
Calculate the loss coefficient (K) for a rounded entrance to a pipe flush with a reservoir wall.
Excel Usage
=ENTRANCE_ROUNDED(Di, rc, ent_rnd_method)
Di(float, required): Inside diameter of pipe [m]rc(float, required): Radius of curvature of the entrance [m]ent_rnd_method(str, optional, default: “Rennels”): Calculation method
Returns (float): Loss coefficient K for the rounded entrance [-]
Example 1: Basic rounded entrance with Rennels method
Inputs:
| Di | rc |
|---|---|
| 0.1 | 0.0235 |
Excel formula:
=ENTRANCE_ROUNDED(0.1, 0.0235)
Expected output:
0.0983953
Example 2: Large radius of curvature (generous rounding)
Inputs:
| Di | rc |
|---|---|
| 0.1 | 0.1 |
Excel formula:
=ENTRANCE_ROUNDED(0.1, 0.1)
Expected output:
0.0299976
Example 3: Small radius of curvature
Inputs:
| Di | rc |
|---|---|
| 0.1 | 0.005 |
Excel formula:
=ENTRANCE_ROUNDED(0.1, 0.005)
Expected output:
0.29684
Example 4: Swamee method calculation
Inputs:
| Di | rc | ent_rnd_method |
|---|---|---|
| 0.1 | 0.0235 | Swamee |
Excel formula:
=ENTRANCE_ROUNDED(0.1, 0.0235, "Swamee")
Expected output:
0.0681884
Python Code
Show Code
from fluids.fittings import entrance_rounded as fluids_entrance_rounded
def entrance_rounded(Di, rc, ent_rnd_method='Rennels'):
"""
Calculate the loss coefficient (K) for a rounded entrance to a pipe flush with a reservoir wall.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.entrance_rounded
This example function is provided as-is without any representation of accuracy.
Args:
Di (float): Inside diameter of pipe [m]
rc (float): Radius of curvature of the entrance [m]
ent_rnd_method (str, optional): Calculation method Valid options: Rennels, Swamee, Miller, Idelchik, Harris, Crane. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the rounded entrance [-]
"""
try:
try:
Di = float(Di)
rc = float(rc)
except (ValueError, TypeError):
return "Error: Di and rc must be numbers."
if Di <= 0:
return "Error: Di must be positive."
if rc < 0:
return "Error: Rc must be non-negative."
result = fluids_entrance_rounded(Di=Di, rc=rc, method=ent_rnd_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ENTRANCE_SHARP
Calculate the loss coefficient (K) for a sharp entrance to a pipe flush with a reservoir wall.
Excel Usage
=ENTRANCE_SHARP(ent_sharp_method)
ent_sharp_method(str, optional, default: “Rennels”): Calculation method - Rennels, Swamee, Blevins, Idelchik, Crane, or Miller
Returns (float): Loss coefficient K for the sharp entrance [-]
Example 1: Default Rennels method
Inputs:
| ent_sharp_method |
|---|
| Rennels |
Excel formula:
=ENTRANCE_SHARP("Rennels")
Expected output:
0.57
Example 2: Swamee method returns 0.5
Inputs:
| ent_sharp_method |
|---|
| Swamee |
Excel formula:
=ENTRANCE_SHARP("Swamee")
Expected output:
0.5
Example 3: Blevins method returns 0.5
Inputs:
| ent_sharp_method |
|---|
| Blevins |
Excel formula:
=ENTRANCE_SHARP("Blevins")
Expected output:
0.5
Example 4: Miller method returns approximately 0.51
Inputs:
| ent_sharp_method |
|---|
| Miller |
Excel formula:
=ENTRANCE_SHARP("Miller")
Expected output:
0.509268
Python Code
Show Code
from fluids.fittings import entrance_sharp as fluids_entrance_sharp
def entrance_sharp(ent_sharp_method='Rennels'):
"""
Calculate the loss coefficient (K) for a sharp entrance to a pipe flush with a reservoir wall.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.entrance_sharp
This example function is provided as-is without any representation of accuracy.
Args:
ent_sharp_method (str, optional): Calculation method - Rennels, Swamee, Blevins, Idelchik, Crane, or Miller Valid options: Rennels, Swamee, Blevins, Idelchik, Crane, Miller. Default is 'Rennels'.
Returns:
float: Loss coefficient K for the sharp entrance [-]
"""
try:
result = fluids_entrance_sharp(method=ent_sharp_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
EXIT_NORMAL
Calculate the loss coefficient (K) for a normal pipe exit discharging into a reservoir.
Excel Usage
=EXIT_NORMAL()
Returns (float): Loss coefficient K = 1.0 for a normal pipe exit [-]
Example 1: Normal pipe exit K = 1.0
Inputs:
|| | |
Excel formula:
=EXIT_NORMAL()
Expected output:
1
Example 2: Verify exit loss is always 1.0
Inputs:
|| | |
Excel formula:
=EXIT_NORMAL()
Expected output:
1
Example 3: Exit coefficient verification
Inputs:
|| | |
Excel formula:
=EXIT_NORMAL()
Expected output:
1
Example 4: Standard exit loss coefficient
Inputs:
|| | |
Excel formula:
=EXIT_NORMAL()
Expected output:
1
Python Code
Show Code
from fluids.fittings import exit_normal as fluids_exit_normal
def exit_normal():
"""
Calculate the loss coefficient (K) for a normal pipe exit discharging into a reservoir.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.exit_normal
This example function is provided as-is without any representation of accuracy.
Returns:
float: Loss coefficient K = 1.0 for a normal pipe exit [-]
"""
try:
result = fluids_exit_normal()
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
HELIX
Calculate the loss coefficient (K) for a helical coil pipe section.
Excel Usage
=HELIX(Di, rs, pitch, N, fd)
Di(float, required): Inside diameter of pipe [m]rs(float, required): Radius of spiral [m]pitch(float, required): Distance between two subsequent coil centers [m]N(int, required): Number of coils in the helix [-]fd(float, required): Darcy friction factor [-]
Returns (float): Loss coefficient K for the helix [-]
Example 1: Basic helix coil
Inputs:
| Di | rs | pitch | N | fd |
|---|---|---|---|---|
| 0.01 | 0.1 | 0.03 | 10 | 0.0185 |
Excel formula:
=HELIX(0.01, 0.1, 0.03, 10, 0.0185)
Expected output:
14.5251
Example 2: Tight pitch helix
Inputs:
| Di | rs | pitch | N | fd |
|---|---|---|---|---|
| 0.02 | 0.15 | 0.025 | 5 | 0.02 |
Excel formula:
=HELIX(0.02, 0.15, 0.025, 5, 0.02)
Expected output:
6.19405
Example 3: Many coils helix
Inputs:
| Di | rs | pitch | N | fd |
|---|---|---|---|---|
| 0.01 | 0.1 | 0.03 | 20 | 0.0185 |
Excel formula:
=HELIX(0.01, 0.1, 0.03, 20, 0.0185)
Expected output:
29.0503
Example 4: Large radius helix
Inputs:
| Di | rs | pitch | N | fd |
|---|---|---|---|---|
| 0.015 | 0.2 | 0.05 | 8 | 0.018 |
Excel formula:
=HELIX(0.015, 0.2, 0.05, 8, 0.018)
Expected output:
14.3645
Python Code
Show Code
from fluids.fittings import helix as fluids_helix
def helix(Di, rs, pitch, N, fd):
"""
Calculate the loss coefficient (K) for a helical coil pipe section.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.helix
This example function is provided as-is without any representation of accuracy.
Args:
Di (float): Inside diameter of pipe [m]
rs (float): Radius of spiral [m]
pitch (float): Distance between two subsequent coil centers [m]
N (int): Number of coils in the helix [-]
fd (float): Darcy friction factor [-]
Returns:
float: Loss coefficient K for the helix [-]
"""
try:
try:
Di = float(Di)
rs = float(rs)
pitch = float(pitch)
N = int(N)
fd = float(fd)
except (ValueError, TypeError):
return "Error: All parameters must be numbers."
if Di <= 0:
return "Error: Di must be positive."
if rs <= 0:
return "Error: Rs must be positive."
if pitch <= 0:
return "Error: Pitch must be positive."
if N < 1:
return "Error: N must be at least 1."
if fd <= 0:
return "Error: Fd must be positive."
result = fluids_helix(Di=Di, rs=rs, pitch=pitch, N=N, fd=fd)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_BALL_VALVE
Calculate the loss coefficient (K) for a ball valve using the Crane method.
Excel Usage
=K_BALL_VALVE(D_valve, D_pipe, angle)
D_valve(float, required): Diameter of the valve seat bore [m]D_pipe(float, required): Diameter of the pipe attached to the valve [m]angle(float, required): Angle formed by the reducer in the valve [degrees]
Returns (float): Loss coefficient K for the ball valve [-]
Example 1: Reduced port ball valve at 50 degrees
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.01 | 0.02 | 50 |
Excel formula:
=K_BALL_VALVE(0.01, 0.02, 50)
Expected output:
14.0513
Example 2: Full bore ball valve
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.05 | 0.05 | 0 |
Excel formula:
=K_BALL_VALVE(0.05, 0.05, 0)
Expected output:
0.0571959
Example 3: Small angle ball valve
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.04 | 0.05 | 20 |
Excel formula:
=K_BALL_VALVE(0.04, 0.05, 20)
Expected output:
0.404588
Example 4: Steep angle ball valve (60 degrees)
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.03 | 0.05 | 60 |
Excel formula:
=K_BALL_VALVE(0.03, 0.05, 60)
Expected output:
5.34776
Python Code
Show Code
from fluids.fittings import K_ball_valve_Crane as fluids_k_ball_valve
def k_ball_valve(D_valve, D_pipe, angle):
"""
Calculate the loss coefficient (K) for a ball valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_ball_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D_valve (float): Diameter of the valve seat bore [m]
D_pipe (float): Diameter of the pipe attached to the valve [m]
angle (float): Angle formed by the reducer in the valve [degrees]
Returns:
float: Loss coefficient K for the ball valve [-]
"""
try:
try:
D1 = float(D_valve)
D2 = float(D_pipe)
angle = float(angle)
except (ValueError, TypeError):
return "Error: D_valve, D_pipe, and angle must be numbers."
if D1 <= 0 or D2 <= 0:
return "Error: Diameters must be positive."
if D1 > D2:
return "Error: D_valve must be <= D_pipe."
if angle < 0 or angle > 180:
return "Error: Angle must be between 0 and 180 degrees."
result = fluids_k_ball_valve(D1=D1, D2=D2, angle=angle)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_BUTTERFLY_VALVE
Calculate the loss coefficient (K) for a butterfly valve using the Crane method.
Excel Usage
=K_BUTTERFLY_VALVE(D, bfly_style)
D(float, required): Diameter of the pipe section the valve is mounted in [m]bfly_style(str, optional, default: “centric”): Valve style type
Returns (float): Loss coefficient K for the butterfly valve [-]
Example 1: Small centric butterfly valve
Inputs:
| D |
|---|
| 0.1 |
Excel formula:
=K_BUTTERFLY_VALVE(0.1)
Expected output:
0.732981
Example 2: Double offset butterfly valve
Inputs:
| D | bfly_style |
|---|---|
| 0.1 | double_offset |
Excel formula:
=K_BUTTERFLY_VALVE(0.1, "double_offset")
Expected output:
1.20535
Example 3: Triple offset butterfly valve
Inputs:
| D | bfly_style |
|---|---|
| 0.1 | triple_offset |
Excel formula:
=K_BUTTERFLY_VALVE(0.1, "triple_offset")
Expected output:
3.55088
Example 4: Large centric butterfly valve
Inputs:
| D |
|---|
| 0.5 |
Excel formula:
=K_BUTTERFLY_VALVE(0.5)
Expected output:
0.294561
Python Code
Show Code
from fluids.fittings import K_butterfly_valve_Crane as fluids_k_butterfly_valve
def k_butterfly_valve(D, bfly_style='centric'):
"""
Calculate the loss coefficient (K) for a butterfly valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_butterfly_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Diameter of the pipe section the valve is mounted in [m]
bfly_style (str, optional): Valve style type Valid options: Centric, Double Offset, Triple Offset. Default is 'centric'.
Returns:
float: Loss coefficient K for the butterfly valve [-]
"""
try:
try:
D = float(D)
except (ValueError, TypeError):
return "Error: D must be a number."
if D <= 0:
return "Error: D must be positive."
style_map = {
'centric': 0,
'double_offset': 1,
'triple_offset': 2
}
style_int = style_map.get(bfly_style, 0)
result = fluids_k_butterfly_valve(D=D, style=style_int)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_GATE_VALVE
Calculate the loss coefficient (K) for a gate valve using the Crane method.
Excel Usage
=K_GATE_VALVE(D_valve, D_pipe, angle)
D_valve(float, required): Diameter of the valve seat bore [m]D_pipe(float, required): Diameter of the pipe attached to the valve [m]angle(float, required): Angle formed by the reducer in the valve [degrees]
Returns (float): Loss coefficient K for the gate valve [-]
Example 1: Gate valve with 13 degree angle
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.1 | 0.146 | 13.115 |
Excel formula:
=K_GATE_VALVE(0.1, 0.146, 13.115)
Expected output:
1.1466
Example 2: Full bore gate valve (no reduction)
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.1 | 0.1 | 0 |
Excel formula:
=K_GATE_VALVE(0.1, 0.1, 0)
Expected output:
0.130308
Example 3: Reduced port gate valve
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.05 | 0.1 | 30 |
Excel formula:
=K_GATE_VALVE(0.05, 0.1, 30)
Expected output:
10.626
Example 4: Steep angle gate valve (50 degrees)
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.08 | 0.1 | 50 |
Excel formula:
=K_GATE_VALVE(0.08, 0.1, 50)
Expected output:
0.920225
Python Code
Show Code
from fluids.fittings import K_gate_valve_Crane as fluids_k_gate_valve
def k_gate_valve(D_valve, D_pipe, angle):
"""
Calculate the loss coefficient (K) for a gate valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_gate_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D_valve (float): Diameter of the valve seat bore [m]
D_pipe (float): Diameter of the pipe attached to the valve [m]
angle (float): Angle formed by the reducer in the valve [degrees]
Returns:
float: Loss coefficient K for the gate valve [-]
"""
try:
try:
D1 = float(D_valve)
D2 = float(D_pipe)
angle = float(angle)
except (ValueError, TypeError):
return "Error: D_valve, D_pipe, and angle must be numbers."
if D1 <= 0 or D2 <= 0:
return "Error: Diameters must be positive."
if D1 > D2:
return "Error: D_valve must be <= D_pipe."
if angle < 0 or angle > 180:
return "Error: Angle must be between 0 and 180 degrees."
result = fluids_k_gate_valve(D1=D1, D2=D2, angle=angle)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_GLOBE_VALVE
Calculate the loss coefficient (K) for a globe valve using the Crane method.
Excel Usage
=K_GLOBE_VALVE(D_valve, D_pipe)
D_valve(float, required): Diameter of the valve seat bore [m]D_pipe(float, required): Diameter of the pipe attached to the valve [m]
Returns (float): Loss coefficient K for the globe valve [-]
Example 1: Reduced port globe valve
Inputs:
| D_valve | D_pipe |
|---|---|
| 0.01 | 0.02 |
Excel formula:
=K_GLOBE_VALVE(0.01, 0.02)
Expected output:
135.92
Example 2: Full bore globe valve
Inputs:
| D_valve | D_pipe |
|---|---|
| 0.05 | 0.05 |
Excel formula:
=K_GLOBE_VALVE(0.05, 0.05)
Expected output:
6.4822
Example 3: Large globe valve
Inputs:
| D_valve | D_pipe |
|---|---|
| 0.1 | 0.15 |
Excel formula:
=K_GLOBE_VALVE(0.1, 0.15)
Expected output:
26.9385
Example 4: Small globe valve
Inputs:
| D_valve | D_pipe |
|---|---|
| 0.025 | 0.025 |
Excel formula:
=K_GLOBE_VALVE(0.025, 0.025)
Expected output:
7.68995
Python Code
Show Code
from fluids.fittings import K_globe_valve_Crane as fluids_k_globe_valve
def k_globe_valve(D_valve, D_pipe):
"""
Calculate the loss coefficient (K) for a globe valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_globe_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D_valve (float): Diameter of the valve seat bore [m]
D_pipe (float): Diameter of the pipe attached to the valve [m]
Returns:
float: Loss coefficient K for the globe valve [-]
"""
try:
try:
D1 = float(D_valve)
D2 = float(D_pipe)
except (ValueError, TypeError):
return "Error: D_valve and D_pipe must be numbers."
if D1 <= 0 or D2 <= 0:
return "Error: Diameters must be positive."
if D1 > D2:
return "Error: D_valve must be <= D_pipe."
result = fluids_k_globe_valve(D1=D1, D2=D2)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_SWING_CHECK_VALVE
Calculate the loss coefficient (K) for a swing check valve using the Crane method.
Excel Usage
=K_SWING_CHECK_VALVE(D, angled)
D(float, required): Diameter of the pipe attached to the valve [m]angled(bool, optional, default: true): If true, angled swing check valve (K is 2x straight)
Returns (float): Loss coefficient K for the swing check valve [-]
Example 1: Angled swing check valve
Inputs:
| D |
|---|
| 0.02 |
Excel formula:
=K_SWING_CHECK_VALVE(0.02)
Expected output:
2.39743
Example 2: Straight swing check valve
Inputs:
| D | angled |
|---|---|
| 0.02 | false |
Excel formula:
=K_SWING_CHECK_VALVE(0.02, FALSE)
Expected output:
1.19871
Example 3: Large angled swing check valve
Inputs:
| D |
|---|
| 0.1 |
Excel formula:
=K_SWING_CHECK_VALVE(0.1)
Expected output:
1.62885
Example 4: Large straight swing check valve
Inputs:
| D | angled |
|---|---|
| 0.1 | false |
Excel formula:
=K_SWING_CHECK_VALVE(0.1, FALSE)
Expected output:
0.814423
Python Code
Show Code
from fluids.fittings import K_swing_check_valve_Crane as fluids_k_swing_check
def k_swing_check_valve(D, angled=True):
"""
Calculate the loss coefficient (K) for a swing check valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_swing_check_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Diameter of the pipe attached to the valve [m]
angled (bool, optional): If true, angled swing check valve (K is 2x straight) Default is True.
Returns:
float: Loss coefficient K for the swing check valve [-]
"""
try:
try:
D = float(D)
except (ValueError, TypeError):
return "Error: D must be a number."
if D <= 0:
return "Error: D must be positive."
result = fluids_k_swing_check(D=D, angled=angled)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_TO_CV
Convert loss coefficient (K) to imperial valve flow coefficient (Cv).
Excel Usage
=K_TO_CV(K, D)
K(float, required): Loss coefficient [-]D(float, required): Inside diameter of the valve [m]
Returns (float): Imperial Cv valve flow coefficient [gallons/minute]
Example 1: Basic K to Cv conversion
Inputs:
| K | D |
|---|---|
| 16 | 0.015 |
Excel formula:
=K_TO_CV(16, 0.015)
Expected output:
2.60122
Example 2: Small K value
Inputs:
| K | D |
|---|---|
| 1 | 0.025 |
Excel formula:
=K_TO_CV(1, 0.025)
Expected output:
28.9025
Example 3: Large K value
Inputs:
| K | D |
|---|---|
| 100 | 0.05 |
Excel formula:
=K_TO_CV(100, 0.05)
Expected output:
11.561
Example 4: Small valve diameter
Inputs:
| K | D |
|---|---|
| 10 | 0.01 |
Excel formula:
=K_TO_CV(10, 0.01)
Expected output:
1.46236
Python Code
Show Code
from fluids.fittings import K_to_Cv as fluids_k_to_cv
def k_to_cv(K, D):
"""
Convert loss coefficient (K) to imperial valve flow coefficient (Cv).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_to_Cv
This example function is provided as-is without any representation of accuracy.
Args:
K (float): Loss coefficient [-]
D (float): Inside diameter of the valve [m]
Returns:
float: Imperial Cv valve flow coefficient [gallons/minute]
"""
try:
try:
K = float(K)
D = float(D)
except (ValueError, TypeError):
return "Error: K and D must be numbers."
if K <= 0:
return "Error: K must be positive."
if D <= 0:
return "Error: D must be positive."
result = fluids_k_to_cv(K=K, D=D)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
K_TO_KV
Convert loss coefficient (K) to metric valve flow coefficient (Kv).
Excel Usage
=K_TO_KV(K, D)
K(float, required): Loss coefficient [-]D(float, required): Inside diameter of the valve [m]
Returns (float): Metric Kv valve flow coefficient [m^3/hr]
Example 1: Basic K to Kv conversion
Inputs:
| K | D |
|---|---|
| 15.153 | 0.015 |
Excel formula:
=K_TO_KV(15.153, 0.015)
Expected output:
2.31203
Example 2: Small K value
Inputs:
| K | D |
|---|---|
| 1 | 0.025 |
Excel formula:
=K_TO_KV(1, 0.025)
Expected output:
25
Example 3: Large K value
Inputs:
| K | D |
|---|---|
| 100 | 0.05 |
Excel formula:
=K_TO_KV(100, 0.05)
Expected output:
10
Example 4: Small valve diameter
Inputs:
| K | D |
|---|---|
| 10 | 0.01 |
Excel formula:
=K_TO_KV(10, 0.01)
Expected output:
1.26491
Python Code
Show Code
from fluids.fittings import K_to_Kv as fluids_k_to_kv
def k_to_kv(K, D):
"""
Convert loss coefficient (K) to metric valve flow coefficient (Kv).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_to_Kv
This example function is provided as-is without any representation of accuracy.
Args:
K (float): Loss coefficient [-]
D (float): Inside diameter of the valve [m]
Returns:
float: Metric Kv valve flow coefficient [m^3/hr]
"""
try:
try:
K = float(K)
D = float(D)
except (ValueError, TypeError):
return "Error: K and D must be numbers."
if K <= 0:
return "Error: K must be positive."
if D <= 0:
return "Error: D must be positive."
result = fluids_k_to_kv(K=K, D=D)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
KV_TO_K
Convert metric valve flow coefficient (Kv) to loss coefficient (K).
Excel Usage
=KV_TO_K(Kv, D)
Kv(float, required): Metric Kv valve flow coefficient [m^3/hr]D(float, required): Inside diameter of the valve [m]
Returns (float): Loss coefficient K [-]
Example 1: Basic Kv to K conversion
Inputs:
| Kv | D |
|---|---|
| 2.312 | 0.015 |
Excel formula:
=KV_TO_K(2.312, 0.015)
Expected output:
15.1534
Example 2: Larger Kv value
Inputs:
| Kv | D |
|---|---|
| 10 | 0.025 |
Excel formula:
=KV_TO_K(10, 0.025)
Expected output:
6.25
Example 3: Small valve diameter
Inputs:
| Kv | D |
|---|---|
| 1.5 | 0.01 |
Excel formula:
=KV_TO_K(1.5, 0.01)
Expected output:
7.11111
Example 4: Large valve diameter
Inputs:
| Kv | D |
|---|---|
| 100 | 0.1 |
Excel formula:
=KV_TO_K(100, 0.1)
Expected output:
16
Python Code
Show Code
from fluids.fittings import Kv_to_K as fluids_kv_to_k
def kv_to_k(Kv, D):
"""
Convert metric valve flow coefficient (Kv) to loss coefficient (K).
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.Kv_to_K
This example function is provided as-is without any representation of accuracy.
Args:
Kv (float): Metric Kv valve flow coefficient [m^3/hr]
D (float): Inside diameter of the valve [m]
Returns:
float: Loss coefficient K [-]
"""
try:
try:
Kv = float(Kv)
D = float(D)
except (ValueError, TypeError):
return "Error: Kv and D must be numbers."
if Kv <= 0:
return "Error: Kv must be positive."
if D <= 0:
return "Error: D must be positive."
result = fluids_kv_to_k(Kv=Kv, D=D)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
SPIRAL
Calculate the loss coefficient (K) for a spiral coil pipe section.
Excel Usage
=SPIRAL(Di, rmax, rmin, pitch, fd)
Di(float, required): Inside diameter of pipe [m]rmax(float, required): Radius of spiral at extremity [m]rmin(float, required): Radius of spiral at end near center [m]pitch(float, required): Distance between two subsequent coil centers [m]fd(float, required): Darcy friction factor [-]
Returns (float): Loss coefficient K for the spiral [-]
Example 1: Basic spiral coil
Inputs:
| Di | rmax | rmin | pitch | fd |
|---|---|---|---|---|
| 0.01 | 0.1 | 0.02 | 0.01 | 0.0185 |
Excel formula:
=SPIRAL(0.01, 0.1, 0.02, 0.01, 0.0185)
Expected output:
7.95092
Example 2: Wide radius range spiral
Inputs:
| Di | rmax | rmin | pitch | fd |
|---|---|---|---|---|
| 0.015 | 0.2 | 0.05 | 0.015 | 0.02 |
Excel formula:
=SPIRAL(0.015, 0.2, 0.05, 0.015, 0.02)
Expected output:
13.4557
Example 3: Tight pitch spiral
Inputs:
| Di | rmax | rmin | pitch | fd |
|---|---|---|---|---|
| 0.01 | 0.1 | 0.02 | 0.005 | 0.0185 |
Excel formula:
=SPIRAL(0.01, 0.1, 0.02, 0.005, 0.0185)
Expected output:
15.8408
Example 4: Small spiral
Inputs:
| Di | rmax | rmin | pitch | fd |
|---|---|---|---|---|
| 0.008 | 0.08 | 0.02 | 0.01 | 0.022 |
Excel formula:
=SPIRAL(0.008, 0.08, 0.02, 0.01, 0.022)
Expected output:
7.06369
Python Code
Show Code
from fluids.fittings import spiral as fluids_spiral
def spiral(Di, rmax, rmin, pitch, fd):
"""
Calculate the loss coefficient (K) for a spiral coil pipe section.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.spiral
This example function is provided as-is without any representation of accuracy.
Args:
Di (float): Inside diameter of pipe [m]
rmax (float): Radius of spiral at extremity [m]
rmin (float): Radius of spiral at end near center [m]
pitch (float): Distance between two subsequent coil centers [m]
fd (float): Darcy friction factor [-]
Returns:
float: Loss coefficient K for the spiral [-]
"""
try:
try:
Di = float(Di)
rmax = float(rmax)
rmin = float(rmin)
pitch = float(pitch)
fd = float(fd)
except (ValueError, TypeError):
return "Error: All parameters must be numbers."
if Di <= 0:
return "Error: Di must be positive."
if rmax <= 0 or rmin <= 0:
return "Error: Rmax and rmin must be positive."
if rmax <= rmin:
return "Error: Rmax must be greater than rmin."
if pitch <= 0:
return "Error: Pitch must be positive."
if fd <= 0:
return "Error: Fd must be positive."
result = fluids_spiral(Di=Di, rmax=rmax, rmin=rmin, pitch=pitch, fd=fd)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator