[petsc-users] SNESSetUp
Mark F. Adams
mfadams at lbl.gov
Thu Oct 10 12:28:02 CDT 2013
>
> It seems like first, the (snes->vec_rhs == snes->vec_sol) test should be moved to SNESSolve where these are apparently set.
>
> This is not good enough since the next lines will fail if snes->vec_sol is NULL.
That's what I suggested below. I can test this now if you like.
Mark
> I think we do not to substitute vec_func for vec_sol, but
> we also need to move creation of the update vector since it must be the size of the solution. Will do it now.
>
> Matt
>
> Second can we use snes->vec_func instead of snes->vec_sol here? This would remove all dependance on vec_rhs and vec_sol in SNESSetup.
>
> Mark
>
> ! Extract global and local vectors from DM; then duplicate for remaining
> ! vectors that are the same types
> call MatGetVecs(solver%KKTmat,solver%xVec2,solver%bVec2,ierr)
> call VecDuplicate(solver%bVec2,solver%rVec2,ierr)
>
> call SNESSetDM(solver%snes,solver%da,ierr)
>
> ! call SNESSetApplicationContext(solver%snes,solver,ierr)
> ! call SNESSetApplicationContext(solver%snes,grid,ierr)
>
> ! Set function evaluation routine and vector
> call SNESSetFunction(solver%snes,solver%rVec2,FormFunction,solver,ierr)
>
> call SNESSetJacobian(solver%snes,solver%KKTmat,solver%KKTmat,FormJacobian,solver,ierr)
>
> ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> ! Customize nonlinear solver; set runtime options
> ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> ! Set runtime options (e.g., -snes_monitor -snes_rtol <rtol> -ksp_type <type>)
> call SNESSetFromOptions(solver%snes,ierr)
>
> call SNESSetUp(solver%snes,ierr) ! pre setup, same as (old) KSP
>
>
>
>
>
> --
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131010/c6fcdd88/attachment.html>
More information about the petsc-users
mailing list