X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=nlsop.c;h=d61d2aca2868b7a95b4941198adcabb7c996ffb3;hp=c4fc825f28886eb99c75f769dc8674681346b16f;hb=f271c1142da782420ef76f1f85750949094e4269;hpb=0ee31a02cd254d757c4750270d9423a049f25335 diff --git a/nlsop.c b/nlsop.c index c4fc825..d61d2ac 100644 --- a/nlsop.c +++ b/nlsop.c @@ -2,9 +2,10 @@ * nlsop.c * * this program tries helping to understand the amorphous depuration - * and recrystallization of SiCx while ion implanation. hopefully the program - * will simulate the stabilization of the selforganizing structure in the - * observed behaviour. + * and recrystallization of SiCx while ion implantation at temperatures + * below 400 degree celsius. + * hopefully the program will simulate the stabilization of the + * selforganizing lamella structure in the observed behaviour. * * refs: * - J. K. N. Lindner. Habilationsschrift, Universitaet Augsburg. @@ -33,11 +34,12 @@ int usage(void) puts("usage:"); puts("-h \t\t help"); puts("-n \t\t no user interaction"); + puts("-Z \t\t cryst -> amorph c diffusion in z direction"); printf("-a \t slope of nuclear energy loss (default %f)\n",A_EL); printf("-b \t nuclear energy loss offset (default %f)\n",B_EL); printf("-x \t # x cells (default %d)\n",X); - printf("-y \t # x cells (default %d)\n",Y); - printf("-z \t # x cells (default %d)\n",Z); + printf("-y \t # y cells (default %d)\n",Y); + printf("-z \t # z cells (default %d)\n",Z); /* printf("-X \t display x (default %d)\n",X/2-1); printf("-Y \t display y (default %d)\n",Y/2-1); @@ -54,6 +56,8 @@ int usage(void) printf("-C \t initial c concentration (default %d)\n",CC); */ printf("-D \t diffusion rate from cryst to amorph cells (default %f)\n",D_R); + printf("-W \t write every steps to save file (default %d)\n",RESAVE); + puts("-C \t convert file to gnuplot format"); puts("-L \t load from file"); puts("-S \t save to file"); puts("-R \t read from random file"); @@ -66,6 +70,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int unsigned char *thiz; int *conc; int i,j; + int off; double p; thiz=d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y; @@ -77,25 +82,19 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int { if(!(i==0 && j==0)) { - if(*(d3_l->status+((x+d3_l->max_x+i)%d3_l->max_x)+((y+d3_l->max_y+j)%d3_l->max_x)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH) p+=a*URAND_MAX/(i*i+j*j); + off=((x+d3_l->max_x+i)%d3_l->max_x)+((y+d3_l->max_y+j)%d3_l->max_x)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y; + if(*(d3_l->status+off)&AMORPH) p+=a*(*(d3_l->extra+off))*URAND_MAX/(i*i+j*j); } } } + // printf("debug: p = %f\n",p); if(!(*thiz&AMORPH)) { - if(get_rand(URAND_MAX)<=p) - { - MAKE_AMORPH(thiz); - // *t_c=*t_c+1-*conc; - } // else *t_c+=1; + if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz); } else { /* assume 1-p probability */ - if(get_rand(URAND_MAX)>p) - { - MAKE_CRYST(thiz); - // *t_c=*t_c+1+*conc; - } // else *t_c+=1; + if(get_rand(URAND_MAX)>p) MAKE_CRYST(thiz); } *t_c+=1; @@ -103,7 +102,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int return 1; } -int distrib_c(d3_lattice *d3_l,double d_r,double a,double b) +int distrib_c(d3_lattice *d3_l,double d_r,double a,double b,char z_diff) { u32 x,y,z; int i,j,k,c; @@ -133,10 +132,15 @@ int distrib_c(d3_lattice *d3_l,double d_r,double a,double b) if(c!=0) { off=((i+d3_l->max_x+c)%d3_l->max_x)+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y; + carry=0; /* case neighbour not amorph */ if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(d_r*(*(d3_l->extra+off))); /* case neighbour amorph */ + /* + * no diffusion between amorphous cells + * else carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2; + */ if(carry!=0) { *(d3_l->extra+offset)+=carry; @@ -149,10 +153,16 @@ int distrib_c(d3_lattice *d3_l,double d_r,double a,double b) if(c!=0) { off=i+((j+c+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+k*d3_l->max_x*d3_l->max_y; + carry=0; /* case neighbour not amorph */ if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(d_r*(*(d3_l->extra+off))); /* case neighbour amorph */ + /* + * + * no diffusion between amorphous cells + * else carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2; + */ if(carry!=0) { *(d3_l->extra+offset)+=carry; @@ -169,6 +179,7 @@ int distrib_c(d3_lattice *d3_l,double d_r,double a,double b) if(c!=0) { off=i+((j+c+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+k*d3_l->max_x*d3_l->max_y; + carry=0; /* case neighbour not amorph */ if(!(*(d3_l->status+off)&AMORPH)) { @@ -181,6 +192,39 @@ int distrib_c(d3_lattice *d3_l,double d_r,double a,double b) } } } + for(c=-1;c<=1;c++) + { + if(c!=0) + { + off=((i+c+d3_l->max_x)%d3_l->max_x)+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y; + carry=0; + /* case neighbour not amorph */ + if(!(*(d3_l->status+off)&AMORPH)) + { + carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2; + if(carry!=0) + { + *(d3_l->extra+offset)+=carry; + *(d3_l->extra+off)-=carry; + } + } + } + } + /* cryst -> amorph diffusion in z direction */ + if(z_diff) + { + for(c=1;c>=-1;c--) + { + off=i+j*d3_l->max_x+((k+c+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y; + carry=0; + if(*(d3_l->status+off)&AMORPH) carry=(int)(d_r*(*(d3_l->extra+offset))); + if(carry!=0) + { + *(d3_l->extra+offset)-=carry; + *(d3_l->extra+off)+=carry; + } + } + } /* if z_diff */ } } /* for z */ } /* for y */ @@ -331,14 +375,45 @@ int load_from_file(char *lf,d3_lattice *d3_l,info *my_inf) return 1; } +int convert_file(char *cf,d3_lattice *d3_l) +{ + int x,y,z; + int c_fd; + + if((c_fd=open(cf,O_WRONLY|O_CREAT))<0) + { + puts("cannot open convert file"); + return -1; + } + dprintf(c_fd,"# created by nlsop (gnuplot format)\n"); + for(x=0;xmax_x;x++) + { + for(y=0;ymax_y;y++) + { + for(z=0;zmax_z;z++) + { + if(*(d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH) dprintf(c_fd,"%d %d %d\n",x,y,z); + } + } + } + close(c_fd); + + return 1; +} + int main(int argc,char **argv) { - u32 max_x,max_y,max_z,x,y,z,x_c,y_c,z_c; + u32 x,y,z,x_c,y_c,z_c; int i,quit,escape,nowait; - int refresh; + int refresh,resave; + char z_diff; char s_file[MAX_CHARS]; + char s_file_tmp[MAX_CHARS]; char l_file[MAX_CHARS]; + char c_file[MAX_CHARS]; + char convert; char r_file[MAX_CHARS]; +#ifdef USE_DFB_API char x_txt[MAX_TXT]; char y_txt[MAX_TXT]; char z_txt[MAX_TXT]; @@ -357,15 +432,18 @@ int main(int argc,char **argv) char el2_txt[MAX_TXT]; char dr_txt[MAX_TXT]; char *arg_v[MAX_ARGV]; +#endif d3_lattice d3_l; info my_info; - max_x=X; - max_y=Y; - max_z=Z; + d3_l.max_x=X; + d3_l.max_y=Y; + d3_l.max_z=Z; my_info.steps=STEPS; my_info.range=RANGE; refresh=REFRESH; + resave=RESAVE; + z_diff=0; my_info.a_el=A_EL; my_info.b_el=B_EL; my_info.a_cd=A_CD; @@ -379,6 +457,8 @@ int main(int argc,char **argv) escape=0; strcpy(s_file,""); strcpy(l_file,""); + strcpy(c_file,""); + convert=0; strcpy(r_file,""); for(i=1;i