This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How do I initialize a MixedFunction

+3 votes

Hello,
I define the space W as:

V_q = VectorFunctionSpace(mesh,'CG',1)
V_T = FunctionSpace(mesh,'CG',1)
W = V_q*V_T

and a function qT as:

qT = Function(W)

How can I initialize the function qT ?

Thanks.

asked Jun 14, 2013 by micdup FEniCS User (1,120 points)
edited Jun 14, 2013 by johanhake

Can you be more specific on how you would like to initialize it?

With constant values.
Thanks

1 Answer

+4 votes
 
Best answer

You can do an interpolation of a Constant:

qT.interpolate(Constant((1,2,3)))

The above assumes you are in 2D.

answered Jun 14, 2013 by johanhake FEniCS Expert (22,480 points)
selected Jun 14, 2013 by Jan Blechta

Thank you very much.

...