Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
Browse files Browse the repository at this point in the history
…issue-2111-custom-transport-efficiency

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
TomTranter committed Nov 13, 2023
2 parents e96ff9a + b0db430 commit dcc55f3
Show file tree
Hide file tree
Showing 43 changed files with 1,175 additions and 730 deletions.
10 changes: 10 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,16 @@
"contributions": [
"doc"
]
},
{
"login": "RuiheLi",
"name": "RuiheLi",
"avatar_url": "https://avatars.githubusercontent.com/u/84007676?v=4",
"profile": "https://github.com/RuiheLi",
"contributions": [
"code",
"test"
]
}
],
"contributorsPerLine": 7,
Expand Down
6 changes: 4 additions & 2 deletions .github/release_workflow.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release workflow

This file contains the workflow required to make a `PyBaMM` release on GitHub and PyPI by the maintainers.
This file contains the workflow required to make a `PyBaMM` release on GitHub, PyPI, and conda-forge by the maintainers.

## rc0 releases (automated)

Expand Down Expand Up @@ -75,5 +75,7 @@ Some other essential things to check throughout the release process -
- As the release workflow is initiated by the `release` event, it's important to note that the default `GITHUB_REF` used by `actions/checkout` during the checkout process will correspond to the tag created during the release process. Consequently, the workflows will consistently build PyBaMM based on the commit associated with this tag. Should new commits be introduced to the `vYY.MM` branch, such as those addressing build issues, it becomes necessary to manually update this tag to point to the most recent commit -
```
git tag -f <tag_name> <commit_hash>
git push origin <tag_name> # can only be carried out by the maintainers
git push -f <pybamm-team/PyBaMM_remote_name> <tag_name> # can only be carried out by the maintainers
```
- If changes are made to the API, console scripts, entry points, new optional dependencies are added, support for major Python versions is dropped or added, or core project information and metadata are modified at the time of the release, make sure to update the `meta.yaml` file in the `recipe/` folder of the [conda-forge/pybamm-feedstock](https://github.com/conda-forge/pybamm-feedstock) repository accordingly by following the instructions in the [conda-forge documentation](https://conda-forge.org/docs/maintainer/updating_pkgs.html#updating-the-feedstock-repository) and re-rendering the recipe
- The conda-forge release workflow will automatically be triggered following a stable PyPI release, and the aforementioned updates should be carried out directly in the main repository by pushing changes to the automated PR created by the conda-forge-bot. A manual PR can also be created if the updates are not included in the automated PR for some reason. This manual PR **must** bump the build number in `meta.yaml` and **must** be from a personal fork of the repository.
79 changes: 45 additions & 34 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Push Docker Images
name: Build and push Docker images to Docker Hub

on:
workflow_dispatch:
Expand All @@ -7,69 +7,80 @@ on:
- develop

jobs:
pre_job:
build_docker_images:
# This workflow is only of value to PyBaMM and would always be skipped in forks
if: github.repository_owner == 'pybamm-team'
name: Image (${{ matrix.build-args }})
runs-on: ubuntu-latest
strategy:
matrix:
build-args: ["No solvers", "JAX", "ODES", "IDAKLU", "ALL"]
fail-fast: true

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: List built images
run: docker images

- name: Build and Push Docker Image (Without Solvers)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:latest
push: true
- name: Create tags for Docker images based on build-time arguments
id: tags
run: |
if [ "${{ matrix.build-args }}" = "No solvers" ]; then
echo "tag=latest" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "JAX" ]; then
echo "tag=jax" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "ODES" ]; then
echo "tag=odes" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "IDAKLU" ]; then
echo "tag=idaklu" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "ALL" ]; then
echo "tag=all" >> "$GITHUB_OUTPUT"
fi
- name: Build and Push Docker Image (With JAX Solver)
- name: Build and push Docker image to Docker Hub (no solvers)
if: matrix.build-args == 'No solvers'
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:jax
tags: pybamm/pybamm:${{ steps.tags.outputs.tag }}
push: true
build-args: |
JAX=true
platforms: linux/amd64, linux/arm64

- name: Build and Push Docker Image (With ODES & DAE Solver)
- name: Build and push Docker image to Docker Hub (with ODES and IDAKLU solvers)
if: matrix.build-args == 'ODES' || matrix.build-args == 'IDAKLU'
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:odes
tags: pybamm/pybamm:${{ steps.tags.outputs.tag }}
push: true
build-args: |
ODES=true
build-args: ${{ matrix.build-args }}=true
platforms: linux/amd64, linux/arm64

