Prerequisites
For this course, knowledge of the stress tensor, strong and weak forms of equations, function spaces, and familiarity with Python/Jupyter notebooks is recommended.
To follow along with the examples, you need to install Docker on your system. This setup requires Windows 10/11 Education or Professional. It does not work on Windows 10/11 Home.
You will also need:
- Docker
- ParaView
- Gmsh
- Google Chrome
After installation, open Chrome and go to
chrome://flags/. Enable WebGL Developer Extensions.
Install FEniCS/FEniCSx
Once Docker is installed and running, open a terminal and run:
docker pull iitrabhi/fenicsx_lab
docker pull iitrabhi/fenics_notebook
Running
To start the JupyterLab server, use:
For FEniCS
docker run -p 8888:8888 -v host_system_path:/root/codes/ -w /root/codes/ iitrabhi/fenics_notebook
For FEniCSx
docker run -p 8888:8888 -v host_system_path:/root/codes/ -w /root/codes/ iitrabhi/fenicsx_lab
Replace host_system_path with the path to the folder that contains your code.
For example, if D:\Codes contains your code, run:
docker run -p 8888:8888 -v D:\Codes:/root/codes/ -w /root/codes/ iitrabhi/fenicsx_lab
Once the command starts, it will print a URL beginning with:
http://127.0.0.1:8888/lab
Open it in Chrome (ctrl/cmd + left click) to access JupyterLab.
If you have Windows Home
You can use Google Colab to run FEniCS/FEniCSx on the cloud.
Open Google Colab, upload your notebook, and run:
For FEniCS
try:
import dolfin
except ImportError:
!pip install gmsh
!pip install meshio
!pip install h5py
!pip install matplotlib
!apt-get update
!apt-get install -y libglu1-mesa
!wget "https://fem-on-colab.github.io/releases/fenics-install-release-real.sh" -O "/tmp/fenics-install.sh" && bash "/tmp/fenics-install.sh"
import dolfin
For FEniCSx
try:
import dolfinx
except ImportError:
!wget "https://fem-on-colab.github.io/releases/fenicsx-install-release-real.sh" -O "/tmp/fenicsx-install.sh" && bash "/tmp/fenicsx-install.sh"
import dolfinx
Reference: https://fem-on-colab.github.io/packages.html
If you have Mac - M series
- Install Anaconda: https://www.anaconda.com/download
- Go to terminal and run the following commands.
conda create -n fenics -c conda-forge fenicssource activate fenicspip install matplotlibpip install gmshpip install meshiopip install h5py