[petsc-users] DM/DMPlex Issue from DM vector access

Ferrand, Jesus A. FERRANJ2 at my.erau.edu
Mon Dec 6 13:02:30 CST 2021

Dear PETSc Team:

I am a new PETSc user who is working on an FEA code and ran into an issue pertaining to DMPlex.

I have a gmsh mesh file that I import using "DMPlexCreateGmshFromFile()." I then fetch the XYZ coordinates of the nodes from this mesh using "DMGetCoordinatesLocal()." Deeper into the code, I have a call to "DMPlexGetTransitiveClosure()" inside a loop that scans the cells (I think you guys refer to it as "depth-3") to reference nodes. Here's the catch: If I attempt to reference the array from the vector (Vec) in the call to "DMGetCoordinatesLocal()" by using something like "VecGetArray()," or "VecGetArrayRead()," the call to "DMPlexGetTransitiveClosure()" errors-out with a segmentation fault. I need access to that vector's stored XYZ-data because I'm using my own finite element scripts. I have no clue as to why this is happening. Maybe it is a newbie mistake and I am forgetting to restore some memory?

Code, error message, and gmsh files are attached.
Your help is much appreciated.

Machine Type: HP Laptop
C-compiler: Gnu C
OS: Ubuntu 20.04
PETSc version: 3.16.0
MPI Implementation: MPICH


J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach FL

M.Sc. Aerospace Engineering | May 2022

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics

Sigma Gamma Tau

Tau Beta Pi

Honors Program

Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu

    jesus.ferrand at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211206/bf811873/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gmsh.c
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211206/bf811873/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TopOptmesh2.msh
Type: application/octet-stream
Size: 111265 bytes
Desc: TopOptmesh2.msh
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211206/bf811873/attachment-0001.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: error.txt
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211206/bf811873/attachment-0001.txt>

More information about the petsc-users mailing list