- name: Build and Push Docker Image (With IDAKLU Solver)
- name: Build and push Docker image to Docker Hub (with ALL and JAX solvers)
if: matrix.build-args == 'ALL' || matrix.build-args == 'JAX'
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:idaklu
tags: pybamm/pybamm:${{ steps.tags.outputs.tag }}
push: true
build-args: |
IDAKLU=true
build-args: ${{ matrix.build-args }}=true
# exclude arm64 for JAX and ALL builds for now, see
# https://github.com/google/jax/issues/13608
platforms: linux/amd64

- name: Build and Push Docker Image (With All Solvers)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:latest
push: true
build-args: |
ALL=true
- name: List built image(s)
run: docker images
2 changes: 1 addition & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
inputs:
target:
description: 'Deployment target. Can be "pypi" or "testpypi"'
default: "pypi"
default: "testpypi"
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,44 +84,44 @@ jobs:
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=2.38.0.20190211

- name: Install standard python dependencies
- name: Install standard Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools nox
python -m pip install --upgrade pip wheel setuptools
- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: nox -s pybamm-requires
run: pipx run nox -s pybamm-requires

- name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest')
run: nox -s unit
run: pipx run nox -s unit

- name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: nox -s coverage
run: pipx run nox -s coverage

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
uses: codecov/[email protected]

- name: Run integration tests
run: nox -s integration
run: pipx run nox -s integration

- name: Install docs dependencies and run doctests
if: matrix.os == 'ubuntu-latest'
run: nox -s doctests
run: pipx run nox -s doctests

- name: Check if the documentation can be built
if: matrix.os == 'ubuntu-latest'
run: nox -s docs
run: pipx run nox -s docs

- name: Install dev dependencies and run example tests
if: matrix.os == 'ubuntu-latest'
run: nox -s examples
run: pipx run nox -s examples

- name: Run example scripts tests
if: matrix.os == 'ubuntu-latest'
run: nox -s scripts
run: pipx run nox -s scripts

#M-series Mac Mini
build-apple-mseries:
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:

- name: Install PyBaMM dependencies
run: |
pip install --upgrade pip wheel setuptools nox
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
- name: Cache pybamm-requires nox environment for GNU/Linux
Expand All @@ -111,10 +111,10 @@ jobs:

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: nox -s pybamm-requires
run: pipx run nox -s pybamm-requires

- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: nox -s unit
run: pipx run nox -s unit

# Runs only on Ubuntu with Python 3.11
check_coverage:
Expand Down Expand Up @@ -169,10 +169,10 @@ jobs:
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
run: nox -s pybamm-requires
run: pipx run nox -s pybamm-requires

- name: Run unit tests for Ubuntu with Python 3.11 and generate coverage report
run: nox -s coverage
run: pipx run nox -s coverage

- name: Upload coverage report
uses: codecov/[email protected]
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:

- name: Install PyBaMM dependencies
run: |
pip install --upgrade pip wheel setuptools nox
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
- name: Cache pybamm-requires nox environment for GNU/Linux
Expand All @@ -254,10 +254,10 @@ jobs:

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: nox -s pybamm-requires
run: pipx run nox -s pybamm-requires

- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: nox -s integration
run: pipx run nox -s integration

# Runs only on Ubuntu with Python 3.11. Skips IDAKLU module compilation
# for speedups, which is already tested in other jobs.
Expand Down Expand Up @@ -296,14 +296,14 @@ jobs:

- name: Install PyBaMM dependencies
run: |
pip install --upgrade pip wheel setuptools nox
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
- name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11
run: nox -s doctests
run: pipx run nox -s doctests

- name: Check if the documentation can be built for GNU/Linux with Python 3.11
run: nox -s docs
run: pipx run nox -s docs

# Runs only on Ubuntu with Python 3.11
run_example_tests:
Expand Down Expand Up @@ -341,7 +341,7 @@ jobs:

- name: Install PyBaMM dependencies
run: |
pip install --upgrade pip wheel setuptools nox
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
- name: Cache pybamm-requires nox environment for GNU/Linux
Expand All @@ -358,10 +358,10 @@ jobs:
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
run: nox -s pybamm-requires
run: pipx run nox -s pybamm-requires

- name: Install dev dependencies and run example tests for GNU/Linux with Python 3.11
run: nox -s examples
run: pipx run nox -s examples

# Runs only on Ubuntu with Python 3.11
run_scripts_tests:
Expand Down Expand Up @@ -399,7 +399,7 @@ jobs:

