<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 29, 2017 at 11:17 AM, David Nolte <span dir="ltr"><<a href="mailto:dnolte@dim.uchile.cl" target="_blank">dnolte@dim.uchile.cl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
is it possible to use python's logging module<br>
(<a href="https://docs.python.org/2/howto/logging.html" rel="noreferrer" target="_blank">https://docs.python.org/2/<wbr>howto/logging.html</a>) to handle PETSc output in<br>
python, such as the residuals during a KSP/SNES solve?<br>
I log my solver's activity to a file using the logging module, it would<br>
be great to include the PETSc output aswell.<br></blockquote><div><br></div><div>I think the best way to do this is the following:</div><div><br></div><div>  1) Create a PetscViewer implementation, say PyASCII, that logs to the Python descriptor. This might be as easy as</div><div>      just augmenting the ASCII viewer to grab this descriptor on creation</div><div><br></div><div>  2) Then you can hook this viewer to the monitor using options</div><div><br></div><div>      -ksp_monitor pyascii</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Regards,<br>
David<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51/</a><br></div></div></div>
</div></div>