[petsc-users] Crash when trying to use FD Jacobian
Paul T. Bauman
ptbauman at gmail.com
Fri Jun 5 15:02:51 CDT 2015
On Fri, Jun 5, 2015 at 3:37 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> > On Jun 5, 2015, at 1:49 PM, Paul T. Bauman <ptbauman at gmail.com> wrote:
> >
> >
> >
> > On Fri, Jun 5, 2015 at 2:42 PM, Harshad Sahasrabudhe <
> hsahasra at purdue.edu> wrote:
> > It is not the coloring you need to generate, just the nonzero
> structure. (From that PETSc computes the coloring) so do as I suggest in my
> other email.
> >
> > Thanks, I'll try that out.
> >
> > FYI, this information is contained in the libMesh::CouplingMatrix which
> you can get from the libMesh::DofMap.
>
> Thanks. Maybe using this information could be "automated" within
> PETSc/libMesh so that one could "trivially" use the finite differencing to
> compute the Jacobian with coloring within PETSc/libMesh when the Jacobian
> cannot be provided directly by the user?
Thanks Barry, this is a good suggestion. To be honest, however, since MOOSE
does its own finite differencing (I think...) and other libMesh-based
infrastructure does as well, this may not be a developer priority
immediately. (Might be something good to hack on in a couple weeks at PETSc
20.) That said...
> For example within PETSc if one provides the option -snes_fd_color then
> SNES does
>
> ierr = PetscOptionsBool("-snes_fd_color","Use finite differences with
> coloring to compute
> Jacobian","SNESComputeJacobianDefaultColor",flg,&flg,NULL);CHKERRQ(ierr);
> if (flg) {
> DM dm;
> DMSNES sdm;
> ierr = SNESGetDM(snes,&dm);CHKERRQ(ierr);
> ierr = DMGetDMSNES(dm,&sdm);CHKERRQ(ierr);
> sdm->jacobianctx = NULL;
> ierr =
> SNESSetJacobian(snes,snes->jacobian,snes->jacobian_pre,SNESComputeJacobianDefaultColor,0);CHKERRQ(ierr);
> ierr = PetscInfo(snes,"Setting default finite difference coloring
> Jacobian matrix\n");CHKERRQ(ierr);
> }
>
> with PETSc/libMesh it would have to stick the correct matrix nonzero
> structure (from? "libMesh::CouplingMatrix") into the ,snes->jacobian_pre
> "Jacobian" "matrix"
>
Looks easy enough. Looking at the SNESSetJacobian documentation, the ctx
(in your example, 0) would need to be a pointer a MatFDColoring?
Best,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150605/53bcbc1f/attachment.html>
More information about the petsc-users
mailing list