Installation

The preferred way to install and use cideMOD is using the docker image of cideMOD. Optionally, one can install cideMOD in a FEniCSx working environment (with multiphenicsx) by downloading everything from source and installing it with the Python package manager.

Install dependencies with docker

Install Docker

To install docker follow the instructions from Docker. In Windows and MacOS the preferred way to use Docker is installing Docker Desktop. In Linux systems, at the moment it is necesary to use Docker Engine.

Windows

Note: Windows 10 or higher version is required

Detailed instructions are given in the Windows Docker Webpage

  1. Set up the WSL2 backend.

  2. Download the Docker Desktop installer.

  3. Install Docker Desktop running the downloaded executable. Ensure that the Install required Windows components for WSL 2 option is selected.

Mac OS

Detailed instructions are given in the MacOS Docker Webpage.

Linux

Source: Install Docker Engine on Ubuntu

Docker can be installed in several ways, the easiest for the user would be to download the desktop version. If your device does not have a user interface, here are two ways to install it.

The first thing is to ensure no old versions of Docker are installed. Older versions of Docker went by the names of docker, docker.io, or docker-engine. Uninstall any such older versions before attempting to install a new version.

$ sudo apt-get remove docker docker-engine docker.io containerd runc

It’s OK if apt-get reports that none of these packages are installed.

Once assured that there is no old versions of Docker you will move on to the installation of Docker. On the official website you can find different ways. Docker provides a convenience script to install Docker into development environments non-interactively. It’s useful for creating a provisioning script tailored to your needs. This example downloads the script from https://get.docker.com/ and runs it to install the latest stable release of Docker on Linux.

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

Note

If curl package is not found:

$ sudo apt install curl

If the installation is successful, cideMOD can be now installed, see the image installation section. On the other hand, if the script installation fails, or a customized installation is prefered, another way to proceed is to install from the repository.

Before you install Docker Engine for the first time on a new host machine, you need to setup the Docker repository. Afterward, you can install and update Docker from the repository.

Set up the repository

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS.

$ sudo apt-get update

$ sudo apt-get install \
  ca-certificates \
  curl \
  gnupg \
  lsb-release
  1. Add Docker’s official GPG key.

    $ sudo mkdir -p /etc/apt/keyrings
    
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
      sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    
  2. Use the following command to set up the repository.

    $ echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
      https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"\
      | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    

Install Docker Engine

  1. Update the apt package index.

    $ sudo apt-get update
    
  2. Install Docker Engine, containerd, and Docker Compose.

    $ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
  3. Verify that the Docker Engine installation is successful by running the hello-world image.

    $ sudo docker run hello-world
    
  4. Follow the post-installation steps for Linux in order to configure properly permissions and background services.

Install cideMOD docker image

Source: cideMOD DockerHub

Once Docker is installed, the next step is to download the cideMOD image and create the container.

  1. Download the Docker image.

$ docker pull cidetec/cidemod:v2.0.0
  1. Check that the image is installed correctly.

$ docker images
  1. Next, a folder is created that will be linked to the Docker container for file sharing.

$ mkdir cideMOD
  1. Finally, the container is created based on the cideMOD image and the link between the content folder and the newly created folder is created.

$ docker run -ti --name cideMOD -v /home/{user_name}/{path_to}/cideMOD:/home/cidemod/shared cidetec/cidemod

The cideMOD container terminal should be opened.

Install from source

You can find the installation guide in the documentation of the required packages:

Requirements

From here we will assume that the user has a working environment with FEniCSx and multiphenicsx.

To use cideMOD, first install it from source using pip.

$ git clone https://github.com/cidetec-energy-storage/cideMOD.git cideMOD
$ cd cideMOD
$ pip install .

The P3D/P4D models make use of gmsh meshes to create the cell mesh. Therefore, the python environment should be able to locate the gmsh shared libraries. If your $PYTHONPATH doesn’t contains gmsh, you should add it.

$ export PYTHONPATH=$PYTHONPATH:<path_to_gmsh_libs>

or

$ export PYTHONPATH=$PYTHONPATH:$(find /usr/local/lib -name "gmsh-*-sdk")/lib

Additionally gmsh needs from some libraries that you may not have been installed.

$ sudo apt-get update
$ sudo apt-get install libglu1-mesa-dev libxcursor-dev libxinerama-dev

To test if the installation is complete, run a simple test (within the tests folder).

$ pytest -m "quicktest"