- marked as minor
matshell
Dear users,
I am using petsc4py to solve odes. I am trying sundial or arkimex but the solution explodes whereas it should be bounded (everything is fine with ROSW). I think there is maybe an issue with the jacobian ( snes.setUseMF(True) , precision... ).
I am considering the use of matshell because I know how to compute J.x (J is dense and large, millions^2 of entries ). I can't find simple examples for this in petsc4py. Would it be possible to do something like the old code:
https://code.google.com/p/petsc4py/issues/detail?id=11
Thank you for your help,
Bests,
Romain
Comments (5)
-
reporter -
See this code, that's the way to define a "shell" matrix in petsc4py:
https://bitbucket.org/petsc/petsc4py/src/master/demo/poisson2d/poisson2d.py
-
reporter Thank you for the link, this is what I needed.
Let me ask another question please (I googled it but it not easy to find).
I want to make the computation in def mult(…): y = J(u).x where u is the current solution.
I want to use this with SNES but I don't know how pass u to the function def mult
Can you provide me with this last information please?
Thank you
-
I would suggest to add a method to your Mat class, let's call it "def computeJacobian(self, snes, u, *args)", in such a way that you can pass it to SNES.setJacobian(). That method should store the values of the "u" vector (you should make a copy) to be used later in "mult()".
PS: This bug tracker is not a forum to ask questions, next time please email petsc-users or my personal mail account.
-
- changed status to invalid
Not an issue
- Log in to comment