<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330033">
    <font face="Trebuchet MS">Thank you Matt and Barry!</font><br>
    <br>
    <div class="moz-cite-prefix">On 17/11/16 16:05, Barry Smith wrote:<br>
    </div>
    <blockquote
      cite="mid:A8A751ED-3321-4E0B-8932-80B42DA82057@mcs.anl.gov"
      type="cite">
      <pre wrap="">
   You can also call MatView(jac,PETSC_VIEWER_BINARY_WORLD); at the location where you compute the Jacobian based on the iteration number etc

</pre>
      <blockquote type="cite">
        <pre wrap="">On Nov 17, 2016, at 9:35 AM, Matthew Knepley <a class="moz-txt-link-rfc2396E" href="mailto:knepley@gmail.com"><knepley@gmail.com></a> wrote:

On Thu, Nov 17, 2016 at 8:32 AM, Robert Annewandter <a class="moz-txt-link-rfc2396E" href="mailto:robert.annewandter@opengosim.com"><robert.annewandter@opengosim.com></a> wrote:
Hi, 

Is there a way to fine tune '-ksp_view_mat binary' so it only gives me an output at a defined time? 

I'm implementing a Two-Stage Preconditioner for PFLOTRAN (a subsurface flow and transport simulator which uses PETsc). Currently I like to compare convergence of the preconditioning in PFLOTRAN against a prototyped version in MATLAB. In PFLOTRAN  I export the Jacobian, and residual before they get handed-over to PETsc, which get imported in MATLAB to do the Two-Stage Preconditioning. 

However, I know I can do exports closer to PETsc with the options '-ksp_view_mat binary' and '-ksp_view_rhs binary'. Unfortunately I get outputs for the whole simulation in one file, instead of only at a well-defined Newton-Raphson iteration (as done in PFLOTRAN). 

Is there a way to tell PETsc with above options when to export the Jacobian and residual?

Any pointers much appreciated!

It sounds like you could give the particular solve you want to look at a prefix:

  <a class="moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetOptionsPrefix.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetOptionsPrefix.html</a>

and then give

  -myprefix_ksp_view_mat binary

  Thanks,

     Matt
 
Thank you!
Robert



-- 
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
</pre>
      </blockquote>
      <pre wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>