Closed najlkin closed 4 months ago
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 🤔 .
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.
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 🤔
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 :wink: .
I think this is really awesome, thank you for adding it @najlkin! 👍
To speed-up my review: do you have a simple driver to define and visualize a quadrature function and/or sample quadrature function files?
To speed-up my review: do you have a simple driver to define and visualize a quadrature function and/or sample quadrature function files?
In ex1.cpp
, add:
QuadratureSpace qspace(&mesh, order);
QuadratureFunction qf(&qspace);
qf.ProjectGridFunction(x);
ofstream qf_ofs("sol.qf");
qf_ofs.precision(8);
qf.Save(qf_ofs);
and then in the visualization part instead of ...solution...
use: sol_sock << "quadrature\n" << mesh << qf << flush;
👍
Q
in the help messages printed by h
We have a bigger problem here, it cannot pass on Mac suddenly after just changing README and CHANGELOG 🙃
This is super cool!
Here are the three quadrature data visualization modes for Example 1p on star-q3.mesh
LOR | Interpolation | Projection |
---|---|---|
We have a bigger problem here, it cannot pass on Mac suddenly after just changing README and CHANGELOG 🙃
The CI is quirky, don't worry about it
Works in 3D, parallel, etc. too 😁
For the LOR case, is there some way to visualize mesh faces differently than internal LOR faces? Maybe draw only the mesh faces?
For the LOR case, is there some way to visualize mesh faces differently than internal LOR faces? Maybe draw only the mesh faces?
I agree that this will be nice, but I'm not sure it is feasible.
As an alternative, we can give the same element attribute to the LOR elements from the same parent and pull them apart in GLVis:
For the LOR case, is there some way to visualize mesh faces differently than internal LOR faces? Maybe draw only the mesh faces?
@vladotomov How it works internally is that it converts the quadrature function to grid function before the visualization happens, so there is no way how to do that currently, but it is true I store the original mesh (non-refined), so we could theoretically tunnel the original mesh to the visualization code for the mesh lines one day 😉 But I would not delay this PR and release because of that.
We have a bigger problem here, it cannot pass on Mac suddenly after just changing README and CHANGELOG 🙃
The CI is quirky, don't worry about it
If you look at the failing Mac screenshots at the bottom of https://github.com/GLVis/glvis/actions/runs/9980266401?pr=286, the zoom level appear a bit different. Maybe something changes in GitHub, but just to double-check: are we sure nothing changed with respect to zoom or keys handling that could cause this?
I do not believe so, nothing of that sort. Mainly, it was passing, I just changed README and CHANGELOG 😂 (Compare https://github.com/GLVis/glvis/pull/286/commits/226fd1bafe50a2d8b50a1ef8a93a76be607cc8ab and https://github.com/GLVis/glvis/pull/286/commits/597a94479daebdc8e5aa9a7cc5812c4eec78bde6)
It could be a change in GitHub's mac version or something.
Just to triple-check, can you try some of the tests from https://github.com/GLVis/data/tree/53fbee222cceb0581122cb72518bfc1b85766b4e with master and this PR and make sure the images are the same size?
I do not have a Mac and on Ubuntu it passes.
And now someone tell me how a text file can break a code on Mac and only with CMake 😂
Btw, I am close to implementing that @vladotomov 's suggestion. The difficult part was not the tunneling the mesh, but mixing the meshes together in 2D, where the surface is lifted by the values on the refined mesh, but I have solved that. So like in an hour I may have it 😉 .
Looks like https://github.com/GLVis/glvis/pull/286/commits/f25e99eb03776702991b9d88ac95cb44a1282c61 fixed the CI
Here is the above picture with the mesh drawn as @vladotomov suggested
I like the latest changes @najlkin, re-approving 👍
Wait for 3D 😮 😎
Looks very cool! Just curious, is there a way to toggle back and forth between quadrature function / grid function or is it one or the other? I naively tried doing both but it didn't like that.
./glvis -np 8 -m ../mfem-parallel/examples/mesh -g ../mfem-parallel/examples/sol -q ../mfem-parallel/examples/sol_qf
I see a lot of nice refactoring work here too like with the enum
:).
Nice to hear @justinlaughlin , you need to choose what you want to visualize - a grid function or quadrature function. If you have a bit of time, please test different options, like dimensions, vector/scalar, shadings, ...
Ok, I think I am done 🙌 . There is 3D scalar/vector visualization of original quadrature mesh lines, including element-wise cutting plane (cplane=2
) 😉 Flat cutting plane (cplane=1
) would be difficult and I will leave it for some other day.
Nice to hear @justinlaughlin , you need to choose what you want to visualize - a grid function or quadrature function. If you have a bit of time, please test different options, like dimensions, vector/scalar, shadings, ...
Forgot to mention I tried some things using ex1: different meshes, mesh refinement, function space order, serial/parallel, shadings, stream/command line; I saw no issues. I can test it out more but it would be next week. Looks good to me!
oh, forgot to mention I tested on WSL2 ubuntu 20.04
Very cool, thanks @najlkin!!
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 keywordquadrature
(instead ofsolution
). Two options of visualization are offered (which can be switched byQ
key):Note that high-order quadratures are supported only for tensor finite elements with the first two options.
TODO 📑 :