I had this working at one point.

Should I add PetscViewerHDF5PushTimestepping? 
I don't create a viewer now, but I could make one.

Thanks,
Mark


On Thu, Jan 18, 2024 at 11:26 AM Matthew Knepley <knepley@gmail.com> wrote:
On Thu, Jan 18, 2024 at 10:08 AM Mark Adams <mfadams@lbl.gov> wrote:
I am trying to view a DMSwarm with: -weights_view hdf5:part.h5

     Vec f;
      PetscCall(DMSetOutputSequenceNumber(sw, 0, 0.0));
      PetscCall(DMSwarmCreateGlobalVectorFromField(sw, "w_q", &f));
      PetscCall(PetscObjectSetName((PetscObject)f, "particle weights"));
      PetscCall(VecViewFromOptions(f, NULL, "-weights_view"));
      PetscCall(DMSwarmDestroyGlobalVectorFromField(sw, "w_q", &f));

And I get this error. I had this working once and did not set PetscViewerHDF5PushTimestepping, so I wanted to check.

We probably were not checking then. We might have to check there when we set the timestep.

  Thanks,

    Matt
 
Thanks,
Mark


[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Timestepping has not been pushed yet. Call PetscViewerHDF5PushTimestepping() first
[0]PETSC ERROR: WARNING! There are unused option(s) set! Could be the program crashed before usage or a spelling mistake, etc!
[0]PETSC ERROR:   Option left: name:-options_left (no value) source: command line
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.20.3-461-g585a01bd688  GIT Date: 2024-01-16 23:32:45 +0000
[0]PETSC ERROR: ./ex30k on a arch-macosx-gnu-O named MarksMac-302.local by markadams Thu Jan 18 10:05:53 2024
[0]PETSC ERROR: Configure options CFLAGS="-g -Wno-deprecated-declarations " CXXFLAGS="-g -Wno-deprecated-declarations " COPTFLAGS=-O CXXOPTFLAGS=-O --with-cc=/usr/local/opt/llvm/bin/clang --with-cxx=/usr/local/opt/llvm/bin/clang++ --download-mpich --with-strict-petscerrorcode --download-triangle=1 --with-debugging=0 --download-hdf5=1 PETSC_ARCH=arch-macosx-gnu-O
[0]PETSC ERROR: #1 PetscViewerHDF5SetTimestep() at /Users/markadams/Codes/petsc/src/sys/classes/viewer/impls/hdf5/hdf5v.c:990
[0]PETSC ERROR: #2 VecView_Swarm_HDF5_Internal() at /Users/markadams/Codes/petsc/src/dm/impls/swarm/swarm.c:45
[0]PETSC ERROR: #3 VecView_Swarm() at /Users/markadams/Codes/petsc/src/dm/impls/swarm/swarm.c:86
[0]PETSC ERROR: #4 VecView() at /Users/markadams/Codes/petsc/src/vec/vec/interface/vector.c:806
[0]PETSC ERROR: #5 PetscObjectView() at /Users/markadams/Codes/petsc/src/sys/objects/destroy.c:76
[0]PETSC ERROR: #6 PetscObjectViewFromOptions() at /Users/markadams/Codes/petsc/src/sys/objects/destroy.c:128
[0]PETSC ERROR: #7 VecViewFromOptions() at /Users/markadams/Codes/petsc/src/vec/vec/interface/vector.c:691


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