← Back to team overview

dolfin team mailing list archive

[Question #111370]: Initializing a function with two sub-functions

 

New question #111370 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/111370

Hello,

Is there a nice way to initialize a mixed element function with two of its sub-functions. Specifically,

element = FiniteElement("Lagrange", tetrahedron, 1)
vecElement = element + element
u = Coefficient(vecElement)

Now, in the code, I want to do this:

u[0] = func1
u[1] = func2

where func1 and func2 are functions of "element". I want to do this to initialize u in a newton solver. The above code doesnt copy the values to u's sub-functions. Another way of framing my question could be, given two subfunctions, how do I combine them into a mixed-function?

I can think of some workarounds, e.g. initializing the function "u" as a vector function using an Expression class, but thats not as clean a solution as I would like. I would like to initialize u, given two input functions which are scalar.

Thanks,
-Jehanzeb

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.