[petsc-users] Crash when trying to use FD Jacobian
Barry Smith
bsmith at mcs.anl.gov
Fri Jun 5 14:37:46 CDT 2015
> 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? 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"
Barry
More information about the petsc-users
mailing list