[petsc-users] Obtaining constraint values in DM vector solution
Justin Chang
jchang27 at uh.edu
Tue Mar 31 18:08:45 CDT 2015
In my first program I have already set the name for the solution. Vec U has
the name "pressure".
In my second program, how do I obtain and use/load "pressure"? Would I have
to use PetscObjectQuery somehow?
On Tue, Mar 31, 2015 at 6:00 PM, Matthew Knepley <knepley at gmail.com> wrote:
> On Tue, Mar 31, 2015 at 5:54 PM, Justin Chang <jchang27 at uh.edu> wrote:
>
>> Matt thanks for the responses. I plan on loading the solution sol.h5
>> obtained from one program into another (as the auxiliary). So in my other
>> program, I am solving a different problem but on the same mesh. I have the
>> following lines in my other code:
>>
>
> Yes, if you want to do this, you have to give these vectors proper names:
>
> PetscObjectSetName((PetscObject), U, "solution");
>
> Thanks,
>
> Matt
>
>
>> ierr =
>> PetscViewerHDF5Open(PETSC_COMM_SELF,"sol.h5",FILE_MODE_READ,&viewer);CHKERRQ(ierr);
>> ierr = VecLoad(auxVec,&viewer);CHKERRQ(ierr);
>> ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
>>
>> But when this program reaches VecLoad i get the following errors:
>>
>> HDF5-DIAG: Error detected in HDF5 (1.8.12) MPI-process 0:
>> #000: H5D.c line 334 in H5Dopen2(): not found
>> major: Dataset
>> minor: Object not found
>> #001: H5Gloc.c line 430 in H5G_loc_find(): can't find object
>> major: Symbol table
>> minor: Object not found
>> #002: H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal
>> failed
>> major: Symbol table
>> minor: Object not found
>> #003: H5Gtraverse.c line 641 in H5G_traverse_real(): traversal operator
>> failed
>> major: Symbol table
>> minor: Callback failed
>> #004: H5Gloc.c line 385 in H5G_loc_find_cb(): object
>> 'Vec_0x7f9831516fb0_0' doesn't exist
>> major: Symbol table
>> minor: Object not found
>> [0]PETSC ERROR: --------------------- Error Message
>> --------------------------------------------------------------
>> [0]PETSC ERROR: Error in external library
>> [0]PETSC ERROR: Error in HDF5 call H5Dopen2() Status -1
>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>> for trouble shooting.
>> [0]PETSC ERROR: Petsc Development GIT revision: v3.5.3-2528-gbee642f GIT
>> Date: 2015-03-29 20:36:38 -0500
>> [0]PETSC ERROR: ./trans on a arch-darwin-c-debug named
>> CAML-03.CIVE.UH.EDU by jychang48 Tue Mar 31 17:45:38 2015
>> [0]PETSC ERROR: Configure options --download-chaco --download-exodusii
>> --download-fblaslapack --download-hdf5 --download-metis --download-mumps
>> --download-netcdf --download-openmpi --download-parmetis
>> --download-scalapack --download-triangle --with-cc=gcc --with-cmake=cmake
>> --with-cxx=g++ --with-debugging=1 --with-fc=gfortran --with-valgrind=1
>> CFLAGS= CXXFLAGS= PETSC_ARCH=arch-darwin-c-debug
>> [0]PETSC ERROR: #1 VecLoad_HDF5() line 268 in
>> /Users/jychang48/Software/petsc-dev/src/vec/vec/utils/vecio.c
>> [0]PETSC ERROR: #2 VecLoad_Default() line 391 in
>> /Users/jychang48/Software/petsc-dev/src/vec/vec/utils/vecio.c
>> [0]PETSC ERROR: #3 VecLoad_Plex_Local() line 158 in
>> /Users/jychang48/Software/petsc-dev/src/dm/impls/plex/plex.c
>> [0]PETSC ERROR: #4 VecLoad() line 969 in
>> /Users/jychang48/Software/petsc-dev/src/vec/vec/interface/vector.c
>> [0]PETSC ERROR: #5 CreateMesh() line 265 in
>> /Users/jychang48/Dropbox/Research_Topics/Code_PETSc/Nonneg/trans.c
>> [0]PETSC ERROR: #6 main() line 381 in
>> /Users/jychang48/Dropbox/Research_Topics/Code_PETSc/Nonneg/trans.c
>>
>> Any idea what's going on here?
>>
>> On Tue, Mar 31, 2015 at 5:46 PM, Matthew Knepley <knepley at gmail.com>
>> wrote:
>>
>>> 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
>>>
>>
>>
>>
>> --
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150331/1c5ca187/attachment-0001.html>
More information about the petsc-users
mailing list