Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 2418 dimensional #2419

Merged
merged 141 commits into from
Mar 1, 2023
Merged

Issue 2418 dimensional #2419

merged 141 commits into from
Mar 1, 2023

Conversation

valentinsulzer
Copy link
Member

@valentinsulzer valentinsulzer commented Nov 2, 2022

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

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
Copy link
Contributor

@rtimms rtimms left a comment

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.

examples/scripts/SPMe.py Outdated Show resolved Hide resolved
pybamm/models/full_battery_models/lithium_ion/dfn.py Outdated Show resolved Hide resolved
pybamm/models/full_battery_models/lithium_ion/spm.py Outdated Show resolved Hide resolved
pybamm/parameters/lead_acid_parameters.py Outdated Show resolved Hide resolved
pybamm/parameters/lithium_ion_parameters.py Outdated Show resolved Hide resolved
pybamm/parameters/lithium_ion_parameters.py Outdated Show resolved Hide resolved
pybamm/solvers/idaklu_solver.py Outdated Show resolved Hide resolved
Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

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.

pybamm/CITATIONS.txt Outdated Show resolved Hide resolved
]

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
Sponsor 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
Member Author

Choose a reason for hiding this comment

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

yes

@@ -297,16 +277,17 @@ def _get_standard_volumetric_current_density_variables(self, variables):
phase_name = self.phase_name

if isinstance(self, pybamm.kinetics.NoReaction):
a = 1
Copy link
Sponsor 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
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

pybamm/parameters/lithium_ion_parameters.py Show resolved Hide resolved
pybamm/parameters/lithium_ion_parameters.py Show resolved Hide resolved
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