[petsc-users] reset the sparsity pattern of a matrix without destroying and recreating it
Aulisa, Eugenio
Eugenio.Aulisa at ttu.edu
Fri Oct 23 09:11:50 CDT 2020
Hi
I have a time dependent problem, where at each iteration
the sparsity pattern of some rows of an mpi matrix keeps changing.
I have an estimate at each iteration what the maximum size of these rows should be,
so I can conservatively pre-allocate the matrix memory.
I then assembly using the option
MatSetOption(mat, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
It runs for few iterations but then it saturates the pre-allocated memory.
What happens is that at each iteration new columns are added to the changing rows,
but old entries that are now zero (and not needed anymore) are not removed,
and the size of the changing rows increases till it reaches the maximum allowed value.
Is there any way, when at each iteration I zero the matrix
to forget the previous sparsity pattern and start from fresh,
without destroying and recreating the matrix?
Also, if possible, is it possible to select only the rows where this should happens?
i.e. keeping the same sparsity pattern for a set of rows and forget it for the others.
Thanks,
Eugenio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201023/2b9c3b57/attachment.html>
More information about the petsc-users
mailing list