No convergence for Laplace equation with constant boundary?

Asked by Nikolaus Rath

Hello,

I'm just beginning to use FEniCS, and I think I'm struggling with some basics. As a trivial test problem, I have tried to solve Laplace's equation in a sphere with constant boundary conditions:

$ cat test.py
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import dolfin as df

ORDER=1

def u0_boundary(x, on_boundary):
    return on_boundary

mesh = df.UnitSphere(30)
V = df.FunctionSpace(mesh, 'Lagrange', ORDER)
u = df.TrialFunction(V)
v = df.TestFunction(V)
bc = df.DirichletBC(V, df.Constant('42'), u0_boundary)
a = df.inner(df.nabla_grad(u), df.nabla_grad(v)) * df.dx
L = df.Constant(0) * v * df.dx
psi = df.Function(V)
df.set_log_level(df.PROGRESS)
df.solve(a == L, psi, bc,
         solver_parameters = {'linear_solver': 'cg',
                              'preconditioner': 'ilu'})

However, this fails with

$ python test.py
Solving linear variational problem.
  Applying boundary conditions to linear system.
  Solving linear system of size 29791 x 29791 (PETSc Krylov solver).
  PETSc Krylov solver starting to solve 29791 x 29791 system.
Traceback (most recent call last):
  File "test.py", line 21, in <module>
    'preconditioner': 'ilu'})
  File "/usr/lib/python2.7/dist-packages/dolfin/fem/solving.py", line 250, in solve
    _solve_varproblem(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/dolfin/fem/solving.py", line 273, in _solve_varproblem
    solver.solve()
RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** https://answers.launchpad.net/dolfin
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 3 iterations (PETSc reason DIVERGED_INDEFINITE_PC, norm 2.779098e+03).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.
*** -------------------------------------------------------------------------

However, if I replace the boundary condition with 0 instead of 42, things seem to work.

Am I doing something wrong? Why isn't FEniCS finding the trivial solution with psi=42 everywhere?

Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

FEniCS no longer uses Launchpad for Questions & Answers. Please consult the documentation on the FEniCS web page for where and how to (re)post your question: http://fenicsproject.org/support/

Can you help with this problem?

Provide an answer of your own, or ask Nikolaus Rath for more information if necessary.

To post a message you must log in.