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

Visualization of quadrature functions #286

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

Conversation

najlkin
Copy link
Contributor

@najlkin najlkin commented Jul 1, 2024

This PR adds support for visualization of quadratures (QuadratureFunction). They can be loaded from a file through the new command line argument -q or in a socket stream with the keyword quadrature (instead of solution). Two options of visualization are offered (which can be switched by Q key):

  • Piece-wise constant function on a refined mesh (closed Gauss-Legendre refinement)
  • Discontinuous elements with DOFs collocated with the quadrature on the original mesh
  • L2 projection onto discontinuous elements

Note that high-order quadratures are supported only for tensor finite elements with the first two options.

TODO 📑 :

  • a key for switching
  • maintain consistency of quadrature / grid function
  • testing
    • 1D
    • vector
    • stream
    • animation
    • scripts
    • parallel
  • proper refinement (ClosedGL?)
  • check for tensor basis
  • README, CHANGELOG

@najlkin najlkin added this to the glvis-4.3 milestone Jul 1, 2024
@najlkin najlkin self-assigned this Jul 1, 2024
@najlkin najlkin mentioned this pull request Jul 1, 2024
17 tasks
@najlkin najlkin changed the title [WIP] Visualization of quadrature functions Visualization of quadrature functions Jul 9, 2024
@najlkin
Copy link
Contributor Author

najlkin commented Jul 9, 2024

Unfortunately, there is nothing for high-order quadratures on non-tensor elements. The number of DOFs matches for L2 elements, but the points are different. We would need some special basis for that in MFEM 🤔 .

@v-dobrev
Copy link
Member

v-dobrev commented Jul 9, 2024

Unfortunately, there is nothing for high-order quadratures on non-tensor elements. The number of DOFs matches for L2 elements, but the points are different. We would need some special basis for that in MFEM 🤔 .

Using the values at the quadrature points, one can compute a r.h.s vector for a local L2 projection on an appropriate L2 basis. There are probably multiple options for selecting the "appropriate" L2 basis. One possibility is to choose the order of the L2 basis based on the order of the quadrature rule -- e.g. if the quadrature rule is exact for polynomials of degree p, then we project on order p/2 basis -- this will ensure that we get invertible mass matrix if we use the same quadrature rule for the mass matrix as for the r.h.s.

@najlkin
Copy link
Contributor Author

najlkin commented Jul 9, 2024

Well, that would work for sure, but there are many different ways, as you say, so it is less of visualization and more of processing. It might introduce some oscillations and does not necessarily match the quadrature point-wise. Therefore, I am not sure we want that 🤔

@najlkin
Copy link
Contributor Author

najlkin commented Jul 10, 2024

Ok, you convinced me @v-dobrev , that was quick 😄 . I added L2 projection as another option, which is also the fallback for the other two when non-tensor elements are used. The order is the same as with that collocation, so the same number of points, which seems to me as the most logical. As the quadrature points and DOFs are close, the resulting grid function looks fine 😉 .

Comment on lines 147 to 148
- <kbd>Q</kbd> – Cycle between representations of the quadrature (piece-wise constant refined/L2 element dof collocation)
- <kbd>Q</kbd> – Cycle between representations of the quadrature (piece-wise constant refined
/ L2 element dof collocation / L2 element projection)
Copy link
Member

Choose a reason for hiding this comment

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

Wasn't Q supposed to close all GLVis windows? Or was that just an idea that never got implemented? @tzanio, do you remember?

Copy link
Member

Choose a reason for hiding this comment

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

Wasn't Q supposed to close all GLVis windows? Or was that just an idea that never got implemented? @tzanio, do you remember?

I don't think such a functionality was implemented.

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

Successfully merging this pull request may close these issues.

None yet

3 participants