修订版 | cef3a753d86068239da13ef704b67722e66848e7 (tree) |
---|---|
时间 | 2008-08-15 19:40:52 |
作者 | iselllo |
Commiter | iselllo |
I modified the code adding the possibility of entering by hand the
radius of gyration of certain small clusters. I also am first defining
the number of monomers and THEN the volume grid (otherwise, the
statement if n_mon=2. then... can fail since n_mon could be slightly
different from two).
@@ -13,9 +13,13 @@ | ||
13 | 13 | |
14 | 14 | print "the monodisperse volume is, ", v_mono |
15 | 15 | |
16 | -x=s.logspace(s.log10(v_mono), s.log10(v_mono*2500.),200) # volume grid | |
17 | 16 | |
18 | -n_mon=x/v_mono #volume of solids expressed in terms of number of monomers | |
17 | +n_mon=s.logspace(s.log10(1.), s.log10(2500.),200) # volume grid | |
18 | + | |
19 | +x=n_mon*v_mono #volume of solids expressed in terms of number of monomers | |
20 | + | |
21 | + | |
22 | + | |
19 | 23 | |
20 | 24 | print "n_mon is, ", n_mon |
21 | 25 |
@@ -53,7 +57,7 @@ | ||
53 | 57 | |
54 | 58 | rho=0.01 #monomer density in the box |
55 | 59 | |
56 | -choice_kernel= 5 #0: standard continuum kernel (and standard diffusion_coefficient) | |
60 | +choice_kernel= 10 #0: standard continuum kernel (and standard diffusion_coefficient) | |
57 | 61 | #1: constant kernel |
58 | 62 | #2: continuum kernel, 2 df's and special treatment of monomers (special diffusion coeff) |
59 | 63 | #3: continuum kernel, 1 df and special treatment of monomers (special diffusion coeff) |
@@ -69,10 +73,11 @@ | ||
69 | 73 | #(standard diffusion coeff) |
70 | 74 | #9: continuum kernel, 2 df's, Fuchs beta without special treatment of monomers, but |
71 | 75 | # Fuchs correction is applied to monomers only. |
76 | + #10: as in 5, but this time we introduce by hand the radius of gyration of the smallest | |
77 | + #clusters | |
72 | 78 | |
73 | 79 | |
74 | 80 | |
75 | - | |
76 | 81 | choice_slope = 2 #2: 2 different df's |
77 | 82 | #1: 1 different df |
78 | 83 |
@@ -624,6 +629,102 @@ | ||
624 | 629 | return kern_mat |
625 | 630 | |
626 | 631 | |
632 | + | |
633 | +def Brow_ker_cont_optim_diffusion_adjusted_and_monomer_beta_fuchs_special_rules(Vlist): | |
634 | + #monomer volume | |
635 | + #r_mon=0.5 #monomer radius | |
636 | + #v_mon=4./3.*s.pi*r_mon**3. | |
637 | + #v_mono already defined as a global variable | |
638 | + #n_mon=Vlist/v_mono #number of monomers in each aggregate | |
639 | + | |
640 | + #print "n_mon is, ", n_mon | |
641 | + | |
642 | + Diff=k_B*T_0/(n_mon*m_mon*beta) #vector with the cluster diffusion coefficients | |
643 | + #which just depends on the cluster size. | |
644 | + | |
645 | + R_list=s.zeros(len(Vlist)) #I initialize the array which will contain the | |
646 | + #radia of gyration | |
647 | + | |
648 | + #threshold=15. | |
649 | + | |
650 | +# small=s.where(n_mon<=threshold) | |
651 | +# large=s.where(n_mon>threshold) | |
652 | + | |
653 | +# a_small=0.36 | |
654 | +# df_small=2.19 | |
655 | + | |
656 | +# a_large=0.241 | |
657 | +# df_large=1.62 | |
658 | + | |
659 | + | |
660 | + R_list[small]=a_small*n_mon[small]**(1./df_small) | |
661 | + | |
662 | + R_list[large]=a_large*n_mon[large]**(1./df_large) | |
663 | + | |
664 | + #Now I actually introduce some special rules for the radius of gyration of the smallest clusters | |
665 | + | |
666 | + sel=s.where(n_mon == 1.) | |
667 | + | |
668 | + R_list[sel]=3.87e-1 | |
669 | + | |
670 | + | |
671 | + sel=s.where(n_mon == 2.) | |
672 | + | |
673 | + R_list[sel]=6.39e-1 | |
674 | + | |
675 | + sel=s.where(n_mon == 3.) | |
676 | + | |
677 | + R_list[sel]=7.18e-1 | |
678 | + | |
679 | + sel=s.where(n_mon == 4.) | |
680 | + | |
681 | + R_list[sel]=7.48e-1 | |
682 | + | |
683 | + | |
684 | + print "len(R_list is, )", len(R_list) | |
685 | + print "R_list is, ", R_list | |
686 | + | |
687 | + | |
688 | + | |
689 | + | |
690 | +# R_list[0]=0.5 #special case for the monomer radius | |
691 | + | |
692 | +# m=rho_p*Vlist # this holds in general (i.e. for Vlist !=3.) | |
693 | + ## as long as Vlist is the volume of solid | |
694 | + ##and not the space occupied by the agglomerate structure | |
695 | + | |
696 | + #m=Vlist #since rho = 1. | |
697 | + | |
698 | + c=(8.*k_B*T_0/(s.pi*m))**0.5 | |
699 | + #print 'c is', c | |
700 | + l=8.*Diff/(s.pi*c) | |
701 | + #print 'l is', l | |
702 | + diam_seq=2.*R_list | |
703 | + | |
704 | + g=1./(3.*diam_seq*l)*((diam_seq+l)**3.-(diam_seq**2.+l**2.)**1.5)-diam_seq | |
705 | + | |
706 | + beta_fuchs=(\ | |
707 | + (diam_seq[:,s.newaxis]+diam_seq[s.newaxis,:]) \ | |
708 | + /(diam_seq[:,s.newaxis]+diam_seq[s.newaxis,:]\ | |
709 | + +2.*(g[:,s.newaxis]**2.+g[s.newaxis,:]**2.)**0.5)\ | |
710 | + + 8.*(Diff[:,s.newaxis]+Diff[s.newaxis,:])/\ | |
711 | + ((c[:,s.newaxis]**2.+c[s.newaxis,:]**2.)**0.5*\ | |
712 | + (diam_seq[:,s.newaxis]+diam_seq[s.newaxis,:]))\ | |
713 | + )**(-1.) | |
714 | + | |
715 | + | |
716 | + ## now I have all the bits for the kernel matrix | |
717 | +# kern_mat=Brow_ker_cont_optim(Vlist)*beta | |
718 | + | |
719 | + | |
720 | + kern_mat=4.*s.pi*(Diff[:,s.newaxis]+Diff[s.newaxis,:])* \ | |
721 | + (R_list[:,s.newaxis]+R_list[s.newaxis,:])*beta_fuchs | |
722 | + | |
723 | + | |
724 | + return kern_mat | |
725 | + | |
726 | + | |
727 | + | |
627 | 728 | |
628 | 729 | def beta_fuchs_standalone(Vlist): |
629 | 730 |
@@ -751,6 +852,8 @@ | ||
751 | 852 | elif (choice_kernel == 9): |
752 | 853 | kernel=Brow_ker_cont_optim_diffusion_adjusted_and_monomer_beta_fuchs_single_value(x) |
753 | 854 | |
855 | +elif (choice_kernel ==10): | |
856 | + kernel=Brow_ker_cont_optim_diffusion_adjusted_and_monomer_beta_fuchs_special_rules(x) | |
754 | 857 | |
755 | 858 | |
756 | 859 | f_garrick=mycount_garrick(x) |
@@ -996,11 +1099,12 @@ | ||
996 | 1099 | #I have to re-define a number of important quantities |
997 | 1100 | |
998 | 1101 | |
999 | -x=s.linspace(v_mono, (v_mono*2500.), 2500) #new volume grid | |
1102 | +n_mon=s.linspace(1., 2500., 2500) #new volume grid | |
1000 | 1103 | |
1001 | -#I have to redefine this | |
1002 | 1104 | |
1003 | -n_mon=x/v_mono #volume of solids expressed in terms of number of monomers | |
1105 | +x=n_mon*v_mono #new volume grid | |
1106 | + | |
1107 | + | |
1004 | 1108 | |
1005 | 1109 | print "n_mon is, ", n_mon |
1006 | 1110 |
@@ -1046,6 +1150,8 @@ | ||
1046 | 1150 | elif (choice_kernel == 9): |
1047 | 1151 | kernel=Brow_ker_cont_optim_diffusion_adjusted_and_monomer_beta_fuchs_single_value(x) |
1048 | 1152 | |
1153 | +elif (choice_kernel ==10): | |
1154 | + kernel=Brow_ker_cont_optim_diffusion_adjusted_and_monomer_beta_fuchs_special_rules(x) | |
1049 | 1155 | |
1050 | 1156 | |
1051 | 1157 | y_new = si.odeint(coupling_optim, y0, \ |