[petsc-users] local/global Vec for SNES function/jacobian

Matteo Semplice matteo.semplice at unito.it
Tue Jan 9 00:53:58 CST 2018


Dear all,

     I could not find info on the manual but from the examples and my 
own trying I guess that the vectors involved in the SNESfunction should 
be global ones and that, if one needs ghosts values to compute the 
function and/or the jacobian, should do a GlobalToLocal communication 
inside the function. Correct? (I get errors of inconsistent dimensions 
between Vecs and Mats if I call SNESSolve(snes,b, localU)...)

     Since I need the ghost values both in the function and in the 
jacobian evaluation, would it be safe (and worthwhile) to do define a 
local vector in the ctx, perform the communication in the function and 
using the vec in the ctx in the jacobian evaluation (without performing 
again the communication in the SNESJacobianFunction?)... Put in other 
words, is it guaranteed that each call to the jacobian function is 
preceded by a call to the function with the same x argument?

Thanks,
     Matteo Semplice


More information about the petsc-users mailing list