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

Matthew Knepley knepley at gmail.com
Fri Dec 2 08:07:25 CST 2011


On Fri, Dec 2, 2011 at 8:04 AM, Feng-Chao Wang <wolfshow at gmail.com> wrote:

> **
> 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?
>

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecView.html

  Matt


> Thank you very much in advance!
>
> Best Regards
>
>
>
>
>
> 2011-12-02
> ------------------------------
> Feng-Chao Wang
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111202/6f0de5f1/attachment.htm>


More information about the petsc-users mailing list