Skip to content

Commit

Permalink
Merge branch 'develop' into feat/refactorParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kratman authored Sep 6, 2024
2 parents 51c4978 + ee325c7 commit 3848c7c
Show file tree
Hide file tree
Showing 38 changed files with 76 additions and 110 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,15 @@
"code",
"test"
]
},
{
"login": "medha-14",
"name": "Medha Bhardwaj",
"avatar_url": "https://avatars.githubusercontent.com/u/143182673?v=4",
"profile": "https://github.com/medha-14",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
10 changes: 0 additions & 10 deletions .github/release_reminder.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/periodic_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
LD_LIBRARY_PATH: $HOME/.local/lib

- name: Upload results as artifact
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: asv_periodic_results
path: results
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL=${{ steps.get_num_cores.outputs.count }}
CIBW_ARCHS: AMD64
CIBW_BEFORE_BUILD: python -m pip install setuptools wheel delvewheel # skip CasADi and CMake
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair -w {dest_dir} {wheel}
# Fix access violation because GHA runners have modified PATH that picks wrong
# msvcp140.dll, see https://github.com/adang1345/delvewheel/issues/54
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair --add-path C:/Windows/System32 -w {dest_dir} {wheel}
CIBW_TEST_EXTRAS: "all,dev,jax"
CIBW_TEST_COMMAND: |
python -c "import pybamm; print(pybamm.IDAKLUSolver())"
python -m pytest -m cibw {project}/tests/unit
- name: Upload Windows wheels
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: wheels_windows
path: ./wheelhouse/*.whl
Expand Down Expand Up @@ -127,7 +129,7 @@ jobs:
python -m pytest -m cibw {project}/tests/unit
- name: Upload wheels for Linux
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: wheels_manylinux
path: ./wheelhouse/*.whl
Expand All @@ -149,9 +151,6 @@ jobs:
- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.12.0 https://github.com/pybind/pybind11.git -c advice.detachedHead=false

- name: Set macOS-specific environment variables
run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

Expand Down Expand Up @@ -243,13 +242,15 @@ jobs:
python scripts/install_KLU_Sundials.py
python -m cibuildwheel --output-dir wheelhouse
env:
# 10.13 for Intel (macos-12/macos-13), 11.0 for Apple Silicon (macos-14 and macos-latest)
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-14' && '11.0' || '10.13' }}
CIBW_ARCHS_MACOS: auto
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate
CIBW_REPAIR_WHEEL_COMMAND: |
if [[ $(uname -m) == "x86_64" ]]; then
delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel}
elif [[ $(uname -m) == "arm64" ]]; then
# Use higher macOS target for now: https://github.com/casadi/casadi/issues/3698
# Use higher macOS target for now since casadi/libc++.1.0.dylib is still not fixed
delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel} --require-target-macos-version 11.1
for file in {dest_dir}/*.whl; do mv "$file" "${file//macosx_11_1/macosx_11_0}"; done
fi
Expand All @@ -260,7 +261,7 @@ jobs:
python -m pytest -m cibw {project}/tests/unit
- name: Upload wheels for macOS (amd64, arm64)
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: wheels_${{ matrix.os }}
path: ./wheelhouse/*.whl
Expand All @@ -280,7 +281,7 @@ jobs:
run: pipx run build --sdist

- name: Upload SDist
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: sdist
path: ./dist/*.tar.gz
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/release_reminder.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/run_benchmarks_over_history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
${{ github.event.inputs.commit_start }}..${{ github.event.inputs.commit_end }}
- name: Upload results as artifact
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: asv_over_history_results
path: results
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: SARIF file
path: results.sarif
Expand All @@ -68,6 +68,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5
uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/work_precision_sets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
python benchmarks/work_precision_sets/time_vs_reltols.py
python benchmarks/work_precision_sets/time_vs_abstols.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
delete-branch: true
branch-suffix: short-commit-hash
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.2"
rev: "v0.6.3"
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

## Optimizations
- Removed the `start_step_offset` setting and disabled minimum `dt` warnings for drive cycles with the (`IDAKLUSolver`). ([#4416](https://github.com/pybamm-team/PyBaMM/pull/4416))

## Breaking changes
- Renamed `set_events` function to `add_events_from` to better reflect its purpose. ([#4421](https://github.com/pybamm-team/PyBaMM/pull/4421))

# [v24.9.0](https://github.com/pybamm-team/PyBaMM/tree/v24.9.0) - 2024-09-03

## Features

- Added additional user-configurable options to the (`IDAKLUSolver`) and adjusted the default values to improve performance. ([#4282](https://github.com/pybamm-team/PyBaMM/pull/4282))
- Added the diffusion element to be used in the Thevenin model. ([#4254](https://github.com/pybamm-team/PyBaMM/pull/4254))
- Added lumped surface thermal model ([#4203](https://github.com/pybamm-team/PyBaMM/pull/4203))

## Optimizations

Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ keywords:
- "expression tree"
- "python"
- "symbolic differentiation"
version: "24.5"
version: "24.9.0"
repository-code: "https://github.com/pybamm-team/PyBaMM"
title: "Python Battery Mathematical Modelling (PyBaMM)"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/pybamm-team/PyBaMM/badge)](https://scorecard.dev/viewer/?uri=github.com/pybamm-team/PyBaMM)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-90-orange.svg)](#-contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-91-orange.svg)](#-contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

</div>
Expand Down
1 change: 1 addition & 0 deletions all_contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Ubham16"><img src="https://avatars.githubusercontent.com/u/173074476?v=4?s=100" width="100px;" alt="Ubham16"/><br /><sub><b>Ubham16</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=Ubham16" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MehrdadBabazadeh"><img src="https://avatars.githubusercontent.com/u/30574522?v=4?s=100" width="100px;" alt="Mehrdad Babazadeh"/><br /><sub><b>Mehrdad Babazadeh</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=MehrdadBabazadeh" title="Code">💻</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=MehrdadBabazadeh" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pipliggins"><img src="https://avatars.githubusercontent.com/u/55396775?v=4?s=100" width="100px;" alt="Pip Liggins"/><br /><sub><b>Pip Liggins</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=pipliggins" title="Code">💻</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=pipliggins" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/medha-14"><img src="https://avatars.githubusercontent.com/u/143182673?v=4?s=100" width="100px;" alt="Medha Bhardwaj"/><br /><sub><b>Medha Bhardwaj</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=medha-14" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ requires = [
"setuptools>=64",
"wheel",
# On Windows, use the CasADi vcpkg registry and CMake bundled from MSVC
"casadi>=3.6.5; platform_system!='Windows'",
"casadi>=3.6.6; platform_system!='Windows'",
# Note: the version of CasADi as a build-time dependency should be matched
# cross platforms, so updates to its minimum version here should be accompanied
# across platforms, so updates to its minimum version here should be accompanied
# by a version bump in https://github.com/pybamm-team/casadi-vcpkg-registry.
"cmake; platform_system!='Windows'",
]
build-backend = "setuptools.build_meta"

[project]
name = "pybamm"
version = "24.5"
version = "24.9.0"
license = { file = "LICENSE.txt" }
description = "Python Battery Mathematical Modelling"
authors = [{name = "The PyBaMM Team", email = "[email protected]"}]
Expand All @@ -37,7 +37,7 @@ classifiers = [
dependencies = [
"numpy>=1.23.5,<2.0.0",
"scipy>=1.11.4",
"casadi>=3.6.5",
"casadi>=3.6.6",
"xarray>=2022.6.0",
"anytree>=2.8.0",
"sympy>=1.12",
Expand Down
19 changes: 2 additions & 17 deletions scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import os
import re
from datetime import date
from dateutil.relativedelta import relativedelta


import pybamm


Expand All @@ -17,11 +14,7 @@ def update_version():
Opens file and updates the version number
"""
release_version = os.getenv("VERSION")[1:]
release_date = (
date.today()
if "rc" in release_version
else date.today() + relativedelta(day=31)
)
release_date = date.today()

# pybamm/version.py
with open(
Expand Down Expand Up @@ -84,15 +77,7 @@ def update_version():
with open(os.path.join(pybamm.root_dir(), "CHANGELOG.md"), "r+") as file:
output_list = file.readlines()
output_list[0] = changelog_line1
# add a new heading for rc0 releases
if "rc0" in release_version:
output_list.insert(2, changelog_line2)
else:
# for rcX and final releases, update the already existing rc
# release heading
for i in range(0, len(output_list)):
if re.search("[v]\d\d\.\drc\d", output_list[i]):
output_list[i] = changelog_line2[:-1]
output_list.insert(2, changelog_line2)
file.truncate(0)
file.seek(0)
file.writelines(output_list)
Expand Down
2 changes: 1 addition & 1 deletion src/pybamm/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def build_model_equations(self):
f"Setting initial conditions for {submodel_name} submodel ({self.name})"
)
submodel.set_initial_conditions(self.variables)
submodel.set_events(self.variables)
submodel.add_events_from(self.variables)
pybamm.logger.verbose(f"Updating {submodel_name} submodel ({self.name})")
self.update(submodel)
self.check_no_repeated_keys()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ def build_model_equations(self):
f"Setting initial conditions for {submodel_name} submodel ({self.name})"
)
submodel.set_initial_conditions(self.variables)
submodel.set_events(self.variables)
submodel.add_events_from(self.variables)
pybamm.logger.verbose(f"Updating {submodel_name} submodel ({self.name})")
self.update(submodel)
self.check_no_repeated_keys()
Expand Down
2 changes: 1 addition & 1 deletion src/pybamm/models/submodels/base_submodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def set_initial_conditions(self, variables):
"""
pass

def set_events(self, variables):
def add_events_from(self, variables):
"""
A method to set events related to the state of submodel variable. Note: this
method modifies the state of self.events. Unless overwritten by a submodel, the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ def set_boundary_conditions(self, variables):
}
}

def set_events(self, variables):
def add_events_from(self, variables):
# No event since the concentration is constant
pass
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def set_initial_conditions(self, variables):
z = variables["Distributed SoC"]
self.initial_conditions = {z: self.param.initial_soc}

def set_events(self, variables):
def add_events_from(self, variables):
z_surf = variables["Surface SoC"]
self.events += [
pybamm.Event("Minimum surface SoC", z_surf),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def set_initial_conditions(self, variables):
soc = variables["SoC"]
self.initial_conditions = {soc: self.param.initial_soc}

def set_events(self, variables):
def add_events_from(self, variables):
soc = variables["SoC"]
self.events += [
pybamm.Event("Minimum SoC", soc),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def x_not_zero(x):

return variables

def set_events(self, variables):
def add_events_from(self, variables):
voltage = variables["Voltage [V]"]

# Add voltage events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def set_initial_conditions(self, variables):

self.initial_conditions = {u: u_init}

def set_events(self, variables):
def add_events_from(self, variables):
domain, Domain = self.domain_Domain

if self.reaction_loc == "full electrode":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def set_initial_conditions(self, variables):
l_cr_0 = pybamm.PrimaryBroadcast(l_cr_0, f"{domain} electrode")
self.initial_conditions = {l_cr: l_cr_0}

def set_events(self, variables):
def add_events_from(self, variables):
domain, Domain = self.domain_Domain

if self.x_average is True:
Expand Down
2 changes: 1 addition & 1 deletion src/pybamm/models/submodels/porosity/constant_porosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def get_fundamental_variables(self):

return variables

def set_events(self, variables):
def add_events_from(self, variables):
# No events since porosity is constant
pass
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_coupled_variables(self, variables):

return variables

def set_events(self, variables):
def add_events_from(self, variables):
eps_p = variables["Positive electrode porosity"]
self.events.append(
pybamm.Event(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def set_initial_conditions(self, variables):
eps = variables["Porosity"]
self.initial_conditions = {eps: self.param.epsilon_init}

def set_events(self, variables):
def add_events_from(self, variables):
for domain in self.options.whole_cell_domains:
if domain == "separator":
continue
Expand Down
Loading

0 comments on commit 3848c7c

Please sign in to comment.