Commits

Peter Brune committed b9053b8 Merge with conflicts

Merge branch 'prbrune/fix-aspin-mat' into next

* prbrune/fix-aspin-mat:
SNESASPIN: Test for ex16 with ASPIN
SNESASPIN: Fix for the case of zero iterations

Conflicts:
src/snes/examples/tutorials/makefile

  • Participants
  • Parent commits 7d926a6, 34d332b
  • Branches knepley/fix-quadrature-order, next-oct-2014

Comments (0)

Files changed (3)

src/snes/examples/tutorials/makefile

            -npc_snes_type fas -npc_fas_levels_snes_type ncg -npc_fas_levels_snes_max_it 3 -npc_snes_monitor_short \
 	   > ex16_2.tmp 2>&1; ${DIFF} output/ex16_2.out ex16_2.tmp || printf "${PWD}\nPossible problem with with ex16_2, diffs above\n=========================================\n"; \
            ${RM} -f ex16_2.tmp
+runex16_3:
+	-@${MPIEXEC} ./ex16 -da_refine 1 -da_overlap 3 -da_local_subdomains 4 -snes_type aspin -rad 10.0 -young 10. -ploading 0.0 -loading -0.5 -snes_monitor_short -ksp_monitor_short \
+        -npc_sub_snes_rtol 1e-1 -ksp_rtol 1e-3 \
+	> ex16_3.tmp 2>&1; ${DIFF} output/ex16_3.out ex16_3.tmp || printf "${PWD}\nPossible problem with with ex16_3, diffs above\n=========================================\n"; \
+        ${RM} -f ex16_3.tmp
 runex19:
 	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -pc_type mg -ksp_type fgmres -pc_mg_type full > ex19_1.tmp 2>&1; \
 	   if (${DIFF} output/ex19_1.out ex19_1.tmp) then true; \
                                  runex5_6 ex5.rm ex7.PETSc runex7 ex7.rm\
                                  ex14.PETSc runex14 runex14_2 runex14_3 ex14.rm \
                                  ex15.PETSc runex15 runex15_3 runex15_4 runex15_lag_jac runex15_lag_pc ex15.rm \
+                                 ex16.PETSc runex16_3 ex16.rm \
                                  ex18.PETSc runex18 ex18.rm \
                                  ex19.PETSc runex19 runex19_2 runex19_bcols1 runex19_2_bcols1 runex19_fdcoloring_wp runex19_fdcoloring_ds \
                                  runex19_fdcoloring_wp_bcols1 runex19_fdcoloring_ds_bcols1 \

src/snes/examples/tutorials/output/ex16_3.out

