[petsc-users] MatZeroRows
Matthew Knepley
knepley at gmail.com
Thu Aug 13 08:07:20 CDT 2020
On Thu, Aug 13, 2020 at 3:17 AM Anthony Paul Haas <aph at email.arizona.edu>
wrote:
> Hello,
>
> I am using MatZeroRows for imposing a known forcing into my equations in
> conjunction with rhs and by setting the diagonal of the matrix to 1.
>
> I am using Fortran. I have used:
>
> ! only local processors set their own zeros
>
>
>
> call MatSetOption(self%fieldLHSMat_ps, MAT_NO_OFF_PROC_ZERO_ROWS,
> PETSC_TRUE, ierr)
>
>
> call MatSetOption(self%fieldLHSMat_ps, MAT_KEEP_NONZERO_PATTERN,
> PETSC_TRUE, ierr)
>
>
> call MatZeroRows(self%fieldLHSMat_ps, numrows, glob_row_idx, diag,
> PETSC_NULL_OBJECT, PETSC_NULL_OBJECT, ierr)
>
>
>
> Is numrows above the local (on each proc.) number of rows to remove, or is
> it the global number of rows to remove?
>
Local.
> Also on some processors, I have no rows to remove, hence the array glob_row_idx
> is not allocated. How can I tell Petsc? Should I pass PETSC_NULL_OBJECT
> instead of glob_row_idx in this case?
>
If you pass numrows = 0, it should not matter what is in the next slot, as
long as it type checks.
> Finally, does using the option MAT_KEEP_NONZERO_PATTERN have an influence
> on the time the MatZeroRows call will take?
>
I don't think it makes much of a difference, but I have not measured it.
Thanks,
Matt
> Thanks,
>
>
> Best regards,
>
>
> Anthony
>
>
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200813/ae2bd847/attachment-0001.html>
More information about the petsc-users
mailing list