<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Thank you, the fix works fine indeed.</p>
<p><br /></p>
<p>Pierre Seize</p>
<p><br /></p>
<p>Le 2020-04-01 13:15, Matthew Knepley a écrit :</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div dir="ltr">On Wed, Apr 1, 2020 at 5:34 AM Pierre Seize <<a href="mailto:pierre.seize@onera.fr">pierre.seize@onera.fr</a>> wrote:</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif;">
<p>Hello everyone.</p>
<p>I noticed a strange feature, and I don't know if it is a small bug or if it is expected behaviour.</p>
<p>I have a DMPLEX read from a file, and I add a PetscFV field to it. For debugging purposes I want to name this PetscFV with PetscObjectSetName. But when later I create a global vector, the name of the field gets erased. Is it to be expected ?</p>
<p><br /></p>
</div>
</blockquote>
<div>You are right. It is a bug. I have made a merge request for this fix here:</div>
<div> </div>
<div>  <a href="https://gitlab.com/petsc/petsc/-/merge_requests/2670" target="_blank" rel="noopener noreferrer">https://gitlab.com/petsc/petsc/-/merge_requests/2670</a></div>
<div> </div>
<div>and it seems to work on your example:</div>
<div> </div>
<div>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">master *:~/Downloads/tmp/Pierre$ ./names</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">DM Object: Mesh 1 MPI processes</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="gmail-Apple-converted-space">  </span>type: plex</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">Mesh in 0 dimensions:</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">Labels:</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="gmail-Apple-converted-space">  </span>celltype: 0 strata with value/size ()</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">Field FV Model:</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="gmail-Apple-converted-space">  </span>adjacency FVM</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">DM Object: Mesh 1 MPI processes</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="gmail-Apple-converted-space">  </span>type: plex</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">Mesh in 0 dimensions:</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">Labels:</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="gmail-Apple-converted-space">  </span>celltype: 0 strata with value/size ()</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">Field FV Model:</p>
<p class="gmail-p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="gmail-Apple-converted-space">  </span>adjacency FVM</p>
</div>
<div> </div>
<div>The reason for this behavior was that originally, FEM people named the fields individually, but</div>
<div>FV people tended to have one field with the physical fields being components so that they could</div>
<div>have a single Riemann solve for all fields. Now you can name field components, so this does not</div>
<div>matter anymore.</div>
<div> </div>
<div>Thanks,</div>
<div> </div>
<div>   Matt </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif;">
<p>Here is a minimal working example:</p>
<p><span style="font-family: 'courier new',courier,monospace;">#include <petscdmplex.h></span><br /><span style="font-family: 'courier new',courier,monospace;">int main(int argc, char **argv){</span><br /><span style="font-family: 'courier new',courier,monospace;">  PetscErrorCode    ierr;</span><br /><br /><span style="font-family: 'courier new',courier,monospace;">  DM      dm;</span><br /><span style="font-family: 'courier new',courier,monospace;">  PetscFV fvm;</span><br /><span style="font-family: 'courier new',courier,monospace;">  Vec     x;</span><br /><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = PetscInitialize(&argc, &argv, NULL, NULL); if (ierr) return ierr;</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMCreate(PETSC_COMM_WORLD, &dm);                   CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMSetType(dm, DMPLEX);                             CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = PetscFVCreate(PETSC_COMM_WORLD, &fvm);             CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMAddField(dm, NULL, (PetscObject) fvm);           CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = PetscObjectSetName((PetscObject) fvm, "FV Model"); CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMView(dm, PETSC_VIEWER_STDOUT_WORLD);             CHKERRQ(ierr); <- Here the field is named "FV Model"</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMCreateGlobalVector(dm, &x);                      CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMView(dm, PETSC_VIEWER_STDOUT_WORLD);             CHKERRQ(ierr)</span><span style="font-family: 'courier new',courier,monospace;">; <- Here the field is named "Field_0"</span><br /><br /><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = VecDestroy(&x);       CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = PetscFVDestroy(&fvm); CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = DMDestroy(&dm);       CHKERRQ(ierr);</span><br /><span style="font-family: 'courier new',courier,monospace;">  ierr = PetscFinalize();</span><br /><span style="font-family: 'courier new',courier,monospace;">  return ierr;</span><br /><span style="font-family: 'courier new',courier,monospace;">}</span></p>
</div>
</blockquote>
</div>
<br clear="all" />
<div> </div>
-- <br />
<div class="gmail_signature" dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br />-- Norbert Wiener</div>
<div> </div>
<div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" rel="noopener noreferrer">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p><br /></p>
</body></html>