u in u.function_space() returns False
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
Fix Released
|
Critical
|
Johan Hake |
Bug Description
Script to reproduce with debugging prints
from dolfin import *
mesh = UnitSquare(3,3)
U = FunctionSpace(mesh, "CG", 1)
V = FunctionSpace(mesh, "DG", 0)
W = FunctionSpace(mesh, "CG", 1)
M = MixedFunctionSp
uvw = Function(M)
u, v, w = split(uvw)
L = dot(uvw,uvw)*dx
L_F = derivative(L, uvw)
L_J = derivative(L_F, uvw)
if 1:
print
print 'uvw'
print str(uvw.
print repr(uvw.
print
print 'M'
print str(M)
print repr(M)
print
solve(L_J == -L_F, uvw)
Output when running:
uvw
<Function space of dimension 50 (<Mixed element: (<CG1 on a <triangle cell in R2>>, <DG0 on a <triangle cell in R2>>, <CG1 on a <triangle cell in R2>>)>)>
<dolfin.
M
<Function space of dimension 50 (<Mixed element: (<CG1 on a <triangle cell in R2>>, <DG0 on a <triangle cell in R2>>, <CG1 on a <triangle cell in R2>>)>)>
<dolfin.
Traceback (most recent call last):
File "bug.py", line 27, in <module>
solve(L_J == -L_F, uvw)
File "/home/
_solve_
File "/home/
form_
File "/home/
cpp.
File "/home/
_cpp.
RuntimeError:
*** -------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** https:/
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------
*** Error: Unable to define linear variational problem a(u, v) = L(v) for all v.
*** Reason: Expecting the solution variable u to be a member of the trial space.
*** Where: This error was encountered inside LinearVariation
*** -------
Related branches
summary: |
- In Python, Function(M).function_space() is incompatible with M, triggers - assertion in LinearVariationalProblem + In Python, Function(M).function_space() is incompatible with + MixedFunctionSpace M, triggers assertion in LinearVariationalProblem |
Changed in dolfin: | |
status: | New → Fix Committed |
assignee: | nobody → Johan Hake (johan-hake) |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
Much simplified test:
from dolfin import *
mesh = UnitSquare(3,3)
U = FunctionSpace(mesh, "CG", 1) ace([U, V])
V = FunctionSpace(mesh, "DG", 0)
M = MixedFunctionSp
u = Function(M)
print u in M # True
print u in u.function_space() # False!