Dear Matthew, Thank you for your suggestion. I tried to update the vector with the information coming from the hdf5 file inside the main function. Then I print the vector two times (see the lines below), the first time it has the correct data. However, the second time, it has the same values like I never updated it with VecLoad.
It is an alternative way of initialise a vector coming from DMSWarm with previously stored information (keeping the parallel structure)? Miguel //! Load Hdf5 viewer PetscViewer viewer_hdf5; REQUIRE_NOTHROW(PetscViewerHDF5Open(MPI_COMM_WORLD, Output_hdf5_file, FILE_MODE_READ, &viewer_hdf5)); REQUIRE_NOTHROW(PetscViewerHDF5PushTimestepping(viewer_hdf5)); //! Load the vector and fill it with the information from the .hdf5 file Vec stdv_q; REQUIRE_NOTHROW(DMSwarmCreateGlobalVectorFromField( Simulation.atomistic_data, "stdv-q", &stdv_q)); REQUIRE_NOTHROW(PetscViewerHDF5PushGroup(viewer_hdf5, "/particle_fields")); REQUIRE_NOTHROW(VecLoad(stdv_q, viewer_hdf5)); REQUIRE_NOTHROW(VecView(stdv_q, PETSC_VIEWER_STDOUT_WORLD)); REQUIRE_NOTHROW(PetscViewerHDF5PopGroup(viewer_hdf5)); REQUIRE_NOTHROW(DMSwarmDestroyGlobalVectorFromField( Simulation.atomistic_data, "stdv-q", &stdv_q)); //! Destoy HDF5 context REQUIRE_NOTHROW(PetscViewerDestroy(&viewer_hdf5)); //! Load the vector again and print REQUIRE_NOTHROW(DMSwarmCreateGlobalVectorFromField( Simulation.atomistic_data, "stdv-q", &stdv_q)); REQUIRE_NOTHROW(VecView(stdv_q, PETSC_VIEWER_STDOUT_WORLD)); REQUIRE_NOTHROW(DMSwarmDestroyGlobalVectorFromField( Simulation.atomistic_data, "stdv-q", &stdv_q)); Best, Miguel Miguel Molinos Investigador postdoctoral Juan de la Cierva Dpto. Mecánica de Medios Continuos y Teoría de Estructuras - ETSI Universidad de Sevilla Camino de los descubrimientos, s/n 41092 Sevilla [us_logo.jpg] https://urldefense.us/v3/__http://www.us.es__;!!G_uCfscf7eWS!cBA1ckF1ChOi-Bgd9vd_TbaJmDZbonuQUNk2GOtfDnlYlIyTsO0mIZDspS-H1SopQFNhXZr5udHSOKQPUNQ-Xw$ Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Si no es UD. el destinatario del mensaje, le ruego lo destruya sin hacer copia digital o física, comunicando al emisor por esta misma vía la recepción del presente mensaje. Gracias On 1 Apr 2024, at 16:28, Matthew Knepley <[email protected]> wrote: >From the description, my guess is that this is pointer confusion. The vector >inside the function is different from the vector outside the function.
