Skip to content

Moment based reffes #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 146 commits into
base: master
Choose a base branch
from
Draft

Moment based reffes #1048

wants to merge 146 commits into from

Conversation

JordiManyer
Copy link
Member

@JordiManyer JordiManyer commented Nov 8, 2024

So we've been having a look at the current implementation of Raviart-Thomas and Nedelec. It has become clear that the current implementation

  • has issues with high-order, that have to do with how we choose our basis/prebasis when computing the moments.
  • has issues related to scaling in mixed formulations.
  • is outright wrong when using high-order approximations for the geometry.
  • is very hard to read, modify and extend.

Moreover, there has been interest lately in implementing more types of moment-based discretisations like Crouzeix-Raviart.

We believe the best way to solve all these issues at once is to create some extendable machinery to easily create moment-based FEs.

TODOs:

  • Create the moment-based machinery
  • Create the pullback machinery Pullbacks #1067
  • Replicate RT and ND in 2D/3D with oriented meshes
  • Replicate RT and ND in 2D/3D with non-oriented meshes
  • Benchmark against current implementations
  • Change of basis needs to be transposed and inverted on pushforward.

New RefFEs:

  • Crouzeix-Raviart
  • Hellan-Herrmann-Jhonson
  • Mardal-Tai-Winther
  • Arnold-Winther

Other: Polynomial bases

The solution to the first issue requires extending Jacobi-type polynomial bases. Although it could be done blindly, I think we could try to merge a lot of code together. In the future we might want to have even more basis of polynomials, which would require a lot of copied code.

@JordiManyer JordiManyer self-assigned this Nov 8, 2024
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 65.30461% with 934 lines in your changes missing coverage. Please review.

Project coverage is 86.01%. Comparing base (6db1059) to head (ee48f9f).
Report is 49 commits behind head on master.

Files with missing lines Patch % Lines
src/ReferenceFEs/deprecated/RaviartThomasRefFEs.jl 0.00% 266 Missing ⚠️
src/ReferenceFEs/deprecated/NedelecRefFEs.jl 0.00% 197 Missing ⚠️
src/FESpaces/deprecated/DivConformingFESpaces.jl 0.00% 94 Missing ⚠️
src/ReferenceFEs/deprecated/BDMRefFEs.jl 0.00% 87 Missing ⚠️
src/ReferenceFEs/MomentBasedReferenceFEs.jl 76.85% 56 Missing ⚠️
src/ReferenceFEs/AWRefFEs.jl 0.00% 38 Missing ⚠️
src/ReferenceFEs/MTWRefFEs.jl 0.00% 30 Missing ⚠️
src/ReferenceFEs/HHJRefFEs.jl 0.00% 29 Missing ⚠️
src/ReferenceFEs/Pullbacks.jl 62.66% 28 Missing ⚠️
src/ReferenceFEs/CRRefFEs.jl 4.00% 24 Missing ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1048      +/-   ##
==========================================
- Coverage   89.35%   86.01%   -3.35%     
==========================================
  Files         197      212      +15     
  Lines       23916    24577     +661     
==========================================
- Hits        21370    21139     -231     
- Misses       2546     3438     +892     

☔ View full report in Codecov by Sentry.
📢 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 and others added 2 commits January 10, 2025 19:21
Moment based reffes: refactoring and extension of Gridap.Polynomials
@@ -197,6 +196,7 @@ export bdm
export nedelec
export bezier
export modalC0
export cr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we name Crouziex-Raviart reffename: crouziex_raviart = CrouziexRaviart() for clarity and consistency with raviart_thomas = RaviartThomas() ?

Copy link

@Jai-Tushar Jai-Tushar Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the literature, people just refer to it as "cr" just like "bdm". I would suggest that we should name "raviart_thomas" as "RT" instead, which is how people refer to it in the literature and probably modify "cr" to "CR" and "bdm" to "BDM".

Copy link
Member Author

@JordiManyer JordiManyer Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer longer names. CR, RT, ... could mean anything. If you start abbreviating you end up with fortran77 codes...
If a user doesn't know that CR means Crouziex-Raviart, maybe they should not be using it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: If you don't know what Raviart-Thomas is, you can google it. Going the other direction is not as easy.

Antoinemarteau and others added 27 commits January 24, 2025 15:42
and 1D Monomial basis optimization
de Casteljau indices and iteration needed to be computed and unrolled at compile
time
To really optimise this, the tuple of orders should be added in the type
parameters of the UniformPolyBases and CompWiseTensorPolyBases, in order
to avoid creating the Val(Kd) at runtime and associated runtime dispatch
into _evaluate_1d! (but this seems overkill for most usages)
renamed _ps_filter and _qs_filter to _ph_filter and _qh_filter
respectively, "h" for Homogeneous.
A dof basis \Sigma is a set of dofs \sigma, and a dof is in
V* = {\sigma: V -> R}, not in V** = { p: V* -> R}.
Removed the maximum order K from template parameters of PolynomialBasis
to simplify the type signature,
added the corresponding field to all concrete subtypes,
passed the order by Val to [...]_nd! functions to avoid allocations and
runtime dispatch in them (at each evaluation point)
added _get_static_parameters(::PolynomialBasis) to let each basis choose
their static parameter (Val(K), nothing, others...)
unfortunately _evaluate_nd! and friend do not specialize properly
when unpacking a tuple of Val in evaluate!

The parameters could also be put in cache, but then return_cache is not
independant of the polynomial order anymore (currently it is thanks to
_setsize! in evaluate!)
Fixed test coverage, fixed singular simplex detection, simplified
bernstein_term_id, updated NEWS.md.
Moment based reffes - Implementation of scalar Bernstein basis in barycentric coordinates.
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.

3 participants