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

Putting discrete non-collinear constraints on a function space.

0 votes

I am very new to FEniCS, and I am learning to use it by looking at the Python demos given in the package and extracting what I need. This question is solely about how I define a slightly altered function space.

Suppose that my domain is the unit square, and I define:

define boundary

def u0_boundary(x):
tol = DOLFIN_EPS
return abs(x[0]) < tol or \
abs(x[1]) < tol or \
abs(x[0] - 1) < tol or \
abs(x[1] - 1) < tol

Create mesh and define function space

mesh = UnitSquareMesh(MeshD,MeshD)

I previously used

V = FunctionSpace(mesh,'Lagrange',2)

This gave me a nice set of functions on this mesh.

Now, for the problem I want to solve I need to make a new function space in which I define the following three points:
{a_1} = (0,1/2), {a_2} = (1/2,0), {a_3} = (1,1/2).
I want to alter the above function space V such that I get V_0 where
V_0 = v in V such that v = 0 on a_i for i = 1, 2, 3.

This is what I'm trying to do. I hope there's an easy way to do so.

Thanks for all of your help.

asked Jun 8, 2015 by DRich186 FEniCS Novice (120 points)

1 Answer

0 votes

You can not enforce that in the finite element space.

If the points a_i are located at mesh vertices (and you are using lagrangian elements) then you could use a pointwise Dirichlet boundary condition.

For the more general case, you should use lagrangian multipliers (one for each constraint).

answered Jun 9, 2015 by umberto FEniCS User (6,440 points)

If I define by points a_i to be boundary vertices, and thus they will always be mesh vertices, then can I define the pointwise Dirichlet boundary condition on the function space? For instance will it work if I do

mesh = UnitSquareMesh(MeshD,MeshD)
V = FunctionSpace(mesh,'Lagrange',2)

a1 = CompiledSubDomain("near(0.0,0.0)")
a2 = CompiledSubDomain("near(0.5,1.0)")
a3 = CompiledSubDomain("near(1.0,0.0)")

bc1 = DirichletBC(V, u0, a1, "pointwise")
bc2 = DirichletBC(V, u0, a2, "pointwise")
bc3 = DirichletBC(V, u0, a2, "pointwise")

Then could I incorporate all three of those simultaneously into the solver, or would I have to define a Dirichlet condition that encompasses all three of those points so that the solver only handles one boundary condition?

Thanks

...