[petsc-users] PETSc object creation/destruction with adaptive grid

Samuel Estes samuelestes91 at gmail.com
Tue Dec 7 11:54:04 CST 2021


I have a code implementing a finite element method with an adaptive grid.
Rather than destroying the PETSc objects (the Jacobian matrix and RHS
residual vector) every time the code refines the grid, we want to
(over-)allocate some "padding" for these objects so that we only
destroy/create new PETSc objects when the number of new nodes exceeds the
padding. In order to solve the linear system with padding, we just fill the
matrix with ones on the diagonal and fill the residual with zeros for the
padded parts.

Is this a reasonable way to do things? I'm sure that this problem has come
up before but I haven't found anything about it. I would like to know what
other solutions people have come up with when using PETSc for adaptive
problems since PETSc does not support dynamic reallocation of objects (i.e.
I don't think you are allowed to change the size of a PETSc matrix).

If this problem has come up before, can you please point me to a link to
the discussion?

In particular, I'm curious if there is any way to solve the padded linear
system without having to fill in values for the unused parts of the system.
The linear solver obviously complains if there are rows of the matrix
without any values, I'm just wondering if it's possible to get the linear
solver to ignore them?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211207/5293c817/attachment-0001.html>

More information about the petsc-users mailing list