[petsc-users] How to output the values of a parallel PETSc vector to a ASCII file

Feng-Chao Wang wolfshow at gmail.com
Fri Dec 2 08:04:59 CST 2011


Dear all,

I intend to postprocess the solution of a PDE (stored in a parallel PETSc vector ) using tecplot. Thus I want to  output the values of the parallel vector as well as other data (such as the grid information) to a ASCII file.

When I deal this with 


VecGetArray(U, &u);

for (i=0; i<Mx*My; i++)
{
PetscViewerASCIIPrintf(viewer,"%F %F %F", x, y, u[i]);
}

If more than 1 processor are used, I found that only part of the value of u was output correctly (that stored on the first processor).
I found in the manual page of "PetscViewerASCIIPrintf" that "Not Collective, but only first processor in set has any effect"

Could anyone give me some suggestions on this issue?

Thank you very much in advance!

Best Regards





2011-12-02 



Feng-Chao Wang 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111202/b80064d1/attachment.htm>


More information about the petsc-users mailing list