webgui

Hello NGSolve-Community,

we can now visualize meshes and solutions within jupyter notebooks !

Have a look at
https://ngsolve.org/docu/nightly/i-tutorials/wta/poisson.html
and the other whetting-the-appetite examples.

webgui is available in the NGSolve 20.05 release, and there are frequent updates and fixes in the nightly versions.

The main activists have been Matthias and Amanda, many thanks to them !

webgui already supports visualization of higher order scalar and vectorial fields, clipping planes, and animation of time-dependent and complex valued solutions.

With webgui you can run the IPython kernel on a server, and visualize locally within your jupyter session. It is also the basis for interactive computing in a cloud. With nbconvert you can generate html pages including interactive views for tutorials and presentation of your results.

webgui is based on webgl, threejs, and jupyter notebook extension.

Try it and enjoy it,
Joachim

Hi Joachim,

Can you be more specific on the prerequisites for getting webgui?

I updated ngsolve to version 2005, but the gui didn’t pop up. I get the following string instead:

NGSWebGuiWidget(value={'ngsolve_version': '6.2.2005-14-g40518403', 'mesh_dim': 2, 'order2d': 1, 'order3d': 1, …

You mentioned “webgui is based on webgl, threejs, and jupyter notebook extension.”
I have threejs install via pip, but how to get webgl?

Best,
Guosheng

Thank you for the great news.

you have to install the notebook extension like that:

pip3 install ipywidgets
jupyter nbextension install --py widgetsnbextension
jupyter nbextension enable --py widgetsnbextension
jupyter nbextension install --user --py ngsolve
jupyter nbextension enable --user --py ngsolve

Just started the upload of the updated documentation.

Joachim

Works like a charm!
Thanks for this great adds-on. :slight_smile:

Hello again,

Webgui is amazing. But I encounter a couple of questions:

Q1: How to modify default parameters in webgui? For netgen gui we have all the options in ngsolve.internal import visoptions, viewoptions to play with…

Q2: can you fix a bug for quads mesh? currently, the quad mesh only present a triangle instead of square for the element…

Best,
Guosheng

Hi Guosheng,

Q1: That’s a good point. The Draw() function handles some arguments already (like min, max draw_surf, draw_vol). We still need to think about an interface to expose other settings (like camera, clipping plane etc.)

Q2: That’s already work in progress and will be merged within the next days.

Best,
Matthias

Hi Matthias,

Cool!
Another feature I would like to have is the ability to adjust bounding box size of the gui, like in matplotlib, we can do

plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots

The current default size might not be optimal. e.g. the example below on a slightly stretched domain, it has quit large empty white spaces:

https://ngsolve.org/media/kunena/attachments/758/space.png [
Best,
Guosheng

This is great! I just tested it in Mac OS (High Sierra) and Ubuntu 20.04. I will try to test soon in Windows…

Best,
Dow

ps. I assume this is based heavily on the new ngsgui – will it be able to support ngsgui plugins like the ‘tents_visualization’ ?

Hi,

I think it is great!

One thing I couldn’t figure out is if the webgui can be updated by the command ReDraw to generate a short animation as in the wave DG tutorial. Is this possible?

Hi,

see the Navier-Stokes tutorial:

https://ngsolve.org/docu/latest/i-tutorials/wta/navierstokes.html

scene = Draw(gfu...)
...
scene.Redraw()

Thanks. it works great.

Thanks, the webgui is working great.

I have a question which is maybe not so much related to ngsolve.
How can I export the 3D models embeded into a *.html?