]> www.hackdaworld.org Git - physik/nlsop.git/commitdiff
added z diffusion (cryst->amorph) + fixed cryst-cryst diffusion bug
authorhackbard <hackbard>
Thu, 19 Jun 2003 15:50:08 +0000 (15:50 +0000)
committerhackbard <hackbard>
Thu, 19 Jun 2003 15:50:08 +0000 (15:50 +0000)
nlsop.c

diff --git a/nlsop.c b/nlsop.c
index 069f39fe74327828212c5e8540edd447aca75926..69e8bcb404d2a551e4da697a1c27fcb9595285a9 100644 (file)
--- a/nlsop.c
+++ b/nlsop.c
@@ -34,6 +34,7 @@ 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 <value> \t slope of nuclear energy loss (default %f)\n",A_EL);
  printf("-b <value> \t nuclear energy loss offset (default %f)\n",B_EL);
  printf("-x <value> \t # x cells (default %d)\n",X);
@@ -101,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;
@@ -191,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+off)));
+       if(carry!=0)
+       {
+        *(d3_l->extra+offset)+=carry;
+       *(d3_l->extra+off)-=carry;
+       }
+      }
+     } /* if z_diff */
     }
    } /* for z */
   } /* for y */
@@ -372,6 +406,7 @@ int main(int argc,char **argv)
  u32 x,y,z,x_c,y_c,z_c;
  int i,quit,escape,nowait;
  int refresh,resave;
+ char z_diff;
  char s_file[MAX_CHARS];
  char s_file_tmp[MAX_CHARS];
  char l_file[MAX_CHARS];
@@ -408,6 +443,7 @@ int main(int argc,char **argv)
  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;
@@ -459,10 +495,11 @@ int main(int argc,char **argv)
     case 'Y':
      y=atoi(argv[++i]);
      break;
+    */
     case 'Z':
-     z=atoi(argv[++i]);
+     z_diff=1;
      break;
-    */
+    /* */
     case 's':
      my_info.steps=atoi(argv[++i]);
      break;
@@ -614,7 +651,7 @@ int main(int argc,char **argv)
    x_c=get_rand(d3_l.max_x);
    y_c=get_rand(d3_l.max_y);
    z_c=get_rand_lgp(d3_l.max_z,my_info.a_el,my_info.b_el);
-   distrib_c(&d3_l,my_info.d_r,my_info.a_cd,my_info.b_cd);
+   distrib_c(&d3_l,my_info.d_r,my_info.a_cd,my_info.b_cd,z_diff);
    process_cell(&d3_l,x_c,y_c,z_c,my_info.range,my_info.a_ap,my_info.b_ap,&(my_info.cc));
 #ifdef USE_DFB_API
    if(i%refresh==0)