def test_adj_cellwise_nwtrph(init_sup_sat, nwtrph_iters = nwtrph_iters_def): opts.nwtrph_iters = nwtrph_iters print "[nwtrph adj_cellwise]" rhod, th, rv, rc, rr, dt = initial_state(init_sup_sat) # define pressure consistent with adj_cellwise to compare results p = arr_t([common.p(rhod[0], rv[0], common.T(th[0], rhod[0]))]) #nwtrph requires th_std input th_std = arr_t([common.th_dry2std(th[0], rv[0])]) blk_1m.adj_cellwise_nwtrph(opts, p, th_std, rv, rc, dt) T = common.exner(p[0]) * th_std[0] ss = supersaturation(T, p[0], rv[0]) print "final supersaturation", ss, th_std[0], rv[0] return ss
def test_adj_cellwise_nwtrph(init_sup_sat, nwtrph_iters=nwtrph_iters_def): opts.nwtrph_iters = nwtrph_iters print("[nwtrph adj_cellwise]") rhod, th, rv, rc, rr, dt = initial_state(init_sup_sat) # define pressure consistent with adj_cellwise to compare results p = arr_t([common.p(rhod[0], rv[0], common.T(th[0], rhod[0]))]) #nwtrph requires th_std input th_std = arr_t([common.th_dry2std(th[0], rv[0])]) blk_1m.adj_cellwise_nwtrph(opts, p, th_std, rv, rc, dt) T = common.exner(p[0]) * th_std[0] ss = supersaturation(T, p[0], rv[0]) print("final supersaturation", ss, th_std[0], rv[0]) return ss
def test_adj_cellwise_constp(init_sup_sat, r_eps = r_eps_def): opts.r_eps = r_eps print "[constp adj_cellwise]" rhod, th, rv, rc, rr, dt = initial_state(init_sup_sat) # define pressure consistent with adj_cellwise to compare results p = arr_t([common.p(rhod[0], rv[0], common.T(th[0], rhod[0]))]) #constp requires th_std input th_std = arr_t([common.th_dry2std(th[0], rv[0])]) blk_1m.adj_cellwise_constp(opts, rhod, p, th_std, rv, rc, rr, dt) T = common.exner(p[0]) * th_std[0] ss = supersaturation(T, p[0], rv[0]) print "final supersaturation", ss, th_std[0], rv[0] return ss
for i in np.arange(nx): for j in np.arange(ny): if clb_idx[i, j] > 0: clb_rv[i, j] = rv[i, j, clb_idx[i, j]] clb_th[i, j] = th[i, j, clb_idx[i, j]] # model a parcel to get an adiabatic rl for i in np.arange(nx): for j in np.arange(ny): parcel_rv = clb_rv[i, j] parcel_th = clb_th[i, j] parcel_rl = 0 for k in np.arange(nz): parcel_T = parcel_th * lcmn.exner(p_e.astype(float)[k]) delta_rv = parcel_rv - lcmn.r_vs(parcel_T, p_e.astype(float)[k]) if delta_rv <= 0: delta_rv = 0 parcel_rv -= delta_rv parcel_th += delta_rv * evap_lat / lcmn.c_pd / lcmn.exner( p_e.astype(float)[k]) parcel_rl += delta_rv adia_rl[i, j, k] = parcel_rl #adia_rl = np.where(adia_rl > 0., adia_rl, 0) #print adia_rl # translate rl to AF #AF = np.where(adia_rl > 0., rl / adia_rl, 0)