dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17146
Re: [Question #95908]: Error: Invalid value rank for coefficient 1
Question #95908 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/95908
Status: Open => Answered
Anders Logg proposed the following answer:
On Tue, Jan 05, 2010 at 08:13:37AM -0000, Phil Marinier wrote:
> Question #95908 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/95908
>
> Status: Solved => Open
>
> Phil Marinier is still having a problem:
> So I just finished thinking through some of the consequences of not
> being able to use vector valued Functions. I am trying to assign
> gradients to a Neumann boundary condition. Basic I'm doing a domain
> decomposition approach and I need to be able to calculate the gradients
> after each iteration, average them out and reapply them as Neumann BCs
> for the next iteration. I am also doing stuff on another boundary but
> its all Dirichlet conditions. I defined my FunctionSpace and neumann
> conditions like so:
>
> element = FiniteElement("Lagrange", triangle, 1)
>
> v = TestFunction(element)
> u = TrialFunction(element)
> f = Function(element)
> g = Function(element)
>
> a = inner(grad(v), grad(u))*dx
> L = v*f*dx + v*g*ds(3)
>
> where g is going to be my Neumann condition. In my code, I am currently
> trying to assign a Function with 2 subfunctions (X and Y) to g
>
> L.g = FunctionWith2SubFunctions
>
> This should work, assuming the function with 2 subfunctions is defined
> on the same FunctionSpace as L. But if I don't use vecotr values
> elements, will dolfin know that the 2 SubFunctions are the X and Y
> values? If my understanding of how things work is right, then dolfin
> will get confused and either run wrong, or blow up.
>
> Can I define 2 Neumann conditions, X and Y on the same boundary? If so
> should I mark them differently? by this I mean should I do this:
>
> L = v*f*dx + v*g*ds(2) + v*h*ds(3)
>
> but mark the same boundary as both 2 and 3? Can this even be done in
> dolfin?
>
> Thank you for your help.
>
> Phil
In your above examples, g is scalar-valued since you have defined it
by
g = Function(element)
and element is a scalar element.
Then you can't assign L.g = something vector-valued.
--
Anders
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.