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:
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 )
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 )
c
call SNESSetJacobian ( snes_mhd, J_mf, M_mhd,
@ SNESDefaultComputeJacobianColor, fdcoloring,
@ ierpetsc )
Has anyone any suggestions on what to do?
Kostas
