To whom it may concern,

I would like to modify the code in SNES's ex2.c to run in parallel.

https://www.mcs.anl.gov/petsc/petsc-3.6.4/src/snes/examples/tutorials/ex2.c.html

I modified my ex2.c, as attached here. Even though ex3.c is the parallel version, I would like my implementation to "not contain" DMDA.

(Despite version 3.6.4, it works for version 3.15.0, which I use in my debugging purpose.)

The "crucial" parts of ex2.c that I modified are (apart from deletion of comments, exact solution verification, etc):

- (line 63-64) matrix preallocation
- use MatGetOwnershipRange on a PETSc matrix jac (in FormJacobian)
- use VecGetOwnershipRange on every PETSc vector in the program 

I try to run the program with mpiexec. For n = 1 it works fine for -pc_type lu -snes_type newtonls. However, when I increase n to be n = 2, the code does not iterate further. (It does not go into the FormJacobian for after the first iteration.) I try several different pc_type and snes_type, but still do not get the result as obtained with n = 1.

I attached the terminal printout also.

Since the manual (3.15.0) said that (p81, section 2.4, 1st paragraph)

"Also, the SNES interface is identical for the uniprocess and parallel cases; the only difference in the parallel version is that each process typically forms only its local contribution to various matrices and vectors"

Therefore, I think that by modified only the vectors and matrices part, I should be able to get parallelism.

Regards,
Suwun

PS1: I compile using mpicc and use mpiexec found in the directory ${PETSC_DIR}/arch-mumps-opt/bin/ to run the code.
PS2: I attached the install.sh (I install with MUMPS) that I use to install PETSc. Note that I also turn on --with-debuggin=yes
PS3: my OS is Ubuntu 20.04.2. Intel CPU. My environment should have everything necessary (gfortran, gcc, g++, valgrind, cmake).