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

"Pointwise" BC

0 votes

Hi,

When I specify a displacement field to be a quadratic function, FEnICS will automatically insert new nodal points for quadratic interpolation.
Does anybody know that the boundary condition using "pointwise" will automatically constraint those new nodes?

Thanks,

asked Jun 6, 2016 by lee FEniCS User (1,170 points)

1 Answer

0 votes

Hi, the answer is yes. This can be seen in the source code and also tested easily

from dolfin import *

mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, 'CG', 2)

bdry = CompiledSubDomain('near(x[0], 0)')
value = Expression('x[1]*(1-x[1])', degree=2)
bc = DirichletBC(V, value, bdry, method='pointwise')

# Set quadratic f to quad function
f = Function(V)
f.vector().zero()
bc.apply(f.vector())

# There should be zero error between f and prescribed value on the boundary
facet_f = FacetFunction('size_t', mesh, 0)
bdry.mark(facet_f, 1)
e = (f-value)**2*ds(domain=mesh, subdomain_data=facet_f, subdomain_id=1)

print assemble(e)
plot(f, interactive=True) 
answered Jun 11, 2016 by MiroK FEniCS Expert (80,920 points)
...