[petsc-users] Save images of ksp_monitor and ksp_view_eigenvaluses with user defined names

Barry Smith bsmith at petsc.dev
Wed Feb 8 15:35:25 CST 2023


   It cannot be done using the default X windows monitor and -draw_save because there is no way to distinguish the files for each sub window images.

   However, there is an alternative. 

   -ksp_view_eigenvalues draw:image:jeff.ppm -viewer_view -ksp_monitor_solution draw:image:joe.ppm

  This alternative only supports .ppm files (so you may need to call a converter on the result) and does put each image in a separate file in its own named directory, for example, joe/joe_0.ppm  but at least it allows you to have different named files. Of course you can also just run your code twice with two different options.

   Unfortunately there is a bug in the KSP eigenmonitor viewing that I had to fix to get this to work so you'll need to checkout the barry/2023-02-08/fix-ksp-monitor-eigenvalues-draw branch of PETSc to use the option I suggest.

  Barry


   

> On Feb 8, 2023, at 5:09 AM, Zongze Yang <yangzongze at gmail.com> wrote:
> 
> Hi, PETSc group,
> 
> I was trying to save figures of the residual and eigenvalues with different names but not default names.
> 
> The default name is used when I use `-draw_save .png`. All images are saved.
> ```
> python test.py -N 16 -test1_ksp_type gmres -test1_pc_type jacobi -test1_ksp_view_eigenvalues draw -test1_ksp_monitor draw::draw_lg -draw_save .png
> ```
> But when I use `-draw_save abc.png`, only the figure of eigenvalues is saved.
> ```
> python test.py -N 16 -test1_ksp_type gmres -test1_pc_type jacobi -test1_ksp_view_eigenvalues draw -test1_ksp_monitor draw::draw_lg -draw_save .png
> ```
> 
>  How can I add the command line options, to specify different names for those images?
> 
> Thanks,
> Zongze

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


More information about the petsc-users mailing list