Re: [petsc-users] Requesting help with SNES non-linear example

2024-10-27 Thread Jose E. Roman via petsc-users
bratu2dnpy.py does not "return f", instead it modifies the argument f by manipulating its internal array. If you want to use a function that "return f" you have to receive this returned variable and then set it to the Vec object, i.e.: f = self.compute(expected_soln_vec_npy, x, f)

Re: [petsc-users] Requesting help with SNES non-linear example

2024-10-26 Thread Vaishak Prasad
Dear Jose, Thankyou very much for your response. On Sat, Oct 26, 2024 at 3:32 PM Jose E. Roman wrote: > Your residue() function is computing something (f) that is not returned to > the calling function. So evalFunction() returns a zero residual and the > solver stops in one iteration. > Apologi

Re: [petsc-users] Requesting help with SNES non-linear example

2024-10-26 Thread Jose E. Roman via petsc-users
Your residue() function is computing something (f) that is not returned to the calling function. So evalFunction() returns a zero residual and the solver stops in one iteration. Mixing numpy arrays and petsc4py vectors is going to be tricky unless you know what you are doing. It is simpler to m

Re: [petsc-users] Requesting help with SNES non-linear example

2024-10-26 Thread Vaishak Prasad
Hi, Thanks for pointing me to the updated example. The example itself works fine. However, on adapting the example to a simple problem ( recovering a given 1D vector), I find that there is only one function call happening and the solution has not converged. I am attaching the modified example her

Re: [petsc-users] Requesting help with SNES non-linear example

2024-10-26 Thread Jose E. Roman via petsc-users
The examples in those old slides might be outdated. Try with the examples that come with the PETSc repo or tarball. In particular, that example can be found in src/binding/petsc4py/demo/legacy/bratu2d/bratu2d.py. Jose > El 25 oct 2024, a las 19:58, Vaishak Prasad > escribió: > > Dear All, >

[petsc-users] Requesting help with SNES non-linear example

2024-10-25 Thread Vaishak Prasad
Dear All, Greetings from India. I am new to petsc4py. I was trying out the example on slides 18, and 19 at https://urldefense.us/v3/__https://www.bu.edu/pasi/files/2011/01/Lisandro-Dalcin-petsc4py.pdf__;!!G_uCfscf7eWS!ehNmddsrNhTg2K1fvJVZhjNXm7zt2pz25zK1Th5iKAIPiWNt4cl3DL63Z2e4zzZ0-e1Ff4Xg7-UB4QG