There is problem in line 3 in the following MPI code:
- fespace VhG(ThG, P2); //global mesh ThG
- VhG uG=0, uReduce=0;
- uReduce = u //u is a local variable defined on local mesh Th on one specific MPI processor
- mpiAllReduce(uReduce, uG, mpiCommWorld, mpiSUM)
The problem is when I do uReduce = u in line 3, the values are extrapolated automatically, which is NOT zero on ThG-Th, so that line 4 generates wrong values in uG using mpiSUM.
Is there a better method to centralise/combine results form different MPI processors?