用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Soljourner/claude-engineering-skills --skill coolprop-db命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Query loss coefficients for pipes, valves, fittings in pump systems
基于 SOC 职业分类
正在显示 SKILL.md
| name | coolprop-db |
| description | Query thermodynamic properties for 100+ fluids from CoolProp database |
| category | databases |
| domain | fluids |
| complexity | basic |
| dependencies | ["CoolProp"] |
Query thermodynamic and transport properties for over 100 pure and pseudo-pure fluids using the CoolProp open-source thermophysical property library.
CoolProp is a comprehensive thermophysical property database that provides:
CoolProp uses high-accuracy equations of state (Helmholtz energy formulations) and is validated against NIST REFPROP data.
pip install CoolProp
import CoolProp
print(CoolProp.__version__)
print(CoolProp.get_global_param_string("version"))
from CoolProp.CoolProp import PropsSI
# Syntax: PropsSI(output, input1_name, input1_value, input2_name, input2_value, fluid)
value = PropsSI('D', 'T', 298.15, 'P', 101325, 'Water')
from CoolProp.CoolProp import Props1SI
# For properties requiring only fluid name
T_crit = Props1SI('Tcrit', 'Water') # Critical temperature
P_crit = Props1SI('Pcrit', 'Water') # Critical pressure
| Code | Property | SI Unit | Description |
|---|---|---|---|
T | Temperature | K | Absolute temperature |
P | Pressure | Pa | Absolute pressure |
D | Density | kg/m³ | Mass density |
H | Enthalpy | J/kg | Specific enthalpy |
S | Entropy | J/kg/K | Specific entropy |
U | Internal Energy | J/kg | Specific internal energy |
Q | Quality | - | Vapor mass fraction (0-1) |
Dmolar | Molar Density | mol/m³ | Molar density |
Hmolar | Molar Enthalpy | J/mol | Molar enthalpy |
Smolar | Molar Entropy | J/mol/K | Molar entropy |
| Code | Property | SI Unit | Description |
|---|---|---|---|
V | Viscosity | Pa·s | Dynamic viscosity |
L | Thermal Conductivity | W/m/K | Thermal conductivity |
C | Specific Heat (const P) | J/kg/K | Cp at constant pressure |
O | Specific Heat (const V) | J/kg/K | Cv at constant volume |
PRANDTL | Prandtl Number | - | Pr = μ·Cp/k |
I | Surface Tension | N/m | Liquid-vapor interface |
| Code | Property | SI Unit | Description |
|---|---|---|---|
Phase | Phase Index | - | 0=Liquid, 3=Supercritical, 5=Gas, 6=Two-phase |
Q | Quality | - | 0=Saturated liquid, 1=Saturated vapor |
| Code | Property | SI Unit | Description |
|---|---|---|---|
Tcrit | Critical Temperature | K | Critical point temperature |
Pcrit | Critical Pressure | Pa | Critical point pressure |
Ttriple | Triple Point Temp | K | Triple point temperature |
Ptriple | Triple Point Press | Pa | Triple point pressure |
M | Molar Mass | kg/mol | Molecular weight |
ACENTRIC | Acentric Factor | - | Pitzer acentric factor |
Water - Pure water (H₂O)Air - Dry air (pseudo-pure mixture)R134a - HFC, common in automotive ACR410A - HFC blend, residential AC/heat pumpsR32 - HFC, lower GWP alternativeR404A - HFC blend, commercial refrigerationR407C - HFC blend, AC systemsR507A - HFC blend, low-temperature refrigerationR22 - HCFC (being phased out)R717 - Ammonia (NH₃)R744 - Carbon dioxide (CO₂)Methane, Ethane, Propane, n-Butane, IsoButanen-Pentane, Isopentane, n-Hexane, n-Heptane, n-Octanen-Nonane, n-DecaneNitrogen, Oxygen, Argon, Helium, Neon, HydrogenCO2 - Carbon dioxideCO - Carbon monoxideH2S - Hydrogen sulfideSO2 - Sulfur dioxideAmmonia - NH₃from CoolProp.CoolProp import PropsSI
# Water at 25°C (298.15 K) and 1 atm (101325 Pa)
T = 298.15 # K
P = 101325 # Pa
density = PropsSI('D', 'T', T, 'P', P, 'Water') # kg/m³
enthalpy = PropsSI('H', 'T', T, 'P', P, 'Water') # J/kg
entropy = PropsSI('S', 'T', T, 'P', P, 'Water') # J/kg/K
viscosity = PropsSI('V', 'T', T, 'P', P, 'Water') # Pa·s
cp = PropsSI('C', 'T', T, 'P', P, 'Water') # J/kg/K
print(f"Water at {T-273.15}°C and {P/1000:.1f} kPa:")
print(f" Density: {density:.2f} kg/m³")
print(f" Enthalpy: {enthalpy/1000:.2f} kJ/kg")
print(f" Entropy: {entropy/1000:.4f} kJ/kg·K")
print(f" Viscosity: mPa·s")
()
from CoolProp.CoolProp import PropsSI
# R134a saturation properties at 25°C
T_sat = 298.15 # K
fluid = 'R134a'
# Get saturation pressure at this temperature
P_sat = PropsSI('P', 'T', T_sat, 'Q', 0, fluid) # Pa
# Saturated liquid properties (Q=0)
rho_liquid = PropsSI('D', 'T', T_sat, 'Q', 0, fluid)
h_liquid = PropsSI('H', 'T', T_sat, 'Q', 0, fluid)
s_liquid = PropsSI('S', 'T', T_sat, 'Q', 0, fluid)
# Saturated vapor properties (Q=1)
rho_vapor = PropsSI('D', 'T', T_sat, 'Q', 1, fluid)
h_vapor = PropsSI('H', 'T', T_sat, 'Q', 1, fluid)
s_vapor = PropsSI('S', 'T', T_sat, 'Q', 1, fluid)
# Latent heat
h_fg = h_vapor - h_liquid
print(f"{fluid} at {T_sat-273.15}°C:")
print(f" Saturation pressure: {P_sat/1000:.2f} kPa")
print(f" Liquid density: kg/m³")
()
()
from CoolProp.CoolProp import PropsSI
# Find temperature at known pressure and enthalpy
P = 500000 # 5 bar = 500 kPa
h = 250000 # 250 kJ/kg
T = PropsSI('T', 'P', P, 'H', h, 'R134a')
Q = PropsSI('Q', 'P', P, 'H', h, 'R134a')
print(f"R134a at {P/1000:.0f} kPa and {h/1000:.0f} kJ/kg:")
print(f" Temperature: {T-273.15:.2f}°C")
print(f" Quality: {Q:.4f} (0=liquid, 1=vapor)")
from CoolProp.CoolProp import Props1SI
fluids = ['Water', 'CO2', 'Nitrogen', 'R134a']
for fluid in fluids:
T_crit = Props1SI('Tcrit', fluid)
P_crit = Props1SI('Pcrit', fluid)
T_triple = Props1SI('Ttriple', fluid)
M = Props1SI('M', fluid)
print(f"\n{fluid}:")
print(f" Critical point: {T_crit-273.15:.2f}°C, {P_crit/1e6:.2f} MPa")
print(f" Triple point: {T_triple-273.15:.2f}°C")
print(f" Molar mass: {M*1000:.2f} g/mol")
from CoolProp.CoolProp import PropsSI
import numpy as np
# Calculate water viscosity from 0°C to 100°C at atmospheric pressure
P = 101325 # Pa
temperatures = np.linspace(273.15, 373.15, 11) # 0 to 100°C
print("Water viscosity vs temperature:")
print("T(°C) μ(mPa·s)")
for T in temperatures:
mu = PropsSI('V', 'T', T, 'P', P, 'Water') * 1000 # Convert to mPa·s
print(f"{T-273.15:5.0f} {mu:.4f}")
from CoolProp.CoolProp import PropsSI
# R134a at 10 bar with 50% quality
P = 1000000 # 10 bar = 1 MPa
Q = 0.5 # 50% vapor
T = PropsSI('T', 'P', P, 'Q', Q, 'R134a')
h = PropsSI('H', 'P', P, 'Q', Q, 'R134a')
s = PropsSI('S', 'P', P, 'Q', Q, 'R134a')
rho = PropsSI('D', 'P', P, 'Q', Q, 'R134a')
print(f"R134a two-phase at {P/1e6:.1f} MPa, quality = {Q}:")
print(f" Temperature: {T-273.15:.2f}°C")
print(f" Enthalpy: {h/1000:.2f} kJ/kg")
print(f" Entropy: {s/1000:.4f} kJ/kg·K")
print(f" Density: {rho:.2f} kg/m³")
Props1SI('Tmin', fluid) and Props1SI('Tmax', fluid)Props1SI('pmin', fluid) and Props1SI('pmax', fluid)Not all input pairs are valid in all regions:
Error: "CoolProp error: [PropsSI] Two saturation inputs are not valid"
Error: "CoolProp error: Value is outside range"
Error: "CoolProp error: Fluid not found"
Error: "Unable to match the inputs"
from CoolProp.CoolProp import PropsSI
def safe_props(output, input1, value1, input2, value2, fluid):
"""Query CoolProp with error handling"""
try:
result = PropsSI(output, input1, value1, input2, value2, fluid)
return result
except ValueError as e:
print(f"Error querying {fluid}: {e}")
return None
except Exception as e:
print(f"Unexpected error: {e}")
return None
# Usage
density = safe_props('D', 'T', 300, 'P', 101325, 'Water')
if density is not None:
print(f"Density: {density:.2f} kg/m³")
| Task | Function | Example |
|---|---|---|
| Two-input property | PropsSI(output, in1, val1, in2, val2, fluid) | PropsSI('D', 'T', 300, 'P', 101325, 'Water') |
| Single-input property | Props1SI(param, fluid) | Props1SI('Tcrit', 'Water') |
| Saturation liquid | Use Q=0 | PropsSI('H', 'T', 300, 'Q', 0, 'R134a') |
| Saturation vapor | Use Q=1 | PropsSI('H', 'T', 300, 'Q', 1, 'R134a') |
| Two-phase | Use 0<Q<1 | PropsSI('D', 'P', 500000, 'Q', 0.5, 'R134a') |
| List all fluids | CoolProp.__fluids__ | import CoolProp; print(CoolProp.__fluids__) |
This skill provides access to one of the most comprehensive open-source thermophysical property databases available, suitable for research, engineering design, and educational applications.