How are (q,T) and qT related here ?
Pair (q,T)
is a view (shallow copy) into qT
unless you do
(q,T) = qT.split(deepcopy=True)
in which case q,T
have its own copies of vectors.
Does a modification of qT affect q and T and vice versa ?
In principle yes (in case of shallow copy).
How can this be done ?
In practice you can't access q.vector()
and T.vector()
for writing (in case of shallow copy). You can't either use q,T
in definition of forms (this can be done using qT[0], qT[1]
or split(qT)
), interpolatate or project to them. You can only q.assign(foo)
which will make q
a new function having no relation to qT
.
On the other hand one can do operations like
qT0 = Function(W)
q0,T0 = qT0.split()
u, v = TrialFunction(W), TestFunction(W)
proj_form = inner(u, v)*dx
r,U = TestFunctions(W)
qT = Function(W)
solve(proj_form == 42.0*q0*r*dx + 66.0*T0*U*dx, qT)