Skip to content

Issue 2418 dimensional - #2419

Merged
valentinsulzer merged 141 commits into
developfrom
issue-2418-dimensional
Mar 1, 2023
Merged

Issue 2418 dimensional#2419
valentinsulzer merged 141 commits into
developfrom
issue-2418-dimensional

Conversation

@valentinsulzer

@valentinsulzer valentinsulzer commented Nov 2, 2022

Copy link
Copy Markdown
Member

Description

Makes all models dimensional. Major changes:

  • Model equations now specified in dimensional form. To help with this, there are a scale and reference attributes for variables, which can be set to make sure that variables are order 1. Algebraic equations also have to be multiplied by an appropriate number (e.g. L_x**2) to make them order 1 and hence pass the tolerance check.
  • Removed dimensionless parameters
  • Removed most dimensionless variables
  • Removed some parameters that were just for non-dimensionalization (typical current, typical electrolyte concentration)

Most models are now a lot faster but some of the degradation models might be a bit slower, possibly less robust.

Fixes #2418
Fixes #2281
Fixes #2690
Fixes #1260

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@valentinsulzer
valentinsulzer marked this pull request as draft November 2, 2022 00:50
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@valentinsulzer
valentinsulzer marked this pull request as ready for review February 20, 2023 04:26

@rtimms rtimms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @tinosulzer, looks great! A few minor changes and a couple of things to check. This is going to make contributing models much simpler.

Comment thread examples/scripts/SPMe.py Outdated
Comment thread pybamm/models/full_battery_models/lithium_ion/basic_dfn_composite.py Outdated
Comment thread pybamm/models/full_battery_models/lithium_ion/dfn.py Outdated
Comment thread pybamm/models/full_battery_models/lithium_ion/spm.py Outdated
Comment thread pybamm/models/submodels/current_collector/potential_pair.py Outdated
Comment thread pybamm/parameters/lead_acid_parameters.py Outdated
Comment thread pybamm/parameters/lithium_ion_parameters.py Outdated
Comment thread pybamm/parameters/lithium_ion_parameters.py Outdated
Comment thread pybamm/solvers/idaklu_solver.py Outdated

@brosaplanella brosaplanella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, amazing job @tinosulzer! Just a few very minor comments.

Comment thread pybamm/CITATIONS.txt Outdated
Comment thread pybamm/models/submodels/current_collector/potential_pair.py
]

self.algebraic[delta_phi] = sum_a_j_av - sum_a_j
self.algebraic[delta_phi] = (sum_a_j_av - sum_a_j) / self.param.a_j_scale

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is dividing by self.param.a_j_scale just to have a better conditioned problem?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

phase_name = self.phase_name

if isinstance(self, pybamm.kinetics.NoReaction):
a = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a bug or was it changed later one?(Asking because we have an issue with calendar ageing that could be related).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for NoReaction it should have no effect on results since j=0 and a only ever appears as a * j

Comment thread pybamm/parameters/lithium_ion_parameters.py
Comment thread pybamm/parameters/lithium_ion_parameters.py
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
@valentinsulzer
valentinsulzer merged commit b2f8b62 into develop Mar 1, 2023
@valentinsulzer
valentinsulzer deleted the issue-2418-dimensional branch March 1, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants