What is deal.II?

deal.II1 is an open source software library written in C++ for solving partial differential equations (PDEs) using the finite element method (FEM). It provides a comprehensive set of tools for solving complex PDEs arising in various fields, including fluid dynamics, solid mechanics, electromagnetics, and quantum mechanics. It is designed to be flexible, efficient, and scalable, supporting parallel computing on a wide range of architectures. The library provides a high-level interface for generating meshes, defining finite element spaces, assembling and solving linear systems, and post-processing and visualizing solutions. It also includes adaptive mesh refinement techniques, error estimators, and a wide range of finite element formulations, including continuous and discontinuous Galerkin methods.

The key functionalities of deal.II are:

  • Mesh Generation and Manipulation: deal.II supports various mesh types, including structured, unstructured, and hierarchical meshes. It provides tools for mesh generation, refinement, coarsening, and partitioning for parallel computations.
  • Finite Element Spaces: The library offers a variety of finite element spaces, including continuous and discontinuous Galerkin formulations, as well as mixed and non-conforming elements. It supports various element types, such as Lagrange, Nedelec, and Raviart-Thomas elements.
  • Assembly and Linear Solvers: deal.II provides efficient routines for assembling and solving linear systems arising from the finite element discretization. It includes a range of iterative solvers, preconditioners, and direct solvers, as well as support for distributed parallel computing using MPI.
  • Adaptive Mesh Refinement: The library implements adaptive mesh refinement techniques based on a posteriori error estimators. It supports different refinement strategies, including global, local, and hierarchical refinement.
  • Post-processing and Visualization: deal.II offers tools for post-processing and visualizing solutions, including support for various output formats (e.g., VTK, Gnuplot, and ParaView) and data manipulation utilities.
  • Extensibility: deal.II is designed to be extensible, allowing users to implement their own finite element formulations, solvers, and other components by leveraging the library’s infrastructure.
  • Parallelism: The library supports distributed parallel computing using MPI, as well as shared-memory parallelism using threads and vectorization.
  • Documentation and Community: deal.II has extensive documentation, including tutorials, examples, and a comprehensive reference manual. It also has an active community of users and contributors who provide support and contribute to the library’s development.

deal.II is widely used in academic research and industrial applications, particularly in the fields of computational fluid dynamics, solid mechanics, and materials science. Its modular design, powerful features, and active community make it a popular choice for solving complex PDEs and developing scientific computing applications.

Run deal.II on Docker interactive mode

In this tutorial, we will see how to use deal.II on Docker in interactive mode in a step by step guideline.

Step 1: Pull Docker image

Pull Docker image for deal.II2, which includes essential development tools. The process may take several minutes due to the image’s size.

docker pull dealii/dealii

Step 2: Prepare local environment

We will follow the official tutorial step 13. The code is available in their Github repository4. - Create a local directory. - Download and place the CMakeLists.txt and step-1.cc files in the local directory we have created in the previous step. - Change the deal.II version in the CMakeLists.txt file to 9.5 from 9.6.0 on line 26 as the Docker image installs deal.II version 9.5. - Open a terminal/powershell in the same directory.

Step 3: Mount the current directory to docker run

Mount the current directory into the Docker container to execute the deal.II program. The following command runs a container named dealii based on the dealii/dealii image, mounting the current local directory to the /workspace directory inside the container in interactive mode.

docker run -v $(pwd):/workspace -it --name=dealii dealii/dealii

Step 4. Run deal.II program in interpreter mode

  • We can execute deal.II programs within the Docker container. Navigate to the /workspace directory and run the cmake commands to compile the step1.cc program in interpreter mode.

    dealii@41823dd68686:/$ cd /workspace/
    dealii@41823dd68686:/workspace$ cmake .
    dealii@41823dd68686:/workspace$ make
    dealii@41823dd68686:/workspace$ make run
    
  • We will see after running the program it generates two svg files (grid-1.svg, grid-2.svg) in our local folder.

    ├── CMakeCache.txt
    ├── CMakeFiles
    ├── cmake_install.cmake
    ├── CMakeLists.txt
    ├── compile_commands.json
    ├── grid-1.svg
    ├── grid-2.svg
    ├── Makefile
    ├── readme.md
    ├── step-1
    └── step-1.cc
    

alt Generated Figure: Generated grid-2.svg file

We can also check the files from docker like below: alt dealII Figure: Local files after successful program run

(Optional) Rerun Docker container or delete existing container
  • To rerun the dealii Docker container in interactive mode:

    docker start -i dealii
    
  • List and delete Docker container:

    # List all Docker containers, including stopped ones
    docker ps -a
    
    # Delete a specific container using its NAME or CONTAINER ID
    docker rm dealii
    

By following this tutorial, we can install and use deal.II on Docker in an interactive mode.

References

Advertisement

Citation

Click to select citation style

Shovon, A. R. (2024, April 17). Install deal.II on Ubuntu using Docker. Ahmedur Rahman Shovon. Retrieved December 3, 2024, from https://arshovon.com/blog/install-dealii-on-ubuntu-docker/

Shovon, Ahmedur Rahman. “Install deal.II on Ubuntu using Docker.” Ahmedur Rahman Shovon, 17 Apr. 2024. Web. 3 Dec. 2024. https://arshovon.com/blog/install-dealii-on-ubuntu-docker/.

@misc{ shovon_2024,
    author = "Shovon, Ahmedur Rahman",
    title = "Install deal.II on Ubuntu using Docker",
    year = "2024",
    url = "https://arshovon.com/blog/install-dealii-on-ubuntu-docker/",
    note = "[Online; accessed 3-December-2024]"
}