Beispiel #1
0
def make_figure2():
    plt.rc('font', size = 17)
    plt.rc('text', usetex = True)
    # Values for the pathological problem
    y0 = 0.5
    y1 = 0
    T0 = 335        # temperature at 1 bar
    T1 = 375        # temperature at 1 bar
    s0 = thermo.entropy(y0, thermo.bar, T0)
    s1 = thermo.entropy(y1, thermo.bar, T1)

    print ('value of w for wet parcel', thermo.compute_w(y0))

    n = 10000
    p = np.linspace(4e4, 6.5e4, n)
    dhdp0 = np.zeros((n,))
    dhdp1 = np.zeros((n,))
    Tv0 = np.zeros((n,))
    Tv1 = np.zeros((n,))

    for i in range(n):
        dhdp0[i] = thermo.enthalpy_dp(y0, p[i], s0)
        dhdp1[i] = thermo.enthalpy_dp(y1, p[i], s1)
        Tv0[i] = thermo.virtual_temperature(y0, thermo.bar, s0)
        Tv1[i] = thermo.virtual_temperature(y1, thermo.bar, s1)

    plt.clf()
    plt.plot(dhdp1, p / 100, '-', label = 'dry parcel')
    plt.plot(dhdp0, p / 100, '--', label = 'wet parcel')
    plt.xlabel("{\\huge $\\partial_p h$} (J kg$^{-1}$ Pa$^{-1}$)")
    plt.ylabel("Pressure (hPa)")
    plt.ylim(670, 380)
    plt.legend(loc = 'lower right', frameon = False)

    ax = plt.gca()
    ax.tick_params(direction='out', right=False, top = False)
    ax.spines['right'].set_visible(False)
    ax.spines['top'].set_visible(False)
    plt.subplots_adjust(bottom = 0.15, left = 0.125)
    plt.savefig('../output/Stansifer_Fig2.png')
    plt.savefig('../output/Stansifer_Fig2.ps', format='ps')
    plt.savefig('../output/Stansifer_Fig2.eps', format='eps')
    plt.savefig('../output/Stansifer_Fig2.pdf', format='pdf')
    plt.close()
Beispiel #2
0
 def h_dp(self, j, k):
     return thermo.enthalpy_dp(self.y[j], self.p[k], self.s[j])