Skip to content

Dof permutations for moment-based reffes#1306

Draft
JordiManyer wants to merge 16 commits into
masterfrom
moment-based
Draft

Dof permutations for moment-based reffes#1306
JordiManyer wants to merge 16 commits into
masterfrom
moment-based

Conversation

@JordiManyer

@JordiManyer JordiManyer commented May 24, 2026

Copy link
Copy Markdown
Member

The strategy:

  • New API get_basis_permutations(poly::Polytope, basis) that returns the permutations of the moment bases for a certain face polytope.
  • Then moment_face_own_dofs_permutations takes the moments and computes the complete set of permutations by combining the permutations of the moment bases on each face.

Details to figure out:

  • Not all bases are invariant through permutations. In particular, some of the bases used for the moments are not. This raises two questions:
    • Can we change the bases we use for RT/ND/... to use exclusively bases that are invariant under permutations?
    • Can we modify how we construct some of the current bases so that they are invariant under permutations?
    • For the bases which are NOT invariant under permutations, what do we return as the default? Right now I am returning the identity perm, but that will yield wrong results silently (which is bad).
  • Currently, the implementation only works for change_dof=false. In the case where change_dof=true, the final dofs do not correspond to the moments. I am not sure how to deal with this... Should the dof ownership be attached to the prebasis instead? No idea...
  • Currently I have place the permutations within the MomentBasedDofBasis. It was the simplest way to test things. I am open to reconsider its placement.

I have added a MWE for raviart-thomas on meshed with flipped edges. Right now, we have working: RT on simplices (TRI/TET). RT on QUAD/HEX could work if we changed the default basis to use Bernstein. ND currently depends on bases which are not permutation invariant.

I have also added a small driver that helps inspecting the bases permutations for each combination of polytope and basis. @Antoinemarteau

@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.52036% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.70%. Comparing base (d2ee905) to head (2a08996).

Files with missing lines Patch % Lines
src/ReferenceFEs/MomentBasedReferenceFEs.jl 86.90% 11 Missing ⚠️
src/ReferenceFEs/ReferenceFEInterfaces.jl 58.82% 7 Missing ⚠️
src/FESpaces/Pullbacks.jl 82.85% 6 Missing ⚠️
src/Adaptivity/MacroFEs.jl 0.00% 3 Missing ⚠️
src/ReferenceFEs/GeometricDecompositions.jl 50.00% 3 Missing ⚠️
src/ReferenceFEs/ExtrusionPolytopes.jl 97.67% 1 Missing ⚠️
src/ReferenceFEs/ModalScalarRefFEs.jl 80.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (d2ee905) and HEAD (2a08996). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (d2ee905) HEAD (2a08996)
unit-adaptivity 2 0
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1306      +/-   ##
==========================================
- Coverage   88.85%   80.70%   -8.16%     
==========================================
  Files         228      228              
  Lines       30197    30255      +58     
==========================================
- Hits        26832    24417    -2415     
- Misses       3365     5838    +2473     
Flag Coverage Δ
drivers 39.35% <64.70%> (-0.02%) ⬇️
extensions 4.82% <15.34%> (-0.18%) ⬇️
unit-adaptivity ?
unit-basics 14.24% <19.09%> (-0.15%) ⬇️
unit-celldata 20.65% <21.36%> (-0.18%) ⬇️
unit-fespaces-1 32.79% <74.66%> (+0.17%) ⬆️
unit-fespaces-2 39.09% <23.18%> (-0.23%) ⬇️
unit-fields 17.30% <22.27%> (-0.16%) ⬇️
unit-geometry 28.17% <20.45%> (-0.19%) ⬇️
unit-multifield 30.21% <21.81%> (-0.21%) ⬇️
unit-odes 28.12% <21.36%> (-0.18%) ⬇️
unit-referencefes 34.04% <70.90%> (+0.15%) ⬆️
unit-visualization 11.50% <20.45%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Antoinemarteau

Copy link
Copy Markdown
Collaborator

Update on this:

  • the get_basis_permutations(poly::Polytope, basis) API should be implemented for the elemental bases too (not only face moment basis) in order to solve the issue for change_dof=true
  • It is not possible to have "permutation" of all the vector-valued moment bases on simplicies, i.e. the moment bases of 3D Nédélec on TET of both kinds.
  • It should be possible for n-cubes basis, except D>=3 Serendipity of order >= 6 (you get a nontrivial barycentric basis on a square face..)
  • For bases that don't have a permutation, we need a face-wise change of basis matrix between the face basis. It can be stored in the ReferenceFE.
  • I would place the permutations in GenericRefFE, this would make more sense for change_dof=true (where perms are determined by shapefuns)

The implementation of these face wise changes is not that trivial, since currently the permutation info (face_own_dofs_permutations) is used in CellConformity "only", this only works because there are 1 - 1 relations (optionally signed) between dofs.
Once we need to apply (face-wise) changes of basis, which relate several dofs with each other, this has to be done in FESpaces/Pullback.jl, in compute_cell_bases_changes, in a consistent manner with how the CellConformity defines the global dofs.

Lastly, the permutation test driver needs to be updated for vector valued bases, since the correct Piola map needs to be applied when mapping the polynomials to the permuted face.

@Antoinemarteau

Copy link
Copy Markdown
Collaborator

Additional remarks:

  • since the validity of "permutations" of vector valued polynomial depend on the Piola maps, I expect that the get_basis_permutations needs to have an additional conf::Conformity argument in order to be implemented for CompWiseTensorPolyBasis and BarycentricyP(m)ΛBasis, similarly to the geometric decomposition APIs.
  • Since we'll have to implement those face-wise changes of bases, we can implement a general default numeric version that can glue any bases, as long as their trace spaces on a given face are the same.

They have better symmetry properties than Arnold's bases implemented by
BarycentricP(m)ΛBases
The basis r=0 now has a geometric meaning, since the basis form are
exterior products of barycentric coordinates gradients.
makes extrusion uniquely defined for polytopes of dimension up to 2.
- improved the algorithm for computation of D-cubes vertex permutations
  (from complexity factorial(2^D) to factorial(D)*2^D)
- back to setting all permutations by default in any dimension
- if permutation are not available (heterogeneous extrusions for D>=4),
  empty permutation vector is set with a warning ( no wrong values )
- hard coded permutations for WEDGE and PYRAMID

I tried to implement a valid permutation test, but it's not easy for
extrusion polytopes with a TET_AXIS, since the map associated to the
permutation is not isometric (it stretches the polytope a bit), so the
previous det(J(cmap))==1 test isn't valid. It is not enough to check
that the facet vertices are planar either, since all QUAD permutations would
verify that.
moment-based reffe's dof permutations moved in the
GenericRefFE.face_own_dofs_permutations field.

this paves the way to implement dof permutations for change_dof = true

Also, we should probably move nodal reffes dof permutation in there too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants