P_NTU_METHOD
This function solves exchanger performance with the P-NTU method from stream flow, heat capacities, geometry subtype, and a valid temperature/UA specification set. It returns heat duty and related thermal state properties as an Excel data type.
Key definitions include \mathrm{NTU}_1=\frac{UA}{C_1} and Q=P_1 C_1\Delta T_{max}.
Excel Usage
=P_NTU_METHOD(m_one, m_two, cp_one, cp_two, UA, t_one_i, t_one_o, t_two_i, t_two_o, subtype, Ntp, optimal)
m_one(float, required): Mass flow rate of stream 1 (kg/s).m_two(float, required): Mass flow rate of stream 2 (kg/s).cp_one(float, required): Heat capacity of stream 1 (J/kg/K).cp_two(float, required): Heat capacity of stream 2 (J/kg/K).UA(float, optional, default: null): Area heat transfer coefficient product (W/K).t_one_i(float, optional, default: null): Stream 1 inlet temperature (K).t_one_o(float, optional, default: null): Stream 1 outlet temperature (K).t_two_i(float, optional, default: null): Stream 2 inlet temperature (K).t_two_o(float, optional, default: null): Stream 2 outlet temperature (K).subtype(str, optional, default: “crossflow”): Exchanger configuration subtype (-).Ntp(int, optional, default: 1): Number of tube passes for TEMA exchangers (-).optimal(bool, optional, default: true): Use optimal pass arrangement when applicable (-).
Returns (float): Heat exchanged, with additional properties for temperatures and ratios.
Example 1: P-NTU with specified UA and inlet temperatures
Inputs:
| m_one | m_two | cp_one | cp_two | UA | t_two_i | t_one_i | subtype | Ntp |
|---|---|---|---|---|---|---|---|---|
| 5.2 | 1.45 | 1860 | 1900 | 3041.75 | 15 | 130 | E | 4 |
Excel formula:
=P_NTU_METHOD(5.2, 1.45, 1860, 1900, 3041.75, 15, 130, "E", 4)
Expected output:
{"type":"Double","basicValue":192515,"properties":{"Q":{"type":"Double","basicValue":192515},"UA":{"type":"Double","basicValue":3041.75},"T1i":{"type":"Double","basicValue":130},"T1o":{"type":"Double","basicValue":110.096},"T2i":{"type":"Double","basicValue":15},"T2o":{"type":"Double","basicValue":84.8783},"P1":{"type":"Double","basicValue":0.173081},"P2":{"type":"Double","basicValue":0.607637},"R1":{"type":"Double","basicValue":3.51071},"R2":{"type":"Double","basicValue":0.284843},"C1":{"type":"Double","basicValue":9672},"C2":{"type":"Double","basicValue":2755},"NTU1":{"type":"Double","basicValue":0.31449},"NTU2":{"type":"Double","basicValue":1.10408}}}
Example 2: P-NTU with unknown UA and known outlet temperature
Inputs:
| m_one | m_two | cp_one | cp_two | t_one_i | t_two_i | t_two_o | subtype | Ntp |
|---|---|---|---|---|---|---|---|---|
| 5.2 | 1.45 | 1860 | 1900 | 130 | 15 | 84.87829918042112 | E | 4 |
Excel formula:
=P_NTU_METHOD(5.2, 1.45, 1860, 1900, 130, 15, 84.87829918042112, "E", 4)
Expected output:
{"type":"Double","basicValue":192515,"properties":{"Q":{"type":"Double","basicValue":192515},"UA":{"type":"Double","basicValue":3041.75},"T1i":{"type":"Double","basicValue":130},"T1o":{"type":"Double","basicValue":110.096},"T2i":{"type":"Double","basicValue":15},"T2o":{"type":"Double","basicValue":84.8783},"P1":{"type":"Double","basicValue":0.173081},"P2":{"type":"Double","basicValue":0.607637},"R1":{"type":"Double","basicValue":3.51071},"R2":{"type":"Double","basicValue":0.284843},"C1":{"type":"Double","basicValue":9672},"C2":{"type":"Double","basicValue":2755},"NTU1":{"type":"Double","basicValue":0.31449},"NTU2":{"type":"Double","basicValue":1.10408}}}
Example 3: P-NTU plate exchanger with parallel flow
Inputs:
| m_one | m_two | cp_one | cp_two | UA | t_one_o | t_two_o | subtype | optimal |
|---|---|---|---|---|---|---|---|---|
| 5.2 | 1.45 | 1860 | 1900 | 300 | 126.7 | 26.7 | 2/2p | false |
Excel formula:
=P_NTU_METHOD(5.2, 1.45, 1860, 1900, 300, 126.7, 26.7, "2/2p", FALSE)
Expected output:
{"type":"Double","basicValue":32200.1,"properties":{"Q":{"type":"Double","basicValue":32200.1},"UA":{"type":"Double","basicValue":300},"T1i":{"type":"Double","basicValue":130.029},"T1o":{"type":"Double","basicValue":126.7},"T2i":{"type":"Double","basicValue":15.0121},"T2o":{"type":"Double","basicValue":26.7},"P1":{"type":"Double","basicValue":0.0289453},"P2":{"type":"Double","basicValue":0.101618},"R1":{"type":"Double","basicValue":3.51071},"R2":{"type":"Double","basicValue":0.284843},"C1":{"type":"Double","basicValue":9672},"C2":{"type":"Double","basicValue":2755},"NTU1":{"type":"Double","basicValue":0.0310174},"NTU2":{"type":"Double","basicValue":0.108893}}}
Example 4: P-NTU for basic crossflow configuration
Inputs:
| m_one | m_two | cp_one | cp_two | UA | t_one_i | t_two_i | subtype |
|---|---|---|---|---|---|---|---|
| 4 | 2 | 2000 | 1800 | 1500 | 420 | 300 | crossflow |
Excel formula:
=P_NTU_METHOD(4, 2, 2000, 1800, 1500, 420, 300, "crossflow")
Expected output:
{"type":"Double","basicValue":136614,"properties":{"Q":{"type":"Double","basicValue":136614},"UA":{"type":"Double","basicValue":1500},"T1i":{"type":"Double","basicValue":420},"T1o":{"type":"Double","basicValue":402.923},"T2i":{"type":"Double","basicValue":300},"T2o":{"type":"Double","basicValue":337.948},"P1":{"type":"Double","basicValue":0.142307},"P2":{"type":"Double","basicValue":0.316237},"R1":{"type":"Double","basicValue":2.22222},"R2":{"type":"Double","basicValue":0.45},"C1":{"type":"Double","basicValue":8000},"C2":{"type":"Double","basicValue":3600},"NTU1":{"type":"Double","basicValue":0.1875},"NTU2":{"type":"Double","basicValue":0.416667}}}
Python Code
Show Code
from ht.hx import P_NTU_method as hx_P_NTU_method
def P_NTU_method(m_one, m_two, cp_one, cp_two, UA=None, t_one_i=None, t_one_o=None, t_two_i=None, t_two_o=None, subtype='crossflow', Ntp=1, optimal=True):
"""
Solve a heat exchanger with the P-NTU method.
See: https://ht.readthedocs.io/en/latest/ht.hx.html
This example function is provided as-is without any representation of accuracy.
Args:
m_one (float): Mass flow rate of stream 1 (kg/s).
m_two (float): Mass flow rate of stream 2 (kg/s).
cp_one (float): Heat capacity of stream 1 (J/kg/K).
cp_two (float): Heat capacity of stream 2 (J/kg/K).
UA (float, optional): Area heat transfer coefficient product (W/K). Default is None.
t_one_i (float, optional): Stream 1 inlet temperature (K). Default is None.
t_one_o (float, optional): Stream 1 outlet temperature (K). Default is None.
t_two_i (float, optional): Stream 2 inlet temperature (K). Default is None.
t_two_o (float, optional): Stream 2 outlet temperature (K). Default is None.
subtype (str, optional): Exchanger configuration subtype (-). Default is 'crossflow'.
Ntp (int, optional): Number of tube passes for TEMA exchangers (-). Default is 1.
optimal (bool, optional): Use optimal pass arrangement when applicable (-). Default is True.
Returns:
float: Heat exchanged, with additional properties for temperatures and ratios.
"""
try:
results = hx_P_NTU_method(m1=m_one, m2=m_two, Cp1=cp_one, Cp2=cp_two, UA=UA, T1i=t_one_i, T1o=t_one_o, T2i=t_two_i, T2o=t_two_o, subtype=subtype, Ntp=Ntp, optimal=optimal)
if not isinstance(results, dict):
return "Error: Expected a result dictionary"
def to_prop(value):
return {"type": "Double", "basicValue": value}
return {
"type": "Double",
"basicValue": results.get("Q"),
"properties": {
"Q": to_prop(results.get("Q")),
"UA": to_prop(results.get("UA")),
"T1i": to_prop(results.get("T1i")),
"T1o": to_prop(results.get("T1o")),
"T2i": to_prop(results.get("T2i")),
"T2o": to_prop(results.get("T2o")),
"P1": to_prop(results.get("P1")),
"P2": to_prop(results.get("P2")),
"R1": to_prop(results.get("R1")),
"R2": to_prop(results.get("R2")),
"C1": to_prop(results.get("C1")),
"C2": to_prop(results.get("C2")),
"NTU1": to_prop(results.get("NTU1")),
"NTU2": to_prop(results.get("NTU2"))
}
}
except Exception as e:
return f"Error: {str(e)}"