[petsc-users] petsc4py: reuse setup for multiple solver calls?

Lisandro Dalcin dalcinl at gmail.com
Fri Apr 6 19:50:05 CDT 2018


On 6 April 2018 at 08:48, Robert Speck <r.speck at fz-juelich.de> wrote:
> Thank you for your answer! Please see below for comments/questions.
>
> On 05.04.18 12:53, Matthew Knepley wrote:
>> On Thu, Apr 5, 2018 at 6:39 AM, Robert Speck <r.speck at fz-juelich.de

>>
>> For nonlinear solves which stay the same size, you do nothing.
>
> "nothing" in terms of "nothing you can do" or "nothing you have to do"?
>

I would say "nothing you have to do". Nonlinear solvers work by just
setting two callback routines to compute the residual and the
Jacobian. The user-defined residual routine receives a vector you have
to put values in, same for the Jacobian routine, you have to put
values in the (already preallocated) matrix that is reused on each
newton step, and on each successive solve. SNES will take care of
everything else (in particular, updating the KSP linear solver, and
refreshing the preconditioner, always trying to reuse
already-preallocated internal data structures as much as possible).
All what what I said for SNES applies to TS, in case you ever want to
give it a chance.



-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 0109
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459


More information about the petsc-users mailing list