Hello,
I am setting up a problem with MixElement()
of 2 functions, the Dirichlet BC only applies to only one of the functions (one that corresponds to P1
), how should I implement that? See the following code:
from dolfin import *
mesh = IntervalMesh(20, 0, 1)
P1 = FiniteElement("CG", mesh.ufl_cell(), 1)
P2 = FiniteElement("CG", mesh.ufl_cell(), 1)
element = MixedElement([P1,P2])
V = FunctionSpace(mesh, element)
def Dirichlet_Left(x, on_boundary):
return on_boundary and x[0] < DOLFIN_EPS
bc = DirichletBC(V, Constant(100.), Dirichlet_Left)
The last line gives this error:
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
*** fenics-support@googlegroups.com
*** 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: Expecting a vector-valued boundary value but given function is scalar.
*** Where: This error was encountered inside DirichletBC.cpp.
*** Process: 0
*** DOLFIN version: 2019.1.0
*** Git changeset: 15b823f2c45d3036b6af931284d0f8e3c77b6845
*** -------------------------------------------------------------------------