[petsc-users] Matrix-free TS

Zhang, Hong hongzhang at anl.gov
Mon Mar 27 16:47:17 CDT 2017


The Jacobian interface has the shift parameter which I think is the 'factor' you are looking for.

In the Jacobian function

IJacobian(TS ts,PetscReal time,Vec X,Vec Xdot,PetscReal shift,Mat A,Mat B,void *ctx)

you can save shift and time to your MatShell context, and later, use them in the shell matrix operations. For example,
the Jacobian of F in your case is dF/du+shift*dF/du_t.

As Barry indicated, you should not manually set this 'factor', it is determined internally by PETSc according to the time-stepping scheme you are using.

Hong (Mr.)

On Mar 27, 2017, at 12:56 PM, Amneet Bhalla <mail2amneet at gmail.com<mailto:mail2amneet at gmail.com>> wrote:


On Mon, Mar 27, 2017 at 10:42 AM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
1) sounds easier and matches your current code.

Great!

For matrix free TS, the form of F(t,u,u_t) =  rho u*_t - div ( sigma) as written  "on paper" and should not
contain time stepping factors like (1/2) that comes from CN?  Similarly for RHS = G(t,u). What about Jacobian of F (MATSHELL
to solve momentum eqn) --- should that contain these factors?


--
--Amneet




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170327/ec3d1a40/attachment.html>


More information about the petsc-users mailing list