[petsc-users] Compute initial guess multiple times

Filippo Leonardi filippo.leonardi at sam.math.ethz.ch
Fri Oct 9 05:04:53 CDT 2015


So, I want to solve a system Ax = b multiple times, reuse A with different bs. 
It is natural to set differents initial guesses each time for iterative 
solvers.

And 
KSPSetComputeInitialGuess(ksp,ComputeGuess,&user);
is what PETSc provide for setting the Guess.

I am unsure if I am making something wrong, but it seems to me that this 
function is called only once the matrix is first setted up. I want to be 
called each time.

See my modified ex32.c for comparison.

./ex32 -pc_type mg -pc_mg_type full -ksp_type fgmres -ksp_monitor_short -
pc_mg_levels 3 -mg_coarse_pc_factor_shift_type nonzero -
ksp_initial_guess_nonzero

Thanks.

Best,
Filippo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex32.c
Type: text/x-csrc
Size: 8151 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151009/76ca8f16/attachment.c>


More information about the petsc-users mailing list