<div dir="ltr"><div dir="ltr">On Sat, Mar 28, 2020 at 1:06 PM Nicolas Barral <<a href="mailto:nicolas.barral@math.u-bordeaux.fr">nicolas.barral@math.u-bordeaux.fr</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks Matt!<br>
<br>
with your explanation I realized it was actually one line above in the <br>
test. It seems that you can just specify the number of fields with:<br>
self.plex.setNumFields(1)<br></blockquote><div><br></div><div>Great find. I need to figure out where to put that in the documentation.</div><div><br></div><div> Thanks,</div><div><br></div><div> MAtt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks,<br>
<br>
-- <br>
Nicolas<br>
<br>
On 28/03/2020 17:15, Matthew Knepley wrote:<br>
> On Sat, Mar 28, 2020 at 10:04 AM Nicolas Barral <br>
> <<a href="mailto:nicolas.barral@math.u-bordeaux.fr" target="_blank">nicolas.barral@math.u-bordeaux.fr</a> <br>
> <mailto:<a href="mailto:nicolas.barral@math.u-bordeaux.fr" target="_blank">nicolas.barral@math.u-bordeaux.fr</a>>> wrote:<br>
> <br>
> All,<br>
> <br>
> I hope you're all safe and fine.<br>
> <br>
> My question may be due to me being rusty with dmplex, please forgive me<br>
> <br>
> <br>
> Hi Nicolas! I hope everything is good Bordeaux despite the lockdown.<br>
> <br>
> I think I know this one. I put in support for having fields that extend <br>
> over only part of the mesh, which some<br>
> users really needed. This means that the DM has a description of fields <br>
> independent from the DS and Section.<br>
> Thus we have to ask the DM how many fields it has when creating the <br>
> Section automatically now. I think you<br>
> can fix this by first telling the DM that it has one field:<br>
> <br>
> field = PETSc.Object()<br>
> field.setName('potential')<br>
> dm.addField(field)<br>
> <createSection><br>
> <br>
> Thanks,<br>
> <br>
> Matt<br>
> <br>
> if I missed something obvious...<br>
> In my Firedrake code, I had the following line for a 2D mesh<br>
> > section = createSection([1], [2, 0, 0], perm=mesh._plex_renumbering)<br>
> where mesh._plex_renumbering was an IS containing the mesh renumbering.<br>
> This created a nice section mapping the plex to a P1 field.<br>
> <br>
> However, with a recently installed Petsc/petsc4py, this does not work<br>
> anymore and results in a section pointing all points of the plex to 0.<br>
> I investigated a bit (although I don't understand the doc for this<br>
> function), and found a similar construction in petsc4py<br>
> test/test_dmplex.py in 1D:<br>
> > DIM = 1<br>
> > CELLS = [[0, 1], [1, 2]]<br>
> > COORDS = [[0.], [0.5], [1.]]<br>
> > COMP = 1<br>
> > DOFS = [1, 0]<br>
> ><br>
> > plex = PETSc.DMPlex().createFromCellList(DIM, CELLS, COORDS)<br>
> > section = plex.createSection([COMP], [DOFS])<br>
> > plex.view()<br>
> > section.view()<br>
> <br>
> This also results in an empty section (which makes the test fail when I<br>
> run it manually):<br>
> > PetscSection Object: 1 MPI processes<br>
> > type not yet set<br>
> > Process 0:<br>
> > ( 0) dim 0 offset 0<br>
> > ( 1) dim 0 offset 0<br>
> > ( 2) dim 0 offset 0<br>
> > ( 3) dim 0 offset 0<br>
> > ( 4) dim 0 offset 0<br>
> <br>
> So, what did I miss ?<br>
> <br>
> Thanks,<br>
> <br>
> -- <br>
> Nicolas<br>
> <br>
> <br>
> <br>
> -- <br>
> What most experimenters take for granted before they begin their <br>
> experiments is infinitely more interesting than any results to which <br>
> their experiments lead.<br>
> -- Norbert Wiener<br>
> <br>
> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>