[petsc-users] SNES + linesearch hackery?
Andrew McRae
A.T.T.McRae at bath.ac.uk
Thu Mar 24 10:18:22 CDT 2016
I have a finite element discretisation of the following nonlinear equation:
m*(phi_xx * phi_yy - phi_xy^2) = const,
solving for phi. Unfortunately, the function m depends on phi in a
complicated way -- let's assume I need to call my own function to handle
this.
I'm using PETSc's SNES in Python via petsc4py, within the wider
environment of the software Firedrake.
Currently I'm hacking in the m update (and various output diagnostics) by
writing a Python function "fakemonitor" and calling
snes.setMonitor(fakemonitor). This allows me to update m each nonlinear
iteration.
While this is better than nothing, there's still some problems: if I use
e.g. snes_linesearch_type: "l2", the fnorms for lambda = 1.0, 0.5 and 0.0
are calculated without updating m, and so the step length taken is
(seemingly) far from optimal. I tried adding a damping parameter, but all
this does is change the lambdas used to generate the quadratic fit; it
doesn't actually make the step length smaller.
Is there some cleaner way to do what I want, perhaps by intercepting the
fnorm calculation to update m, rather than abusing a custom monitor routine?
Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160324/ca0a8d12/attachment.html>
More information about the petsc-users
mailing list