[petsc-users] petsc4py/Plex createSection

Nicolas Barral nicolas.barral at math.u-bordeaux.fr
Sat Mar 28 09:04:22 CDT 2020


All,

I hope you're all safe and fine.

My question may be due to me being rusty with dmplex, please forgive me 
if I missed something obvious...
In my Firedrake code, I had the following line for a 2D mesh
> section = createSection([1], [2, 0, 0], perm=mesh._plex_renumbering)
where mesh._plex_renumbering was an IS containing the mesh renumbering. 
This created a nice section mapping the plex to a P1 field.

However, with a recently installed Petsc/petsc4py, this does not work 
anymore and results in a section pointing all points of the plex to 0.
I investigated a bit (although I don't understand the doc for this 
function), and found a similar construction in petsc4py 
test/test_dmplex.py in 1D:
> DIM = 1
> CELLS = [[0, 1], [1, 2]]
> COORDS = [[0.], [0.5], [1.]]
> COMP = 1
> DOFS = [1, 0]
>
> plex = PETSc.DMPlex().createFromCellList(DIM, CELLS, COORDS)
> section = plex.createSection([COMP], [DOFS])
> plex.view()
> section.view()

This also results in an empty section (which makes the test fail when I 
run it manually):
> PetscSection Object: 1 MPI processes
>   type not yet set
> Process 0:
>   (   0) dim  0 offset   0
>   (   1) dim  0 offset   0
>   (   2) dim  0 offset   0
>   (   3) dim  0 offset   0
>   (   4) dim  0 offset   0

So, what did I miss ?

Thanks,

-- 
Nicolas



More information about the petsc-users mailing list