PETSc error code 63 (argument out of range)

My guess is that this has something to do with assembling a residual entirely on the boundary, since I only see ds measures in the definition of F1. Take a look at the following minimal example, which includes a possible solution:

from dolfin import *
mesh = UnitIntervalMesh(10)
V = FunctionSpace(mesh,"CG",1)

# Constrain all interior nodes:
bc = DirichletBC(V,Constant(0.0),"!(near(x[0],0.0)||near(x[0],1.0))",
                 "pointwise")

# Try to solve a variational problem on the boundary:
u = Function(V)
v = TestFunction(V)

# Causes error code 63 on its own:
residual = (u-1.0)*v*ds

# Fix:
residual += Constant(0.0)*u*v*dx

solve(residual==0,u,bcs=[bc,])
1 Like