[petsc-users] Obtaining constraint values in DM vector solution

Matthew Knepley knepley at gmail.com
Tue Mar 31 17:13:55 CDT 2015


On Tue, Mar 31, 2015 at 5:06 PM, Justin Chang <jchang27 at uh.edu> wrote:

> Hi all,
>
> So in my DMPlex FEM (serial) simulations, I want to output the solution U
> to a binary file. I have the following:
>
> ierr =
> PetscViewerBinaryOpen(PETSC_COMM_WORLD,"sol.dat",FILE_MODE_WRITE,&viewer);CHKERRQ(ierr);
> ierr = VecView(U,viewer);CHKERRQ(ierr);
> ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
>
> The mesh I am solving has 13368 nodes, and 404 of them are constrained
> using the DMPlexAddBoundary(...)  function. However, when I output the
> vector I only get 12964 values, which I believe is leaving out the 404
> constrained ones. How do I get all dofs in the vector U (both free and
> constrained) printed?
>

I would use HDF5 which will do this automatically:

  -vec_view hdf5:sol.h5

  Thanks,

     Matt


> Thanks,
>
>
> --
> Justin Chang
> PhD Candidate, Civil Engineering - Computational Sciences
> University of Houston, Department of Civil and Environmental Engineering
> Houston, TX 77004
> (512) 963-3262
>



-- 
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/20150331/753430bf/attachment.html>


More information about the petsc-users mailing list