DIFFUSER_SHARP
Overview
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 [-]
Examples
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:
| Result |
|---|
| 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:
| Result |
|---|
| 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:
| Result |
|---|
| 0.9216 |
Example 4: Sudden expansion with Hooper method
Inputs:
| Di_small | Di_large | diff_sharp_method |
|---|---|---|
| 0.5 | 1 | Hooper |
Excel formula:
=DIFFUSER_SHARP(0.5, 1, "Hooper")
Expected output:
| Result |
|---|
Error: Method Hooper requires Reynolds number |
Python Code
import micropip
await micropip.install(["fluids"])
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:
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."
try:
result = fluids_diffuser_sharp(Di1=Di1, Di2=Di2, method=diff_sharp_method)
return float(result)
except Exception as e:
return f"Error: {str(e)}"