[petsc-users] Error loading data coming from a .hdf5 file into a DMSwarm

Matthew Knepley knepley at gmail.com
Mon Apr 1 09:28:34 CDT 2024


On Sun, Mar 31, 2024 at 4:08 PM MIGUEL MOLINOS PEREZ <mmolinos at us.es> wrote:

> Dear all, I am writing a function which store datasets (Vectors) coming
> from a DMSwarm structure into a hdf5 file. This step is done nicely
> write_function(){ PetscViewerHDF5Open(…) PetscViewerHDF5PushTimestepping(…)
> DMSwarmCreateGlobalVectorFromField(…)
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>
> ZjQcmQRYFpfptBannerEnd
> Dear all,
>
> I am writing a function which store datasets (Vectors) coming from a DMSwarm
> structure into a hdf5 file. This step is done nicely
>
> write_function(){
> PetscViewerHDF5Open(…)
> PetscViewerHDF5PushTimestepping(…)
> DMSwarmCreateGlobalVectorFromField(…)
> VecLoad(…)
> DMSwarmDestroyGlobalVectorFromField(…)
> }
>
> The resulting hdf5 file looks good after an inspection using python’s
> library h5py.
>
> However, I am finding difficulties when I try to use this .hdf5 file as a
> fresh start for my application. The target field is not properly updated
> when I try to load the stored data (it keeps the default one).
>
> read_function(){
>> PetscViewerHDF5Open(…)
> PetscViewerHDF5PushTimestepping(…)
> DMSwarmCreateGlobalVectorFromField(…)
> VecLoad(… )
> DMSwarmDestroyGlobalVectorFromField(…)
> ...
> }
>
> The puzzling part is: if I print the “updated” vector inside of
> read_function() using VecView after VecLoad, the vector seem to hold the
> updated values. However, If I print the field in the main function after
> the call to read_function(), the field remains the same it was before
> calling to read_function() and I do not get any erro message.
>
> It is there something wrong with the logic of my programing? Maybe I am
> missing something.
>

>From the description, my guess is that this is pointer confusion. The
vector inside the function is different from the vector outside the
function.

  Thanks,

    Matt


> Thank you in advance.
>
> Best regards,
> 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
>
>
> [image: us_logo.jpg]
>
>
>
>
>
> https://urldefense.us/v3/__http://www.us.es__;!!G_uCfscf7eWS!YnltLCiNPOvMtX9m3CBEtxQ-FLDRM3Ef6ZAOt3huF3xEquvYmdHNozTGvZpnCoX8m3gZ_6W9SXKOxFP20r74$ 
> <https://urldefense.us/v3/__http://www.us.es__;!!G_uCfscf7eWS!egnWYkerVjlSmbuh1nUjljGJ4vkEwKUvO9ygc9e5BJ72KxK-T4qbWIxTBbg-BeyxDvqN5Rr5EvaWMAIXee5w9w$>
> 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
>
>

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

https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YnltLCiNPOvMtX9m3CBEtxQ-FLDRM3Ef6ZAOt3huF3xEquvYmdHNozTGvZpnCoX8m3gZ_6W9SXKOxFq8o9DM$  <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YnltLCiNPOvMtX9m3CBEtxQ-FLDRM3Ef6ZAOt3huF3xEquvYmdHNozTGvZpnCoX8m3gZ_6W9SXKOxM9qa1SP$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240401/6b8c074c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: us_logo.jpg
Type: image/jpeg
Size: 21155 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240401/6b8c074c/attachment-0001.jpg>


More information about the petsc-users mailing list