This indeed suggests that somewhere in your system you're using a `firedrake.function.Function` instead of a `firedrake_adjoint.types.function.Function`. You should indeed be using `from firedrake_adjoint import *`. Note that if you are using both firedrake and firedrake_adjoint imports (firedrake_adjoint currently doesn't seem to provide everything that firedrake provides), then the firedrake_adjoint import should be last. If your code spreads multiple modules, they all need to use the same firedrake_adjoint imports. You can check the type of the coefficients in your system with: print([type(c) for c in F.coefficients()]) Cheers Stephan On 08/03/18 20:57, Bock, Andreas wrote:
Hi,
After having installed `pyadjoint` by running `firedrake-update --install pyadjoint` I am getting `AttributeError: 'CoordinatelessFunction' object has no attribute 'block_variable'` on all calls to `solve` or `assemble` e.g.:
``` solve(F == 0, self.I, bcs=bcs) File "/home/bock/bin/firedrake/src/pyadjoint/fenics_adjoint/solving.py", line 28, in solve block = SolveBlock(*args, **kwargs) File "/home/bock/bin/firedrake/src/pyadjoint/fenics_adjoint/solving.py", line 112, in __init__ self.add_dependency(c.block_variable) File "/home/bock/bin/firedrake/src/firedrake/firedrake/function.py", line 275, in __getattr__ return getattr(self._data, name) AttributeError: 'CoordinatelessFunction' object has no attribute 'block_variable' ```
From the error above it seems that the constellation of my imports is incorrect, and that the (I believe) correct `Function` in firedrake_adjoint/types/function.py is not used. I have been playing around with different combinations of `from {firedrake_adjoint, pyadjoint} import *` without success.
Can you please point me in the direction of documentation that can help me modify my code to cater for the new change?
`firedrake-status`:
``` --------------------------------------------------------------------------- |Package |Branch |Revision |Modified | --------------------------------------------------------------------------- |COFFEE |master |5bb1b30 |False | |FInAT |master |ef12759 |False | |PyOP2 |master |8a918cfc |False | |fiat |master |4a201c7 |False | |firedrake |master |3cf27a5f |False | |h5py |firedrake |c1e4a81 |False | |libspatialindex |master |4768bf3 |True | |petsc |firedrake |3c589c124b|False | |petsc4py |firedrake |3f09f6d |False | |pyadjoint |master |89b15bd |False | |tsfc |master |e6882a1 |False | |ufl |master |bd0376da |False | --------------------------------------------------------------------------- ```
<mailto:firedrake%40imperial.ac.uk>
Best regards,
Andreas Bock
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake