UFL

Replacing derivative coefficients fail (since recently)

Bug #920674 reported by Marie Rognes
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UFL
Fix Released
High
Martin Sandve Alnæs

Bug Description

This snippet

--
from ufl import *

V = FiniteElement("CG", triangle, 1)
u = Coefficient(V)
g = Coefficient(V)
J = inner(u, u)*dx
a = derivative(J, u)
G = replace(a, {u:g})
--

gives this error

--
Applying replace with arguments among derivative coefficients is not correctly implemented.
Traceback (most recent call last):
  File "foo.py", line 8, in <module>
    G = replace(a, {u:g})
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 890, in replace
    return apply_transformer(e, Replacer(mapping2))
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 867, in apply_transformer
    return transform_integrands(e, _transform)
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 842, in transform_integrands
    integrand = transform(itg.integrand())
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 866, in _transform
    return transformer.visit(expr)
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 160, in visit
    r = h(o)
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 284, in coefficient_derivative
    error("Applying replace with arguments among derivative coefficients is not correctly implemented.")
  File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/log.py", line 148, in error
    raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Applying replace with arguments among derivative coefficients is not correctly implemented.
--

This error seems to have been put in last week. The functionality is sorely missed though. Is a fix planned?

Revision history for this message
Martin Sandve Alnæs (martinal) wrote : Re: [Bug 920674] [NEW] Replacing derivative coefficients fail (since recently)
Download full text (4.4 KiB)

I added this to protect against another bug. It may not be a problem in your case, maybe we can adjust the error check a bit.

Martin

Den 23. jan. 2012 kl. 22:38 skrev Marie Rognes <email address hidden>:

> Public bug reported:
>
>
> This snippet
>
> --
> from ufl import *
>
> V = FiniteElement("CG", triangle, 1)
> u = Coefficient(V)
> g = Coefficient(V)
> J = inner(u, u)*dx
> a = derivative(J, u)
> G = replace(a, {u:g})
> --
>
> gives this error
>
> --
> Applying replace with arguments among derivative coefficients is not correctly implemented.
> Traceback (most recent call last):
> File "foo.py", line 8, in <module>
> G = replace(a, {u:g})
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 890, in replace
> return apply_transformer(e, Replacer(mapping2))
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 867, in apply_transformer
> return transform_integrands(e, _transform)
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 842, in transform_integrands
> integrand = transform(itg.integrand())
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 866, in _transform
> return transformer.visit(expr)
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 160, in visit
> r = h(o)
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 284, in coefficient_derivative
> error("Applying replace with arguments among derivative coefficients is not correctly implemented.")
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/log.py", line 148, in error
> raise self._exception_type(self._format_raw(*message))
> ufl.log.UFLException: Applying replace with arguments among derivative coefficients is not correctly implemented.
> --
>
> This error seems to have been put in last week. The functionality is
> sorely missed though. Is a fix planned?
>
> ** Affects: ufl
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to FEniCS
> Project.
> https://bugs.launchpad.net/bugs/920674
>
> Title:
> Replacing derivative coefficients fail (since recently)
>
> Status in Unified Form Language:
> New
>
> Bug description:
>
> This snippet
>
> --
> from ufl import *
>
> V = FiniteElement("CG", triangle, 1)
> u = Coefficient(V)
> g = Coefficient(V)
> J = inner(u, u)*dx
> a = derivative(J, u)
> G = replace(a, {u:g})
> --
>
> gives this error
>
> --
> Applying replace with arguments among derivative coefficients is not correctly implemented.
> Traceback (most recent call last):
> File "foo.py", line 8, in <module>
> G = replace(a, {u:g})
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 890, in replace
> return apply_transformer(e, Replacer(mapping2))
> File "/home/meg/local/fenics/lib/python2.7/site-packages/ufl/algorithms/transformations.py", line 867, in apply_transformer
> r...

Read more...

Revision history for this message
Patrick Farrell (pefarrell) wrote :

Marie asked me to test r1276 of ufl -- it fixes the problem nicely. Thanks!

Changed in ufl:
status: New → Fix Committed
importance: Undecided → Medium
importance: Medium → High
Changed in ufl:
milestone: none → 1.1.0-alpha
assignee: nobody → Martin Sandve Alnæs (martinal)
Changed in ufl:
status: Fix Committed → Fix Released
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.