Hi all,<br><br>I have been playing around with ksp/examples/tutorials/ex3.c, a brief summary of this example follows:<br><br>The Laplace equation in two-dimensions on a unit square [0,1]x[0,1] is solved using a structured mesh of linear quadrilateral finite elements, m elements in each direction. Dirichlet boundary conditions are specified: u_hat = y on the boundary, which means the exact solution is u_star = y. The global system matrix dimension is specified and PETSc decides how to split the matrix amongst processors. The DOFs are numbered &#39;naturally&#39; from the origin, left to right, bottom to top. Boundary conditions are applied by zeroing the rows of the matrix corresponding to the boundary DOFs, inserting 1&#39;s on the diagonal entries of these rows and inserting the boundary conditions into the global RHS vector entries corresponding to these DOFs.<br>
<br>I ran the following uniprocess tests (to run the direct solve tests I had to comment the line &#39;ierr = KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);CHKERRQ(ierr);&#39; but otherwise I made no changes to the example code):<br>
<br>---Tests with 5x5 element mesh (36 DOFs)---<br>$ mpirun -np 1 ./ex3 -ksp_type gmres<br>Norm of error 1.73622e-06 Iterations 3<br>$ mpirun -np 1 ./ex3 -ksp_type bcgs<br>Norm of error 1.5157e-07 Iterations 2<br>$ mpirun -np 1 ./ex3 -ksp_type cg<br>
Norm of error 1.88557e-06 Iterations 3<br>$ mpirun -np 1 ./ex3 -ksp_type gmres -pc_type none<br>Norm of error &lt; 1.e-12 Iterations 7<br>$ mpirun -np 1 ./ex3 -ksp_type bcgs -pc_type none<br>Norm of error 0.00109538 Iterations 6<br>
$ mpirun -np 1 ./ex3 -ksp_type cg -pc_type none<br>Norm of error &lt; 1.e-12 Iterations 7<br>$ mpirun -np 1 ./ex3 -ksp_type preonly -pc_type lu<br>Norm of error &lt; 1.e-12 Iterations 1<br><br>---Tests with 100x100 element mesh (10201 DOFs)---<br>
$ mpirun -np 1 ./ex3 -ksp_type gmres -m 100<br>Norm of error 2.90652e-05 Iterations 32<br>$ mpirun -np 1 ./ex3 -ksp_type bcgs -m 100<br>Norm of error 3.92733e-05 Iterations 24<br>$ mpirun -np 1 ./ex3 -ksp_type cg -m 100<br>
Norm of error 2.4332e-05 Iterations 32<br>$ mpirun -np 1 ./ex3 -ksp_type gmres -pc_type none -m 100<br>Norm of error 0.570146 Iterations 0<br>$ mpirun -np 1 ./ex3 -ksp_type bcgs -pc_type none -m 100<br>Norm of error 0.570146 Iterations 0<br>
$ mpirun -np 1 ./ex3 -ksp_type cg -pc_type none -m 100<br>Norm of error 0.570146 Iterations 0<br>$ mpirun -np 1 ./ex3 -ksp_type preonly -pc_type lu -m 100<br>Norm of error &lt; 1.e-12 Iterations 1<br><br>I had two questions:<br>
<br>1. I was wondering if someone could explain why the system cannot be solved using for a mesh of 100x100 elements without a using preconditioner? The way the boundary conditions are applied causes the system matrix to lose symmetry but GMRes and BiCGStab should work for non-symmetric systems.<br>
<br>2. I&#39;m also unsure about why the CG method seems to be able to solve this non-symmetric system in some cases, are there some cases where this is possible?<br><br>Thanks,<br><br>Matija<br>