✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🏦 Standard & Poor's chooses Dash Enterprise for ESG analysis. Learn why, sign up for the June 23 Webinar here!

Show and Tell: Dash for tokamak heat flux prediction

Recently created a dash GUI for use with a code, H.E.A.T., that predicts the heat fluxes and temperatures on divertor plasma facing components in nuclear fusion tokamak reactors. Fusion is a potential clean energy source that produces no carbon or long-lived radioactive waste, and uses water for fuel. The physics code that runs under the hood is python, and I was originally coding raw HTML5/JS/CSS, but decided to give dash a try and keep it all in python. The results are good! Grateful to the dash community for providing such a useful suite of tools. Thanks everyone!

The code is here (dash is located in source/dashGUI.py)

And there are a set of slides describing the physics here

Some examples of the user interface:

An example of the HEAT output:

6 Likes

Very sweet! What components are used to render these graphs?
image

@chriddyp these rendering are done in ParaView, another open source project, which is the (multi-)industry standard for scientific visualization. The ParaView “show and tell” is located here.

ParaView can read a ton of filetypes, it can generate movies and time varying output, it can run in parallel on petascale supercomputers or GPU clusters while sending data back to client machines, it can be used with virtual reality headsets, and it can do a lot of other stuff that I probably don’t know about.

ParaView has desktop version, and a python interface, but it also has a web version. In the previous version of HEAT (where I coded all HTML5/JS/CSS by hand), I would launch a separate ParaView web server and then embed the server webpage into an iFrame in html. I would generate all the VTK objects using HEAT, then use the web server to visualize them. I still need to add this into a new tab in the Dash version of HEAT, but my punchlist is long and that is a low priority compared to some of my physics deliverables. For the images shown above, I just rendered in ParaView on my local machine.

One of these days (probably in the next six months), I will embed the ParaView server into my dash app like I had in previous html5 versions of HEAT. I think there is a really cool use case here where I use dash to built my custom application, do heavy rendering on a GPU cluster using ParaView, then display inside the dash app using paraviewweb, all in python.

4 Likes

Have you tried these visualizations in Dash VTK? In theory almost anything that renders in Paraview should render in Dash VTK. Likely easier and a nicer result than trying to embed the ParaView server as an iFrame.

@jack that is awesome! I had no idea that existed, so thank you so much for educating me! I agree that seems much cleaner than an embedded iFrame for simple renderings (most of what I render is pretty simple).

ParaViewWeb does have the option to render remotely (ie on GPU cluster). Does the dash-vtk render on the server or client side?

Again, thanks for connecting me to dash-vtk. I will definitely use this for HEAT (when I finally get back to the GUI part of the code). I have been very happy with the dash UI and the community support.

2 Likes

Does the dash-vtk render on the server or client side?

Dash VTK uses vtk.js, so renders on the client-side. Dash VTK documentation is now on the main Dash documentation site - Overview | Dash for Python Documentation | Plotly

@plasmapotential Have you had a chance to try Dash VTK in your tokamak app?

2 Likes

@jack I have not had a chance to do this yet. I will likely be spending the remainder of the calendar year adding new physics into the code, as the version I have works (although is not ideal), and I have specific physics deliverables that I need to achieve. I also spent some time creating an appImage of the HEAT code with the Dash GUI included.

I will probably do an overhaul of the GUI eventually, and when I do I will investigate this method. That is fantastic that it is available in the documentation. Thanks for helping me out here! It looks like the dash-vtk is incredibly powerful. Those examples on the documentation page are very cool.

When I do (eventually) try this out in the GUI I will report back to this thread and let you know how it goes.

2 Likes