Skip to content
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

Add demo of stokes with various stable pairs of finite elements #2505

Closed
wants to merge 13 commits into from

Conversation

juliusgh
Copy link
Contributor

@juliusgh juliusgh commented Jan 18, 2023

There is already a demo of the Stokes equations for the lid driven cavity scenario with Taylor-Hood elements: https://docs.fenicsproject.org/dolfinx/main/python/demos/demo_stokes.html

Based on this, I have created a demo using various stable pairs of finite elements. So far these are:

  1. $(\mathcal{P}_2, \mathcal{P}_1$): The Taylor-Hood element for $k=2$
  2. $(\mathcal{P}_1 + \mathcal{B}_3, \mathcal{P}_1)$: The MINI element
  3. $(\mathcal{P}_1^{\rm CR}, \mathcal{P}_0)$: The non-conforming Crouzeix-Raviart element
  4. $(\mathcal{P}_4, \mathcal{P}_3^{-1})$: The Scott-Vogelius element for $k=4$

With the MINI element, an enriched finite element is also used in a demo now. Such a demo was requested in #2312.
I think this demo would be helpful for beginners who want to try new finite elements.
Since this is my first contribution to dolfinx I would appreciate any feedback.

@mscroggs mscroggs linked an issue Jan 19, 2023 that may be closed by this pull request
@jhale
Copy link
Member

jhale commented Jan 19, 2023

I like this! My only comment would be that it would be good to show the lowest-order pressure-robust Scott-Vogelius finite element pair.

@jhale
Copy link
Member

jhale commented Jan 20, 2023

Thanks! The Scott-Vogelius element is only (provably) int-sup stable for k = 4 ( https://doi.org/10.1051/m2an/1985190101111) so I would propose using a higher-order for the demo.

@juliusgh
Copy link
Contributor Author

juliusgh commented Jan 20, 2023

Thank you for the feedback! I added the Scott-Vogelius element using the iterative procedure explained in the FEniCS book in chapter 20.3.
I am not completely sure about the reconstruction of the pressure field. Is there a built-in project function in DOLFINx like in DOLFIN? I could not find it so far and used the code from https://github.com/michalhabera/dolfiny/blob/master/dolfiny/projection.py instead.
In the meantime, I also noticed that the Scott-Vogelius element is not stable for $k<4$, since the iteration does not converge in this case.

@nate-sime
Copy link
Contributor

nate-sime commented Jan 27, 2023

@juliusgh
Copy link
Contributor Author

Does this demo exhibit any dolfinx functionality that's not already shown in other demos?

E.g. https://github.com/FEniCS/dolfinx/blob/main/python/demo/demo_lagrange_variants.py and https://github.com/FEniCS/dolfinx/blob/main/python/demo/demo_stokes.py?

The goal of this demo was to show an EnrichedElement in action, as requested in #2312. As far as I can tell, there is no demo that shows this yet. The MINI element for the Stokes equations is a simple example of this, which I think would be helpful for inexperienced DOLFINx users.

While the existing Stokes demo focuses on different algebraic solvers, different finite element types are compared here.

Also consider https://github.com/jorgensd/fenics22-tutorial/blob/main/comparing_elements.ipynb.

Thanks for the tip! I did not know this tutorial before. I think the convergence studies are very informative. I would love to extend this demo accordingly.

@nate-sime
Copy link
Contributor

For every demo added, there's a burden of maintenance for the developers. This demo only shows element enrichment which has overloaded the + operator which at a glance is about 3 of 529 lines. I vote for incorporating this into one of the existing demos if it's really required.

Otherwise I think the rest of the demo is an interesting report of various numerical methods which would be better hosted as part of a tutorial or personal portfolio.

@garth-wells
Copy link
Member

Remained open for some time, so closing.

@garth-wells garth-wells closed this Nov 8, 2023
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.

Add a demo using an EnrichedElement
4 participants