Unable to run with fenics 2016.2

Issue #66 resolved
Former user created an issue

Hello,

I updated my fenics version to 2016.2 and dolfin-adjoint is not running, I think because the deprecated function copy;

Here is the message from dolfin:

raise RuntimeError("Use 'Function.copy(deepcopy=True)' for copying.") RuntimeError: Use 'Function.copy(deepcopy=True)' for copying.

And the dolfin-adjoint code problem is placed at:

File "/usr/lib/python2.7/dist-packages/libadjoint/libadjoint.py", line 681, in cfunc output = self(dependencies, values) File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/adjrhs.py", line 196, in call u = backend.Function(ic)

Comments (2)

  1. Ricardo D. Lahuerta

    Sorry, I didn't login it.

    I was checking the dolfin code and the error occurs at DOLFIN / site-packages / dolfin / functions / function.py at line at line 262.

    *if isinstance(args[0], Function): other = args[0] if len(args) == 1: # Copy constructor used to be here raise RuntimeError("Use 'Function.copy(deepcopy=True)' for copying.")*

    But if replace at adjrhs.py line 196, it is possible to go little bit further

    #u = backend.Function(ic).copy() u = backend.Function(ic.function_space()) backend.assign(u, ic)

    and the error goes to:

    functional_value = self._substitute_form(adjointer, timestep, dependencies, values) File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/functional.py", line 253, in _substitute_form replace[term_dep] = deps[str(end)] KeyError: 'Displacement LC -1:0:2:Forward'

    I will continue be tracking the error...

  2. Simon Funke
    • edited description
    • changed status to resolved

    Hi Ricardo, do you use an up-to-date version of dolfin-adjoint? The lines 196 on adjrhs.py look different for me.

    Feel free to reopen this issue if needed.

  3. Log in to comment