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)