[petsc-users] Obtaining constraint values in DM vector solution
Matthew Knepley
knepley at gmail.com
Tue Mar 31 17:46:34 CDT 2015
On Tue, Mar 31, 2015 at 5:29 PM, Justin Chang <jchang27 at uh.edu> wrote:
> How do I invoke this command into my program? When I add "-vec_view
> hdf5:sol.h5" my program says this has been left out.
>
You can call VecView() directly with an HDF5 Viewer, or I think its easier
to call
VecViewFromOptions(U, NULL, "-vec_view");
Thanks,
Matt
> On Tue, Mar 31, 2015 at 5:13 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> 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
>>
>
>
>
> --
> 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/dfd85deb/attachment-0001.html>
More information about the petsc-users
mailing list