Homework+1+IDL+code+demo

code format="idl" cdf2idl, 'COARE_soundings_goodset.nc' @COARE_soundings_goodset.idl

qv = RH/100.*mixrat(T,p) Tvabs = (T+273.2)*(1+0.61*qv) Tv = Tvabs - 273.2 dz = (287.*Tvabs/9.8/p)*5 ;;; dp = 5mb z = total(dz, 2, /cum)

s = entropy(T,p,qv)    ;;; test sdry = entropy(T,p,qv*1e-5) ssat = entropy(T,p,mixrat(T,p))

plot, s(0,*), z(0,*)/1000., ytit='z (km)', xtit='dry, actual, and saturation entropy', xra=[100,300], tit='10 sondes' oplot, sdry(0,*), z(0,*)/1000., lines=1 oplot, ssat(0,*), z(0,*)/1000., lines=2
 * Plot a few

for isond = 0,10 do $ oplot, s(isond,*), z(isond,*)/1000., color=5+isond*250/10 for isond = 0,10 do $ oplot, sdry(isond,*), z(isond,*)/1000., lines=1, color=5+isond*250/10 for isond = 0,10 do $ oplot, ssat(isond,*), z(isond,*)/1000., lines=2, color=5+isond*250/10

Te = T(0,*) qe = qv(0,*) pe = p(0,*) se = s(0,*)
 * Pick one sounding, call it "env" e

Te = total(T,1)/1726. qe = total(qv,1)/1726. se = total(s,1)/1726.
 * No, use the mean s and q

invert_s, se(0),pe,qe(0), Tp,qvp
 * Lift surface parcel, conserving entropy and total water

Tvp = (Tp+273.2)*(1+0.61*qvp) - 273.2 Tve = (Te+273.2)*(1+0.61*qe) - 273.2

Trhop = (Tp+273.2) *(1+qvp/0.622)/(1+qe(0)) -273.2
 * The density temperature includes condensate loading

plot, Tp-Te, -pe, tit='lifted parcel Tp-Te, Tvp-Tve, and Trhop-Tve', ytit='-p (mb)', xtit='K', xra=[-2,5] oplot, Tvp-Tve, -pe, lines=1 oplot, Trhop-Tve, -pe, lines=2 ver,0

plot, 9.8*(Tp-Te)/Tvabs(0,*), z(0,*)/1000, tit='Buoyancy', ytit='z (km)', xtit='m s!U-2!N or J/kg', xra=[-0.2, 0.2] oplot, 9.8*(Tvp-Tve)/Tvabs(0,*), z(0,*)/1000, lines=1 oplot, 9.8*(Trhop-Tve)/Tvabs(0,*), z(0,*)/1000, lines=2 ver,0


 * Downdraft: plenty of water, conserve entropy
 * invert_s, se(40),pe(0:40),qe(40), Tdownp,qdownp
 * plot, Tdownp-Te, -pe(0:40), tit='rainy downdraft parcel Tp-Te'

Te500 = T(*,100) ;;; 500mb invert_s, s(*,0),500.,qv(*,0), Tp500,qvp500
 * Lifted Index

LI = Te500-Tp500 thetae = theta_e(T,p,q)

qv1 = RH/100.*mixrat(T+1,p) s1 = entropy(T+1,p,qv1)
 * SST CHANGE TYPE THINKING +1K

invert_s, s1(0,0),pe,qv1(0,0), Tp1,qvp1

plot, tp1-tp, z(0,*)/1000, tit='parcel T change: initial T+1K, RH=const', ytit='z (km)', xtit='Tp over warmer SST', $ yra=[0,13]\

b = 9.8*(Tp-Te)/Tvabs(0,*) dzz = dz(0,*) hlp, total((b>0)*dzz)
 * CAPE

b = 9.8*(Tp1-Te)/Tvabs(0,*) hlp, total((b>0)*dzz)
 * CAPE +1K

sde = entropy(Te,pe,qe*1e-5) ssate = entropy(Te,pe,mixrat(Te,pe))
 * entraining plume buoyancy, mean sounding

plot, se, z(0,*)/1000., ytit='z (km)', xtit='dry, actual, and saturation entropy', $ xra=[100,300], tit='mean sounding' oplot, sde, z(0,*)/1000., lines=1 oplot, ssate, z(0,*)/1000., lines=2
 * Plot tripod

eps = 1./100 ;;; fractional entrainment rate per mb M0 = 1. ;;; unit mass flux at cloud base dp = 5 ;; mb
 * Now entrain

M = M0 * exp((1005-pe)*eps) Mq = (M0*qe[0]) + cumulate(eps*dp *M*qe) Ms = (M0*se[0]) + cumulate(eps*dp *M*se)
 * Entrainment mixes q and s

qplume = Mq/M splume = Ms/M

!p.multi=[0,2,1] plot, qe, z(0,*)/1000., tit='q of environment and plume' oplot, qplume, z(0,*)/1000., color=250

plot, se, z(0,*)/1000., ytit='z (km)', xtit='dry, actual, and saturation entropy', $ xra=[100,300], tit='mean sounding' oplot, sde, z(0,*)/1000., lines=1 oplot, ssate, z(0,*)/1000., lines=2 oplot, splume, z(0,*)/1000., color=250

code