[petsc-users] Issue with SNES with petsc4py 3.22
Blauth, Sebastian
sebastian.blauth at itwm.fraunhofer.de
Tue Dec 10 02:27:58 CST 2024
Hi everyone,
I am having trouble with using SNES from petsc4py in PETSc 3.22. The problem
is similar to https://gitlab.com/petsc/petsc/-/issues/1611 and related to
the readonly access of x. Particularly, in my application, based on
FEniCS, I want to solve a nonlinear PDE. Therefore, in my callbacks, I want
to set the vector of DoFs of my FEniCS function to x with a line like
self.u.vector().vec().setArray(x)
However, this now raises the error
[0] Vector 'Vec_0x84000003_0' (argument #1) was locked for read-only access
in unknown_function() at unknown file:0 (line numbers only accurate to
function begin)
I believe that this is a consequence of
https://gitlab.com/petsc/petsc/-/merge_requests/7567#22c226fc29b6fc9dc5781b0
aff4dcc70ac6c3489, but I did not find any information on how to remove the
lock from the vector or how I can set use x to update the vector of my
function. Using
xx = x.getArray(readonly=True)
as described in https://gitlab.com/petsc/petsc/-/issues/1611 does not work
either, as calling self.u.vector().vec().setArray(xx) then fails with the
same error message.
Does anyone have an idea how to fix this?
Thanks a lot in advance,
Sebastian
--
Dr. Sebastian Blauth
Fraunhofer-Institut für
Techno- und Wirtschaftsmathematik ITWM
Abteilung Transportvorgänge
Fraunhofer-Platz 1, 67663 Kaiserslautern
Telefon: +49 631 31600-4968
<mailto:sebastian.blauth at itwm.fraunhofer.de>
sebastian.blauth at itwm.fraunhofer.de
<https://www.itwm.fraunhofer.de> https://www.itwm.fraunhofer.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241210/636890aa/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7943 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241210/636890aa/attachment-0001.p7s>
More information about the petsc-users
mailing list