Skip to main content

Module thermodynamics

Module thermodynamics 

Source

Functions§

adiabatic_final_pressure
Adiabatic relation: P1 * V1^γ = P2 * V2^γ → P2 = P1 * (V1/V2)^γ
average_kinetic_energy
Average kinetic energy of a gas molecule: KE = (3/2) * k_B * T
biot_number
Biot number: Bi = hL/k (external convection vs internal conduction)
boiling_point_elevation
Boiling point elevation: ΔTb = Kb × m
carnot_efficiency
Carnot efficiency: η = 1 - T_cold / T_hot
celsius_to_fahrenheit
Celsius to Fahrenheit: F = C × 9/5 + 32
celsius_to_kelvin
Celsius to Kelvin: K = C + 273.15
celsius_to_rankine
Celsius to Rankine: R = (C + 273.15) × 9/5
clausius_clapeyron
Clausius-Clapeyron (approximate): ln(P2/P1) = (L/R) * (1/T1 - 1/T2) Returns P2 given P1, T1, T2, and molar latent heat L.
convective_heat_rate
Newton’s law of convection: Q/t = h×A×ΔT
cop_heat_pump
Coefficient of performance (heat pump): COP = Q_hot / W
cop_refrigerator
Coefficient of performance (refrigerator): COP = Q_cold / W
entropy_change_ideal_gas
Entropy change for an ideal gas: ΔS = nCvln(T2/T1) + nRln(V2/V1)
entropy_change_isothermal
Entropy change for heat transfer at constant temperature: ΔS = Q / T
fahrenheit_to_celsius
Fahrenheit to Celsius: C = (F - 32) × 5/9
fahrenheit_to_kelvin
Fahrenheit to Kelvin via Celsius
freezing_point_depression
Freezing point depression: ΔTf = Kf × m
grashof_number
Grashof number: Gr = gβΔTL³/ν²
heat_conduction_rate
Heat conduction (Fourier’s law): Q/t = k * A * ΔT / d
heat_equation_stability
Maximum stable time step for explicit finite difference: dt_max = dx²/(2α)
heat_equation_step_1d
Explicit finite difference: T_i^(n+1) = T_i^n + α×dt/dx² × (T_(i+1) - 2T_i + T_(i-1)) Fixed boundary conditions (first and last elements unchanged).
heat_of_vaporization_trouton
Trouton’s rule: ΔHvap ≈ 88 × Tb (J/mol)
heat_radiation_power
Heat radiation (Stefan-Boltzmann law): P = ε * σ * A * T^4
heat_transfer
Heat transfer: Q = m * c * ΔT
ideal_gas_moles
Number of moles: n = PV / (RT)
ideal_gas_pressure
Ideal gas law: PV = nRT. Solve for pressure: P = nRT / V
ideal_gas_temperature
Solve for temperature: T = PV / (nR)
ideal_gas_volume
Solve for volume: V = nRT / P
kelvin_to_celsius
Kelvin to Celsius: C = K - 273.15
kelvin_to_fahrenheit
Kelvin to Fahrenheit via Celsius
latent_heat
Heat for phase change: Q = m * L (latent heat)
mean_free_path
Mean free path: λ = 1 / (√2 * π * d^2 * n/V)
net_radiation_power
Net radiative heat transfer: P = ε * σ * A * (T_hot^4 - T_cold^4)
newton_cooling
Newton’s law of cooling: dT/dt = -k * (T - T_env) Returns temperature at time t: T(t) = T_env + (T0 - T_env) * e^(-k*t)
nusselt_number
Nusselt number: Nu = hL/k
prandtl_number
Prandtl number: Pr = ν/α
quality
Steam quality (dryness fraction): x = m_vapor / m_total
radiative_equilibrium_temperature
Radiative equilibrium temperature: T = ((L(1-a))/(16πσd²))^(1/4)
rankine_to_celsius
Rankine to Celsius: C = R × 5/9 - 273.15
rayleigh_number
Rayleigh number: Ra = Gr × Pr
rms_speed
RMS speed of gas molecules: v_rms = sqrt(3 * k_B * T / m)
saturation_pressure
Antoine equation: log10(P) = A - B/(C+T), returns P
specific_enthalpy_wet
Specific enthalpy of wet steam: h = hf + x × hfg
spectral_exitance
Planck’s law: M = (2πhc²/λ⁵) × 1/(e^(hc/λkT) - 1)
subcool_degree
Degree of subcooling: ΔT = T_sat - T_actual
superheat_degree
Degree of superheat: ΔT = T_actual - T_sat
thermal_diffusivity
Thermal diffusivity: α = k/(ρ×cₚ)
thermal_efficiency
Thermal efficiency: η = W / Q_hot
wien_displacement
Wien’s displacement law: λ_max = b/T where b = 2.898e-3 m·K
work_adiabatic
Work done during adiabatic process: W = (P1V1 - P2V2) / (γ - 1)
work_isobaric
Work done during isobaric (constant pressure) process: W = P * ΔV
work_isothermal
Work done by an ideal gas during isothermal expansion: W = nRT * ln(V2/V1)