Skip to content
Snippets Groups Projects
Commit 87c8cb08 authored by Jan Habscheid's avatar Jan Habscheid
Browse files

Package structure 1, now correct commit

parent db98b388
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 2.1
Name: FENICSxDGM
Version: 1.0
Summary: A description is yet to follow
Home-page: https://git.rwth-aachen.de/JanHab/Bsc-ElectrolyteModels
Author: Jan Habscheid, Lambert Theisen, Manuel Torrilhon
Author-email: Jan.Habscheid@rwth-aachen.de, lambert.theisen@rwth-aachen.de, mt@mathcces.rwth-aachen.de
License: GNU General Public License v3.0 or later
Keywords: fenics-project,Battery Simulation,finite element method
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.12.3
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyvista==0.43.10
Requires-Dist: numpy==1.26.4
Requires-Dist: scipy==1.14.0
Provides-Extra: notebook
Requires-Dist: jupyter>=1.0.0; extra == "notebook"
Provides-Extra: tests
Requires-Dist: pytest==8.3.3; extra == "tests"
Provides-Extra: docs
Requires-Dist: sphinx==7.3.7; extra == "docs"
Requires-Dist: myst-parser==4.0.0; extra == "docs"
Requires-Dist: sphinx-copybotton==0.5.2; extra == "docs"
Requires-Dist: sphinx_rtd_theme==3.0.1; extra == "docs"
Provides-Extra: build
Requires-Dist: build>=0.7.0; extra == "build"
Provides-Extra: dev
Requires-Dist: FENICSxDGM[tests]; extra == "dev"
Requires-Dist: FENICSxDGM[docs]; extra == "dev"
Requires-Dist: FENICSxDGM[build]; extra == "dev"
# Reproducibility Repository for Numerical Treatment of a Thermodynamically Consistent Electrolyte Model (B.Sc. Thesis - Jan Habscheid)
[![Pipeline Status](https://git.rwth-aachen.de/Jan.Habscheid/bsc-electrolytemodels/badges/main/pipeline.svg)](https://git.rwth-aachen.de/Jan.Habscheid/bsc-electrolytemodels/pipelines)
[![Documentation](https://img.shields.io/badge/docs-latest-blue)](https://janhab.pages.rwth-aachen.de/bsc-electrolytemodels/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13645296.svg)](https://doi.org/10.5281/zenodo.13645296)
[![GitLab Version](https://img.shields.io/badge/version-1.0-blue.svg)](https://git.rwth-aachen.de/jan.habscheid/bsc-electrolytemodels/-/tags)
[![License](https://img.shields.io/badge/license-GPLv3-blue)](https://git.rwth-aachen.de/Jan.Habscheid/bsc-electrolytemodels/-/blob/main/LICENSE?ref_type=heads)
## Thesis
This repository contains the code to reproduce the results presented in the bachelor thesis: Numerical Treatment of a Thermodynamically Consistent Electrolyte Model
Find the thesis at [https://doi.org/10.18154/RWTH-2024-09837](https://doi.org/10.18154/RWTH-2024-09837)
### Abstract
Batteries play a crucial role in the energy transition. The production of green energy depends on external factors. Storing energy in batteries is necessary to access green energy at any time.
Better optimized batteries are essential for the future. Lifetime, loading time, and energy loss are just some aspects that must be improved to prepare for a greener future. Numerical simulations are crucial to understanding and optimizing batteries' behavior. Those simulations enable researchers to test many different materials without considerable additional expenses to, for example, find the best combination of anions and cations.
The classical Nernst-Planck model for the ion transport in an electrolyte fails to predict the correct concentration in the boundaries of the electrolyte. This work will present and analyze a thermodynamically consistent electrolyte model with dimensionless units under isothermal conditions. A simplified version of the system for the one-dimensional equilibrium of an ideal mixture and the incompressible limit will be considered. The numerical implementation of the model with the open-source software FEniCSx will be discussed. Furthermore, the influence of different boundary conditions, material parameters, solvation, and compressibility on the electric potential, pressure, and ion concentration will be investigated, and the model will be compared with the classical Nernst-Planck model. Examples of the double layer capacity and electrolytic diode will be considered.
## Installation
As a numerical solver, mainly FEniCSx was used and installed via conda.
All the calculations were performed on a Linux machine. According to the documentation, everything should work well on macOS, but this was not tested. FEniCSx offers some beta versions for Windows support, but it is recommended to use WSL2 instead.
```
conda create --name fenicsx-env python=3.12.3 -y
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx=0.8.0 mpich=4.2.1 pyvista=0.43.10 gcc=12.4.0 matplotlib=3.8.4 numpy=1.26.4 scipy=1.14.0 pytest==8.3.3 -y
```
### Alternative installation
Use the "environment.yml" file to install all necessary environments
```
conda env create -f environment.yml
```
### macOS installation using Docker
```
docker compose build
docker compose run solver
```
### Testing
Use pytest with
```
python -m pytest
```
to verify that everything was installed correctly.
## Usage
Find the visualizations from the thesis and some extra calculations 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 in *.svg format in "Figures".
In "src" there are the generic FEniCSx implementations, that were used to calculate the examples.
## Contact
**Author**
- Jan Habscheid
- Jan.Habscheid@rwth-aachen.de
**Supervisor**
- Dr. Lambert Theissen
- ACoM - Applied and Computational Mathematics
- RWTH Aachen University
- theisen@acom.rwth-aachen.de
**Supervisor**
- Prof. Dr. Manuel Torrilhon
- ACoM - Applied and Computational Mathematics
- RWTH Aachen University
- mt@acom.rwth-aachen.de
LICENSE
README.md
pyproject.toml
setup.cfg
setup.py
src/ElectrolyticDiode.py
src/Eq02.py
src/Eq04.py
src/EqN.py
src/Helper_DoubleLayerCapacity.py
src/__init__.py
src/FENICSxDGM.egg-info/PKG-INFO
src/FENICSxDGM.egg-info/SOURCES.txt
src/FENICSxDGM.egg-info/dependency_links.txt
src/FENICSxDGM.egg-info/entry_points.txt
src/FENICSxDGM.egg-info/requires.txt
src/FENICSxDGM.egg-info/top_level.txt
src/FENICSxDGM.egg-info/zip-safe
tests/test_ElectrolyticDiode.py
tests/test_Eq02.py
tests/test_Eq04.py
tests/test_EqN.py
tests/test_Helper_DoubleLayerCapacity.py
\ No newline at end of file
[console_scripts]
my-example-utility = example.example_module:main
pyvista==0.43.10
numpy==1.26.4
scipy==1.14.0
[build]
build>=0.7.0
[dev]
FENICSxDGM[tests]
FENICSxDGM[docs]
FENICSxDGM[build]
[docs]
sphinx==7.3.7
myst-parser==4.0.0
sphinx-copybotton==0.5.2
sphinx_rtd_theme==3.0.1
[notebook]
jupyter>=1.0.0
[tests]
pytest==8.3.3
FENICSxDGM
from .ElectrolyticDiode import ElectrolyticDiode
from .Eq02 import solve_System_2eq
from .Eq04 import solve_System_4eq, create_refined_mesh
from .EqN import solve_System_Neq
from .Helper_DoubleLayerCapacity import *
\ No newline at end of file
No preview for this file type
%% Cell type:code id: tags:
``` python
import FENICSxDGM as DGM
```
%% Cell type:code id: tags:
``` python
phi_left = 5.0
phi_right = 0.0
p_right = 0.0
y_A_R = 1/3
y_C_R = 1/3
z_A = -1.0
z_C = 1.0
K = 'incompressible'
Lambda2 = 8.553e-6
a2 = 7.5412e-4
number_cells = 1024
relax_param = .1
rtol = 1e-4
max_iter = 500
```
%% Cell type:code id: tags:
``` python
y_A, y_C, phi, p, x = DGM.solve_System_2eq(phi_left, phi_right, p_right, z_A, z_C, y_A_R, y_C_R, K, Lambda2, a2, number_cells, relax_param=relax_param, x0=0, x1=1, refinement_style='uniform', return_type='Vector', max_iter=max_iter, rtol=rtol)
```
%% Output
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 y_A, y_C, phi, p, x = DGM.solve_System_2eq(phi_left, phi_right, p_right, z_A, z_C, y_A_R, y_C_R, K, Lambda2, a2, number_cells, relax_param=relax_param, x0=0, x1=1, refinement_style='uniform', return_type='Vector', max_iter=max_iter, rtol=rtol)
AttributeError: module 'src' has no attribute 'solve_System_2eq'
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment