<div class="gmail_quote">On Thu, Sep 22, 2011 at 16:54, Milan Mitrovic <span dir="ltr"><<a href="mailto:milan.v.mitrovic@gmail.com">milan.v.mitrovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":1gm"> call SNESCreate(PETSC_COMM_WORLD, snes, info)<br>
call SNESSetType(snes, SNESLS, info)<br>
call SNESGetKSP(snes, ksp, info)<br>
call KSPGetPC(ksp, pc, info)<br>
call PCSetType(pc, PCNONE, info)<br>
call KSPSetFromOptions(ksp, info)<br>
call SNESSetFunction(snes, r, theta_step, ctx, info)<br>
call SNESSetJacobian(snes, J, J, jacobian, PETSC_NULL, info)<br></div></blockquote><div><br></div><div>Where did you get this J from?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":1gm">
<br>
And then in the jacobian function I create one of the matrices:<br>
<br>
<br>
call MatCreateMPIAIJ(PETSC_COMM_WORLD, Np, Np, Ng, Ng, &<br>
nmax+1, PETSC_NULL_INTEGER, nmax+1, PETSC_NULL_INTEGER, Jac, info)</div></blockquote></div><br><div>You should create the matrix first and just do assembly in this function.</div>