-
Notifications
You must be signed in to change notification settings - Fork 63
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
Adds notebook to plot MFEM dofs and quadrature points #72
Adds notebook to plot MFEM dofs and quadrature points #72
Conversation
Currently hardcoded to plot only one element of a Cartesian mesh, but can be extended relatively easily.
* Only add alpha to fills, not to edges. This makes it easier to see the small qpts * Sort qpt list by distance to center for nicer view of overlaps qpts
@sshiraiwa -- Is there a way to add a binder for this? |
Good question! That would be wonderful, but TBH, i am not so familiar with Binder. |
One suggestion for small improvement: in the quadrature point plots make the area of the discs proportional to the quadrature weight -- right now it looks like the weight is proportional to the radius. Perceptually, we tend to see a disc as two times larger if its area is two times larger. |
You can also use red color for negative weights. 😁 |
Thanks for the suggestions @v-dobrev -- working on it now |
* Scale weights proportionally to area of circle instead of radius * Use complementary color for negative weights * Plot qpts at even orders
I've tried to get this working a bit ago but the default binder environment doesn't work because of the cmake build. There are ways to make more complex envs and I'll look into it more in the near future |
" 'ix': ip.x, \n", | ||
" 'iy': ip.y,\n", | ||
" 'w' : ip.weight}\n", | ||
" #print(d)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(very minor) remove?
" pts = getDofPositions(fespace, 0)\n", | ||
" plotDofPositions(F'{fec.Name()}_{bname}', pts, 0.05)\n", | ||
" except:\n", | ||
" #print(F\"\\tFEC {fec.Name()} did not work: dim {dim} -- basis type {b} -- fec type {f}\" )\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(very minor) remove?
" name = F\"qpts_{g_name}_{q['name']}_{dim}D_P{2*o}\"\n", | ||
"\n", | ||
" #for p in pts:\n", | ||
" # print(F\"{name}: P{2*o} {p['w']}\")\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(very minor) remove?
"\n", | ||
"To use this, your python environment must have:\n", | ||
"* PyMFEM (https://github.com/mfem/PyMFEM)\n", | ||
"* Matplotlib (https://matplotlib.org)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add NumPy (https://numpy.org)
?
"import os\n", | ||
"import math\n", | ||
"\n", | ||
"%matplotlib inline\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) not needed since you plot to files, did you want to have an option at the top like save_to_files
that is True
by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this one -- this notebook both plots the generated figures and saves them to disk.
Are you suggesting that it should be converted to one or the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Nice work @kennyweiss !
Looks like this (jupyterhub/mybinder.org-user-guide#56) makes a trick. |
@kennyweiss |
Currently hardcoded to plot only one element of a Cartesian mesh,
but can be extended relatively easily.
Current output contains figures of the following form (as

svg
,png
andpdf
figures, but not in an html table):DOFs:
QPts:
