Praveen C <[email protected]> writes: > Hello Matt > > >> No. You want 2 DAs, 1 for evaluating residuals with s = 3, and one for >> making a Jacobian with s = 1. You give these >> two DAs to >> >> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/ >> DMDASNESSetFunctionLocal.html >> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/ >> DMDASNESSetJacobianLocal.html >> >> and I think it should work as you want. Its too bad we cannot handle this >> case with SNESSetDM() since it only takes >> a single DM and there is no way to specialize the Jacobian. >> >> > ok, I was on wrong track trying to use SNESSetFunction and SNESSetJacobian > which wouldnt have worked.
You can use SNESSetJacobian, but DMSNESSetJacobianLocal is more convenient in my opinion. > I still have some doubt. If > > da0 --> for residual > da1 --> for jacobian > > I still need to call SNESetDM. So here I pass da0 ? But then how will snes > know about da1 ? This should work. DMCreateMatrix(da1, &Jpre); SNESSetDM(snes, da0); SNESSetJacobian(snes, NULL, Jpre, NULL, NULL); DMDASNESSetJacobianLocal(da0, func, ctx); Your func will assemble into the Pmat argument. You might run with -snes_mf_operator to apply the action of the true Jacobian while preconditioning with the preconditioning matrix. See also src/snes/examples/tutorials/ex15.c and its handling of "-alloc_star".
signature.asc
Description: PGP signature
