Summation of preassembled matrices breaks dolfin-adjoint
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dolfin-adjoint |
New
|
Undecided
|
Unassigned |
Bug Description
Consider the dolfin-
It preassembles the lhs of the system with:
A = assemble(a)
and uses it later in the solve command:
solver = LUSolver(A)
While this works, a simple variation breaks this test: Namely replacing the assembly part with:
A1 = assemble(a)
A = 2*A1
crashes with:
libadjoint.
The problem is that the new A object does not carry the "form" attribute anymore.
The dirty way to fix this is:
A1 = assemble(a)
A = 2*A1
A.form = 2*A1.form
A short term solution to this bug would be to moneky patch the Matrix objects in dolfin-adjoint so that it always carries the .form attribute with it.
Alternatively, we can submit a fix to dolfin I guess?