Closed gmarkall closed 13 years ago
I see a potential problem here:
T
to be a TrialFunction
if it is a field we want to solve for (e.g. the field we define the UFL equation for)T
to be a Coefficient
otherwiseHave I got this right?
I think the idea is that it should be used like this (for a Poisson's equation example):
F = state.scalar_fields["SourceTerm"] # T is a Coefficient instance E = F.element() v = TestFunction(E) u = TrialFunction(E)
a = dot(grad(v),grad(u))_dx L = v_F*dx
soln = solve(a,L) state.scalar_fields["Solution"] = soln
I think this avoids the issue of whether it is a TrialFunction or a Coefficient, by explicitly getting the element of the field and using that to define Test and Trial Functions.
Change semantics of state.scalar_fields[] etc. to return a coefficient instead of an element. If you want the element, use T.element() (where T is the field from state) instead. That way, you can use T in a form.