Konstantinos Kontzialis <[email protected]> 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

Attachment: pgpenjCzvipc7.pgp
Description: PGP signature

Reply via email to