Skip to content

Commit af295f3

Browse files
#1100 merge develop
2 parents 595601e + 3851b18 commit af295f3

File tree

132 files changed

+3748
-943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3748
-943
lines changed

.all-contributorsrc

+40
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,46 @@
283283
"test",
284284
"example"
285285
]
286+
},
287+
{
288+
"login": "priyanshuone6",
289+
"name": "Priyanshu Agarwal",
290+
"avatar_url": "https://avatars.githubusercontent.com/u/64051212?v=4",
291+
"profile": "https://github.com/priyanshuone6",
292+
"contributions": [
293+
"test"
294+
]
295+
},
296+
{
297+
"login": "DrSOKane",
298+
"name": "DrSOKane",
299+
"avatar_url": "https://avatars.githubusercontent.com/u/42972513?v=4",
300+
"profile": "https://github.com/DrSOKane",
301+
"contributions": [
302+
"code",
303+
"example",
304+
"doc",
305+
"test"
306+
]
307+
},
308+
{
309+
"login": "Saransh-cpp",
310+
"name": "Saransh Chopra",
311+
"avatar_url": "https://avatars.githubusercontent.com/u/74055102?v=4",
312+
"profile": "https://github.com/Saransh-cpp",
313+
"contributions": [
314+
"code",
315+
"test"
316+
]
317+
},
318+
{
319+
"login": "DavidMStraub",
320+
"name": "David Straub",
321+
"avatar_url": "https://avatars.githubusercontent.com/u/10965193?v=4",
322+
"profile": "https://github.com/DavidMStraub",
323+
"contributions": [
324+
"bug"
325+
]
286326
}
287327
],
288328
"contributorsPerLine": 7,

