[petsc-users] petsc4py and PCMGGetSmoother

Klaij, Christiaan C.Klaij at marin.nl
Tue May 28 09:38:12 CDT 2024


I'm attempting some rapid prototyping with petsc4py. The idea is basically to read-in a matrix and rhs, setup GAMG as ksppreonly, get the smoother and overrule it with a python function of my own, similar to the demo where the Jacobi method is user-defined in python. So far I have something like this:

pc = PETSc.PC().create()
pc.setOperators(A)
pc.setType(PETSc.PC.Type.GAMG)
pc.PCMGGetSmoother(l=0,ksp=smoother)

which triggers the following error:

AttributeError: 'petsc4py.PETSc.PC' object has no attribute 'PCMGGetSmoother'

1) Am I doing something wrong, or is this function just not available through python? 

2) How can I tell up front if a function is available, only if it is listed in libpetsc4py.pyx? 

3) Given the function description in C from the manual pages, how can I deduce the python syntax?
    (perhaps it's supposed to be ksp = pc.PCMGGetSmoother(l=0), or something else entirely)

Thanks for your help,
dr. ir. Christiaan Klaij
 | Senior Researcher | Research & Development
T +31 317 49 33 44 |  C.Klaij at marin.nl | https://urldefense.us/v3/__http://www.marin.nl__;!!G_uCfscf7eWS!fuGSX2r2dc6Uj05gGWmXIUBhKmH4GUWf4FdVk1fonAxLxhy9cN2iLnXPgauopyAAtW08jyABFGurfeZ-5GDS9n8$ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240528/80f2840b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image663216.png
Type: image/png
Size: 5004 bytes
Desc: image663216.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240528/80f2840b/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image279842.png
Type: image/png
Size: 487 bytes
Desc: image279842.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240528/80f2840b/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image807462.png
Type: image/png
Size: 504 bytes
Desc: image807462.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240528/80f2840b/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image039071.png
Type: image/png
Size: 482 bytes
Desc: image039071.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240528/80f2840b/attachment-0007.png>


More information about the petsc-users mailing list