fxdgm

https://git.rwth-aachen.de/janhab/fxdgm/badges/main/pipeline.svg https://img.shields.io/badge/docs-latest-blue https://zenodo.org/badge/DOI/10.5281/zenodo.13645296.svg https://img.shields.io/badge/version-1.0-blue.svg

A nonlinear, mixed finite element solver for the DGM electrolyte model

_images/logo.svg

Physical Background

The system, which is solved, refers to the original work, Overcoming the shortcomings of the Nernst–Planck model, from Wolfgang Dreyer, Clemens Guhlke and Rüdiger Müller in 2013.
This paper introduces a new, generalized Nernst-Planck model, which is thermodynamically consistent, as the classical Nernst-Planck model fails to predict the correct ion-concentrations close to the boundaries.
The open-source package FEniCSx was used for the numerical implementation.

Main Features

  • Solving stationary DGM model in dimensionless units

    • for a ternary electrolyte (cations, anions, neutral solvent)

    • for an electrolyte of N arbitrary species

  • Local mesh refinement for one-dimensional domains towards the electrode

  • Testcases for the one-dimensional case or the two-dimensional electrolytic diode

  • Solutions for the Double-Layer Capacity, both numerical and analytical

  • Numerical Convergence with relaxation parameter for newtons method

  • Two-dimensional testcases for the example of the electrolytic diode

Installation

Install the fxdgm package with pip to get all the implemented functions.
pip install git+https://git.rwth-aachen.de/JanHab/fxdgm
For the backend, FEniCSx was used and installed via conda.
The necessary dependencies can be installed with
conda install -c conda-forge fenics-dolfinx=0.8.0 mpich=4.2.1 pyvista=0.43.10 gcc=12.4.0 -y
It is also possible to install the FEniCSx backend in a different manner. See the FEniCSx documentation for this.
Although this installation method should work, it was not tested for the purpose of this package.

macOS installation using Docker

The docker installation method works for linux too. It was not tested on windows.
docker compose build
docker compose run solver

Testing

For testing clone the repository, install pytest and run the tests with
pip install pytest==8.3.3
python -m pytest

Usage

Find the package source code in fxdgm
This implements the nonlinear electrolyte model.
Furthermore, some physical examples are provided in the examples folder.
In the subfolder ReproducableCode is the code, to execute the calculations with some first visualizations.
The subfolder Data stores the data for all the simulations in a *.npz file, which can be read with numpy np.load(file.npz).
visualizations creates the necessary figures from the thesis and stores them either in *.svg or *.pdf format in “Figures”.

Contact

Author

Supervisor