+lambda: 2.777778 mu: 4.166667
+  0 SNES Function norm 18.7531 
+    0 KSP Residual norm 18.7531 
+    1 KSP Residual norm 8.05256 
+    2 KSP Residual norm 8.04786 
+    3 KSP Residual norm 4.27617 
+    4 KSP Residual norm 3.62967 
+    5 KSP Residual norm 1.71735 
+    6 KSP Residual norm 0.588593 
+    7 KSP Residual norm 0.202214 
+    8 KSP Residual norm 0.0806734 
+    9 KSP Residual norm 0.0669857 
+   10 KSP Residual norm 0.0623931 
+   11 KSP Residual norm 0.0538008 
+   12 KSP Residual norm 0.016186 
+  1 SNES Function norm 10.4021 
+    0 KSP Residual norm 10.4021 
+    1 KSP Residual norm 3.42492 
+    2 KSP Residual norm 2.21113 
+    3 KSP Residual norm 0.950724 
+    4 KSP Residual norm 0.760002 
+    5 KSP Residual norm 0.306077 
+    6 KSP Residual norm 0.235119 
+    7 KSP Residual norm 0.129355 
+    8 KSP Residual norm 0.122988 
+    9 KSP Residual norm 0.102518 
+   10 KSP Residual norm 0.0355132 
+   11 KSP Residual norm 0.0163353 
+   12 KSP Residual norm 0.0140545 
+   13 KSP Residual norm 0.0106957 
+   14 KSP Residual norm 0.00616451 
+  2 SNES Function norm 1.00734 
+    0 KSP Residual norm 1.00734 
+    1 KSP Residual norm 0.567055 
+    2 KSP Residual norm 0.471574 
+    3 KSP Residual norm 0.21098 
+    4 KSP Residual norm 0.0997817 
+    5 KSP Residual norm 0.0539412 
+    6 KSP Residual norm 0.0336272 
+    7 KSP Residual norm 0.0273344 
+    8 KSP Residual norm 0.0236243 
+    9 KSP Residual norm 0.0173613 
+   10 KSP Residual norm 0.0124758 
+   11 KSP Residual norm 0.00736045 
+   12 KSP Residual norm 0.00236986 
+   13 KSP Residual norm 0.000516898 
+  3 SNES Function norm 0.0226603 
+    0 KSP Residual norm 0.0226603 
+    1 KSP Residual norm 0.0140148 
+    2 KSP Residual norm 0.00726117 
+    3 KSP Residual norm 0.00452695 
+    4 KSP Residual norm 0.0023784 
+    5 KSP Residual norm 0.00146327 
+    6 KSP Residual norm 0.000756808 
+    7 KSP Residual norm 0.000213204 
+    8 KSP Residual norm 8.1835e-05 
+    9 KSP Residual norm 7.0229e-05 
+   10 KSP Residual norm 6.42218e-05 
+   11 KSP Residual norm 6.0983e-05 
+   12 KSP Residual norm 4.25973e-05 
+   13 KSP Residual norm 3.51369e-05 
+   14 KSP Residual norm 2.39262e-05 
+   15 KSP Residual norm 2.33202e-05 
+   16 KSP Residual norm 2.25052e-05 
+  4 SNES Function norm 3.60231e-05 
+    0 KSP Residual norm 3.60231e-05 
+    1 KSP Residual norm 2.83768e-05 
+    2 KSP Residual norm 2.63883e-05 
+    3 KSP Residual norm 2.62197e-05 
+    4 KSP Residual norm 2.60675e-05 
+    5 KSP Residual norm 2.20031e-05 
+    6 KSP Residual norm 1.62981e-05 
+    7 KSP Residual norm 1.11855e-05 
+    8 KSP Residual norm 4.77946e-06 
+    9 KSP Residual norm 3.38491e-06 
+   10 KSP Residual norm 3.18286e-06 
+   11 KSP Residual norm 3.03849e-06 
+   12 KSP Residual norm 2.56911e-06 
+   13 KSP Residual norm 1.86423e-06 
+   14 KSP Residual norm 1.04632e-06 
+   15 KSP Residual norm 3.12907e-07 
+   16 KSP Residual norm 1.2336e-07 
+   17 KSP Residual norm 3.52811e-08 
+  5 SNES Function norm 3.52358e-08 
+Number of SNES iterations = 5

src/snes/impls/nasm/aspin.c

   PetscBool      match;
   MPI_Comm       comm;
   KSP            ksp;
-  PC             pc;
   Vec            *x,*b;
   Vec            W;
   SNES           npc;
+  Mat            subJ,subpJ;
 
   PetscFunctionBegin;
   ierr = MatShellGetContext(m,&ctx);CHKERRQ(ierr);
   for (i=0;i<n;i++) {
     ierr = VecScatterEnd(oscatter[i],W,b[i],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
     ierr = VecSet(x[i],0.);CHKERRQ(ierr);
+    ierr = SNESGetJacobian(subsnes[i],&subJ,&subpJ,NULL,NULL);CHKERRQ(ierr);
     ierr = SNESGetKSP(subsnes[i],&ksp);CHKERRQ(ierr);
-    ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
-    ierr = PCApply(pc,b[i],x[i]);CHKERRQ(ierr);
+    ierr = KSPSetOperators(ksp,subJ,subpJ);CHKERRQ(ierr);
+    ierr = KSPSolve(ksp,b[i],x[i]);CHKERRQ(ierr);
     ierr = VecScatterBegin(oscatter[i],x[i],Y,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
   }
   for (i=0;i<n;i++) {