Commits

Rio Yokota committed 86ffcf6

Bugfix for BEM_MatMult.

Comments (0)

Files changed (3)

   PetscReal *xm = fmm->xm;
   PetscReal *ym = fmm->ym;
   PetscReal *re = fmm->re;
+  PetscReal eps = fmm->eps;
   VecGetSize(x,&i);
   ierr = VecGetArray(x,&xl);CHKERRQ(ierr);
   ierr = VecGetArray(y,&yl);CHKERRQ(ierr);
-  nbodyG(nb,xm,ym,yl,nb,xm,ym,xl,1e-2);
   for (i=0; i<nb; i++) {
-    yl[i] += (1 - log(re[i] / 2)) * xl[i];
+    yl[i] = 0;
+  }
+  nbodyG(nb,xm,ym,yl,nb,xm,ym,xl,eps);
+  for (i=0; i<nb; i++) {
+    yl[i] += (1 - log(re[i] / 2) + log(eps)) * xl[i];
   }
   ierr = VecRestoreArray(x,&xl);CHKERRQ(ierr);
   ierr = VecRestoreArray(y,&yl);CHKERRQ(ierr);
 
   PetscReal eps = .2 / (1<<((int)(log2(info.mx-1))));
   FMM_Init(eps*eps, 0);
+  fmm->eps = eps;
   PetscFunctionReturn(0);
 }
 
   PetscReal *xi  = fmm->xi;
   PetscReal *yi  = fmm->yi;
   PetscReal *ri  = fmm->ri;
-  PetscReal *ub  = fmm->ub;
+  //PetscReal *ub  = fmm->ub;
   PetscReal *xm  = fmm->xm;
   PetscReal *ym  = fmm->ym;
   PetscReal *um  = fmm->um;
   PetscReal *rhs = fmm->rhs;
   PetscReal *un  = fmm->un;
   PetscReal *ui  = fmm->ui;
+  PetscReal  eps = fmm->eps;
 
   PetscInt i, j, ic = 0;
   for (i=info.xs; i<info.xs+info.xm; i++) { // Loop over interior points
     }
   }
   assert( ni == ic );
-  PetscReal eps = .2 / (1<<((int)(log2(info.mx-1))));
 
   ic = 0;
   j = 0;
     for (j=0; j<i; j++) {
       PetscReal dx = xm[i] - xm[j];
       PetscReal dy = ym[i] - ym[j];
-      PetscReal r = sqrt(dx * dx + dy * dy + 1e-4);
+      PetscReal r = sqrt(dx * dx + dy * dy + eps * eps);
       PetscReal value = -log(r);
       MatSetValue(G,i,j,value,INSERT_VALUES);
       MatSetValue(G,j,i,value,INSERT_VALUES);
   Vec u,f;
   Mat G;
   PetscInt ni,nb,*ip1;
-  PetscReal *xi,*yi,*ri,*xb,*yb,*ub,*xm,*ym,*um,*dxe,*dye,*re,*rhs,*un,*ui;
+  PetscReal *xi,*yi,*ri,*xb,*yb,*ub,*xm,*ym,*um,*dxe,*dye,*re,*rhs,*un,*ui,eps;
 } PC_FMM;
 
 #define PCFMM "fmm"
 
 Poisson2D: Poisson2D.o fmm.o
 	${CLINKER} $^ -o $@ ${PETIGA_LIB} -L../../exafmm2d/wrappers -lfmm -ltbb
-	${RM} -f $<
+#	${RM} -f $<
 #	mpirun -np 1 ./Poisson2D -ksp_monitor -ksp_norm_type UNPRECONDITIONED -ksp_max_it 100 -pc_type fmm -log_summary
-	mpirun -np 1 ./Poisson2D -ksp_monitor -ksp_norm_type UNPRECONDITIONED -draw_pause 1 -iga_elements 64
+	mpirun -np 1 ./Poisson2D -ksp_monitor -ksp_norm_type UNPRECONDITIONED -draw_pause -1 -iga_elements 64
 clean::
 	-@${RM} ${TARGETS}