Skip to content

BUG: PETSc interface change has broken VertexOnlyMesh #3998

Open
@dham

Description

Describe the bug
This change to PETSc has changed the interface to DMSwarm such that the cell ID field has changed.

Steps to Reproduce

Using current Firedrake and PETSc main:

from firedrake import *
msh = UnitSquareMesh(5,5)
VOM = VertexOnlyMesh(msh, vertexcoords=msh.coordinates.dat.data, redundant=False)

Produces:

   3880     # NOTE ensure that swarm.restoreField is called for each field too!
   3881     swarm_coords = swarm.getField("DMSwarmPIC_coor").reshape((num_vertices, gdim))
-> 3882     swarm_parent_cell_nums = swarm.getField("DMSwarm_cellid").ravel()
   3883     field_parent_cell_nums = swarm.getField("parentcellnum").ravel()
   3884     field_reference_coords = swarm.getField("refcoord").reshape((num_vertices, tdim))

petsc4py/PETSc/DMSwarm.pyx in petsc4py.PETSc.DMSwarm.getField()

Error: error code 83
[0] DMSwarmGetField() at /tmp/petsc-src/src/dm/impls/swarm/swarm.c:1663
[0] DMSwarmDataBucketGetDMSwarmDataFieldByName() at /tmp/petsc-src/src/dm/impls/swarm/data_bucket.c:172
[0] Cannot find DMSwarmDataField with name DMSwarm_cellid

Additional behaviour

It appears that the cell id is no longer stored in the hard-coded name "DMSwarm_cellid" but instead the name has to be accessed programatically. It's not clear how to do that from Python (and the interface may not have been exposed).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions