Repository describing my favourite workflow combining Visual Studio Code, OpenFOAM and Docker. Make sure to first follow the guide at https://github.com/jakobhaervig/openfoam-dockerfiles before continuing with this guide.
First, install the text editor Visual Studio Code.
In the left panel find "Extensions". Search for and install the following extensions, which will help our OpenFOAM workflow:
- Docker
- Dev Containers
- OpenFOAM
First, make sure Docker is running and you have a Docker image avialable with your OpenFOAM installation. I have a created a guide github.com/jakobhaervig/openfoam-dockerfiles, which will guide you through the process if in doubt.
Use the alias of
to start a Docker container:
of
If your alias isn't set up correctly, you can start a Docker container by the full command::
docker container run -ti --rm -v $HOME/openfoam-data:/data -w /data openfoam:latest
Attach Visual Studio Code to the running Docker container. This enables us to access the file system within the container directly in VS Code.
From within the newly opened window open a folder at root /
to gain full access to the file system of the Docker container.
Open a new terminal within the Docker container and test if OpenFOAM is sourced correctly:
simpleFoam -help