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

Periodic BC - Display function values at all nodes

+2 votes

Hello all,

after solving a PDE with periodic boundary conditions like in this tutorial Poisson equation with periodic boundary conditions , I need an array with all function values for computing displacements at all nodes.
Assuming, I've implemented the code in the tutorial on a UnitSquareMesh(3,3), I could add the line

u.vector().array()

which displays only 12 values, as the appropriate FunctionSpace is constrained. Is there a possibility to display all 16 values?

asked Feb 4, 2015 by puffin FEniCS Novice (440 points)

1 Answer

+2 votes

Hi, consider using interpolation

Vp = FunctionSpace(mesh, 'CG', 1, constrained_domain=PeriodicBoundary())
u = Function(Vp)  

# Unconstrained space
V = FunctionSpace(mesh, 'CG', 1)
v = interpolate(u, V)  # v has 'all' values
answered Feb 5, 2015 by MiroK FEniCS Expert (80,920 points)

Thank You, that solved my problem.

...