[petsc-users] DMPlexMatSetClosure for non connected points in DM

Ashish Patel ashish.patel at onscale.com
Tue Oct 6 14:31:08 CDT 2020


Upon some more testing, the idea of adding the disconnected vertex point to
the cone of the surface point didn't pan out. It was effecting the closure
of other points in the mesh and also for mpi simulations the disconnected
vertex was thrown away from the distributed mesh. I instead switched to
using MatSetValues to achieve what I wanted along with supplementing the
dof of the reference node to a point in the continuous mesh. There is a
performance price to pay since I am adding new non zeros after the DM
matrix creation. Based on this post which had a similar problem statement
https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2017-January/031318.html
It seems that preallocating the matrix ourselves instead of using the DM is
a possible solution for avoiding this performance issue.

Thanks
Ashish

On Fri, Oct 2, 2020 at 4:15 PM Ashish Patel <ashish.patel at onscale.com>
wrote:

> Dear PETSc users,
>
> I am trying to assemble a matrix for a finite element problem where the
> degree of freedom (dof) on a surface is constrained via a reference node
> which also exists in the DM but is not connected  with any other point in
> the mesh. To apply the constraint I want to be able to set matrix values in
> the rows belonging to dofs of reference nodes and columns belonging to dofs
> of surface nodes and vice versa. But since the two points are not connected
> topologically I cannot just use DMPlexMatSetClosure to do that. I am
> currently trying to use DMPlexAddConeSize on all the constrained surface
> points followed by a call to DMPlexInsertCone wherein I add the reference
> node to the cone of surface point before setting up the PetscSection. Is
> this the right approach? I am currently getting following message
>
> New nonzero at (8952,28311) caused a malloc
> Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn
> off this check
>
> I could set the suggested option to get rid of the error but was wondering
> if I am missing something.
>
> Thanks
> Ashish
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201006/cf8d21b0/attachment.html>


More information about the petsc-users mailing list