- edited description
Weird Test-Functions on Triple Mixed Spaces
Dear all,
If I define a triple mixed function space, similar to a Taylor-Hood discretization but P2, P1, P2, e.g.
V2 = VectorElement("CG", mesh.ufl_cell(), 2)
S1 = FiniteElement("CG", mesh.ufl_cell(), 1)
TH2 = V2*S1*V2
F2 = FunctionSpace(mesh, TH2)
v = TestFunctions(F2)
I think it's natural to assume the Test Functions v should follow the components of V2, S1, V2, e.g. be a 3 component list consisting of (in 2D:)
1) 2 element UFL list tensor [[v_0[0], v_0[1]]
2) 1 UFL indexed v_0[2]
3) 2 element UFL list tensor [v_0[3], v_0[4]]
But in the current dev version, I am getting as a return a 2 component list consisting of
1) 3 element UFL list tensor [v_0[0], v_0[1], v_0[2]]
2) 2 element UFL list tensor [v_0[3], v_0[4]]
so, the test functions do not adhere the grouping of the desired function space, which seems rather weird.
As a consequence of this, the command
(u,q,w) = v.split()
seems no longer to be working...
A minimal example is attached.
Comments (9)
-
reporter -
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
This issue is old and cannot really be resolved as Python does not (to my knowledge) distinguish between
V*V*V
and(V*V) * V
, even though the intention of the programmer can be quite different ... (see e.g the old answer https://answers.launchpad.net/dolfin/+question/164237 )The current best way to accomplish what you want is to use MixedElement, see e.g https://bitbucket.org/trlandet/ocellaris/src/cc8facdba1071a767dee6e8b264dfb649c0c2ac9/ocellaris/solver_parts/bdm.py?at=master&fileviewer=file-view-default#bdm.py-40
-
reporter Ah! The approach using MixedElements indeed works flawlessly! Thanks!
-
- changed status to invalid
- Log in to comment