[petsc-users] MAT_COPY_VALUES not allowed for unassembled matrix
Matthew Knepley
knepley at gmail.com
Sat Oct 10 12:25:29 CDT 2020
On Sat, Oct 10, 2020 at 5:31 AM baikadi pranay <pranayreddy865 at gmail.com>
wrote:
> Hello,
> I am using the MatDuplicate routine so that I use the Jacobian matrix as a
> preconditioning matrix as well. However, I get the error "MAT_COPY_VALUES
> not allowed for unassembled matrix". The exact command I use is the
> following:
> *call MatDuplicate(jac,MAT_COPY_VALUES,prec,ierr)*
> I am attaching you the error output in a text file for your reference.
> Could you please let me know how to solve this problem?.
>
1) You should be using CHKERRQ(ierr) after the call
2) You need to assemble the matrix, MatAssemblyBegin/End(), before calling
MatDuplicate()
3) You do not need to duplicate the matrix, just pass the same matrix twice
Thanks,
Matt
> Thank you in advance.
> Best Regards,
> Pranay.
>
> ᐧ
>
--
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/20201010/d7d1152d/attachment.html>
More information about the petsc-users
mailing list