firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
498 stars 157 forks source link

matrix_free/operators.py AttributeError #1658

Closed AndrewLister-STFC closed 3 years ago

AndrewLister-STFC commented 4 years ago

I am getting the following error when trying to run a solve on a problem with no dirichlet boundaries:

Traceback (most recent call last):
  File "libpetsc4py/libpetsc4py.pyx", line 879, in libpetsc4py.MatMultTranspose_Python
  File "/home/alister/firedrake/src/firedrake/firedrake/matrix_free/operators.py", line 252, in multTranspose
    self._xbc.dat.zero()
AttributeError: 'ImplicitMatrixContext' object has no attribute '_xbc'

This in turn causes the solve to fail:

  File "/home/alister/firedrake/src/firedrake/firedrake/adjoint/variational_solver.py", line 55, in wrapper
    out = solve(self, **kwargs)
  File "/home/alister/firedrake/src/firedrake/firedrake/variational_solver.py", line 271, in solve
    solving_utils.check_snes_convergence(self.snes)
  File "/home/alister/firedrake/src/firedrake/firedrake/solving_utils.py", line 44, in check_snes_convergence
    %s""" % (snes.getIterationNumber(), msg))
firedrake.exceptions.ConvergenceError: Nonlinear solve failed to converge after 0 nonlinear iterations.
Reason:
   DIVERGED_LOCAL_MIN

It looks like _xbc is only defined when there are dirichlet bounds. (Although I'm not sure if that means the multTranspose function should be inaccessable?).

Any help would be greatly appreciated.

wence- commented 4 years ago

Sorry for the slow response, this looks like a bug. @ksagiyam this is your code, could you take a look?

ksagiyam commented 4 years ago

@AndrewLister-STFC Sorry for the late. I attempted to fix this on fix_mat_transpose branch. Could you try using this branch, or could you give us a failing example that illustrate your problem? Thanks.

wence- commented 4 years ago

Was that fix ever merged?

wence- commented 3 years ago

This was fixed by #1833.