-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 141408b
Showing
6 changed files
with
675 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
*.txt | ||
*.tmp | ||
*.png | ||
/local/ | ||
*.DS_Store | ||
*.csv | ||
|
||
# don't ignore important .txt and .csv files | ||
!LICENSE.txt | ||
!data/*.csv | ||
!results/*.csv | ||
|
||
# running files | ||
*.pyc | ||
*.py~ | ||
.~lock* | ||
*.swp | ||
|
||
# Python cache | ||
*__pycache__/ | ||
*.cache | ||
*.ipynb_checkpoints/ | ||
|
||
# Sphinx build files | ||
build/ | ||
|
||
# setup.py files | ||
*.egg-info | ||
dist/ | ||
|
||
# virtual enviroment | ||
env/ | ||
bin/ | ||
etc/ | ||
lib/ | ||
lib64 | ||
share/ | ||
pyvenv.cfg | ||
.vscode | ||
|
||
# downloads | ||
*.gz | ||
|
||
# third party | ||
third-party |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2022, Robert Timms. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# PyBaMM DFN example | ||
|
||
This repository shows an example of how to define your own model and parameter set to use in PyBaMM simulations. This kind of repository may be useful for sharing results from a particular paper, or hosting standalone PyBaMM models. The file `model.py` defines the DFN in a single script (this is equivalent to `pybamm.lithium_ion.BasicDFN`). The file `parameters.py` defines a set of parameter values for an LG M50 cell taken from the paper | ||
|
||
> Chang-Hui Chen, Ferran Brosa Planella, Kieran O’Regan, Dominika Gastol, W. Dhammika Widanage, and Emma Kendrick. ["Development of Experimental Techniques for Parameterization of Multi-scale Lithium-ion Battery Models."](https://iopscience.iop.org/article/10.1149/1945-7111/ab9050) Journal of the Electrochemical Society 167 (2020): 080534 | ||
|
||
|
||
|
||
## 🚀 Installation | ||
In order to run the models and load in any data you will need to install `pybamm`. The example script `example.py` has been tested on PyBaMM Version 22.2. To install the required python packages on Linux/Mac OS use the following terminal commands: | ||
|
||
1. Clone the repository | ||
```bash | ||
https://github.com/rtimms/dfn-example | ||
``` | ||
2. Change into the `dfn-example` directory | ||
```bash | ||
cd dfn-example | ||
``` | ||
3. Create a virtual environment (optional) | ||
```bash | ||
virtualenv env | ||
``` | ||
4. Activate the virtual environment (optional) | ||
```bash | ||
source env/bin/activate | ||
``` | ||
5. Install the required packages | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
PyBaMM is available on GNU/Linux, MacOS and Windows. For more detailed instructions on how to install PyBaMM, see [the PyBaMM documentation](https://pybamm.readthedocs.io/en/latest/install/GNU-linux.html#user-install). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pybamm | ||
|
||
# import model and create an instance | ||
from model import DFN | ||
|
||
model = DFN() | ||
|
||
# import parameters | ||
from parameters import parameter_values | ||
|
||
# create and solve simulation | ||
# 1C constant current discharge | ||
sim = pybamm.Simulation(model, parameter_values=parameter_values) | ||
sim.solve([0, 3600]) # solve for 1 hour | ||
|
||
# plot | ||
# note these are mostly dimensionless variables! | ||
vars_to_plot = [ | ||
"Negative particle surface concentration", | ||
"Electrolyte concentration", | ||
"Positive particle surface concentration", | ||
"Current [A]", | ||
"Negative electrode potential", | ||
"Electrolyte potential", | ||
"Positive electrode potential", | ||
"Terminal voltage", | ||
] | ||
sim.plot(vars_to_plot) |
Oops, something went wrong.