Skip to content

BUG: Horizontal R space on tensor product element is not globally constant #5394

Open

Description

@ThighamOxford

Describe the bug
This is a bug only on the horizontal R space - not the vertical.

I would like to construct an element on a cuboid mesh that is a tensor product of R space and CG.

elt = TensorProductElement(FiniteElement("R", quadrilateral, 0),
FiniteElement("CG", interval, p))
M = FunctionSpace(mesh, elt)

This TensorProductElement treats the R space as a per-cell discontinuous constant.

Steps to Reproduce
The following code compares the actual number of DOFS for this TensorProductElement to the expected DOFs (P*Layers + 1 when CG^P is in the extrusion direction and R in the horizontal direction).

We only extrude in 2 layers for each example so the number of DOFs coming from CG should not change. If the R space works correctly then increasing the resolution of the base mesh should not change the number of DOFs.

from firedrake import *
P = 2
LAYERS = 2
EXPECTED = P * LAYERS + 1
print(f"{'nx,ny':>8} {'base cells':>11} {'R (x) CG':>10} {'DQ0 (x) CG':>11} {'expected':>9}")

for n in (1, 2, 3, 4):
    base = UnitSquareMesh(n, n, quadrilateral=True)
    mesh = ExtrudedMesh(base, layers=LAYERS, layer_height=1.0 / LAYERS)

    cg_v = FiniteElement("CG", interval, P)
    r_elt = TensorProductElement(FiniteElement("R", quadrilateral, 0), cg_v)
    dq_elt = TensorProductElement(FiniteElement("DQ", quadrilateral, 0), cg_v)

    dim_r = FunctionSpace(mesh, r_elt).dim()
    dim_dq = FunctionSpace(mesh, dq_elt).dim()

    print(f"{f'{n},{n}':>8} {n*n:>11} {dim_r:>10} {dim_dq:>11} {EXPECTED:>9}")

Expected behavior
I expect every example R \times CG example in the above to have 5 DOFs.

Environment:

  • OS: MACOS
  • Python version: 3.14.6

Activity

  1. changed the title [-]BUG: R space on tensor product element is not globally constant[/-] [+]BUG: Horizontal R space on tensor product element is not globally constant[/+] on Aug 27, 2026
  2. connorjward commented on Aug 27, 2026

    @connorjward
    Contributor

    I could be wrong but I don't think we support tensor products with R with the R space over the bash mesh.

  3. connorjward commented on Aug 27, 2026

    @connorjward
    Contributor

    It should be a fairly straightforward addition post pyop3 though...

  4. ThighamOxford commented on Aug 27, 2026

    @ThighamOxford
    CollaboratorAuthor

    Do you mean base mesh? If so I agree. Is implementing this something that would work in pyop2 or not?

  5. connorjward commented on Aug 27, 2026

    @connorjward
    Contributor

    Do you mean base mesh? If so I agree. Is implementing this something that would work in pyop2 or not?

    In PyOP2 this would be a complete nightmare.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions