[petsc-users] Preconditioning in matrix-free methods

Jed Brown jed at jedbrown.org
Mon Feb 24 19:18:36 CST 2014


Konstantinos Kontzialis <ckontzialis at lycos.com> writes:

> Dear all,
>  
> I am trying to use preconditioning in SNES within a matrix free conext. I use
> petsc 3.3 and whenever I use the option
> -snes_mf_operator I get the following error:

-snes_mf_operator means to use the matrix you assemble for
 preconditioning, but apply the true Jacobian using matrix-free finite
 differencing.  It is normally used when the function you pass to
 TSSetIJacobian() only approximates the true Jacobian, typically by
 using a lower-order discretization or by discarding some terms.

> Must call DMShellSetMatrix() or DMShellSetCreateMatrix()
>
>  
> I code the following:
>  
>       call TSCreate (petsc_comm_world, ts_mhd, ierpetsc)     
> c          
>       call TSSetProblemType (ts_mhd, TS_NONLINEAR, ierpetsc)    
> c
>       call TSSetIFunction ( ts_mhd, res_mhd, residual_mag,     
>      @  PETSC_NULL_OBJECT, ierpetsc )     
> c    
>       call TSSetSolution( ts_mhd, Bmagnetic_pet, ierpetsc )
> c
>       call TSSetMaxSNESFailures ( ts_mhd, -1, ierpetsc)
> c             
>       call TSGetSNES (ts_mhd, snes_mhd, ierpetsc )
>  
>       call MatCreateSNESMF ( snes_mhd, J_mf, ierpetsc )     
> c     
>       call SNESSetJacobian ( snes_mhd, J_mf, M_mhd,
>     @ SNESDefaultComputeJacobianColor, fdcoloring,
>     @ ierpetsc )
>  
> Has anyone any suggestions on what to do?
>  
> Kostas
-------------- 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/20140224/0e00573c/attachment-0001.pgp>


More information about the petsc-users mailing list