//Initializations
// ierr = KSPGMRESSetRestart(ksp, 16); CHKERRQ(ierr);
- ierr = KSPSetTolerances(ksp, 1e-10, 1e-10, PETSC_DEFAULT, 16); CHKERRQ(ierr);
+ ierr = KSPSetTolerances(ksp, 1e-13, 1e-13, PETSC_DEFAULT, 16); CHKERRQ(ierr);
ierr = KSPSetInitialGuessNonzero(ksp, PETSC_TRUE); CHKERRQ(ierr);
- //Error
+ KSPGetResidualNorm(ksp,&norm);
+
+ /* //Error
ierr = VecCopy(x, residu); CHKERRQ(ierr);
ierr = VecAXPY(residu, -1, x_old); CHKERRQ(ierr);
ierr = VecNorm(residu, NORM_INFINITY, &norm); CHKERRQ(ierr);
-
+ */
ierr = PetscPrintf(PETSC_COMM_WORLD, "Norm of error %g, outer iteration %D\n", norm, giter); CHKERRQ(ierr);
+ KSPGetResidualNorm(ksp,&norm);
+
+ /*
//Error
ierr = VecCopy(x, residu); CHKERRQ(ierr);
ierr = VecAXPY(residu, -1, x_old); CHKERRQ(ierr);
ierr = VecNorm(residu, NORM_INFINITY, &norm); CHKERRQ(ierr);
-
+ */
ierr = PetscPrintf(PETSC_COMM_WORLD, "Norm of error %g, outer iteration %D\n", norm, giter); CHKERRQ(ierr);
ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr);
ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr);
+ PetscMPIInt size;
+ MPI_Comm_size(PETSC_COMM_WORLD,&size);
+ PetscPrintf(PETSC_COMM_WORLD,"Number of processors = %d\n",size);
+
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Compute the matrix and right-hand-side vector that define
the linear system, Ax = b.
}
-
+
/*
Free work space. All PETSc objects should be destroyed when they