;+ ; NAME: ; oclc_fwd_dnu.pro ; ; PURPOSE: ; Calculates the derivative of the refractivity, dnudr, from the ; radius, pressure, temperature, temperature derivative with respect ; to radius, refractivity at STP, molecular weight and mass of the planet. ; ; DESCRIPTION: ; ; CALLING SEQUENCE: ; dnu = oclc_fwd_dnu(r, p, t, mu, nuSTP, mp) ; ; INPUTS: ; **** All inputs in cgs units ******** ; ; r - An array of radius values from the center of the planet, in cm. ; The radius array could be in ascending or descending order. ; p - An array (corresponding to r) of the pressure, ; in microbar. ; t - An array (corresponding to r) or scalar of the temperature, ; in Kelvin. ; mu - An array (corresponding to r) or scalar of the molecular weight ; (unitless). ; nuSTP - the refractivity of the gas at STP ; mp - the planetary mass, in grams. ; ; OOPTIONAL INPUTS: ; dt - the derivative of temperature with radius ; ; OUTPUTS: ; dnu - derivative of number density ; ; EXAMPLE 1 - scalar temperature, molecular weight ; r = dindgen(200)*1d5 + 1200d5 ; array of r, in cm ; r0 = 1250d5 ; reference r in cm ; t = 104.d ; scalar temperature in K ; mu = 28.01d ; scalar molecular weight ; nustp = 2.98e-4 ; N2 ; p0 = 1.0d ; reference pressure in microbar ; mp = 1.3d25 ; reference planet mass in g ; p = oclc_fwd_hydrostatic(r,t,mu,r0,p0,mp) ; dnu = oclc_fwd_dnu(r, p, t, mu, nuSTP, mp) ; ; ; ---- exact calculation, see Elliot and Young 1992 ; lam = (!phys.g*mp*mu*!phys.m_u/(!phys.k*t*r )) ;energy ratio ; lam0 = (!phys.g*mp*mu*!phys.m_u/(!phys.k*t*r0)) ; p2 = p0 * exp( lam - lam0 ) ; loschmidt = 1.01325e6/(!phys.k * 273.15) ; nu2 = (p2 / (!phys.k * t)) * (nustp/loschmidt) ; dnu2 = -nu2 * (lam) / r ; ; plot, r/1e5, (dnu-dnu2)/dnu2 ; print, minmax( (dnu-dnu2)/dnu2 ) ; -6.0180608e-15 -4.4277798e-15 ; print, mean( (dnu-dnu2)/dnu2 ) ; -3.9870151e-24 ; ; ; EXAMPLE 2 - variable temperature ; r = dindgen(200)*1d5 + 1200d5 ; array of r, in cm ; r0 = 1250d5 ; reference r in cm ; b = -2.d ; t0 = 104.d ; t = t0 * (r/r0)^b ; scalar temperature in K ; dt = b*t/r ; mu = 28.01d ; scalar molecular weight ; nustp = 2.98e-4 ; N2 ; p0 = 1.0d ; reference pressure in microbar ; mp = 1.3d25 ; reference planet mass in g ; p = oclc_fwd_hydrostatic(r,t,mu,r0,p0,mp) ; the call. ; nu = oclc_fwd_nu(p, t, nustp) ; hnarr = oclc_fwd_hn(r, t, mu, mp) ; hn = oclc_fwd_hn(r, t, mu, mp, dt=dt) ; dnuarr = oclc_fwd_dnu(r, p, t, mu, nuSTP, mp) ; dnu = oclc_fwd_dnu(r, p, t, mu, nuSTP, mp, dt=dt) ; ; ---- exact calculation, see Elliot and Young 1992 ; lam = (!phys.g*mp*mu*!phys.m_u/(!phys.k*t *r )) ;energy ratio ; lam0 = (!phys.g*mp*mu*!phys.m_u/(!phys.k*t0*r0)) ; p2 = p0 * exp( (lam - lam0)/(1 + b) ) ; loschmidt = 1.01325e6/(!phys.k * 273.15) ; nu2 = (p2 / (!phys.k * t)) * (nustp/loschmidt) ; hn2 = r/(lam + b) ; dnu2 = -nu2 * (lam + b) / r ; ; plot, r/1e5, (dnuarr-dnu2)/dnu2 ; print, minmax( (dnuarr-dnu2)/dnu2 ) ; -1.4146718e-07 2.8278174e-07 ; print, mean( (dnuarr-dnu2)/dnu2 ) ; -1.0877865e-07 ; ; plot, r/1e5, (dnu-dnu2)/dnu2 ; print, minmax( (dnu-dnu2)/dnu2 ) ;-9.1506314e-15 8.6675652e-15 ; print, mean( (dnu-dnu2)/dnu2 ) ;-2.4523038e-16 ; ; REVISON HISTORY: ; 25-Aug-2006 CBO SwRI -- modified from LAY's lightcurve.pro ; 23-Sep-2006 LAY SwRI -- changed some variable names, added example ; ;- function oclc_fwd_dnu, r, p, t, mu, nustp, mp, DT = dt nu = oclc_fwd_nu(p, t, nustp) hn = oclc_fwd_hn(r, t, mu, mp, dt=dt) dnu = -nu / hn return, dnu end