Question #109900 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/109900
Anders Logg proposed the following answer:
On Thu, May 06, 2010 at 02:52:33PM +0200, Marie Rognes wrote:
Achim Schroll wrote:
New question #109900 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/109900
for a plain Poisson eqn with pure Neumann b.c., how to specify
the scaling condition u*dx = 0 ?
If you have a recent dolfin, you can introduce a constant c acting
as a Lagrange multiplier corresponding to the constraint. See
example below.
from dolfin import *
mesh = UnitSquare(32, 32)
V = FunctionSpace(mesh, "CG", 1)
Q = FunctionSpace(mesh, "R", 0)
M = V * Q
(u, c) = TrialFunctions(M)
(v, d) = TestFunctions(M)
f = Expression("x[0]*x[1]*sin(pi*x[0])")
a = dot(grad(v), grad(u))*dx + d*u*dx + c*v*dx
L = v*f*dx
pde = VariationalProblem(a, L)
u_h = pde.solve()
plot(u_h[0])
interactive()
But make sure to not name that space 'M' if you try this with a UFL
file or you will get a strange error (since 'M' is reserved in form
files).
Anyway, I'm wondering about the dofmap for the "R" element. It sets
_global_dimension to m.num_entities[2] which is the global number of
cells, but then it maps all dofs to 0. Is that right? Shouldn't the
global dimension be 1?