This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Limit to Mesh Size and KSPSolve

0 votes

Hi,

The script below (a simple poisson script) runs for me if I set 'n' to less than 45 (n is the number of mesh points in a given direction). However, if I set it to, say, 50, the program crashes with the error

"Unable to successfully call PETSc function 'KSPSolve'."

If I run the script in prallel, however, there is no error (presumably because the mesh is distributed over multiple cores).

Is this error due to my computer resources? Can anyone else run the script in serial with n set to 50?

from dolfin import *

# Create mesh and define function space
n = 50
mesh = BoxMesh(-10,-10,-10,10,10,10,n,n,n)
V = FunctionSpace(mesh, "Lagrange", 1)

# Define Dirichlet boundary (x = 0 or x = 1)
def boundary(x, on_boundary):
        return on_boundary

# Define boundary condition
u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundary)

# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
g = Expression("sin(5*x[0])")
a = inner(grad(u), grad(v))*dx
L = f*v*dx + g*v*ds

# Compute solution
u = Function(V)
solve(a == L, u, bc)
asked Sep 17, 2014 by sixtysymbols FEniCS User (2,280 points)
edited Sep 19, 2014 by Garth N. Wells

1 Answer

+4 votes
 
Best answer

I get the same error for n=50, however, I also see this message in the error output:

UMFPACK V5.6.2 (Apr 25, 2013): ERROR: out of memory

This problem has been addressed several times before, for instance here and here. Using mumps as the linear solver fixes the problem for me:

solve(a == L, u, bc, solver_parameters={'linear_solver': 'mumps'})
answered Sep 18, 2014 by johannr FEniCS Expert (17,350 points)
selected Sep 18, 2014 by sixtysymbols
...