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

Smith, Barry F. bsmith at mcs.anl.gov
Sat Dec 22 13:19:32 CST 2018



> On Dec 22, 2018, at 12:29 PM, Matthew Knepley via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> 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 ?)

   No, A(t) has five diagonals as indicated by the calls to MatSetValues() with five entries per row; they correspond to the usual 5 pt stencil in 2d.

> 
> 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 experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/



More information about the petsc-users mailing list