I took step 40, changed the rhs term to be a constant 1 and added a
flux_calculation() function which loops on the boundary and dots the normal with the gradient of the solution (akin to calculating forces).
I also added a GridTools::distort_random(0.3, triangulation, true, 500 or something);after mesh generation to get an unstructured mesh.
I run it for a single cycle and there seem to be a discrepancy in the flux calculation for an unstructured grid when running with different cores.
This doesn't happen with a structured grid.
The output for the flux calculation on a structured mesh with MPI 1 is:
Running with PETSc on 1 MPI rank(s)...
Cycle 0:
Number of active cells: 64
Number of degrees of freedom: 289
Solved in 9 iterations.
Sigma_flux -0.994394
and for MPI 4 is:
Running with PETSc on 4 MPI rank(s)...
Cycle 0:
Number of active cells: 64
Number of degrees of freedom: 289
Solved in 9 iterations.
Sigma_flux -0.994394
But after activating distort_random the output with MPI 1 is:
Running with PETSc on 1 MPI rank(s)...
Cycle 0:
Number of active cells: 64
Number of degrees of freedom: 289
Solved in 8 iterations.
Sigma_flux -0.993997
but with MPI 4 the output is:
Running with PETSc on 4 MPI rank(s)...
Cycle 0:
Number of active cells: 64
Number of degrees of freedom: 289
Solved in 9 iterations.
Sigma_flux -0.994323
The file is also attached bellow.