Commits

Jed Brown committed b1be220 Merge with conflicts

Merge branch 'maint'

* maint:
Revert "MatMPIBAIJSetPreallocationCSR() handled the input matrix entries incorrectly, it treated them as if each row of values"
MatMPIBAIJSetPreallocationCSR() handled the input matrix entries incorrectly, it treated them as if each row of values was provided ordered by row within the block rows instead of by block as it was originally designed to be. Also added more discussion to the manual pages on the expected order of the values
PCGAMG: add man page for PCGAMGType
Add a test example for TS + MG + MatFDColoring
Fixed SNESComputeJacobianDefaultColor() in the case of multilevel PC

Conflicts:
src/ts/examples/tutorials/makefile

Comments (0)

Files changed (4)

include/petscpc.h

 PETSC_EXTERN PetscErrorCode PCPARMSSetNonsymPerm(PC pc,PetscBool nonsym);
 PETSC_EXTERN PetscErrorCode PCPARMSSetFill(PC pc,PetscInt lfil0,PetscInt lfil1,PetscInt lfil2);
 
+/*E
+    PCGAMGType - type of generalized algebraic multigrid (PCGAMG) method
+
+    Level: intermediate
+
+.seealso: PCMG, PCSetType(), PCGAMGSetThreshold(), PCGAMGSetThreshold(), PCGAMGSetReuseProl()
+E*/
 typedef const char *PCGAMGType;
 #define PCGAMGAGG         "agg"
 #define PCGAMGGEO         "geo"

src/snes/interface/snesj2.c

   void           *funcctx;
   ISColoring     iscoloring;
   PetscBool      hascolor;
+  PetscBool      solvec;
 
   PetscFunctionBegin;
   if (color) PetscValidHeaderSpecific(color,MAT_FDCOLORING_CLASSID,6);
     ierr = PetscObjectDereference((PetscObject)color);CHKERRQ(ierr);
   }
 
-  /* F is only usable if there is no RHS on the SNES */
-  if (!snes->vec_rhs) {
+  /* F is only usable if there is no RHS on the SNES and the full solution corresponds to x1 */
+  ierr = VecEqual(x1,snes->vec_sol,&solvec);CHKERRQ(ierr);
+  if (!snes->vec_rhs && solvec) {
     ierr = MatFDColoringSetF(color,F);CHKERRQ(ierr);
   }
   ierr = MatFDColoringApply(*B,color,x1,flag,snes);CHKERRQ(ierr);

src/ts/examples/tutorials/makefile

 	   ${DIFF} output/ex26_3.out ex26_3.tmp || echo  ${PWD} "\nPossible problem with ex26_3, diffs above \n=========================================";  \
 	   ${RM} -f ex26_3.tmp
 
+runex26_4:
+	-@${MPIEXEC} -n 2 ./ex26 -da_refine 1 -lidvelocity 100 -grashof 1e3 -ts_max_steps 10 -ts_rtol 1e-3 -ts_atol 1e-3 \
+        -ts_type beuler -ts_monitor -snes_monitor_short -snes_fd_color -pc_type mg  > ex26_4.tmp 2>&1; \
+	   ${DIFF} output/ex26_4.out ex26_4.tmp || echo  ${PWD} "\nPossible problem with ex26_4, diffs above \n=========================================";  \
+	   ${RM} -f ex26_4.tmp
+
 runex29:
 	-@${MPIEXEC} -n 16 ./ex29 -da_refine 4 -ts_max_steps 10 -ts_rtol 1e-3 -ts_atol 1e-3 \
         -ts_type arkimex -ts_monitor -snes_monitor -snes_type ngmres \
                             ex12.PETSc ex12.rm ex13.PETSc runex13 runex13_2 runex13_3 ex13.rm\
                             ex15.PETSc runex15 runex15_2 runex15_3 runex15_4 runex15_5 ex15.rm \
                             ex17.PETSc runex17 runex17_2 ex17.rm ex22.PETSc runex22 runex22_2 runex22_3 ex22.rm \
-                            ex25.PETSc runex25 ex25.rm ex26.PETSc runex26 runex26_2 runex26_3 ex26.rm
+                            ex25.PETSc runex25 ex25.rm ex26.PETSc runex26 runex26_2 runex26_3 runex26_4 ex26.rm
 TESTEXAMPLES_C_NOCOMPLEX  = ex9.PETSc runex9 runex9_2 runex9_3 ex9.rm
 TESTEXAMPLES_C_X	  =
 TESTEXAMPLES_FORTRAN	  = ex1f.PETSc runex1f ex1f.rm ex2f.PETSc runex2f ex2f.rm ex22f.PETSc ex22f.rm # ex22f_mf.PETSc ex22f_mf.rm

src/ts/examples/tutorials/output/ex26_4.out

+7x7 grid, lid velocity = 100, prandtl # = 1, grashof # = 1000
+0 TS dt 0.0714286 time 0
+    0 SNES Function norm 263.23 
+    1 SNES Function norm 140.467 
+    2 SNES Function norm 3.20716 
+    3 SNES Function norm 5.71143e-05 
+    4 SNES Function norm 1.528e-10 
+1 TS dt 0.0714286 time 0.0714286
+    0 SNES Function norm 598.779 
+    1 SNES Function norm 1.05211 
+    2 SNES Function norm 7.88385e-06 
+    3 SNES Function norm 1.845e-11 
+2 TS dt 0.0714286 time 0.142857
+    0 SNES Function norm 484.697 
+    1 SNES Function norm 0.797688 
+    2 SNES Function norm 4.88379e-06 
+    3 SNES Function norm 1.045e-11 
+3 TS dt 0.0714286 time 0.214286
+    0 SNES Function norm 392.486 
+    1 SNES Function norm 1.87433 
+    2 SNES Function norm 1.11379e-05 
+    3 SNES Function norm 3.034e-11 
+4 TS dt 0.0714286 time 0.285714
+    0 SNES Function norm 317.323 
+    1 SNES Function norm 0.418122 
+    2 SNES Function norm 2.11794e-06 
+5 TS dt 0.0714286 time 0.357143
+    0 SNES Function norm 255.672 
+    1 SNES Function norm 0.244614 
+    2 SNES Function norm 1.00826e-06 
+6 TS dt 0.0714286 time 0.428571
+    0 SNES Function norm 205.242 
+    1 SNES Function norm 0.155892 
+    2 SNES Function norm 6.46844e-07 
+7 TS dt 0.0714286 time 0.5
+    0 SNES Function norm 164.282 
+    1 SNES Function norm 0.0979264 
+    2 SNES Function norm 3.69565e-07 
+8 TS dt 0.0714286 time 0.571429
+    0 SNES Function norm 131.298 
+    1 SNES Function norm 0.0620509 
+    2 SNES Function norm 1.78843e-07 
+9 TS dt 0.0714286 time 0.642857
+    0 SNES Function norm 104.972 
+    1 SNES Function norm 0.0399592 
+    2 SNES Function norm 1.45618e-07 
+10 TS dt 0.0714286 time 0.714286
+CONVERGED_ITS at time 0.714286 after 10 steps