<div dir="auto">You can find other  examples at <a href="https://gitlab.com/stefanozampini/petscexamples">https://gitlab.com/stefanozampini/petscexamples</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 14, 2023, 19:50 Jose E. Roman <<a href="mailto:jroman@dsic.upv.es">jroman@dsic.upv.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Have a look at ex100.c ex100.py:<br>
<a href="https://gitlab.com/petsc/petsc/-/blob/c28a890633c5a91613f1645670105409b4ba3c14/src/ksp/ksp/tutorials/ex100.c" rel="noreferrer noreferrer" target="_blank">https://gitlab.com/petsc/petsc/-/blob/c28a890633c5a91613f1645670105409b4ba3c14/src/ksp/ksp/tutorials/ex100.c</a><br>
<a href="https://gitlab.com/petsc/petsc/-/blob/c28a890633c5a91613f1645670105409b4ba3c14/src/ksp/ksp/tutorials/ex100.py" rel="noreferrer noreferrer" target="_blank">https://gitlab.com/petsc/petsc/-/blob/c28a890633c5a91613f1645670105409b4ba3c14/src/ksp/ksp/tutorials/ex100.py</a><br>
<br>
Jose<br>
<br>
<br>
> El 14 mar 2023, a las 17:45, Eric Hester <<a href="mailto:eric.w.hester@icloud.com" target="_blank" rel="noreferrer">eric.w.hester@icloud.com</a>> escribió:<br>
> <br>
> Is there a similar example of how to create shell preconditioners using petsc4py?<br>
> <br>
> Thanks,<br>
> Eric<br>
> <br>
>> On Mar 13, 2023, at 09:37, Eric Hester <<a href="mailto:eric.w.hester@icloud.com" target="_blank" rel="noreferrer">eric.w.hester@icloud.com</a>> wrote:<br>
>> <br>
>> Ah ok. I see how the poisson2d example works. Thanks for the quick reply.<br>
>> <br>
>> Eric<br>
>> <br>
>>> On Mar 13, 2023, at 08:10, Jose E. Roman <<a href="mailto:jroman@dsic.upv.es" target="_blank" rel="noreferrer">jroman@dsic.upv.es</a>> wrote:<br>
>>> <br>
>>> Both ode/vanderpol.py and poisson2d/poisson2d.py use shell matrices via a mult(self,mat,X,Y) function defined in the python side. Another example is ex3.py in slepc4py.<br>
>>> <br>
>>> Jose<br>
>>> <br>
>>> <br>
>>> <br>
>>>> El 13 mar 2023, a las 15:58, Eric Hester via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a>> escribió:<br>
>>>> <br>
>>>> Hello everyone,<br>
>>>> <br>
>>>> Does petsc4py support matrix-free iterative solvers (as for Matrix-Free matrices in petsc)?<br>
>>>> <br>
>>>> For context, I have a distributed matrix problem to solve. It comes from a Fourier-Chebyshev Galerkin discretisation. The corresponding matrix is dense, but it is fast to evaluate using fftw. It is also distributed in memory.<br>
>>>> <br>
>>>> While I’ve found some petsc4py tutorial examples in "/petsc/src/binding/petsc4py/demo/“, they don’t seem to show a matrix free example. And I don’t see a reference to a matrix shell create method in the petsc4py api.<br>
>>>> <br>
>>>> If petsc4py does support matrix free iterative solvers, it would be really helpful if someone could provide even a toy example of that. Serial would work, though a parallelised one would be better.<br>
>>>> <br>
>>>> Thanks,<br>
>>>> Eric<br>
>>>> <br>
>>>> <br>
>>> <br>
>> <br>
> <br>
<br>
</blockquote></div>