CYL_HT
Excel Usage
=CYL_HT(Ti, To, hi, ho, Di, ts, ks)
Ti(float, required): Inside temperature (K)To(float, required): Outside temperature (K)hi(float, required): Inside heat transfer coefficient (W/m^2/K)ho(float, required): Outside heat transfer coefficient (W/m^2/K)Di(float, required): Inside diameter (m)ts(list[list], required): Thicknesses of each layer (m)ks(list[list], required): Thermal conductivities of each layer (W/m/K)
Returns (list[list]): Table of results (Q, UA, U_inner, U_outer, q, Ts, Rs).
Examples
Example 1: Single layer cylinder
Inputs:
| Ti | To | hi | ho | Di | ts | ks |
|---|---|---|---|---|---|---|
| 400 | 300 | 100 | 10 | 0.1 | 0.005 | 50 |
Excel formula:
=CYL_HT(400, 300, 100, 10, 0.1, 0.005, 50)
Expected output:
| Result | ||
|---|---|---|
| Q | 311.03522 | |
| q | 900.05079 | |
| UA | 3.11035 | |
| U_outer | 9.00051 | |
| U_inner | 9.90056 | |
| Ts | 400 | 399.90564 |
| Rs | 0.0001 |
Example 2: Two layer insulated pipe
Inputs:
| Ti | To | hi | ho | Di | ts | ks | ||
|---|---|---|---|---|---|---|---|---|
| 500 | 300 | 500 | 15 | 0.05 | 0.005 | 0.05 | 50 | 0.04 |
Excel formula:
=CYL_HT(500, 300, 500, 15, 0.05, {0.005,0.05}, {50,0.04})
Expected output:
| Result | |||
|---|---|---|---|
| Q | 49.40056 | ||
| q | 98.27928 | ||
| UA | 0.247 | ||
| U_outer | 0.4914 | ||
| U_inner | 1.57247 | ||
| Ts | 500 | 499.97133 | 307.18094 |
| Rs | 0.00029 | 1.96166 |
Example 3: Bare pipe in air
Inputs:
| Ti | To | hi | ho | Di | ts | ks |
|---|---|---|---|---|---|---|
| 400 | 300 | 1000 | 10 | 0.1 | 0.005 | 50 |
Excel formula:
=CYL_HT(400, 300, 1000, 10, 0.1, 0.005, 50)
Expected output:
| Result | ||
|---|---|---|
| Q | 341.46113 | |
| q | 988.09502 | |
| UA | 3.41461 | |
| U_outer | 9.88095 | |
| U_inner | 10.86905 | |
| Ts | 400 | 399.89641 |
| Rs | 0.0001 |
Example 4: Thick walled vessel
Inputs:
| Ti | To | hi | ho | Di | ts | ks |
|---|---|---|---|---|---|---|
| 600 | 300 | 100 | 100 | 2 | 0.5 | 20 |
Excel formula:
=CYL_HT(600, 300, 100, 100, 2, 0.5, 20)
Expected output:
| Result | ||
|---|---|---|
| Q | 51027.60067 | |
| q | 5414.19659 | |
| UA | 170.092 | |
| U_outer | 18.04732 | |
| U_inner | 27.07098 | |
| Ts | 600 | 435.35491 |
| Rs | 0.03041 |
Python Code
from ht.conduction import cylindrical_heat_transfer
def cyl_ht(Ti, To, hi, ho, Di, ts, ks):
"""
Heat transfer through a cylindrical wall (pipes, vessels).
See: https://ht.readthedocs.io/en/latest/ht.conduction.html#ht.conduction.cylindrical_heat_transfer
This example function is provided as-is without any representation of accuracy.
Args:
Ti (float): Inside temperature (K)
To (float): Outside temperature (K)
hi (float): Inside heat transfer coefficient (W/m^2/K)
ho (float): Outside heat transfer coefficient (W/m^2/K)
Di (float): Inside diameter (m)
ts (list[list]): Thicknesses of each layer (m)
ks (list[list]): Thermal conductivities of each layer (W/m/K)
Returns:
list[list]: Table of results (Q, UA, U_inner, U_outer, q, Ts, Rs).
"""
try:
def to_list(x):
if isinstance(x, list):
flat = []
for row in x:
if isinstance(row, list):
flat.extend(row)
else:
flat.append(row)
return flat
return [x]
def to_flat_positive(values, name):
flat = []
for val in to_list(values):
try:
num = float(val)
except (TypeError, ValueError):
return None, f"Error: {name} must contain numeric values"
if num <= 0:
return None, f"Error: {name} values must be positive"
flat.append(num)
if not flat:
return None, f"Error: {name} must contain at least one value"
return flat, None
ts_list, ts_err = to_flat_positive(ts, "ts")
if ts_err:
return ts_err
ks_list, ks_err = to_flat_positive(ks, "ks")
if ks_err:
return ks_err
if len(ts_list) != len(ks_list):
return "Error: ts and ks must have the same length"
res = cylindrical_heat_transfer(
Ti=float(Ti),
To=float(To),
hi=float(hi),
ho=float(ho),
Di=float(Di),
ts=ts_list,
ks=ks_list,
)
output = []
max_len = 0
key_order = ["Q", "q", "UA", "U_outer", "U_inner", "Ts", "Rs"]
for key in key_order:
if key not in res:
continue
value = res[key]
row = [key]
if isinstance(value, list):
row.extend(value)
else:
row.append(value)
output.append(row)
max_len = max(max_len, len(row))
for row in output:
if len(row) < max_len:
row.extend([""] * (max_len - len(row)))
return output
except Exception as e:
return f"Error: {str(e)}"