Revision | 548001fc24e9a87ce5d7497b3576575a37595639 (tree) |
---|---|
Zeit | 2007-06-13 17:48:31 |
Autor | iselllo |
Commiter | iselllo |
I fixed some bug in lognormal_binning.R. Now I correctly generate a set
of diameters in [D_min,D_max] which are log spaced.
@@ -2,11 +2,11 @@ | ||
2 | 2 | #first I fix a grid in the volume which will then become a diamter grid |
3 | 3 | #the maximum diameter can be 1000nm and careful about the units we use! |
4 | 4 | #1000nm=1e-6m |
5 | -D_max<-600 #in nm | |
5 | +D_max<-1200 #in nm | |
6 | 6 | #Now I am going to create a sequence of 100 volumes |
7 | -N_vol<-100 | |
7 | +N_vol<-250 | |
8 | 8 | # Now I introduce the value of the fractal dimension D_f |
9 | -D_f<-2.9 | |
9 | +D_f<-2.25 | |
10 | 10 | print ("the chosen fractal dimension is") |
11 | 11 | print (D_f) |
12 | 12 | write.table(D_f,"fractal_dimension",col.names=FALSE,row.names=FALSE) |
@@ -16,7 +16,9 @@ | ||
16 | 16 | print("the diameter of the basic monomer is [nm]") |
17 | 17 | print(D_0) |
18 | 18 | print ("and consequently the volume is [nm^3]") |
19 | -V_0<-pi/6*D_0^3 | |
19 | +V_0<-pi/6*D_0^3 # NB: the fundamental particle does not have a fractal structure | |
20 | +# so its solid volume is simply the one of a sphere (or equivalently the effective density | |
21 | +# is equal to the physical density of the material it is made up of). | |
20 | 22 | print(V_0) |
21 | 23 | # I now save the volume of the fundamental monomer in m |
22 | 24 | write.table(D_0/1e9/2,"monomer_radius",col.names=FALSE,row.names=FALSE) |
@@ -26,7 +28,8 @@ | ||
26 | 28 | print("D_min is [nm]") |
27 | 29 | print (D_min) |
28 | 30 | |
29 | - | |
31 | +#In the end, the lowest bin must correspond to a D_min which has to be at least as large as | |
32 | +# the one of the primary particles | |
30 | 33 | |
31 | 34 | linear_bin<-0 |
32 | 35 |
@@ -68,21 +71,23 @@ | ||
68 | 71 | } |
69 | 72 | if (linear_bin !=1) |
70 | 73 | {# then I want to introduce some log-binning |
74 | +# first I work on the diameter grid, then I will translate it into the | |
75 | +# grid on the volume of solid | |
71 | 76 | print ("chosen a log binning") |
72 | -D_seq<-seq(len=(N_vol+1)) | |
77 | +D_seq<-seq(0,len=(N_vol+1)) | |
73 | 78 | # klog<-log(D_max) |
74 | 79 | |
75 | 80 | |
76 | 81 | klog<-log(D_max)-log(D_min) |
77 | 82 | delta_log<-klog/(length(D_seq)-1) |
78 | 83 | |
79 | -# D_seq[1]<-1 | |
80 | -D_seq[1]<-D_min | |
81 | -# delta_log_seq<-exp(seq(1:(length(D_seq)-1))*delta_log) | |
82 | -delta_log_seq<-exp(seq(1:(length(D_seq)-1))*delta_log)*D_min | |
83 | -D_seq[2:length(D_seq)]<-delta_log_seq # this way I created a log-spaced diameter binning | |
84 | + | |
85 | +# this way I create a log-spaced diameter binning | |
86 | +D_seq<-exp(D_seq*delta_log)*D_min | |
84 | 87 | d_temp<-D_seq |
85 | 88 | print("OK D_seq_log") |
89 | +# now that I have my diameter grid, I can create a corresponding grid of solid volumes | |
90 | +# which turns out to be a function of the fractal dimension | |
86 | 91 | V_seq<-pi/6*D_seq^3*(D_seq/D_0)^(D_f-3) #New sequence of volumes |
87 | 92 | } |
88 | 93 | #now I have a list of diameters corresponding to a constant shape of the vectors |
@@ -106,7 +111,7 @@ | ||
106 | 111 | N_meas<-1.061e8*1e6 #I multiplied by 1e6 in order to go from cm^-3 |
107 | 112 | # to m^-3 |
108 | 113 | |
109 | -correction<-0.67 # correction factor to account for the conservation of the total volume | |
114 | +correction<-0.640 # correction factor to account for the conservation of the total volume | |
110 | 115 | |
111 | 116 | bin_pop<-bin_pop*N_meas*correction |
112 | 117 |
@@ -394,16 +399,20 @@ | ||
394 | 399 | |
395 | 400 | #Now I work out the diameter sequence |
396 | 401 | # D_seq[1]<-2*D_seq[2]-D_seq[3] #or maybe I set the first value by hand |
397 | -D_seq[1]<-10 #now I have the problem I mentioned above. Since I cannot take the | |
402 | +# D_seq[1]<-10 #now I have the problem I mentioned above. Since I cannot take the | |
398 | 403 | # log(0), I need to re-set the first value of the diameter sequence |
399 | 404 | |
400 | 405 | |
401 | 406 | |
407 | +#probably I do not need this bit any more, now I am setting D_seq[1]=D_min | |
408 | + | |
402 | 409 | #carefuk with this bit!!!!!!!! |
403 | -if (linear_bin != 1) | |
404 | -{ | |
405 | -D_seq[1]<-1 | |
406 | -} | |
410 | +# if (linear_bin != 1) | |
411 | +# { | |
412 | +# D_seq[1]<-1 | |
413 | +# } | |
414 | + | |
415 | + | |
407 | 416 | |
408 | 417 | write.table(D_seq,"diameter_sequence",col.names=FALSE,row.names=FALSE) |
409 | 418 |