[petsc-users] Customized Jacobi-Vector action approximation
Jed Brown
jed at jedbrown.org
Sat May 31 10:11:31 CDT 2014
Jonas Mairhofer <mairhofer at itt.uni-stuttgart.de> writes:
> Hi all,
>
> I am using PETSc to solve a system of nonlinear equations arising from
> Density Functional Theory. Depending on the actual problem setup the
> residulas of the matrix-free linear solver (GMRES)
> stagnate and the nonlinear system converges only slowly.
> Besides preconditioning my second idea to improve the performance of the
> linear solver was to use a higher order approximation of the
> Jacobi-vector product. Therefore, I am trying to write a user defined
> subroutine that calculates the approximation of the matrix-free
> Jacobi-Vector product, i.e. I would like to have a routine which can
> replace the default 1st order approximation
>
> J(x)*v = (F(x+eps*v) - F(x) ) / eps
>
> for instance by a 2nd order approximation such as
>
> J(x)*v = (F(x+eps*v) - F(x-eps*v) ) / 2eps
>
> So assuming that I have a subroutine which claculates the approximation
> of J(x)*v, how do I get PETSc to use this result in the SNES solver?
Unless you are trying to add the centered difference code to the PETSc
library, you should create a MatShell that computes the action by your
formula. Note that the centered difference does not help with rounding
error, so you'll likely want to use a larger step size (eps) and rely on
the function having sufficient smoothness if you hope to achieve better
accuracy than the one-sided difference.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140531/e3c97e7f/attachment-0001.pgp>
More information about the petsc-users
mailing list