From 845ad84ccde1e4f73f6ab3cda74290835d236f11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 19:32:49 +0000 Subject: [PATCH 1/8] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/benchmark_on_push.yml | 2 +- .github/workflows/create_release.yml | 2 +- .github/workflows/lychee_url_checker.yml | 2 +- .github/workflows/periodic_benchmarks.yml | 4 ++-- .github/workflows/publish_pypi.yml | 6 +++--- .github/workflows/run_benchmarks_over_history.yml | 4 ++-- .github/workflows/run_periodic_tests.yml | 6 +++--- .github/workflows/test_on_push.yml | 12 ++++++------ .github/workflows/update_license.yml | 4 ++-- .github/workflows/update_version.yml | 2 +- .github/workflows/work_precision_sets.yml | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/benchmark_on_push.yml b/.github/workflows/benchmark_on_push.yml index 07747af58c..126f4d3a09 100644 --- a/.github/workflows/benchmark_on_push.yml +++ b/.github/workflows/benchmark_on_push.yml @@ -13,7 +13,7 @@ jobs: benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.8 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 6280387e53..8d029d3bc5 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -17,7 +17,7 @@ jobs: python-version: [3.8] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get current date run: | diff --git a/.github/workflows/lychee_url_checker.yml b/.github/workflows/lychee_url_checker.yml index a6735d2806..d727ca0784 100644 --- a/.github/workflows/lychee_url_checker.yml +++ b/.github/workflows/lychee_url_checker.yml @@ -24,7 +24,7 @@ jobs: restore-keys: cache-lychee- # check URLs with Lychee - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # use stable version for now to avoid breaking changes - name: Lychee URL checker diff --git a/.github/workflows/periodic_benchmarks.yml b/.github/workflows/periodic_benchmarks.yml index 239f5fa5bb..ce0ad37cd2 100644 --- a/.github/workflows/periodic_benchmarks.yml +++ b/.github/workflows/periodic_benchmarks.yml @@ -19,7 +19,7 @@ jobs: benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.8 uses: actions/setup-python@v4 with: @@ -58,7 +58,7 @@ jobs: - name: Install asv run: pip install asv - name: Checkout pybamm-bench repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pybamm-team/pybamm-bench token: ${{ secrets.BENCH_PAT }} diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 6d89da1387..54dd70d5a7 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -19,7 +19,7 @@ jobs: name: Build wheels on windows-latest runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.8 @@ -74,7 +74,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.8 @@ -135,7 +135,7 @@ jobs: python-version: [3.8] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/run_benchmarks_over_history.yml b/.github/workflows/run_benchmarks_over_history.yml index 9cdcc0b2c0..6752e38800 100644 --- a/.github/workflows/run_benchmarks_over_history.yml +++ b/.github/workflows/run_benchmarks_over_history.yml @@ -22,7 +22,7 @@ jobs: benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.8 uses: actions/setup-python@v4 with: @@ -59,7 +59,7 @@ jobs: - name: Install asv run: pip install asv - name: Checkout pybamm-bench repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pybamm-team/pybamm-bench token: ${{ secrets.BENCH_PAT }} diff --git a/.github/workflows/run_periodic_tests.yml b/.github/workflows/run_periodic_tests.yml index f70a748800..663eb5cfca 100644 --- a/.github/workflows/run_periodic_tests.yml +++ b/.github/workflows/run_periodic_tests.yml @@ -32,7 +32,7 @@ jobs: if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup python uses: actions/setup-python@v4 with: @@ -53,7 +53,7 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -127,7 +127,7 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install python & create virtualenv shell: bash run: | diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 2fd4c92b2e..839d53306f 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -16,7 +16,7 @@ jobs: style: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: @@ -43,7 +43,7 @@ jobs: steps: - name: Check out PyBaMM repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install and cache apt packages - name: Install Linux system dependencies @@ -123,7 +123,7 @@ jobs: steps: - name: Check out PyBaMM repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install and cache apt packages - name: Install Linux system dependencies @@ -186,7 +186,7 @@ jobs: steps: - name: Check out PyBaMM repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install and cache apt packages - name: Install Linux system dependencies @@ -266,7 +266,7 @@ jobs: steps: - name: Check out PyBaMM repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install and cache apt packages - name: Install Linux system dependencies @@ -327,7 +327,7 @@ jobs: steps: - name: Check out PyBaMM repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install and cache apt packages - name: Install Linux system dependencies diff --git a/.github/workflows/update_license.yml b/.github/workflows/update_license.yml index 718b24e6b7..4712b5dd94 100644 --- a/.github/workflows/update_license.yml +++ b/.github/workflows/update_license.yml @@ -13,7 +13,7 @@ jobs: if: github.repository_owner == 'pybamm-team' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Update year in license @@ -28,7 +28,7 @@ jobs: needs: license runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Update year in docs diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml index c205603c88..7488c40aa2 100644 --- a/.github/workflows/update_version.yml +++ b/.github/workflows/update_version.yml @@ -13,7 +13,7 @@ jobs: python-version: [3.8] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/.github/workflows/work_precision_sets.yml b/.github/workflows/work_precision_sets.yml index 5be4d079f8..87eb068947 100644 --- a/.github/workflows/work_precision_sets.yml +++ b/.github/workflows/work_precision_sets.yml @@ -9,7 +9,7 @@ jobs: benchmarks_on_release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup python uses: actions/setup-python@v4 with: From b7ee3ca0c6f592791f5e3d0229fb78cc81962162 Mon Sep 17 00:00:00 2001 From: Arjun Date: Tue, 5 Sep 2023 16:37:42 +0530 Subject: [PATCH 2/8] Pin `asv==0.5.1` to fix failing benchmarks (#3310) * Pin `asv==0.5.1` to fix failing benchmarks * Add comment for pinning `asv==0.5.1` --- .github/workflows/benchmark_on_push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark_on_push.yml b/.github/workflows/benchmark_on_push.yml index 126f4d3a09..8be4af8741 100644 --- a/.github/workflows/benchmark_on_push.yml +++ b/.github/workflows/benchmark_on_push.yml @@ -23,8 +23,9 @@ jobs: sudo apt-get update sudo apt install gfortran gcc libopenblas-dev - name: Install python dependencies + # Pin asv==0.5.1 to fix failing benchmarks. Related to https://github.com/airspeed-velocity/asv/issues/1323 run: | - python -m pip install --upgrade pip wheel setuptools virtualenv asv wget cmake casadi numpy + python -m pip install --upgrade pip wheel setuptools virtualenv asv==0.5.1 wget cmake casadi numpy - name: Install SuiteSparse and Sundials run: python scripts/install_KLU_Sundials.py - name: Fetch base branch From f73621866f72d25b8d64cb7865137b5224c09296 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 6 Sep 2023 00:02:54 +0530 Subject: [PATCH 3/8] #3309 Fix doctests --- docs/source/user_guide/installation/windows-wsl.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/user_guide/installation/windows-wsl.rst b/docs/source/user_guide/installation/windows-wsl.rst index d08545edc0..6453c92211 100644 --- a/docs/source/user_guide/installation/windows-wsl.rst +++ b/docs/source/user_guide/installation/windows-wsl.rst @@ -22,13 +22,13 @@ Get PyBaMM's Source Code sudo apt install git-core -3. Clone the PyBaMM repository:: +3. Clone the PyBaMM repository: .. code:: bash git clone https://github.com/pybamm-team/PyBaMM.git -4. Enter the PyBaMM Directory by running:: +4. Enter the PyBaMM Directory by running: .. code:: bash From a05a4616153b0c4eb638f54f4bf3154b2026c392 Mon Sep 17 00:00:00 2001 From: martinjrobins Date: Thu, 7 Sep 2023 10:48:03 +0000 Subject: [PATCH 4/8] #3130 use model.y_slices rather than var.y_slice --- pybamm/solvers/solution.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pybamm/solvers/solution.py b/pybamm/solvers/solution.py index 411341f887..9284aa942b 100644 --- a/pybamm/solvers/solution.py +++ b/pybamm/solvers/solution.py @@ -308,7 +308,8 @@ def check_ys_are_not_too_large(self): y = y[:, -1] if np.any(y > pybamm.settings.max_y_value): for var in [*model.rhs.keys(), *model.algebraic.keys()]: - y_var = y[model.variables[var.name].y_slices[0]] + first_index = model.y_slices[var][0] + y_var = y[first_index] if np.any(y_var > pybamm.settings.max_y_value): pybamm.logger.error( f"Solution for '{var}' exceeds the maximum allowed value " From c5bdce7e7414a988ef685710cfd71b1c50427902 Mon Sep 17 00:00:00 2001 From: martinjrobins Date: Thu, 7 Sep 2023 10:48:48 +0000 Subject: [PATCH 5/8] #3130 use a more accurate name --- pybamm/solvers/solution.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pybamm/solvers/solution.py b/pybamm/solvers/solution.py index 9284aa942b..3da5673e34 100644 --- a/pybamm/solvers/solution.py +++ b/pybamm/solvers/solution.py @@ -308,8 +308,8 @@ def check_ys_are_not_too_large(self): y = y[:, -1] if np.any(y > pybamm.settings.max_y_value): for var in [*model.rhs.keys(), *model.algebraic.keys()]: - first_index = model.y_slices[var][0] - y_var = y[first_index] + slice = model.y_slices[var][0] + y_var = y[slice] if np.any(y_var > pybamm.settings.max_y_value): pybamm.logger.error( f"Solution for '{var}' exceeds the maximum allowed value " From 209ad4761ee3c70ab2a3b24642015753aab38a70 Mon Sep 17 00:00:00 2001 From: martinjrobins Date: Thu, 7 Sep 2023 11:07:58 +0000 Subject: [PATCH 6/8] #3130 fix case where model isnt discretised --- pybamm/solvers/solution.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pybamm/solvers/solution.py b/pybamm/solvers/solution.py index 3da5673e34..d6f8b03f3e 100644 --- a/pybamm/solvers/solution.py +++ b/pybamm/solvers/solution.py @@ -308,8 +308,18 @@ def check_ys_are_not_too_large(self): y = y[:, -1] if np.any(y > pybamm.settings.max_y_value): for var in [*model.rhs.keys(), *model.algebraic.keys()]: - slice = model.y_slices[var][0] - y_var = y[slice] + var = model.variables[var.name] + # find the statevector corresponding to this variable + statevector = None + for node in var.pre_order(): + if isinstance(node, pybamm.StateVector): + statevector = node + if statevector is None: + raise RuntimeError( + "Cannot find statevector corresponding to variable {}" + .format(var.name) + ) + y_var = y[statevector.y_slices[0]] if np.any(y_var > pybamm.settings.max_y_value): pybamm.logger.error( f"Solution for '{var}' exceeds the maximum allowed value " From 52ab34103514b6c68205c294508d99995d829dbb Mon Sep 17 00:00:00 2001 From: martinjrobins Date: Thu, 7 Sep 2023 12:42:08 +0000 Subject: [PATCH 7/8] #3130 no cover for branch --- pybamm/solvers/solution.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pybamm/solvers/solution.py b/pybamm/solvers/solution.py index d6f8b03f3e..65c3e0b5a7 100644 --- a/pybamm/solvers/solution.py +++ b/pybamm/solvers/solution.py @@ -314,7 +314,9 @@ def check_ys_are_not_too_large(self): for node in var.pre_order(): if isinstance(node, pybamm.StateVector): statevector = node - if statevector is None: + + # there will always be a statevector, but just in case + if statevector is None: # pragma: no cover raise RuntimeError( "Cannot find statevector corresponding to variable {}" .format(var.name) From ccd53ebb0823189d5851485707a02945432ecf7c Mon Sep 17 00:00:00 2001 From: martinjrobins Date: Thu, 7 Sep 2023 14:59:10 +0000 Subject: [PATCH 8/8] #3130 add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ec5e39b8b..d6927f20bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ## Bug fixes +- Fixed a bug that occured in `check_ys_are_not_too_large` when trying to reference `y-slice` where the referenced variable was not a `pybamm.StateVector` ([#3313](https://github.com/pybamm-team/PyBaMM/pull/3313) - Fixed a bug with `_Heaviside._evaluate_for_shape` which meant some expressions involving heaviside function and subtractions did not work ([#3306](https://github.com/pybamm-team/PyBaMM/pull/3306)) - 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 the "basic" lithium-ion models gave incorrect results when using nonlinear particle diffusivity ([#3207](https://github.com/pybamm-team/PyBaMM/pull/3207))