dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17866
Re: [Question #104471]: BCs in mixed space vector+scalar+scalar
Question #104471 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/104471
Status: Open => Answered
Johan Hake proposed the following answer:
Hello Chris!
When defining MixedFunction spaces with more than one component you should
use:
W = MixedFunctionSpace([V,Q,R])
The add operator in FunctionSpace returns a MixedFunctionSpace of its two
components, so
V+Q+R
would result in:
W = MixedFunctionSpace([MixedFunctionSpace([V,Q]),R])
Johan
On Monday 15 March 2010 14:13:12 Chris Richardson wrote:
> New question #104471 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/104471
>
> I want to solve for a vector and two scalars, and I have specified the
> FunctionSpace W intuitively correctly, but the BC complains that my
> dimension is incorrect (for the vector). What am I doing wrong?
>
> mesh=UnitSquare(10,10)
>
> V=VectorFunctionSpace(mesh,"CG",2)
> Q=FunctionSpace(mesh,"CG",1)
> R=FunctionSpace(mesh,"CG",1)
> W=V+Q+R
>
> def bound0(x):
> x[0]<DOLFIN_EPS
>
> v0=Constant((0.0,0.0))
>
> bc=DirichletBC(W.sub(0),v0,bound0)
>
>
> bc=DirichletBC(W.sub(0),v0,bound0)
> File "/usr/lib/python2.6/dist-packages/dolfin/mesh/bcs.py", line 56, in
> __init__ cpp.DirichletBC.__init__(self, *args)
> File "/usr/lib/python2.6/dist-packages/dolfin/cpp.py", line 9390, in
> __init__ _cpp.DirichletBC_swiginit(self,_cpp.new_DirichletBC(*args))
> RuntimeError: *** Error: Unable to create boundary condition. Reason:
> Illegal value 2 for value dimension, should be 3.
>
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.