Re: [petsc-users] Example of SNES using matrix free jacobian

2024-11-04 Thread Daniel Pino Munoz
Dear all, The problem was the context. The context was not properly set, and yet for some reason it was running correctly in Debug mode. Now this problem has been solved. Thank you Barry for your help. Best,   Daniel On 29/10/2024 23:04, Barry Smith wrote: Run in the debugger, even tho

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Barry Smith
Run in the debugger, even though there will not be full debugging support with the optimizations it should still provide you some information > On Oct 29, 2024, at 4:35 PM, Daniel Pino Munoz > wrote: > > That's what I thought, so I replaced its content by: > > VecZeroEntries(f); > > and

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Barry Smith
This [0]PETSC ERROR: #1 SNES callback function indicates the crash is in your computeResidual function and thus you need to debug your function Barry > On Oct 29, 2024, at 4:28 PM, Daniel Pino Munoz > wrote: > > I ran it with -malloc_debug and it does not change anything. > > Th

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Daniel Pino Munoz
I ran it with -malloc_debug and it does not change anything. The output is the following: he absolute tolerance is 0.001 The relative tolerance is 0.001 The divergence tolerance is 1 The maximum iterations is 1 Initial load ! [0]PETSC ERROR: -

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Daniel Pino Munoz
That's what I thought, so I replaced its content by: VecZeroEntries(f); and the result is the same... On 29/10/2024 21:31, Barry Smith wrote: This [0]PETSC ERROR: #1 SNES callback function indicates the crash is in your computeResidual function and thus you need to debug your funct

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Barry Smith
Hmm, cut and paste the output when it crashes. Also run with -malloc_debug and see what happens Barry > On Oct 29, 2024, at 3:13 PM, Daniel Pino Munoz > wrote: > > Hi Barry, > > Thanks for getting back to me! > > I tried replacing KSPSetOperators(ksp, J, J); by SNESSetJacobia

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Daniel Pino Munoz
Hi Barry, Thanks for getting back to me! I tried replacing KSPSetOperators(ksp, J, J); by SNESSetJacobian(snes,J,J, MatMFFDComputeJacobian) and I get the same result = It works in Debug mode but not in Release. I also ran valgrind and it did not catch any memory problem. Any ideas? PS : Y

Re: [petsc-users] Example of SNES using matrix free jacobian

2024-10-29 Thread Barry Smith
Don't call KSPSetOperators(ksp, J, J); instead call SNESSetJacobian(snes,J,J, MatMFFDComputeJacobian) but I am not sure that would explain the crash. BTW: since you are applying no preconditioner if the matrix is ill-conditioned it may take many iterations or not conv