merge scalar functions into vector-valued function

Asked by Nico Schlömer on 2013-05-07

I've got a function u in V=FunctionSpace(mesh, 'CG', 2) that I'd like to concatenate with Constant(0.0) to retrieve a function in V*V (or an Expression that I can do inner(..., v) --v in V*V-- with, anyhow).
How to do that?

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Blechta
Solved:
2013-05-09
Last query:
2013-05-09
Last reply:
2013-05-07
Best Jan Blechta (blechta) said : #1

Do a projection:

u1 = Function(V)
u2 = Constant(0.0)

W = V*V
w_trial, w_test = TrialFunction(W), TestFunction(W)
v1, v2 = TestFunctions(W)

a = inner(w_trial, w_test)*dx
L = u1*v1*dx + u2*v2*dx

w = Function(W)
solve(a==L, w)

Or you can somehow fiddle with dofs.

Note that assignment to subfunction is still open blueprint.

Nico Schlömer (nschloe) said : #2

Thanks Jan Blechta, that solved my question.