Hello,
I am trying to use non-conforming elements for my simulation on FEniCS (still the 2019.1.0 version), the Crouzeix-Raviart element in particular. Given a simple 2D square geometry and triangular mesh, after applying a Dirichlet boundary condition with constant values on all boundaries, the result does not look reasonable. I don’t understand if it is just because of the non-conforming elements, or due to something else that I didn’t catch. CG and DG elements have also been tested, but they all work well as expected.
The first snapshot is the u_x field with CR elements, and the second one is that with CG elements. The u_y field faces the same issue as well.
Any advice or insight would be much appreciated!
from dolfin import *
# Create mesh
L = 0.5e3
H = 0.5e3
Nx = 20
Ny = 20
mesh = RectangleMesh(Point(0., 0.), Point(L, H), Nx, Ny, "crossed")
# Define functions
V = VectorFunctionSpace(mesh, "CR", 1) # Function space for u
u = Function(V)
# Boundary conditions
boundary = CompiledSubDomain( "on_boundary")
bcb = DirichletBC(V, Constant((2, -2)), boundary, "geometric")
bcs = [bcb]
# Test BC
for bc in bcs:
bc.apply(u.vector())
file_results = XDMFFile("test_bc.xdmf")
u.rename("u", "displacement field")
file_results.write(u)