[petsc-users] (no subject)
Li Luo
li.luo at kaust.edu.sa
Sun Dec 1 02:56:42 CST 2019
Dear Developers,
I tried to use the multi-color finite-difference (MC-FD) method for
constructing the Jacobians. However, I find it is very slow compared to the
exact Jacobian.
My implementation of MC-FD Jacobian is posted below, would you please check
whether I am correct? Anything missed? Thank you!
////////// Setup phase:
MatStructure flag;
ISColoring iscoloring;
ierr = MatGetColoring(Jac,MATCOLORINGSL,&iscoloring);
ierr = MatFDColoringCreate(Jac,iscoloring,&this->matfdcoloring);
ierr =
MatFDColoringSetFunction(this->matfdcoloring,(PetscErrorCode
(*)(void))__libmesh_petsc_snes_residual,(void *)this);
ierr = MatFDColoringSetFromOptions(this->matfdcoloring);
ierr = ISColoringDestroy(&iscoloring);
//////////// Apply:
ierr = MatZeroEntries(*jac);CHKERRQ(ierr);
ierr =
MatFDColoringApply(*jac,solver->matfdcoloring,x,msflag,snes);
Best regards,
Li Luo
--
This message and its contents, including attachments are intended solely
for the original recipient. If you are not the intended recipient or have
received this message in error, please notify me immediately and delete
this message from your computer system. Any unauthorized use or
distribution is prohibited. Please consider the environment before printing
this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191201/a86bf5fe/attachment-0001.html>
More information about the petsc-users
mailing list