[petsc-users] Using Finite Difference Jacobian with TS

Barry Smith bsmith at petsc.dev
Wed Feb 2 17:17:34 CST 2022


  For a big matrix the asii output is slow (especially parallel)

  Yes, this view will be called automatically on all matrix when they are assembled so if you are assembling a bunch of matrices it will output them all.

  You can attach a unique prefix to the matrix PetscObjectSetPrefix() and then use -uniqueprefix_mat....

  You can use the binary format (faster) with -mat_view binary:ColFDJac.mat and use PetscBinaryRead() in Matlab share/petsc/matlab 

  You can use MatView() directly in your code with a binary PetscViewer on exactly the matrix you wish to save.

> On Feb 2, 2022, at 6:07 PM, Jorti, Zakariae via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Hello,
> 
> I am using a TS to solve a differential algebraic equation (DAE). 
> I do not provide the Jacobian matrix but instead set the TS to use a finite difference jacobian with coloring. 
> For debugging, I only solve this DAE on one time step.
> Is there a way to output this finite difference jacobian in a matlab format (.m file)?
> I have already tried this flag : -mat_view ascii:ColFDJac.m:ascii_matlab , but when I use it the test takes too long. My guess is that this flag  is trying to save all the matrices involved in the computations. I am  only interested in the jacobian though. 
> Thank you.
> 
> Best,
> 
> Zakariae

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


More information about the petsc-users mailing list