site-packages/dolfin/fem/formmanipulations.py correctly insists on Function but is poorly documented

Issue #29 resolved
Nico Schlömer created an issue

When using derivative(F, u), Dolfin insists for u to be a Function. When looking at the code though, I see that the only factual requirement for u is to provide the .function_space() which is also the case for, e.g., TestFunction objects and maybe some others. This is how I got bugged by this: I provided a TestFunction and was disturbed by an error message and a "third argument" (?).

The derivative() method would profit from using the try-catch logic. Also, the error message must be improved, and the third argument better explained in the documentation.

Comments (9)

  1. Martin Sandve Alnæs

    1) Why would you want to pass a TestFunction? It would fail at the ufl level if dolfin allowed it.

    2) The "third argument" is du (see the signature), i.e. the variation: derivative(F, u, du) := d/dt F(u+t*du)|_t=0

    3) The documentation is bad. I consider this a documentation bug only.

  2. Nico Schlömer reporter

    1) Why would you want to pass a TestFunction? It would fail at the ufl level if dolfin allowed it.

    Ah, I thought it was whatever symbol is used in F to indicate the argument. -- I believe I don't quite understand the interface yet. Documentation++.

  3. Log in to comment