Some PETSc parameters parsed from command line changes after plotting

Issue #512 invalid
Magne Nordaas created an issue

Tolerances for PETSc solvers parsed from command line are set to 1 after plotting. This issue also affects other double-valued parameters.

The following example reproduces the issue.

import sys
from dolfin import *
args = """
        --petsc.ksp_type cg
        --petsc.pc_type hypre
        --petsc.ksp_max_it 30
        --petsc.ksp_rtol 1.0e-8
        --petsc.ksp_atol 1.0e-10
"""
parameters.parse(argv = sys.argv[0:1] + args.split())
mesh = UnitSquareMesh(8,8)
V = FunctionSpace(mesh, 'CG', 1)
u, v = TrialFunction(V), TestFunction(V)
uh = Function(V); x = uh.vector()

a = inner(grad(u),grad(v))*dx + u*v * dx
L = v * dx

A, b = assemble_system(a, L)

solver = PETScKrylovSolver()

solver.solve(A, x, b)
solver.ksp().view()

plot(mesh)

solver.solve(A, x, b)
solver.ksp().view()

Prior to plotting, the tolerances are set correctly:

#!
  tolerances:  relative=1e-08, absolute=1e-10, divergence=10000

After plotting, the tolerances are set to 1.

#!
  tolerances:  relative=1, absolute=1, divergence=10000

Comments (4)

  1. Simon Funke

    I can reproduce it with PETSc 3.5.3 and DOLFIN master.

    simon@doodson /dataint/simon/src/fenics_master/dolfin git:master$ python bug.py | grep tolerances
      tolerances:  relative=1e-08, absolute=1e-10, divergence=10000
      tolerances:  relative=1, absolute=1, divergence=10000
    
  2. Log in to comment