Also note that MatShell is _exactly_ the same as the CVODE interface. It is
just a wrapper for that function pointer so that we do not need to change
the top-level interface.

  Thanks,

      Matt

On Tue, Jul 8, 2025 at 2:10 AM Jed Brown <j...@jedbrown.org> wrote:

> Using MatShell is the standard method. Note that MatShell allows exposing
> other "matrix operations", such as producing a diagonal or other
> preconditioning ingredients.
>
> Art <mac3...@gmail.com> writes:
>
> > Hi all,
> >
> > I am integrating a stiff system of ODEs/PDEs using PETSc TS (typically
> with
> > BDF or other implicit time-stepping schemes), and I would like to exploit
> > the fact that I can efficiently compute the action of the Jacobian on a
> > vector (Jv) without assembling the full Jacobian matrix. Since for a
> large
> > system it becomes expensive to assemble the Jacobian in each iteration.
> In
> > scikits.odes (SUNDIALS/CVODE), there is a native API for passing only a
> J*v
> > routine to the time integrator. In my experience, when I use only a
> > Jacobian-vector product routine (without assembling the full matrix), the
> > performance improves significantly for large systems. However, in PETSc
> TS,
> > the workflow seems more matrix-centric, and I have only found the
> > possibility to use MatShell for the Jacobian
> >
> > Is there a way to do something similar in PETSc TS (for BDF or other
> > implicit schemes)?
> >
> > Currently, I use the matrix-free Newton-Krylov method to approximate the
> > Jacobian and have adjusted the tolerances to achieve convergence, as
> > recommended by Barry. In that case, I obtain similar integration times
> > with scikits.odes CVODE without using the Jacobian times vector.
> >
> > Best regards,
> >
> > Art
>


-- 
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

https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ee4C66EMPaHUhn55k5ZDEY4tEPmxzmhPifOJHGQtd6NBISPZb8UlupQ3u-o3Vt7n7NjYikEhGokM92hphqtq$
  
<https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ee4C66EMPaHUhn55k5ZDEY4tEPmxzmhPifOJHGQtd6NBISPZb8UlupQ3u-o3Vt7n7NjYikEhGokM90c1eT9N$
 >

Reply via email to