Summation of preassembled matrices breaks dolfin-adjoint

Bug #1039635 reported by Simon Funke
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Consider the dolfin-consider/tests/supg example.
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.exceptions.LibadjointErrorInvalidInputs: Your matrix A has to have the .form attribute: was it assembled after from dolfin_adjoint import *?

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?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.