//*************************************************** // // SOAHTchemistry.ipf // Author: Ziyue Li (UC Davis) // Revision Number: 1.00 // Revision Date: Sep 24, 2018 // Revision Notes: // // ///////////////////////////////////////////////////////////////// menu "HT Oxidation" Submenu "Create Rate Constants Wave" //Simple = rate constants for all the three generations are assumed identical "Low RH-Simple", CreatekkWave_3G_basic() "High RH-Simple", CreatekkWave_3G_basicH2O() //Complex = different rate constants are assumed for each generation "Low RH-Complex", CreatekkWave_3G_adv() "High RH-Complex", CreatekkWave_3G_advH2O() end Submenu "Profiles at one OH conc" //To use the following, rate contant wave must be creased first, simple and complex both work //RO is not considered explicitly in the following two functions "Low RH", OHexposure38s_3G_dry() "High RH", OHexposure38s_3G_H2O() //RO is considered explicitly; however particle growth due to water uptake is not considered //"Low RH with RO",OHexposure38s_3G_dry_RO() end Submenu "Profiles at various OH conc" //The following functions treat RO radicals implicitly and use same rate constants for three generations "Low RH", FullOHRange_lowRH() "High RH", FullOHRange_highRH() end end ////////////////////////////////////////////////////////////////////////////////////////// //This function pops up a selection menu to set values for Dorg, uptake_OH, prob, kkRO2 and bratio //This function assumes that uptake_HO2=uptake_OH and that frag prob, kkRO2 and bratio for all generations are the same Function CreatekkWave_3G_basic() make/o/d/n=(100) kkWave make/o/t/n=(100) kkWave_names kkWave=nan kkWave_names="" variable Dorg=1e-18 variable uptake_OH=0.105 variable prob=0.31 variable kk=1e-15 variable bratio=0.75 variable kd=1e5 variable kk_1=1e-15 prompt Dorg, "Diffusivity in m2/s" prompt uptake_OH, "Uptake coef of OH and HO2" prompt prob, "Fragmentation probability (fraction)" prompt kk, "Rate constant for RO2+RO2" prompt bratio, "Braching ratio ROOH_1+OH->RO2_1" //prompt kd, "Decomposition rate of RO" //prompt kk_1, "Rate constant for RO+RH" DoPrompt "Set following values",Dorg,uptake_OH,prob,kk,bratio//,kd,kk_1 variable Dfrag=1.4*Dorg variable OH_gas=0.6e11 variable HO2_gas=0.6e11 variable OH_gs=0.6e11 variable HO2_gs=0.6e11 variable flowtime=38.00 variable totaltimesteps=101 variable timestep=flowtime/(totaltimesteps-1) variable smallest_timestep=0.0001 variable stepnum if(smallest_timestep<=0) print "smallest_timestep can't be zero or negative" abort else stepnum=ceil(timestep/smallest_timestep) smallest_timestep=timestep/stepnum endif variable Dp=125 //nm variable SL_depth=0.76 //nm; surface layer depth is fixed no matter how particle shrinks unless particle radius is smaller than SL detph variable totallayers=50 //# variable layerdepth=(0.5*Dp-SL_depth)/totallayers variable density=1.3 //g/cm3 variable MWorg=175 //g/mol variable NA=6.022e23 //mlc/mol variable Corg_initial=density*NA/MWorg //mlc/cm3-particle variable Corg_mlc_initial=Corg_initial*pi/6*(Dp*1e-7)^3 //total mlc in one particle kkWave[0]=Dorg //m2/s kkWave[1]=Dfrag //m2/s kkWave[2]=OH_gas //mlc/cm3-air kkWave[3]=HO2_gas //mlc/cm3-air kkWave[4]=OH_gs //mlc/cm3-air gas concentration near the surface kkWave[5]=HO2_gs //mlc/cm3-air gas concentration near the surface kkWave[6]=uptake_OH kkWave[7]=uptake_OH kkWave[8]=flowtime //s kkWave[9]=totaltimesteps kkWave[10]=timestep //s kkWave[11]=stepnum kkWave[12]=smallest_timestep //s kkWave[13]=Dp //nm initial diameter kkWave[14]=SL_depth //nm kkWave[15]=totallayers //besides surface layer kkWave[16]=layerdepth //nm initial layerdepth kkWave[17]=density //g/cm3-particle kkWave[18]=MWorg //g/mol kkWave[19]=Corg_initial //mlc/cm3-particle kkWave[20]=Corg_mlc_initial //mlc kkWave[21]=prob //fragmentation probability for RO2_1+RO2_1 kkWave[22]=prob //fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2 kkWave[23]=prob //fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[24]=kk //cm3/mlc/s, RO2_1+RO2_1 kkWave[25]=kk //RO2_1+RO2_2 kkWave[26]=kk //RO2_2+RO2_2 kkWave[27]=kk //RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[28]=bRatio //braching ratio of ROOH_1+OH-> bratio*RO2_1+ (1-bratio)* RO2_2 kkWave[29]=bRatio //braching ratio of ROOH_2+OH-> bratio*RO2_2+ (1-bratio)* RO2_3 kkWave[30]=kd //RO_1->2*Frag kkWAve[31]=kd //RO_2->2*Frag kkWave[32]=kd //RO_3->2*Frag kkWave[33]=kk_1 //RO_1+RH->ROH1+RO2_1 kkWave[34]=kk_1 //RO_1+ROH1->ROH1+RO2_2 kkWave[35]=kk_1 //RO_1+ROH2->ROH1+RO2_3 kkWave[36]=kk_1 //RO_1+ROH3->ROH1+RO2_3 kkWave[37]=kk_1 //RO_2+RH->ROH2+RO2_1 kkWave[38]=kk_1 //RO_2+ROH1->ROH2+RO2_2 kkWave[39]=kk_1 //RO_2+ROH2->ROH2+RO2_3 kkWave[40]=kk_1 //RO_2+ROH3->ROH2+RO2_3 kkWave[41]=kk_1 //RO_3+RH->ROH3+RO2_1 kkWave[42]=kk_1 //RO_3+ROH1->ROH3+RO2_2 kkWave[43]=kk_1 //RO_3+ROH2->ROH3+RO2_3 kkWave[44]=kk_1 //RO_3+ROH3->ROH3+RO2_3 kkWave[45]=kk_1 //RO_1+ROOH1->ROH1+RO2_2 kkWave[46]=kk_1 //RO_1+ROOH2->ROH1+RO2_3 kkWave[47]=kk_1 //RO_1+ROOH3->ROH1+RO2_3 kkWave[48]=kk_1 //RO_2+ROOH1->ROH2+RO2_2 kkWave[49]=kk_1 //RO_2+ROOH2->ROH2+RO2_3 kkWave[50]=kk_1 //RO_2+ROOH3->ROH2+RO2_3 kkWave[51]=kk_1 //RO_3+ROOH1->ROH3+RO2_2 kkWAve[52]=kk_1 //RO_3+ROOH2->ROH3+RO2_3 kkWave[53]=kk_1 //RO_3+ROOH3->ROH3+RO2_3 kkWave_names[0]="Dorg,m2/s" kkWave_names[1]="Dfrag,m2/s" kkWave_names[2]="concentration of OH,mlc/cm3-air" kkWave_names[3]="concentration of HO2,mlc/cm3-air" kkWave_names[4]="concentration of OH near the surface, mlc/cm3-air" kkWave_names[5]="concentration of HO2 near the surface, mlc/cm3-air" kkWave_names[6]="uptake coefficient of OH" kkWave_names[7]="uptake coefficient of HO2" kkWave_names[8]="flow time, s" kkWave_names[9]="# of big time steps" kkWave_names[10]="big time step, s" kkWave_names[11]="# of small time steps in each big time step" kkWave_names[12]="smallest time step, s" kkWave_names[13]="initial particle diameter, nm" kkWave_names[14]="depth of surface layer, nm" kkWave_names[15]="# of layers besides surface layer" kkWave_names[16]="initial thickness of each layer, nm" kkWave_names[17]="particle density, g/cm3-particle" kkWave_names[18]="average molecular weight, g/mol" kkWave_names[19]="initial molecular density, mlc/cm3-particle" kkWave_names[20]="initial total molecules, mlc" kkWave_names[21]="fragmentation probability for RO2_1+RO2_1" kkWave_names[22]="fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2" kkWave_names[23]="fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[24]="rate constant for RO2_1+RO2_1, cm3/mlc/s" kkWave_names[25]="rate constant for RO2_1+RO2_2" kkWave_names[26]="rate constant for RO2_2+RO2_2" kkWave_names[27]="rate constant for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[28]="braching ratio of ROOH_1+OH->RO2_1" kkWave_names[29]="braching ratio of ROOH_2+OH->RO2_2" kkWave_names[30]="decomposition rate for RO_1->2*Frag" kkWAve_names[31]="decomposition rate for RO_2->2*Frag" kkWave_names[32]="decomposition rate for RO_3->2*Frag" kkWave_names[33]="rate constant for RO_1+RH->ROH1+RO2_1" kkWave_names[34]="rate constant for RO_1+ROH1->ROH1+RO2_2" kkWave_names[35]="rate constant for RO_1+ROH2->ROH1+RO2_3" kkWave_names[36]="rate constant for RO_1+ROH3->ROH1+RO2_3" kkWave_names[37]="rate constant for RO_2+RH->ROH2+RO2_1" kkWave_names[38]="rate constant for RO_2+ROH1->ROH2+RO2_2" kkWave_names[39]="rate constant for RO_2+ROH2->ROH2+RO2_3" kkWave_names[40]="rate constant for RO_2+ROH3->ROH2+RO2_3" kkWave_names[41]="rate constant for RO_3+RH->ROH3+RO2_1" kkWave_names[42]="rate constant for RO_3+ROH1->ROH3+RO2_2" kkWave_names[43]="rate constant for RO_3+ROH2->ROH3+RO2_3" kkWave_names[44]="rate constant for RO_3+ROH3->ROH3+RO2_3" kkWave_names[45]="rate constant for RO_1+ROOH1->ROH1+RO2_2" kkWave_names[46]="rate constant for RO_1+ROOH2->ROH1+RO2_3" kkWave_names[47]="rate constant for RO_1+ROOH3->ROH1+RO2_3" kkWave_names[48]="rate constant for RO_2+ROOH1->ROH2+RO2_2" kkWave_names[49]="rate constant for RO_2+ROOH2->ROH2+RO2_3" kkWave_names[50]="rate constant for RO_2+ROOH3->ROH2+RO2_3" kkWave_names[51]="rate constant for RO_3+ROOH1->ROH3+RO2_2" kkWAve_names[52]="rate constant for RO_3+ROOH2->ROH3+RO2_3" kkWave_names[53]="rate constant for RO_3+ROOH3->ROH3+RO2_3" Note/k kkwave "This wave stores the rate constants etc., please refer to text wave 'kkwave_names' for what each column is" Note/k kkwave_names "This text wave stores the item names of 'kkwave' " End ////////////////////////////////////////////////////////////////////////////////////////// //This function pops up a selection menu to set values for Dorg, uptake_OH, prob, kkRO2 and bratio //This function assumes that uptake_HO2=uptake_OH and that frag prob, kkRO2 and bratio for all generations are the same //The water in the particle is considered as one of the compositions; Water fraction is considered by setting growth factor >1 Function CreatekkWave_3G_basicH2O() make/o/d/n=(100) kkWave make/o/t/n=(100) kkWave_names kkWave=nan kkWave_names="" variable Dorg=1e-16 variable uptake_OH=0.50 variable prob=0.31 variable kk=1e-15 variable bratio=0.75 variable kd=1e5 variable kk_1=1e-15 variable gf = 1.1 //(growth factor of aP SOA at high RH) prompt Dorg, "Diffusivity in m2/s" prompt uptake_OH, "Uptake coef of OH and HO2" prompt prob, "Fragmentation probability (fraction)" prompt kk, "Rate constant for RO2+RO2" prompt bratio, "Braching ratio ROOH_1+OH->RO2_1" //prompt kd, "Decomposition rate of RO" //prompt kk_1, "Rate constant for RO+RH" prompt gf, "Growth factor of SOA at RH = 90%" DoPrompt "Set following values",Dorg,uptake_OH,prob,kk,bratio,gf//,kd,kk_1 variable Dfrag=1.4*Dorg variable OH_gas=1.7e11 variable HO2_gas=1.7e11 variable OH_gs=1.7e11 variable HO2_gs=1.7e11 variable flowtime=38.00 variable totaltimesteps=101 variable timestep=flowtime/(totaltimesteps-1) variable smallest_timestep=0.0001 variable stepnum if(smallest_timestep<=0) print "smallest_timestep can't be zero or negative" abort else stepnum=ceil(timestep/smallest_timestep) smallest_timestep=timestep/stepnum endif variable Dp=125 //initial diameter(before water uptake) in nm Dp = Dp*gf //diameter of particle after water uptake variable SL_depth=0.76 //nm; surface layer depth is fixed no matter how particle shrinks unless particle radius is smaller than SL detph variable totallayers=50 //# variable layerdepth=(0.5*Dp-SL_depth)/totallayers variable MWorg=175 //g/mol variable NA=6.022e23 //mlc/mol variable f_water_v=(gf^3-1)/(gf^3) //volume fraction of water in the particle variable density_org=1.3 //g/cm3 variable density=density_org*(1-f_water_v)+1.0*f_water_v //g/cm3 variable Corg=density_org*NA/MWorg //mlc/cm3-particle molecular density of organics before water uptake variable Cwater=1.0*NA/18.02 //mlc/cm3-particle variable Corg_initial=Corg*(1-f_water_v) //mlc/cm3-particle molecular density of organics after water uptake variable Cwater_initial=Cwater*f_water_v variable Corg_mlc_initial=Corg_initial*pi/6*(Dp*1e-7)^3 //total mlc in one particle variable Cwater_mlc_initial=Cwater_initial*pi/6*(Dp*1e-7)^3 //total mlc in one particle kkWave[0]=Dorg //m2/s kkWave[1]=Dfrag //m2/s kkWave[2]=OH_gas //mlc/cm3-air kkWave[3]=HO2_gas //mlc/cm3-air kkWave[4]=OH_gs //mlc/cm3-air gas concentration near the surface kkWave[5]=HO2_gs //mlc/cm3-air gas concentration near the surface kkWave[6]=uptake_OH kkWave[7]=uptake_OH kkWave[8]=flowtime //s kkWave[9]=totaltimesteps kkWave[10]=timestep //s kkWave[11]=stepnum kkWave[12]=smallest_timestep //s kkWave[13]=Dp //nm initial diameter kkWave[14]=SL_depth //nm kkWave[15]=totallayers //besides surface layer kkWave[16]=layerdepth //nm initial layerdepth kkWave[17]=density //g/cm3-particle kkWave[18]=MWorg //g/mol kkWave[19]=Corg_initial //mlc/cm3-particle kkWave[20]=Corg_mlc_initial //mlc kkWave[21]=prob //fragmentation probability for RO2_1+RO2_1 kkWave[22]=prob //fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2 kkWave[23]=prob //fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[24]=kk //cm3/mlc/s, RO2_1+RO2_1 kkWave[25]=kk //RO2_1+RO2_2 kkWave[26]=kk //RO2_2+RO2_2 kkWave[27]=kk //RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[28]=bRatio //braching ratio of ROOH_1+OH-> bratio*RO2_1+ (1-bratio)* RO2_2 kkWave[29]=bRatio //braching ratio of ROOH_2+OH-> bratio*RO2_2+ (1-bratio)* RO2_3 kkWave[30]=kd //RO_1->2*Frag kkWAve[31]=kd //RO_2->2*Frag kkWave[32]=kd //RO_3->2*Frag kkWave[33]=kk_1 //RO_1+RH->ROH1+RO2_1 kkWave[34]=kk_1 //RO_1+ROH1->ROH1+RO2_2 kkWave[35]=kk_1 //RO_1+ROH2->ROH1+RO2_3 kkWave[36]=kk_1 //RO_1+ROH3->ROH1+RO2_3 kkWave[37]=kk_1 //RO_2+RH->ROH2+RO2_1 kkWave[38]=kk_1 //RO_2+ROH1->ROH2+RO2_2 kkWave[39]=kk_1 //RO_2+ROH2->ROH2+RO2_3 kkWave[40]=kk_1 //RO_2+ROH3->ROH2+RO2_3 kkWave[41]=kk_1 //RO_3+RH->ROH3+RO2_1 kkWave[42]=kk_1 //RO_3+ROH1->ROH3+RO2_2 kkWave[43]=kk_1 //RO_3+ROH2->ROH3+RO2_3 kkWave[44]=kk_1 //RO_3+ROH3->ROH3+RO2_3 kkWave[45]=kk_1 //RO_1+ROOH1->ROH1+RO2_2 kkWave[46]=kk_1 //RO_1+ROOH2->ROH1+RO2_3 kkWave[47]=kk_1 //RO_1+ROOH3->ROH1+RO2_3 kkWave[48]=kk_1 //RO_2+ROOH1->ROH2+RO2_2 kkWave[49]=kk_1 //RO_2+ROOH2->ROH2+RO2_3 kkWave[50]=kk_1 //RO_2+ROOH3->ROH2+RO2_3 kkWave[51]=kk_1 //RO_3+ROOH1->ROH3+RO2_2 kkWAve[52]=kk_1 //RO_3+ROOH2->ROH3+RO2_3 kkWave[53]=kk_1 //RO_3+ROOH3->ROH3+RO2_3 kkWave[54]=f_water_v //volume fraction of water kkWave[55]=Cwater_initial //molecular density of water in the particle kkWave[56]=Cwater_mlc_initial //initial totale molecule number of water in the particle kkWave[57]=gf //growth factor at 90% RH kkWave_names[0]="Dorg,m2/s" kkWave_names[1]="Dfrag,m2/s" kkWave_names[2]="concentration of OH,mlc/cm3-air" kkWave_names[3]="concentration of HO2,mlc/cm3-air" kkWave_names[4]="concentration of OH near the surface, mlc/cm3-air" kkWave_names[5]="concentration of HO2 near the surface, mlc/cm3-air" kkWave_names[6]="uptake coefficient of OH" kkWave_names[7]="uptake coefficient of HO2" kkWave_names[8]="flow time, s" kkWave_names[9]="# of big time steps" kkWave_names[10]="big time step, s" kkWave_names[11]="# of small time steps in each big time step" kkWave_names[12]="smallest time step, s" kkWave_names[13]="initial particle diameter, nm" kkWave_names[14]="depth of surface layer, nm" kkWave_names[15]="# of layers besides surface layer" kkWave_names[16]="initial thickness of each layer, nm" kkWave_names[17]="particle density, g/cm3-particle" kkWave_names[18]="average molecular weight, g/mol" kkWave_names[19]="initial molecular density, mlc/cm3-particle" kkWave_names[20]="initial total molecules, mlc" kkWave_names[21]="fragmentation probability for RO2_1+RO2_1" kkWave_names[22]="fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2" kkWave_names[23]="fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[24]="rate constant for RO2_1+RO2_1, cm3/mlc/s" kkWave_names[25]="rate constant for RO2_1+RO2_2" kkWave_names[26]="rate constant for RO2_2+RO2_2" kkWave_names[27]="rate constant for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[28]="braching ratio of ROOH_1+OH->RO2_1" kkWave_names[29]="braching ratio of ROOH_2+OH->RO2_2" kkWave_names[30]="decomposition rate for RO_1->2*Frag" kkWAve_names[31]="decomposition rate for RO_2->2*Frag" kkWave_names[32]="decomposition rate for RO_3->2*Frag" kkWave_names[33]="rate constant for RO_1+RH->ROH1+RO2_1" kkWave_names[34]="rate constant for RO_1+ROH1->ROH1+RO2_2" kkWave_names[35]="rate constant for RO_1+ROH2->ROH1+RO2_3" kkWave_names[36]="rate constant for RO_1+ROH3->ROH1+RO2_3" kkWave_names[37]="rate constant for RO_2+RH->ROH2+RO2_1" kkWave_names[38]="rate constant for RO_2+ROH1->ROH2+RO2_2" kkWave_names[39]="rate constant for RO_2+ROH2->ROH2+RO2_3" kkWave_names[40]="rate constant for RO_2+ROH3->ROH2+RO2_3" kkWave_names[41]="rate constant for RO_3+RH->ROH3+RO2_1" kkWave_names[42]="rate constant for RO_3+ROH1->ROH3+RO2_2" kkWave_names[43]="rate constant for RO_3+ROH2->ROH3+RO2_3" kkWave_names[44]="rate constant for RO_3+ROH3->ROH3+RO2_3" kkWave_names[45]="rate constant for RO_1+ROOH1->ROH1+RO2_2" kkWave_names[46]="rate constant for RO_1+ROOH2->ROH1+RO2_3" kkWave_names[47]="rate constant for RO_1+ROOH3->ROH1+RO2_3" kkWave_names[48]="rate constant for RO_2+ROOH1->ROH2+RO2_2" kkWave_names[49]="rate constant for RO_2+ROOH2->ROH2+RO2_3" kkWave_names[50]="rate constant for RO_2+ROOH3->ROH2+RO2_3" kkWave_names[51]="rate constant for RO_3+ROOH1->ROH3+RO2_2" kkWAve_names[52]="rate constant for RO_3+ROOH2->ROH3+RO2_3" kkWave_names[53]="rate constant for RO_3+ROOH3->ROH3+RO2_3" kkWave_names[54]="Volume fraction of water" kkWave_names[55]="Molecular density of water in the particle" kkWave_names[56]="Initial totale molecule number of water in the particle" kkWave_names[57]="Growth factor at 90% RH" Note/k kkwave "This wave stores the rate constants etc., please refer to text wave 'kkwave_names' for what each column is" Note/k kkwave_names "This text wave stores the item names of 'kkwave' " End ///////////////////////////////////////////////////////////////////////////////////////////////////////// //This function pops up a selection menu to set values for Dorg, uptake_OH, prob, kkRO2 and bratio differently for every generation Function CreatekkWave_3G_adv() make/o/d/n=(100) kkWave make/o/t/n=(100) kkWave_names kkWave=nan kkWave_names="" variable Dorg=1e-18 variable uptake_OH=0.15 variable uptake_HO2=0.10 variable prob1=0.5 variable prob2=0.7 variable prob3=0.9 variable kk2=1e-17 variable kk6=1e-16 variable kk11=1e-15 variable bratio1=0.75 variable bratio2=0.75 variable kd1=1e4 //s-1 variable kd2=1e5 //s-1 variable kd3=1e6 //s-1 variable kk_1=1e-15 variable kk_2=1e-15 variable kk_3=1e-15 prompt Dorg, "Diffusivity in m2/s" prompt uptake_OH, "Uptake coef of OH" prompt uptake_HO2, "Uptake coef of HO2" prompt kk2, "Rate constant for RO2+RO2 for G1" prompt kk6, "Rate constant for RO2+RO2 for G2" prompt kk11, "Rate constant for RO2+RO2 for G3" prompt kk_1, "Rate constant for RO+RH for G1" prompt kk_2, "Rate constant for RO+RH for G2" prompt kk_3, "Rate constant for RO+RH for G3" DoPrompt "Set following values",Dorg,uptake_OH,uptake_HO2,kk2,kk6,kk11,kk_1,kk_2,kk_3 variable kk7=kk6 prompt prob1, "Fragmentation probability for G1" prompt prob2, "Fragmentation probability for G2" prompt prob3, "Fragmentation probability for G3" prompt kd1, "Decomposition rate of RO for G1" prompt kd2, "Decomposition rate of RO for G2" prompt kd3, "Decomposition rate of RO for G3" prompt bratio1, "Braching ratio ROOH_1+OH->RO2_1" prompt bratio2, "Braching ratio ROOH_2+OH->RO2_2" DoPrompt "Set following values",prob1,prob2,prob3,kd1,kd2,kd3,bratio1,bratio2 variable Dfrag=1.4*Dorg variable OH_gas=1e11 variable HO2_gas=1e11 variable OH_gs=1e11 variable HO2_gs=1e11 variable flowtime=38 variable totaltimesteps=101 variable timestep=flowtime/(totaltimesteps-1) variable smallest_timestep=0.00001 variable stepnum if(smallest_timestep<=0) print "smallest_timestep can't be zero or negative" abort else stepnum=ceil(timestep/smallest_timestep) smallest_timestep=timestep/stepnum endif variable Dp=125 //nm variable SL_depth=0.4 //nm; surface layer depth is fixed no matter how particle shrinks unless particle radius is smaller than SL detph variable totallayers=50 //# variable layerdepth=(0.5*Dp-SL_depth)/totallayers variable density=1.3 //g/cm3 variable MWorg=170 //g/mol variable NA=6.022e23 //mlc/mol variable Corg_initial=density*NA/MWorg //mlc/cm3-particle variable Corg_mlc_initial=Corg_initial*pi/6*(Dp*1e-7)^3 //total mlc in one particle kkWave[0]=Dorg //m2/s kkWave[1]=Dfrag //m2/s kkWave[2]=OH_gas //mlc/cm3-air kkWave[3]=HO2_gas //mlc/cm3-air kkWave[4]=OH_gs //mlc/cm3-air gas concentration near the surface kkWave[5]=HO2_gs //mlc/cm3-air gas concentration near the surface kkWave[6]=uptake_OH kkWave[7]=uptake_HO2 kkWave[8]=flowtime //s kkWave[9]=totaltimesteps kkWave[10]=timestep //s kkWave[11]=stepnum kkWave[12]=smallest_timestep //s kkWave[13]=Dp //nm initial diameter kkWave[14]=SL_depth //nm kkWave[15]=totallayers //besides surface layer kkWave[16]=layerdepth //nm initial layerdepth kkWave[17]=density //g/cm3-particle kkWave[18]=MWorg //g/mol kkWave[19]=Corg_initial //mlc/cm3-particle kkWave[20]=Corg_mlc_initial //mlc kkWave[21]=prob1 //fragmentation probability for RO2_1+RO2_1 kkWave[22]=prob2 //fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2 kkWave[23]=prob3 //fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[24]=kk2 //cm3/mlc/s, RO2_1+RO2_1 kkWave[25]=kk6 //RO2_1+RO2_2 kkWave[26]=kk7 //RO2_2+RO2_2 kkWave[27]=kk11 //RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[28]=bRatio1 //braching ratio of ROOH_1+OH->RO2_1 kkWave[29]=bRatio2 //braching ratio of ROOH_2+OH->RO2_2 kkWave[30]=kd1 //RO_1->2*Frag kkWAve[31]=kd2 //RO_2->2*Frag kkWave[32]=kd3 //RO_3->2*Frag kkWave[33]=kk_1 //RO_1+RH->ROH1+RO2_1 kkWave[34]=kk_1 //RO_1+ROH1->ROH1+RO2_2 kkWave[35]=kk_1 //RO_1+ROH2->ROH1+RO2_3 kkWave[36]=kk_1 //RO_1+ROH3->ROH1+RO2_3 kkWave[37]=kk_2 //RO_2+RH->ROH2+RO2_1 kkWave[38]=kk_2 //RO_2+ROH1->ROH2+RO2_2 kkWave[39]=kk_2 //RO_2+ROH2->ROH2+RO2_3 kkWave[40]=kk_2 //RO_2+ROH3->ROH2+RO2_3 kkWave[41]=kk_3 //RO_3+RH->ROH3+RO2_1 kkWave[42]=kk_3 //RO_3+ROH1->ROH3+RO2_2 kkWave[43]=kk_3 //RO_3+ROH2->ROH3+RO2_3 kkWave[44]=kk_3 //RO_3+ROH3->ROH3+RO2_3 kkWave[45]=kk_1 //RO_1+ROOH1->ROH1+RO2_2 kkWave[46]=kk_1 //RO_1+ROOH2->ROH1+RO2_3 kkWave[47]=kk_1 //RO_1+ROOH3->ROH1+RO2_3 kkWave[48]=kk_2 //RO_2+ROOH1->ROH2+RO2_2 kkWave[49]=kk_2 //RO_2+ROOH2->ROH2+RO2_3 kkWave[50]=kk_2 //RO_2+ROOH3->ROH2+RO2_3 kkWave[51]=kk_3 //RO_3+ROOH1->ROH3+RO2_2 kkWAve[52]=kk_3 //RO_3+ROOH2->ROH3+RO2_3 kkWave[53]=kk_3 //RO_3+ROOH3->ROH3+RO2_3 kkWave_names[0]="Dorg,m2/s" kkWave_names[1]="Dfrag,m2/s" kkWave_names[2]="concentration of OH,mlc/cm3-air" kkWave_names[3]="concentration of HO2,mlc/cm3-air" kkWave_names[4]="concentration of OH near the surface, mlc/cm3-air" kkWave_names[5]="concentration of HO2 near the surface, mlc/cm3-air" kkWave_names[6]="uptake coefficient of OH" kkWave_names[7]="uptake coefficient of HO2" kkWave_names[8]="flow time, s" kkWave_names[9]="# of big time steps" kkWave_names[10]="big time step, s" kkWave_names[11]="# of small time steps in each big time step" kkWave_names[12]="smallest time step, s" kkWave_names[13]="initial particle diameter, nm" kkWave_names[14]="depth of surface layer, nm" kkWave_names[15]="# of layers besides surface layer" kkWave_names[16]="initial thickness of each layer, nm" kkWave_names[17]="particle density, g/cm3-particle" kkWave_names[18]="average molecular weight, g/mol" kkWave_names[19]="initial molecular density, mlc/cm3-particle" kkWave_names[20]="initial total molecules, mlc" kkWave_names[21]="fragmentation probability for RO2_1+RO2_1" kkWave_names[22]="fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2" kkWave_names[23]="fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[24]="rate constant for RO2_1+RO2_1, cm3/mlc/s" kkWave_names[25]="rate constant for RO2_1+RO2_2" kkWave_names[26]="rate constant for RO2_2+RO2_2" kkWave_names[27]="rate constant for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[28]="braching ratio of ROOH_1+OH->RO2_1" kkWave_names[29]="braching ratio of ROOH_2+OH->RO2_2" kkWave_names[30]="decomposition rate for RO_1->2*Frag" kkWAve_names[31]="decomposition rate for RO_2->2*Frag" kkWave_names[32]="decomposition rate for RO_3->2*Frag" kkWave_names[33]="rate constant for RO_1+RH->ROH1+RO2_1" kkWave_names[34]="rate constant for RO_1+ROH1->ROH1+RO2_2" kkWave_names[35]="rate constant for RO_1+ROH2->ROH1+RO2_3" kkWave_names[36]="rate constant for RO_1+ROH3->ROH1+RO2_3" kkWave_names[37]="rate constant for RO_2+RH->ROH2+RO2_1" kkWave_names[38]="rate constant for RO_2+ROH1->ROH2+RO2_2" kkWave_names[39]="rate constant for RO_2+ROH2->ROH2+RO2_3" kkWave_names[40]="rate constant for RO_2+ROH3->ROH2+RO2_3" kkWave_names[41]="rate constant for RO_3+RH->ROH3+RO2_1" kkWave_names[42]="rate constant for RO_3+ROH1->ROH3+RO2_2" kkWave_names[43]="rate constant for RO_3+ROH2->ROH3+RO2_3" kkWave_names[44]="rate constant for RO_3+ROH3->ROH3+RO2_3" kkWave_names[45]="rate constant for RO_1+ROOH1->ROH1+RO2_2" kkWave_names[46]="rate constant for RO_1+ROOH2->ROH1+RO2_3" kkWave_names[47]="rate constant for RO_1+ROOH3->ROH1+RO2_3" kkWave_names[48]="rate constant for RO_2+ROOH1->ROH2+RO2_2" kkWave_names[49]="rate constant for RO_2+ROOH2->ROH2+RO2_3" kkWave_names[50]="rate constant for RO_2+ROOH3->ROH2+RO2_3" kkWave_names[51]="rate constant for RO_3+ROOH1->ROH3+RO2_2" kkWAve_names[52]="rate constant for RO_3+ROOH2->ROH3+RO2_3" kkWave_names[53]="rate constant for RO_3+ROOH3->ROH3+RO2_3" Note/k kkwave "This wave stores the rate constants etc., please refer to text wave 'kkwave_names' for what each column is" Note/k kkwave_names "This text wave stores the item names of 'kkwave' " End ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////// //This function pops up a selection menu to set values for Dorg, uptake_OH, prob, kkRO2 and bratio differently for every generation //Water content is considered by setting growth factor >1 Function CreatekkWave_3G_advH2O() make/o/d/n=(100) kkWave make/o/t/n=(100) kkWave_names kkWave=nan kkWave_names="" variable Dorg=1e-16 variable uptake_OH=0.50 variable uptake_HO2=0.40 variable prob1=0.5 variable prob2=0.7 variable prob3=0.9 variable kk2=1e-17 variable kk6=1e-16 variable kk11=1e-15 variable bratio1=0.75 variable bratio2=0.75 variable kd1=1e4 //s-1 variable kd2=1e5 //s-1 variable kd3=1e6 //s-1 variable kk_1=1e-15 variable kk_2=1e-15 variable kk_3=1e-15 variable gf = 1.1 //(growth factor of aP SOA at high RH) prompt Dorg, "Diffusivity in m2/s" prompt gf, "Growth factor of SOA at RH = 90%" prompt uptake_OH, "Uptake coef of OH" prompt uptake_HO2, "Uptake coef of HO2" prompt kk2, "Rate constant for RO2+RO2 for G1" prompt kk6, "Rate constant for RO2+RO2 for G2" prompt kk11, "Rate constant for RO2+RO2 for G3" prompt kk_1, "Rate constant for RO+RH for G1" prompt kk_2, "Rate constant for RO+RH for G2" prompt kk_3, "Rate constant for RO+RH for G3" DoPrompt "Set following values",Dorg,gf,uptake_OH,uptake_HO2,kk2,kk6,kk11,kk_1,kk_2,kk_3 variable kk7=kk6 prompt prob1, "Fragmentation probability for G1" prompt prob2, "Fragmentation probability for G2" prompt prob3, "Fragmentation probability for G3" prompt kd1, "Decomposition rate of RO for G1" prompt kd2, "Decomposition rate of RO for G2" prompt kd3, "Decomposition rate of RO for G3" prompt bratio1, "Braching ratio ROOH_1+OH->RO2_1" prompt bratio2, "Braching ratio ROOH_2+OH->RO2_2" DoPrompt "Set following values",prob1,prob2,prob3,kd1,kd2,kd3,bratio1,bratio2 variable Dfrag=1.4*Dorg variable OH_gas=1e11 variable HO2_gas=1e11 variable OH_gs=1e11 variable HO2_gs=1e11 variable flowtime=38 variable totaltimesteps=101 variable timestep=flowtime/(totaltimesteps-1) variable smallest_timestep=0.00001 variable stepnum if(smallest_timestep<=0) print "smallest_timestep can't be zero or negative" abort else stepnum=ceil(timestep/smallest_timestep) smallest_timestep=timestep/stepnum endif variable Dp=125 //initial diameter(before water uptake) in nm Dp = Dp*gf //diameter of particle after water uptake variable SL_depth=0.76 //nm; surface layer depth is fixed no matter how particle shrinks unless particle radius is smaller than SL detph variable totallayers=50 //# variable layerdepth=(0.5*Dp-SL_depth)/totallayers variable MWorg=175 //g/mol variable NA=6.022e23 //mlc/mol variable f_water_v=(gf^3-1)/(gf^3) //volume fraction of water in the particle variable density_org=1.3 //g/cm3 variable density=density_org*(1-f_water_v)+1.0*f_water_v //g/cm3 variable Corg=density_org*NA/MWorg //mlc/cm3-particle molecular density of organics before water uptake variable Cwater=1.0*NA/18.02 //mlc/cm3-particle variable Corg_initial=Corg*(1-f_water_v) //mlc/cm3-particle molecular density of organics after water uptake variable Cwater_initial=Cwater*f_water_v variable Corg_mlc_initial=Corg_initial*pi/6*(Dp*1e-7)^3 //total mlc in one particle variable Cwater_mlc_initial=Cwater_initial*pi/6*(Dp*1e-7)^3 //total mlc in one particle kkWave[0]=Dorg //m2/s kkWave[1]=Dfrag //m2/s kkWave[2]=OH_gas //mlc/cm3-air kkWave[3]=HO2_gas //mlc/cm3-air kkWave[4]=OH_gs //mlc/cm3-air gas concentration near the surface kkWave[5]=HO2_gs //mlc/cm3-air gas concentration near the surface kkWave[6]=uptake_OH kkWave[7]=uptake_HO2 kkWave[8]=flowtime //s kkWave[9]=totaltimesteps kkWave[10]=timestep //s kkWave[11]=stepnum kkWave[12]=smallest_timestep //s kkWave[13]=Dp //nm initial diameter kkWave[14]=SL_depth //nm kkWave[15]=totallayers //besides surface layer kkWave[16]=layerdepth //nm initial layerdepth kkWave[17]=density //g/cm3-particle kkWave[18]=MWorg //g/mol kkWave[19]=Corg_initial //mlc/cm3-particle kkWave[20]=Corg_mlc_initial //mlc kkWave[21]=prob1 //fragmentation probability for RO2_1+RO2_1 kkWave[22]=prob2 //fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2 kkWave[23]=prob3 //fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[24]=kk2 //cm3/mlc/s, RO2_1+RO2_1 kkWave[25]=kk6 //RO2_1+RO2_2 kkWave[26]=kk7 //RO2_2+RO2_2 kkWave[27]=kk11 //RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3 kkWave[28]=bRatio1 //braching ratio of ROOH_1+OH->RO2_1 kkWave[29]=bRatio2 //braching ratio of ROOH_2+OH->RO2_2 kkWave[30]=kd1 //RO_1->2*Frag kkWAve[31]=kd2 //RO_2->2*Frag kkWave[32]=kd3 //RO_3->2*Frag kkWave[33]=kk_1 //RO_1+RH->ROH1+RO2_1 kkWave[34]=kk_1 //RO_1+ROH1->ROH1+RO2_2 kkWave[35]=kk_1 //RO_1+ROH2->ROH1+RO2_3 kkWave[36]=kk_1 //RO_1+ROH3->ROH1+RO2_3 kkWave[37]=kk_2 //RO_2+RH->ROH2+RO2_1 kkWave[38]=kk_2 //RO_2+ROH1->ROH2+RO2_2 kkWave[39]=kk_2 //RO_2+ROH2->ROH2+RO2_3 kkWave[40]=kk_2 //RO_2+ROH3->ROH2+RO2_3 kkWave[41]=kk_3 //RO_3+RH->ROH3+RO2_1 kkWave[42]=kk_3 //RO_3+ROH1->ROH3+RO2_2 kkWave[43]=kk_3 //RO_3+ROH2->ROH3+RO2_3 kkWave[44]=kk_3 //RO_3+ROH3->ROH3+RO2_3 kkWave[45]=kk_1 //RO_1+ROOH1->ROH1+RO2_2 kkWave[46]=kk_1 //RO_1+ROOH2->ROH1+RO2_3 kkWave[47]=kk_1 //RO_1+ROOH3->ROH1+RO2_3 kkWave[48]=kk_2 //RO_2+ROOH1->ROH2+RO2_2 kkWave[49]=kk_2 //RO_2+ROOH2->ROH2+RO2_3 kkWave[50]=kk_2 //RO_2+ROOH3->ROH2+RO2_3 kkWave[51]=kk_3 //RO_3+ROOH1->ROH3+RO2_2 kkWAve[52]=kk_3 //RO_3+ROOH2->ROH3+RO2_3 kkWave[53]=kk_3 //RO_3+ROOH3->ROH3+RO2_3 kkWave[54]=f_water_v //volume fraction of water kkWave[55]=Cwater_initial //molecular density of water in the particle kkWave[56]=Cwater_mlc_initial //initial totale molecule number of water in the particle kkWave[57]=gf //growth factor at 90% RH kkWave_names[0]="Dorg,m2/s" kkWave_names[1]="Dfrag,m2/s" kkWave_names[2]="concentration of OH,mlc/cm3-air" kkWave_names[3]="concentration of HO2,mlc/cm3-air" kkWave_names[4]="concentration of OH near the surface, mlc/cm3-air" kkWave_names[5]="concentration of HO2 near the surface, mlc/cm3-air" kkWave_names[6]="uptake coefficient of OH" kkWave_names[7]="uptake coefficient of HO2" kkWave_names[8]="flow time, s" kkWave_names[9]="# of big time steps" kkWave_names[10]="big time step, s" kkWave_names[11]="# of small time steps in each big time step" kkWave_names[12]="smallest time step, s" kkWave_names[13]="initial particle diameter, nm" kkWave_names[14]="depth of surface layer, nm" kkWave_names[15]="# of layers besides surface layer" kkWave_names[16]="initial thickness of each layer, nm" kkWave_names[17]="particle density, g/cm3-particle" kkWave_names[18]="average molecular weight, g/mol" kkWave_names[19]="initial molecular density, mlc/cm3-particle" kkWave_names[20]="initial total molecules, mlc" kkWave_names[21]="fragmentation probability for RO2_1+RO2_1" kkWave_names[22]="fragmentation probability for RO2_1+RO2_2 and RO2_2+RO2_2" kkWave_names[23]="fragmentation probability for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[24]="rate constant for RO2_1+RO2_1, cm3/mlc/s" kkWave_names[25]="rate constant for RO2_1+RO2_2" kkWave_names[26]="rate constant for RO2_2+RO2_2" kkWave_names[27]="rate constant for RO2_1+RO2_3, RO2_2+RO2_3 and RO2_3+RO2_3" kkWave_names[28]="braching ratio of ROOH_1+OH->RO2_1" kkWave_names[29]="braching ratio of ROOH_2+OH->RO2_2" kkWave_names[30]="decomposition rate for RO_1->2*Frag" kkWAve_names[31]="decomposition rate for RO_2->2*Frag" kkWave_names[32]="decomposition rate for RO_3->2*Frag" kkWave_names[33]="rate constant for RO_1+RH->ROH1+RO2_1" kkWave_names[34]="rate constant for RO_1+ROH1->ROH1+RO2_2" kkWave_names[35]="rate constant for RO_1+ROH2->ROH1+RO2_3" kkWave_names[36]="rate constant for RO_1+ROH3->ROH1+RO2_3" kkWave_names[37]="rate constant for RO_2+RH->ROH2+RO2_1" kkWave_names[38]="rate constant for RO_2+ROH1->ROH2+RO2_2" kkWave_names[39]="rate constant for RO_2+ROH2->ROH2+RO2_3" kkWave_names[40]="rate constant for RO_2+ROH3->ROH2+RO2_3" kkWave_names[41]="rate constant for RO_3+RH->ROH3+RO2_1" kkWave_names[42]="rate constant for RO_3+ROH1->ROH3+RO2_2" kkWave_names[43]="rate constant for RO_3+ROH2->ROH3+RO2_3" kkWave_names[44]="rate constant for RO_3+ROH3->ROH3+RO2_3" kkWave_names[45]="rate constant for RO_1+ROOH1->ROH1+RO2_2" kkWave_names[46]="rate constant for RO_1+ROOH2->ROH1+RO2_3" kkWave_names[47]="rate constant for RO_1+ROOH3->ROH1+RO2_3" kkWave_names[48]="rate constant for RO_2+ROOH1->ROH2+RO2_2" kkWave_names[49]="rate constant for RO_2+ROOH2->ROH2+RO2_3" kkWave_names[50]="rate constant for RO_2+ROOH3->ROH2+RO2_3" kkWave_names[51]="rate constant for RO_3+ROOH1->ROH3+RO2_2" kkWAve_names[52]="rate constant for RO_3+ROOH2->ROH3+RO2_3" kkWave_names[53]="rate constant for RO_3+ROOH3->ROH3+RO2_3" kkWave_names[54]="Volume fraction of water" kkWave_names[55]="Molecular density of water in the particle" kkWave_names[56]="Initial totale molecule number of water in the particle" kkWave_names[57]="Growth factor at 90% RH" Note/k kkwave "This wave stores the rate constants etc., please refer to text wave 'kkwave_names' for what each column is" Note/k kkwave_names "This text wave stores the item names of 'kkwave' " End //////////////////////////////////////////////////////////////////////////////////////////////////////// //This function treats ROOH(hydropeoxides) and other functionalized species (lumped as ROH) differently //RO is considered explicitly in this function with inclusion of RO->(decomposes to)2Frag and RO+RH reactions //This function has high requirement towards smallest_timestep Function OHexposure38s_3G_dry_RO() wave kkWave if (waveexists(kkwave)==0) print "Please create rate constant wave 'kkwave' first" abort endif variable Dorg=kkWave[0] variable Dfrag=kkWave[1] variable OH_gas=kkWave[2] variable HO2_gas=kkWave[3] variable uptake_OH=kkWave[6] variable uptake_HO2=kkWave[7] variable flowtime=kkWave[8] variable totaltimesteps=kkWave[9] variable timestep=kkWave[10] variable stepnum=kkWave[11] variable smallest_timestep=kkWave[12] variable Dp=kkWave[13] variable SL_depth=kkWave[14] variable totallayers=kkWave[15] variable layerdepth=kkWave[16] variable Corg_initial=kkWave[19] variable Corg_mlc_initial=kkWave[20] variable prob1=kkWave[21] variable prob2=kkWave[22] variable prob3=kkWave[23] variable k2=kkWave[24] variable k6=kkWave[25] variable k7=kkWave[26] variable k11=kkWave[27] variable bratio1=kkWave[28] variable bratio2=kkWave[29] variable kd1=kkWave[30] variable kd2=kkWave[31] variable kd3=kkWave[32] variable kk_1=kkWave[33] variable kk_2=kkWave[37] variable kk_3=kkWave[41] variable Kn_OH=6*0.21485e-4/609/Dp/1e-9 //dimensionless variable Kn_HO2=6*0.25e-4/437/Dp/1e-9 //dimensionless variable Fuchs_OH=(0.75+0.28*Kn_OH)/(Kn_OH*(1+Kn_OH)) //Maybe not Fuchs... From Shiraiwa et al. ACP 2010 variable Fuchs_HO2=(0.75+0.28*Kn_HO2)/(Kn_HO2*(1+Kn_HO2)) variable Crtf_OH=1/(1+uptake_OH*Fuchs_OH) //Correction factor of the near surface concentration to the far away concentration variable Crtf_HO2=1/(1+uptake_HO2*Fuchs_HO2) variable OH_initial=OH_gas*Crtf_OH variable HO2_initial=HO2_gas*Crtf_HO2 variable OH_gs=OH_initial //mlc/cm3-air variable HO2_gs=HO2_initial //mlc/cm3-air //stores concentration and mlc number in each layer at each big time step make/o/d/n=(totaltimesteps,totallayers+1) C_RH,C_ROOH1,C_ROOH2,C_ROOH3,C_ROH1,C_ROH2,C_ROH3,C_Frag,C_RO2_1,C_RO2_2,C_RO2_3,C_RO_1,C_RO_2,C_RO_3 make/o/d/n=(totaltimesteps,totallayers+1) mlc_RH,mlc_ROOH1,mlc_ROOH2,mlc_ROOH3,mlc_ROH1,mlc_ROH2,mlc_ROH3,mlc_RO2_1,mlc_RO2_2,mlc_RO2_3,mlc_Frag,mlc_RO_1,mlc_RO_2,mlc_RO_3 //surface layer index is 0 C_RH=0 C_ROOH1=0 C_ROOH2=0 C_ROOH3=0 C_ROH1=0 C_ROH2=0 C_ROH3=0 C_Frag=0 C_RO2_1=0 C_RO2_2=0 C_RO2_3=0 C_RO_1=0 C_RO_2=0 C_RO_3=0 mlc_RH=0 mlc_ROOH1=0 mlc_ROOH2=0 mlc_ROOH3=0 mlc_ROH1=0 mlc_ROH2=0 mlc_ROH3=0 mlc_RO2_1=0 mlc_RO2_2=0 mlc_RO2_3=0 mlc_Frag=0 mlc_RO_1=0 mlc_RO_2=0 mlc_RO_3=0 //stores concentration or mlc number of each layer for past and current time steps only make/o/d/n=(2,totallayers+1)/Free temp_RH,temp_ROOH1,temp_ROOH2,temp_ROOH3,temp_ROH1,temp_ROH2,temp_ROH3,temp_Frag,temp_RO2_1,temp_RO2_2,temp_RO2_3,temp_RO_1,temp_RO_2,temp_RO_3 temp_RH=kkWave[19] //mlc/cm3-particle don't use Corg_mlc_initial for all the layers because it is different temp_ROOH1=0 temp_ROOH2=0 temp_ROOH3=0 temp_ROH1=0 temp_ROH2=0 temp_ROH3=0 temp_Frag=0 temp_RO2_1=0 temp_RO2_2=0 temp_RO2_3=0 temp_RO_1=0 temp_RO_2=0 temp_RO_3=0 //stores change of mlc num in each layer for current time step make/o/d/n=(totallayers+1)/Free temp_dRH,temp_dROOH1,temp_dROOH2,temp_dROOH3,temp_dROH1,temp_dROH2,temp_dROH3,temp_dFragment,temp_dRO2_1,temp_dRO2_2,temp_dRO2_3,temp_dRO_1,temp_dRO_2,temp_dRO_3 temp_dRH=0 temp_dROOH1=0 temp_dROOH2=0 temp_dROOH3=0 temp_dROH1=0 temp_dROH2=0 temp_dROH3=0 temp_dFragment=0 temp_dRO2_1=0 temp_dRO2_2=0 temp_dRO2_3=0 temp_dRO_1=0 temp_dRO_2=0 temp_dRO_3=0 //stores rate of change of each species at the start at every big time step make/o/d/n=(totaltimesteps,totallayers+1)/Free dRH,dROOH1,dROOH2,dROOH3,dROH1,dROH2,dROH3,dRO2_1,dRO2_2,dRO2_3,dFragment,dRO_1,dRO_2,dRO_3 dRH=0 dROOH1=0 dROOH2=0 dROOH3=0 dROH1=0 dROH2=0 dROH3=0 dRO2_1=0 dRO2_2=0 dRO2_3=0 dFragment=0 dRO_1=0 dRO_2=0 dRO_3=0 make/o/d/n=(totaltimesteps) SL_dRO2HO2,SL_dRO2RO2,Bulkavg_dRO2RO2,SL_dRO2P,SL_dRO2Dif SL_dro2ho2=0 SL_dro2ro2=0 Bulkavg_dro2ro2=0 SL_dRO2P=0 SL_dRO2Dif=0 make/o/d/n=(totaltimesteps) SL_dFragP,SL_dFragDif SL_dfragP=0 SL_dFragDif=0 //stores volume, outer surface area of each layer for current time step and volume for previous time step make/o/d/n=(totallayers+1)/Free layer_V,layer_outer_SA,layer_V_pre calculateLayerVolume(Dp,totallayers,SL_depth,layer_V) //returns in unit cm3 calculateLayerVolume(Dp,totallayers,SL_depth,layer_V_pre) //returns in unit cm3 calculateLayerouterSA(Dp,totallayers,SL_depth,layer_outer_SA) //returns in unit cm2 //stores change of mlc number that happens over redistribution of particle due to evaporation for current time step //layer 0 is the mlc added to a layer while layer1 is mlc removed from a layer make/o/d/n=(totaltimesteps,totallayers+1,2)/Free RH_redis,ROOH1_redis,ROOH2_redis,ROOH3_redis,ROH1_redis,ROH2_redis,ROH3_redis,RO2_1_redis,RO2_2_redis,RO2_3_redis,Frag_redis,RO_1_redis,RO_2_redis,RO_3_redis //mlc RH_redis=0 ROOH1_redis=0 ROOH2_redis=0 ROOH3_redis=0 ROH1_redis=0 ROH2_redis=0 ROH3_redis=0 RO2_1_redis=0 RO2_2_redis=0 RO2_3_redis=0 frag_redis=0 RO_1_redis=0 RO_2_redis=0 RO_2_redis=0 //stores mlc added and removed for each layer at current time step only make/o/d/n=(2,totallayers+1)/Free temp_RH_redis,temp_ROOH1_redis,temp_ROOH2_redis,temp_ROOH3_redis,temp_ROH1_redis,temp_ROH2_redis,temp_ROH3_redis,temp_RO2_1_redis,temp_RO2_2_redis,temp_RO2_3_redis,temp_Frag_redis,temp_RO_1_redis,temp_RO_2_redis,temp_RO_3_redis temp_RH_redis=0 temp_ROOH1_redis=0 temp_ROOH2_redis=0 temp_ROOH3_redis=0 temp_ROH1_redis=0 temp_ROH2_redis=0 temp_ROH3_redis=0 temp_RO2_1_redis=0 temp_RO2_2_redis=0 temp_RO2_3_redis=0 temp_Frag_redis=0 temp_RO_1_redis=0 temp_RO_2_redis=0 temp_RO_3_redis=0 //stores volume and outer surface area for each big time step for every layer make/o/d/n=(totaltimesteps,totallayers+1)/Free layer_V_t,layer_outerSA_t layer_V_t=0 layer_outerSA_t=0 //stores detailed mlc number change due to diffusion, chemical production and chemical loss in every layer at each big time step make/o/d/n=(totaltimesteps,totallayers+1,2)/Free dFrag_detail //mlc dFrag_detail=0 make/o/d/n=(totaltimesteps,totallayers+1,3)/Free dRH_detail make/o/d/n=(totaltimesteps,totallayers+1,4)/Free dROOH1_detail,dROOH2_detail,dROOH3_detail make/o/d/n=(totaltimesteps,totallayers+1,5)/Free dROH1_detail,dROH2_detail,dROH3_detail //mlc dRH_detail=0 dROOH1_detail=0 dROOH2_detail=0 dROOH3_detail=0 dROH1_detail=0 dROH2_detail=0 dROH3_detail=0 make/o/d/n=(totaltimesteps,totallayers+1,5)/Free dRO2_1_detail,dRO2_2_detail,dRO2_3_detail make/o/d/n=(totaltimesteps,totallayers+1,4)/Free dRO_1_detail,dRO_2_detail,dRO_3_detail //mlc dRO2_1_detail=0 dRO2_2_detail=0 dRO2_3_detail=0 dRO_1_detail=0 dRO_2_detail=0 dRO_3_detail=0 make/o/d/n=(totaltimesteps)/Free SL_Frag SL_frag=0 //stores VFR etc make/o/d/n=(totaltimesteps) VFR_38s,timewave,NewDp,ratio_HO2_RO2,Evaporation VFR_38s=1 timewave=x*flowtime/(kkwave[9]-1) NewDp[0]=Dp ratio_HO2_RO2=0 Evaporation=0 make/o/d/n=2/Free temp_Dp,temp_VFR temp_Dp=Dp temp_VFR=1 //stores bulk averaged conc of each species at each big timestep make/o/d/n=(totaltimesteps,13) FinalConc // Stores averaged concentration of each species in the order of RH, RO_1-3,ROOH1-3, ROH1-3, RO2_1-3 make/o/d/n=(totallayers+1)/Free temp_sum_mlc variable initialV=Dp^3*pi/6*1e-21 //cm3 //stores the surface layer concentration and bulk averaged concentration of RO2 make/o/d/n=(totaltimesteps) SL_RO2, Bulkavg_RO2 //mlc/cm3 SL_ro2=0 bulkavg_RO2=0 variable f_RH,f_ROOH1,f_ROOH2,f_ROOH3,f_ROH1,f_ROH2,f_ROH3,f_RO2_1,f_RO2_2,f_RO2_3,f_RO_1,f_RO_2,f_RO_3 f_RH=1 f_ROOH1=0 f_ROOH2=0 f_ROOH3=0 f_ROH1=0 f_ROH2=0 f_ROH3=0 f_RO2_1=0 f_RO2_2=0 f_RO2_3=0 f_RO_1=0 f_RO_2=0 f_RO_3=0 //stores fraction of every species in the surface layer at each big time step make/o/d/n=(totaltimesteps,14) Fraction_Matrix fraction_matrix[][0]=1 //fraction of RH fraction_matrix[][1]=0 //fraction of ROOH1 fraction_matrix[][2]=0 //fraction of ROOH2 fraction_matrix[][3]=0 //fraction of ROOH3 fraction_matrix[][4]=0 //fraction of ROH1 fraction_matrix[][5]=0 //fraction of ROH2 fraction_matrix[][6]=0 //fraction of ROH3 fraction_matrix[][7]=0 //fraction of RO2_1 fraction_matrix[][8]=0 //fraction of RO2_2 fraction_matrix[][9]=0 //fraction of RO2_3 fraction_matrix[][10]=0 //fraction of RO_1 fraction_matrix[][11]=0 //fraction of RO_2 fraction_matrix[][12]=0 //fraction of RO_3 fraction_matrix[][13]=0 //fraction of Frag? variable i_time,i_layer,j_time variable layer_r,SL_sum variable temp_dRO2sum, temp_ratio make/o/d/n=(totallayers+1)/Free volume_removed,volume_added temp_ratio=0 temp_dRO2sum=0 volume_removed=0 volume_added=0 variable temp_sum_ro2,temp_sum_layerV temp_sum_ro2=0 temp_sum_layerV=0 for(i_time=0;i_time=0;i-=1) j=totallayers+1-i if(i!=0) Volume_wave[i]=4/3*pi*((layerthickness*j)^3-(layerthickness*(j-1))^3) //cm3 else Volume_wave[i]=4/3*pi*((0.5*currentDp*1e-7)^3-(layerthickness*(j-1))^3) //cm3 endif endfor End ////////////////////////////////////////////////////////////////////////////////////// Function CalculateLayerSA(CurrentDp,totallayers,SL_depth,SA_wave) variable CurrentDp,totallayers,SL_depth wave SA_wave variable layerthickness=(0.5*CurrentDp-SL_depth)/totallayers*1e-7 //cm if(numpnts(SA_wave)!=totallayers+1) print "Make sure that total layer number and length of volume wave match" abort endif variable i,j for(i=totallayers;i>=0;i-=1) j=totallayers+1-i if(i!=0) SA_wave[i]=4*pi*(layerthickness*(j-1)+0.5*layerthickness)^2 //cm2 else SA_wave[i]=4*pi*(layerthickness*(j-1)+SL_depth*0.5e-7)^2 //cm2 endif endfor End ////////////////////////////////////////////////////////////////////////////////////// Function CalculateLayerouterSA(CurrentDp,totallayers,SL_depth,outer_SA_wave) variable CurrentDp,totallayers,SL_depth //Dp, nm wave outer_SA_wave variable layerthickness=(0.5*CurrentDp-SL_depth)/totallayers*1e-7 //cm if(numpnts(outer_SA_wave)!=totallayers+1) print "Make sure that total layer number and length of volume wave match" abort endif variable i,j for(i=totallayers;i>=0;i-=1) j=totallayers+1-i if(i!=0) outer_SA_wave[i]=4*pi*(layerthickness*j)^2 //cm2 else outer_SA_wave[i]=4*pi*(0.5*currentDp*1e-7)^2 //cm2 endif endfor End