Dear developer,
I am using FEniCS to do mixed finite element case. There are five
element spaces in my case and the boundary conditions for space Vqp and Vu are
homogeneous Dirichlet condition. I define the BCs in my code like following way:
# Define function spaces
Vqp = VectorFunctionSpace(mesh, "CG", 2)
Vu = FunctionSpace(mesh, "CG", 2)
Vp = VectorFunctionSpace(mesh, "CG", 1)
Vr = FunctionSpace(mesh, "CG", 2)
Vy = VectorFunctionSpace(mesh, "CG", 1)
W = Vqp * Vu * Vp * Vr * Vy
# Define boundary conditions
u0 = Constant((0.0,0.0))
u1 = Constant(0.0)
bc0 = DirichletBC(W.sub(0), u0, "on_boundary")
bc1 = DirichletBC(W.sub(1), u1, "on_boundary")
# Collect boundary conditions
bcs = [bc0, bc1]
However, error occurred when my code is running. The detail error infos are
Traceback (most recent call last):
File "demo_stokes-taylorhood.py", line 49, in <module>
bc0 = DirichletBC(W.sub(0), u0, "on_boundary")
File
"/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/fem/bcs.py",
line 128, in __init__
cpp.DirichletBC.__init__(self, *args)
File
"/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/cpp/fem.py",
line 1140, in __init__
_fem.DirichletBC_swiginit(self,_fem.new_DirichletBC(*args))
RuntimeError:
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** [email protected]
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to create Dirichlet boundary condition.
*** Reason: Illegal value dimension (2), expecting (6).
*** Where: This error was encountered inside DirichletBC.cpp.
*** Process: unknown
I don’t know what caused this. Is there any wrong with my definition of BCs?
Looking forward to your reply. Thanks a lot.
Best wishes,
—Zheng
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics