# [petsc-users] Some questions about TS/examples/tutorials/ex13

Matthew Knepley knepley at gmail.com
Sat Dec 22 12:29:45 CST 2018

```On Sat, Dec 22, 2018 at 1:18 PM Sajid Ali via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hi,
>
> I have a few questions about ex13 from TS explaining how to solve the
> following PDE in 2D :
>
> u_t = uxx + uyy
>
> 1) Can I get a reference/explanation for how the RHSJacobian function is
> derived ?
>

Its Finite Differences, so maybe the Strikwerda book?

> 2) If the problem is linear, why is TSSetProblemType never set to
> TS_LINEAR?
>

That is the default.

> 3) Since this is just a 2D version of ex3, can't this be set up by only
> providing a function for the evaluation for TSSetRHSJacobian with the
> TSSetRHSFunction set to TSComputeRHSFunctionLinear ?
>

It could. This way, we could do a nonlinear perturbation if we wanted.

> If this is the case and a matrix could be written that equivalently states
> the problem as u_t = A(t)*u, then how would one make such a matrix A(t) ?
> (In essence, what I'm asking is how does petsc define 2D vectors. Would
> A(t) be the familiar block tridiagonal matrix ?)
>

This uses a DMDA, so it has that numbering.

> 4) In lines 153/154, why does the outer loop iterate over columns and the
> inner loop iterate over rows? Does this again have something to do with how
> petsc stores 2d vectors?
>

PETSc does not prescribe how you store them. We choose to do it this way
because it matched BLAS.

Thanks,

Matt

> Thank You,
> Sajid Ali
> Applied Physics
> Northwestern University
>

--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their