Unset parameters should not be written to file

Issue #259 resolved
Corrado Maurini created an issue

The parameters profile and convergence_norm_type of PETScKrylovSolver are unset. This causes the following error when saving the parameters to a file:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to convert parameter to string .
*** Reason:  Parameter has not been set.
*** Where:   This error was encountered inside Parameter.cpp.
*** Process: unknown
*** 
*** DOLFIN version: 1.3.0+
*** Git changeset:  13c0b37b7fc8f69a6de0eb0df104838c9c7c49ff
*** -------------------------------------------------------------------------

A minimal example to reproduce the error:

tmp = PETScKrylovSolver()
p = tmp.parameters
info(p, True)
File("parameters.xml") << p

If I try to set the profile option, the solver does not work any more (it runs without giving error messages, but it does not perform any iteration).

Comments (10)

  1. Corrado Maurini reporter

    @garth-wells The most important part of the bug has been introduced here. Is there a rationale in this commit?

    Is it possible to revert to the previous version?

  2. Corrado Maurini reporter

    Yes, I think that unset parameters should be classified as a bug. The code snippet above saving the parameters to a file still gives the reported error. Below the output of PETScKrylovSolver default parameters. convergence_norm_type and profile should have default values.

      petsc_krylov_solver      |    type    value                         range  access  change
      -----------------------------------------------------------------------------------------
      absolute_tolerance       |  double    1e-15                            []       0       0
      convergence_norm_type    |  string  <unset>  [none, preconditioned, true]       0       0
      divergence_limit         |  double    10000                            []       0       0
      error_on_nonconvergence  |    bool     true                 {true, false}       0       0
      maximum_iterations       |     int    10000                            []       0       0
      monitor_convergence      |    bool    false                 {true, false}       0       0
      nonzero_initial_guess    |    bool    false                 {true, false}       0       0
      options_prefix           |  string  default                            []       0       0
      profile                  |    bool  <unset>                 {true, false}       0       0
      relative_tolerance       |  double    1e-06                            []       0       0
      report                   |    bool     true                 {true, false}       0       0
      use_petsc_cusp_hack      |    bool    false                 {true, false}       0       0
    
  3. Log in to comment