Cp-T-Cu.py ダウンロード/コピー

Cp-T-Cu.py をダウンロード

Cp-T-Cu.py
Cp-T-Cu.py
  1"""
  2概要:
  3    銅(Cu)の比熱の温度依存性を計算しプロットするスクリプトです。
  4
  5詳細説明:
  6    低温領域の比熱、高温領域のShomate方程式による比熱、およびDebyeモデルによる比熱を計算し、
  7    Dulong-Petitの極限値とともにMatplotlibでグラフ化します。定数はNIST Chemistry WebBookなどを
  8    参考にしています。
  9
 10関連リンク:
 11    Cp-T-Cu_usage
 12"""
 13# NIST Chemistry WebBook: https://webbook.nist.gov/chemistry/
 14#    Cu: https://webbook.nist.gov/cgi/cbook.cgi?Formula=Cu&MatchIso=on&NoIon=on&Units=SI&cTC=on
 15
 16import numpy as np
 17import matplotlib.pyplot as plt
 18from scipy.integrate import quad
 19
 20# 定数
 21R = 8.314  # J/mol·K
 22theta_D = 343.5  # Debye温度 (K)
 23dulong_petit = 3 * R  # ≈ 24.94 J/mol·K
 24
 25# 低温比熱パラメータ(mJ → J)
 26gamma = 0.695e-3  # J/mol·K^2
 27beta = 0.468e-5   # J/mol·K^4
 28
 29# Shomate係数
 30A = 17.72891
 31B = 28.09870
 32C = -31.25289
 33D = 13.97243
 34E = 0.068611
 35
 36# Debye積分関数
 37def debye_integral(x):
 38    """
 39    概要:
 40        Debye比熱モデルにおける被積分関数の値を計算します。
 41
 42    引数:
 43        :param x: 無次元化された積分変数。
 44        :type x: float または numpy.ndarray
 45
 46    戻り値:
 47        :returns: 被積分関数の計算結果。
 48        :rtype: float または numpy.ndarray
 49    """
 50    return (x**4 * np.exp(x)) / (np.exp(x) - 1)**2
 51
 52def debye_heat_capacity(T):
 53    """
 54    概要:
 55        指定された温度におけるDebyeモデルに基づく比熱を計算します。
 56
 57    詳細説明:
 58        温度Tが0の場合は0を返します。それ以外の場合は、scipy.integrate.quadを用いて
 59        debye_integralを積分し、Debye比熱を算出します。
 60
 61    引数:
 62        :param T: 絶対温度。
 63        :type T: float
 64
 65    戻り値:
 66        :returns: 計算されたDebye比熱。
 67        :rtype: float
 68    """
 69    if T == 0:
 70        return 0
 71    x_max = theta_D / T
 72    integral, _ = quad(debye_integral, 0, x_max)
 73    return 9 * R * (T / theta_D)**3 * integral
 74
 75# 温度範囲
 76T_low = np.linspace(0.1, 50, 200)
 77T_high = np.linspace(298, 1356, 300)
 78T_debye = np.linspace(1, 500, 300)
 79
 80# 比熱計算
 81C_low = gamma * T_low + beta * T_low**3
 82t = T_high / 1000
 83C_high = A + B*t + C*t**2 + D*t**3 + E/t**2
 84C_debye = np.array([debye_heat_capacity(T) for T in T_debye])
 85
 86# プロット
 87plt.figure(figsize=(10, 6))
 88plt.plot(T_low, C_low, label='Low-T Heat Capacity (γT + βT³)', color='blue')
 89plt.plot(T_high, C_high, label='High-T Heat Capacity (Shomate)', color='red')
 90plt.plot(T_debye, C_debye, label='Debye Model (θ_D = 343.5 K)', color='green', linestyle='--')
 91plt.axhline(y=dulong_petit, color='gray', linestyle='--', label='Dulong-Petit Limit (~24.94 J/mol·K)')
 92
 93# ラベル・凡例・タイトル
 94plt.xlabel('Temperature T (K)')
 95plt.ylabel('Heat Capacity C (J/mol·K)')
 96plt.title('Copper Heat Capacity vs Temperature')
 97plt.legend()
 98plt.grid(True)
 99plt.tight_layout()
100plt.show()