[petsc-users] snessetjacobian question
    Jed Brown 
    jedbrown at mcs.anl.gov
       
    Thu Sep 22 10:01:59 CDT 2011
    
    
  
On Thu, Sep 22, 2011 at 16:54, Milan Mitrovic <milan.v.mitrovic at gmail.com>wrote:
>   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 KSPSetFromOptions(ksp, info)
>     call SNESSetFunction(snes, r, theta_step, ctx, info)
>     call SNESSetJacobian(snes, J, J, jacobian, PETSC_NULL, info)
>
Where did you get this J from?
>
> And then in the jacobian function I create one of the matrices:
>
>
>    call MatCreateMPIAIJ(PETSC_COMM_WORLD, Np, Np, Ng, Ng, &
>         nmax+1, PETSC_NULL_INTEGER, nmax+1, PETSC_NULL_INTEGER, Jac, info)
>
You should create the matrix first and just do assembly in this function.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110922/0a78e9da/attachment.htm>
    
    
More information about the petsc-users
mailing list