; ;jeff snider, univeristy of wyoming, march 2006 ; ;for 'lognorm' the assumption (here) is that aerosol amount ;is expressed as a number mixing ratio per kg of dry air ; ;for 'twomey' "c_twomey" is assumed (here) to be the concentration at the ;state where the CCN measurements are made ; ;account for those nuclei that are larger than the maximum size with parameter ncum_offset ;set the right_tail = 1 if you want to include those particles in the ccn spectrum (see set_common) ; pro ccn_spectrum, specific_volume_initial, nconc, rsalt, rinsoluble, rdry, r, $ sr_crit, s_sfc, rho_solution_vector, r_crit ; common constants, gascon, rho_h2o, mw_nh42so4, rho_nh42so4, sigma_0, $ sigma_t, dsigmadmolality_nh42so4, dsigmadmolality_nacl, mw_h2o, $ mw_nacl, rho_nacl, tkmelt, c_nh42so4, a_nh42so4, c_nacl, a_nacl, $ cp_air_o, cp_h2o_o, mw_air, gravity, p0, alpha, beta_local, $ gascon_h2o, cw_h2o_o, tk_o, lv_o, ew_o, tk_aerosol, salt_type, $ epsilon, c_twomey, k_twomey, aerosol_type, right_tail, $ gascon_air, tc_base, tk_base, p_base, h_start, hmax, $ r0, dt, rmin, rmax, coef, epsilon_aerosol, specific_volume_meas, $ nchan, mw_salt, rho_salt, a_salt, c_salt, specific_volume_base, $ dsigmadmolality_salt, rho_insoluble, volume_insoluble_to_soluble, $ mixrat_tot_1,r_1,geo_sigma_1,mixrat_tot_2,r_2,geo_sigma_2, $ tk_start,p_start,sratio_start,mixrat_tot_3,r_3,geo_sigma_3 ; common graphics, write_flag ; common aerosol, r_m, ncum_mixrat ; ;..the procedure init.pro establishes the arrays r_m and ncum_mixrat, and the dimension nchan. ;..The first two of these are in the common block "aerosol" and the third is in the common block "constants". ;..The dimension of r_m and ncum_mixrat is one larger than nchan ; nconc = dblarr(nchan) ncum_ccn = dblarr(nchan+1) r = dblarr(nchan+1) rinsoluble = dblarr(nchan+1) rdry = dblarr(nchan+1) rsalt = dblarr(nchan+1) sr_crit = dblarr(nchan+1) s_sfc = dblarr(nchan+1) rho_solution_vector = dblarr(nchan+1) r_crit = dblarr(nchan+1) ncum_offset = 0.d ; ;segment the ccn distribution, starting at large size ; for i = 0, nchan do begin rdry(i) = r_m(i) if volume_insoluble_to_soluble gt 0.d then begin rinsoluble(i) = rdry(i) / (1.d + 1.d / volume_insoluble_to_soluble)^(1.d / 3.d) rsalt(i) = rdry(i) / (1.d + volume_insoluble_to_soluble)^(1.d / 3.d) endif else begin rinsoluble(i) = 0.d rsalt(i) = rdry(i) endelse insoluble_size = rinsoluble(i) salt_size = rsalt(i) scrit, salt_size, insoluble_size, sratio_crit, activation_size sr_crit(i) = sratio_crit r_crit(i) = activation_size kohler_size, sratio_start, salt_size, insoluble_size, loop_count, wet_size, mw_on_mtot, rho_solution r(i) = wet_size rho_solution_vector(i) = rho_solution crit_flag = 0 sratio_bdry, crit_flag, wet_size, salt_size, insoluble_size, sratio, loop_count, mw_on_mtot, rho_solution, $ water_activity, molality, wgtf, sigma, kelvin test = abs(sratio - sratio_start)/sratio_start if abs(sratio - sratio_start)/sratio_start gt 0.0001 then begin print, format = '(a,3(a,e10.3))', '*ccn_spectrum* size initialization inconsistency ', $ ' salt_size = ',salt_size,' sratio = ',sratio,' sratio_start = ',sratio_start stop endif else begin s_sfc(i) = sratio endelse if aerosol_type eq 'lognorm' then begin ncum_ccn(i) = ncum_mixrat(i) / specific_volume_initial endif else if aerosol_type eq 'twomey' then begin ncum_ccn(i) = c_twomey*(100.d*(sr_crit(i)-1.d))^k_twomey * (specific_volume_meas / specific_volume_initial) endif if i gt 0 then begin nconc(i-1) = ncum_ccn(i) - ncum_ccn(i-1) endif else if i eq 0 then begin ncum_offset = ncum_ccn(i) endif endfor ; ;..put all of the particles larger than the maximum size in the largest size bin ; if right_tail then nconc(0) = nconc(0) + ncum_offset ; return ; end