distribute_field.py broken in petsc4py-3.11.0

Issue #126 resolved
Ben Mather created an issue

Hello,

I have been running into an issue when creating a section to distribute a field. When running the distribute_field.py file in the DMPlex examples, the following error is raised:

Traceback (most recent call last):
File "distribute_field.py", line 50, in <module>
origSect.setFieldName(0, 'TestField')
File "PETSc/Section.pyx", line 59, in petsc4py.PETSc.Section.setFieldName
petsc4py.PETSc.Error: error code 63
[0] PetscSectionSetFieldName() line 426 in /tmp/petsc-build/petsc-3.11.2/src/vec/is/utils/vsectionis.c
[0] Argument out of range
[0] Section field 0 should be in [0, 0)

I am using PETSc version 3.11.2 and petsc4py 3.11.0. Any help would be greatly appreciated.

Regards,
Ben

Comments (3)

  1. Lisandro Dalcin

    The example is outdated. I think you have to add plex.setNumFields(1) before calling plex.createSection(numComp, numDof). If it works and you have the time, could you please contribute the fix in a pull request?

  2. Log in to comment