- name: Install PyBaMM dependencies
run: |
pip install --upgrade pip wheel setuptools nox
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
- name: Cache pybamm-requires nox environment for GNU/Linux
Expand All @@ -416,7 +416,7 @@ jobs:
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
run: nox -s pybamm-requires
run: pipx run nox -s pybamm-requires

- name: Install dev dependencies and run example scripts tests for GNU/Linux with Python 3.11
run: nox -s scripts
run: pipx run nox -s scripts
12 changes: 3 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.292"
rev: "v0.1.3"
hooks:
- id: ruff
args: [--fix, --ignore=E741, --exclude=__init__.py]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.284]
args: ["--fix","--ignore=E501,E402"]
args: [--fix, --show-fixes]
types_or: [python, pyi, jupyter]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

# [v23.9rc0](https://github.com/pybamm-team/PyBaMM/tree/v23.9rc0) - 2023-10-31
## Bug fixes

- Fixed a bug where the JaxSolver would fails when using GPU support with no input parameters ([#3423](https://github.com/pybamm-team/PyBaMM/pull/3423))

## Features
- Transport efficiency submodel has new options from the literature relating to different tortuosity factor models and also a new option called "tortuosity factor" for specifying the value or function directly as parameters ([#3437](https://github.com/pybamm-team/PyBaMM/pull/3437))

# [v23.9rc0](https://github.com/pybamm-team/PyBaMM/tree/v23.9rc0) - 2023-10-31

- The parameter "Ambient temperature [K]" can now be given as a function of position `(y,z)` and time `t`. The "edge" and "current collector" heat transfer coefficient parameters can also depend on `(y,z)` ([#3257](https://github.com/pybamm-team/PyBaMM/pull/3257))
- Spherical and cylindrical shell domains can now be solved with any boundary conditions ([#3237](https://github.com/pybamm-team/PyBaMM/pull/3237))
- Processed variables now get the spatial variables automatically, allowing plotting of more generic models ([#3234](https://github.com/pybamm-team/PyBaMM/pull/3234))
Expand Down Expand Up @@ -37,6 +42,7 @@
- Error generated when invalid parameter values are passed ([#3132](https://github.com/pybamm-team/PyBaMM/pull/3132))
- Parameters in `Prada2013` have been updated to better match those given in the paper, which is a 2.3 Ah cell, instead of the mix-and-match with the 1.1 Ah cell from Lain2019 ([#3096](https://github.com/pybamm-team/PyBaMM/pull/3096))
- The `OneDimensionalX` thermal model has been updated to account for edge/tab cooling and account for the current collector volumetric heat capacity. It now gives the correct behaviour compared with a lumped model with the correct total heat transfer coefficient and surface area for cooling. ([#3042](https://github.com/pybamm-team/PyBaMM/pull/3042))
- Fixed a bug where supplying an initial soc did not work with half cell models ([#3456](https://github.com/pybamm-team/PyBaMM/pull/3456))

## Optimizations

Expand All @@ -45,6 +51,7 @@

## Breaking changes

- The parameter "Exchange-current density for lithium plating [A.m-2]" has been renamed to "Exchange-current density for lithium metal electrode [A.m-2]" when referring to the lithium plating reaction on the surface of a lithium metal electrode ([#3445](https://github.com/pybamm-team/PyBaMM/pull/3445))
- Dropped support for i686 (32-bit) architectures on GNU/Linux distributions ([#3412](https://github.com/pybamm-team/PyBaMM/pull/3412))
- The class `pybamm.thermal.OneDimensionalX` has been moved to `pybamm.thermal.pouch_cell.OneDimensionalX` to reflect the fact that the model formulation implicitly assumes a pouch cell geometry ([#3257](https://github.com/pybamm-team/PyBaMM/pull/3257))
- The "lumped" thermal option now always used the parameters "Cell cooling surface area [m2]", "Cell volume [m3]" and "Total heat transfer coefficient [W.m-2.K-1]" to compute the cell cooling regardless of the chosen "cell geometry" option. The user must now specify the correct values for these parameters instead of them being calculated based on e.g. a pouch cell. An `OptionWarning` is raised to let users know to update their parameters ([#3257](https://github.com/pybamm-team/PyBaMM/pull/3257))
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(NOT MSVC)
# MSVC does not support variable length arrays (vla)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=vla")
endif()

# casadi seems to compile without the newer versions of std::string
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
Expand Down
Loading

0 comments on commit dcc55f3

Please sign in to comment.