Instructions for installing NGSolve on the GWDG Jupyter Cloud
The following instructions will explain how you can install and use NGSolve
in the GWDG Jupyter Cloud.
Installing NGSolve
First, open the Jupyter Cloud and login with your student account data.
Afterwards, launch a new terminal. To install the latest version of NGSolve
, run the following command:
pip install ngsolve
While this suffices to work with NGSolve
, we recommend that you use the following steps to use the interactive webgui.
First, install webgui_jupyter_widgets
. To this end, run the following command in the terminal:
pip install webgui_jupyter_widgets
Afterwards, use the following commands to install and activate the required extensions:
jupyter nbextension install --user --py widgetsnbextension
jupyter nbextension enable --user --py widgetsnbextension
jupyter nbextension install --user --py webgui_jupyter_widgets
jupyter nbextension enable --user --py webgui_jupyter_widgets
Before trying out the example below, you should log out and back in to make sure that the extensions are activated.
A simple example
You can use the following simple example to test whether the installation was successful.
For further examples we refer to the documentation of NGSolve
.
Launch a new Python 3 (ipykernel) notebook and run the following code
from ngsolve import *
from ngsolve.webgui import Draw
mesh = Mesh(unit_square.GenerateMesh(maxh=.2))
func = 16*x*(1-x)*y*(1-y)
Draw(func,mesh)
You should be able to see a visualization of the function func
on the unit square.