Interpolating between different meshes fails
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
Fix Released
|
High
|
Anders Logg |
Bug Description
When I attempt to interpolate between different meshes, I get completely erroneous results. The following example demonstrates this:
from dolfin import *
mesh1 = UnitSquare(8, 8)
mesh2 = UnitSquare(16, 16)
V1 = FunctionSpace(
V2 = FunctionSpace(
f1 = Function(V1, "500.0 * exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
f1.interpolate()
f2 = interpolate(f1, V2)
plot(f1, title="Original function")
plot(f2, title="Interpolated function")
interactive()
Furthermore, when I comment out f1.interpolate(), i.e. keep it defined as an expression, I do not run into this problem. A workaround (as suggested by Anders) for this seems to be to comment out data._ufc_cell = &cell; from dolfin/
Changed in dolfin: | |
status: | New → Confirmed |
Changed in dolfin: | |
assignee: | nobody → logg (logg) |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
Changed in dolfin: | |
status: | Fix Released → Fix Committed |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
This is problem exists in the c++ version as well.
It's actually critical for some codes I'm writing where I need to interpolate to a submesh.
Everything worked up to revision 6870, and I suspect it's related to putting ufc_cell into data (as is suggested by the workaround in the original bug report).