.github/workflows/benchmark_on_PR.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Run benchmarks on push
2+
on:
3+
push:
4+
5+
jobs:
6+
benchmarks:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Python 3.8
11+
uses: actions/setup-python@v2
12+
with:
13+
python-version: 3.8
14+
- name: Install asv
15+
run: pip install -U pip virtualenv asv
16+
- name: Fetch base branch
17+
run: |
18+
git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF
19+
git fetch origin $GITHUB_HEAD_REF:$GITHUB_HEAD_REF
20+
- name: Run benchmarks
21+
run: |
22+
asv machine --machine "GitHubRunner"
23+
# Get IDs of branch and PR commits
24+
BASE_COMMIT=$(git rev-parse develop)
25+
HEAD_COMMIT=$(git rev-parse HEAD)
26+
echo $BASE_COMMIT | tee commits_to_compare.txt
27+
echo $HEAD_COMMIT | tee -a commits_to_compare.txt
28+
asv run HASHFILE:commits_to_compare.txt --m "GitHubRunner" --show-stderr
29+
- name: Compare commits' benchmark results
30+
run: |
31+
BASE_COMMIT=$(head -1 commits_to_compare.txt)
32+
HEAD_COMMIT=$(tail -1 commits_to_compare.txt)
33+
echo "SUMMARY OF CHANGES"
34+
echo "=================="
35+
asv compare $BASE_COMMIT $HEAD_COMMIT | tee compare_result.txt
36+
# Make sure grep returns error code 0 even if code 1 is
37+
# returned because no match is found
38+
REGRESSIONS=$({ grep "+" compare_result.txt || test $? = 1; })
39+
if [ ! -z "$REGRESSIONS" ]; \
40+
then \
41+
echo "REGRESSIONS FOUND"; \
42+
echo "================="; \
43+
echo "$REGRESSIONS"; \
44+
echo "================="; \
45+
printf "Found %d regression(s)\n" $(echo "$REGRESSIONS" | wc -l); \
46+
exit 1; \
47+
fi
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow periodically runs the benchmarks suite in benchmarks/
2+
# using asv and publish the results, effectively updating
3+
# the display website hosted in the pybamm-bench repo
4+
5+
# Steps:
6+
# - Benchmark all commits since the last one that was benchmarked
7+
# - Push results to pybamm-bench repo
8+
# - Publish website
9+
name: Benchmarks
10+
on:
11+
# Everyday at 3 am UTC
12+
schedule:
13+
- cron: "0 3 * * *"
14+
jobs:
15+
benchmarks:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python 3.8
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.8
23+
- name: Install tox and asv
24+
run: pip install -U pip tox asv
25+
- name: Fetch develop branch
26+
# Not required when worklow trigerred
27+
# on develop, but useful when
28+
# experimenting/developing on another one.
29+
run: |
30+
git fetch origin develop:develop
31+
- name: Run benchmarks
32+
run: |
33+
asv machine --machine "GitHubRunner"
34+
asv run --machine "GitHubRunner" NEW
35+
- name: Upload results as artifact
36+
uses: actions/upload-artifact@v2
37+
with:
38+
name: asv_new_results
39+
path: results
40+
41+
publish-results:
42+
name: Push and publish results
43+
needs: benchmarks
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Set up Python 3.8
47+
uses: actions/setup-python@v2
48+
with:
49+
python-version: 3.8
50+
- name: Install asv
51+
run: pip install asv
52+
- name: Checkout pybamm-bench repo
53+
uses: actions/checkout@v2
54+
with:
55+
repository: pybamm-team/pybamm-bench
56+
token: ${{ secrets.BENCH_PAT }}
57+
- name: Download results artifact
58+
uses: actions/download-artifact@v2
59+
with:
60+
name: asv_new_results
61+
path: new_results
62+
- name: Copy new results and push to pybamm-bench repo
63+
run: |
64+
cp -vr new_results/* results
65+
git config --global user.email ${{ secrets.PUSH_BENCH_EMAIL }}
66+
git config --global user.name ${{ secrets.PUSH_BENCH_NAME }}
67+
git add results
68+
git commit -am "Add new results"
69+
git push
70+
- name: Publish results
71+
run:
72+
|
73+
asv publish
74+
git fetch origin gh-pages:gh-pages
75+
asv gh-pages
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# GitHub actions workflow that runs the benchmark suite in benchmarks/
2+
# from "commit_start" to "commit_end". It pushes the results to the
3+
# pybamm-bench repo and updates the display website.
4+
5+
# This workflow is meant to be triggered manually, see
6+
# https://docs.github.com/en/enterprise-server@3.0/actions/managing-workflow-runs/manually-running-a-workflow
7+
8+
name: Manual benchmarks
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
commit_start:
13+
description: 'Identifier of commit from which to start'
14+
default: 'v0.1.0'
15+
commit_end:
16+
description: 'Identifier of commit at which to end'
17+
default: 'develop'
18+
ncommits:
19+
description: 'Number of commits to benchmark between commit_start and commit_end'
20+
default: '100'
21+
jobs:
22+
benchmarks:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Set up Python 3.8
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: 3.8
30+
- name: Install tox and asv
31+
run: pip install -U pip tox asv
32+
- name: Fetch develop branch
33+
# Not required when worklow trigerred
34+
# on develop, but useful when
35+
# experimenting/developing on another branch.
36+
run: |
37+
git fetch origin develop:develop
38+
- name: Run benchmarks
39+
run: |
40+
asv machine --machine "GitHubRunner"
41+
asv run -m "GitHubRunner" -s ${{ github.event.inputs.ncommits }} \
42+
${{ github.event.inputs.commit_start }}..${{ github.event.inputs.commit_end }}
43+
- name: Upload results as artifact
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: asv_new_results
47+
path: results
48+
49+
publish-results:
50+
name: Push and publish results
51+
needs: benchmarks
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Set up Python 3.8
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: 3.8
58+
- name: Install asv
59+
run: pip install asv
60+
- name: Checkout pybamm-bench repo
61+
uses: actions/checkout@v2
62+
with:
63+
repository: tlestang/pybamm-bench
64+
token: ${{ secrets.BENCH_PAT }}
65+
- name: Download results artifact
66+
uses: actions/download-artifact@v2
67+
with:
68+
name: asv_new_results
69+
path: new_results
70+
- name: Copy new results and push to pybamm-bench repo
71+
run: |
72+
cp -vr new_results/* results
73+
git config --global user.email "thibault.lestang@cs.ox.ac.uk"
74+
git config --global user.name "Thibault Lestang"
75+
git add results
76+
git commit -am "Add new results"
77+
git push
78+
- name: Publish results
79+
run:
80+
|
81+
asv publish
82+
git fetch origin gh-pages:gh-pages
83+
asv gh-pages
84+

.github/workflows/test_on_push.yml

+8-15
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,10 @@ jobs:
4747
sudo apt install gfortran gcc libopenblas-dev graphviz
4848
sudo apt install python${{ matrix.python-version }}.dev
4949
50-
# Added fixes to homebrew installs:
51-
# rm -f /usr/local/bin/2to3
52-
# (see https://github.com/actions/virtual-environments/issues/2322)
53-
# brew unlink gcc@8 gcc@9
54-
# (see https://github.com/actions/virtual-environments/issues/2391)
5550
- name: Install MacOS system dependencies
5651
if: matrix.os == 'macos-latest'
5752
run: |
58-
rm -f /usr/local/bin/2to3
5953
brew update
60-
brew unlink gcc@8 gcc@9
6154
brew install graphviz
6255
brew install openblas
6356
@@ -71,23 +64,23 @@ jobs:
7164
python -m pip install tox
7265
7366
- name: Install SuiteSparse and Sundials
74-
if: matrix.os != 'windows-latest'
67+
if: matrix.os == 'ubuntu-latest'
7568
run: tox -e pybamm-requires
7669

77-
- name: Run unit tests for GNU/Linux and MacOS
78-
if: matrix.os != 'windows-latest'
70+
- name: Run unit tests for GNU/Linux
71+
if: matrix.os == 'ubuntu-latest'
7972
run: python -m tox -e tests
8073

81-
- name: Run unit tests for Windows
82-
if: matrix.os == 'windows-latest'
83-
run: python -m tox -e windows-tests
74+
- name: Run unit tests for Windows and MacOS
75+
if: matrix.os != 'ubuntu-latest'
76+
run: python -m tox -e mac-windows-tests
8477

8578
- name: Install docs dependencies and run doctests
86-
if: matrix.os != 'windows-latest'
79+
if: matrix.os == 'ubuntu-latest'
8780
run: tox -e doctests
8881

8982
- name: Install dev dependencies and run example tests
90-
if: matrix.os != 'windows-latest'
83+
if: matrix.os == 'ubuntu-latest'
9184
run: tox -e examples
9285

9386
- name: Install and run coverage

.github/workflows/url_checker.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Check URLs
2+
3+
on:
4+
push:
5+
schedule:
6+
# Run everyday at 3 am UTC
7+
- cron: 0 3 * * *
8+
9+
jobs:
10+
urlchecks:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: URLs-checker
16+
uses: urlstechie/urlchecker-action@master
17+
with:
18+
# A comma-separated list of file types to cover in the URL checks
19+
file_types: .rst,.md,.py,.ipynb
20+
21+
# Choose whether to include file with no URLs in the prints.
22+
print_all: false
23+
24+
# Timeout in 10 seconds if url is not reached
25+
timeout: 10
26+
27+
# How many times to retry a failed request (each is logged, defaults to 1)
28+
retry_count: 5
29+
30+
# A comma separated patterns to exclude during URL checks
31+
exclude_patterns: https://www.datacamp.com/community/tutorials/fuzzy-string-python,http://127.0.0.1
32+
33+
# A comma separated list of file patterns (direct paths work as well) to exclude
34+
exclude_files: CHANGELOG.md
35+

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,34 @@
22

33
## Features
44

5+
- Added the electrolyte overpotential and Ohmic losses for full conductivity, including surface form ([#1350](https://github.com/pybamm-team/PyBaMM/pull/1350))
56
- Added functionality to `Citations` to print formatted citations ([#1340](https://github.com/pybamm-team/PyBaMM/pull/1340))
67
- Updated the way events are handled in `CasadiSolver` for more accurate event location ([#1328](https://github.com/pybamm-team/PyBaMM/pull/1328))
78
- Added error message if initial conditions are outside the bounds of a variable ([#1326](https://github.com/pybamm-team/PyBaMM/pull/1326))
89
- Added temperature dependence to density, heat capacity and thermal conductivity ([#1323](https://github.com/pybamm-team/PyBaMM/pull/1323))
9-
- Updated solvers' method `solve()` so it can take a list of inputs dictionaries as the `inputs` keyword argument. In this case the model is solved for each input set in the list, and a list of solutions mapping the set of inputs to the solutions is returned. Note that `solve()` can still take a single dictionary as the `inputs` keyword argument. In this case the behaviour is unchanged compared to previous versions.
1010
- Added temperature dependence to the transference number (`t_plus`) ([#1317](https://github.com/pybamm-team/PyBaMM/pull/1317))
1111
- Added new functionality for `Interpolant` ([#1312](https://github.com/pybamm-team/PyBaMM/pull/1312))
1212
- Added option to express experiments (and extract solutions) in terms of cycles of operating condition ([#1309](https://github.com/pybamm-team/PyBaMM/pull/1309))
1313
- The event time and state are now returned as part of `Solution.t` and `Solution.y` so that the event is accurately captured in the returned solution ([#1300](https://github.com/pybamm-team/PyBaMM/pull/1300))
14+
- Added reversible and irreversible lithium plating models ([#1287](https://github.com/pybamm-team/PyBaMM/pull/1287))
1415
- Reformatted the `BasicDFNHalfCell` to be consistent with the other models ([#1282](https://github.com/pybamm-team/PyBaMM/pull/1282))
1516
- Added option to make the total interfacial current density a state ([#1280](https://github.com/pybamm-team/PyBaMM/pull/1280))
1617
- Added functionality to initialize a model using the solution from another model ([#1278](https://github.com/pybamm-team/PyBaMM/pull/1278))
1718
- Added submodels for active material ([#1262](https://github.com/pybamm-team/PyBaMM/pull/1262))
19+
- Updated solvers' method `solve()` so it can take a list of inputs dictionaries as the `inputs` keyword argument. In this case the model is solved for each input set in the list, and a list of solutions mapping the set of inputs to the solutions is returned. Note that `solve()` can still take a single dictionary as the `inputs` keyword argument. In this case the behaviour is unchanged compared to previous versions.([#1261](https://github.com/pybamm-team/PyBaMM/pull/1261))
1820
- Added composite surface form electrolyte models: `CompositeDifferential` and `CompositeAlgebraic` ([#1207](https://github.com/pybamm-team/PyBaMM/issues/1207))
1921

2022
## Optimizations
2123

24+
- Add URLs checker in workflows ([#1347](https://github.com/pybamm-team/PyBaMM/pull/1347))
2225
- The `Solution` class now only creates the concatenated `y` when the user asks for it. This is an optimization step as the concatenation can be slow, especially with larger experiments ([#1331](https://github.com/pybamm-team/PyBaMM/pull/1331))
2326
- If solver method `solve()` is passed a list of inputs as the `inputs` keyword argument, the resolution of the model for each input set is spread across several Python processes, usually running in parallel on different processors. The default number of processes is the number of processors available. `solve()` takes a new keyword argument `nproc` which can be used to set this number a manually.
2427
- Variables are now post-processed using CasADi ([#1316](https://github.com/pybamm-team/PyBaMM/pull/1316))
2528
- Operations such as `1*x` and `0+x` now directly return `x` ([#1252](https://github.com/pybamm-team/PyBaMM/pull/1252))
2629

2730
## Bug fixes
2831

32+
- Differentiation now works even when the differentiation variable is a constant ([#1294](https://github.com/pybamm-team/PyBaMM/pull/1294))
2933
- Fixed a bug where the event time and state were no longer returned as part of the solution ([#1344](https://github.com/pybamm-team/PyBaMM/pull/1344))
3034
- Fixed a bug in `CasadiSolver` safe mode which crashed when there were extrapolation events but no termination events ([#1321](https://github.com/pybamm-team/PyBaMM/pull/1321))
3135
- When an `Interpolant` is extrapolated an error is raised for `CasadiSolver` (and a warning is raised for the other solvers) ([#1315](https://github.com/pybamm-team/PyBaMM/pull/1315))
@@ -38,6 +42,7 @@
3842
- `Interpolant` now takes `x` and `y` instead of a single `data` entry ([#1312](https://github.com/pybamm-team/PyBaMM/pull/1312))
3943
- Boolean model options ('sei porosity change', 'convection') must now be given in string format ('true' or 'false' instead of True or False) ([#1280](https://github.com/pybamm-team/PyBaMM/pull/1280))
4044
- Operations such as `1*x` and `0+x` now directly return `x`. This can be bypassed by explicitly creating the binary operators, e.g. `pybamm.Multiplication(1, x)` ([#1252](https://github.com/pybamm-team/PyBaMM/pull/1252))
45+
- `'Cell capacity [A.h]'` has been renamed to `'Nominal cell capacity [A.h]'`. `'Cell capacity [A.h]'` will be deprecated in the next release. ([#1352](https://github.com/pybamm-team/PyBaMM/pull/1352))
4146

4247
# [v0.3.0](https://github.com/pybamm-team/PyBaMM) - 2020-11-22
4348

CMakeBuild.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def run(self):
7979
"cmake configuration steps encountered errors, and the idaklu module"
8080
" could not be built. Make sure dependencies are correctly "
8181
"installed. See "
82-
"https://github.com/pybamm-team/PyBaMM/blob/develop/"
82+
"https://github.com/pybamm-team/PyBaMM/tree/develop"
8383
"INSTALL-LINUX-MAC.md"
8484
)
8585
raise RuntimeError(msg)

0 commit comments

Comments
 (0)