[petsc-users] Problem with SNES

Milan Mitrovic milan.v.mitrovic at gmail.com
Sat Aug 27 11:17:26 CDT 2011


Hello everyone,

I'm having trouble getting SNES to work. I get 0 for the iteration number.

Here is the code I have:

     call SNESCreate(PETSC_COMM_WORLD, snes, info)

     call SNESSetType(snes, SNESLS, info)

     call SNESGetKSP(snes, ksp, info)
     call KSPGetPC(ksp, pc, info)
     call PCSetType(pc, PCNONE, info)

     call SNESSetFunction(snes, r, implicit_step, ctx, info)
     call SNESSetJacobian(snes, J, J, jacobian, PETSC_NULL, info)

     call SNESSetFromOptions(snes, info)

     call SNESSolve(snes, PETSC_NULL, x, info)
     call SNESGetIterationNumber(snes, i, info)

the jacobian is created with:

    call MatCreateShell(PETSC_COMM_WORLD, Np, Np, Ng, Ng, 0, Jac, info)
    call MatShellSetOperation(Jac, MATOP_MULT, jacobian_multiplication, info)

Any hints as to what I should do to find the problem are very welcome :)

Thanks in advance,
Milan


More information about the petsc-users mailing list