Skip to content

Parameter domains - #2063

Merged
valentinsulzer merged 11 commits into
developfrom
parameter-domains
May 24, 2022
Merged

Parameter domains#2063
valentinsulzer merged 11 commits into
developfrom
parameter-domains

Conversation

@valentinsulzer

Copy link
Copy Markdown
Member

Description

Create subclass for domain-specific parameters. e.g param.c_n_max is now param.n.c_max.
This removes duplication in creation and non-dimensionalization of the parameters, and in calling the parameters in the submodels, for example

c_max = self.domain_param.c_max

instead of

if self.domain == "Negative":
    c_max = self.param.c_n_max
else:
    c_max = self.param.c_p_max

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

@codecov

codecov Bot commented May 17, 2022

Copy link
Copy Markdown

Codecov Report

Merging #2063 (c76b36f) into develop (134585f) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #2063      +/-   ##
===========================================
- Coverage    99.35%   99.35%   -0.01%     
===========================================
  Files          346      346              
  Lines        19033    18616     -417     
===========================================
- Hits         18911    18495     -416     
+ Misses         122      121       -1     
Impacted Files Coverage Δ
...dels/submodels/current_collector/potential_pair.py 100.00% <ø> (ø)
...rrent_collector/quite_conductive_potential_pair.py 100.00% <ø> (ø)
pybamm/models/submodels/electrode/ohm/base_ohm.py 100.00% <ø> (ø)
...s/electrolyte_diffusion/leading_order_diffusion.py 100.00% <ø> (ø)
...odels/oxygen_diffusion/leading_oxygen_diffusion.py 100.00% <ø> (ø)
...mal/pouch_cell/pouch_cell_2D_current_collectors.py 100.00% <ø> (ø)
pybamm/models/submodels/thermal/x_full.py 100.00% <ø> (ø)
pybamm/expression_tree/averages.py 100.00% <100.00%> (ø)
pybamm/geometry/battery_geometry.py 100.00% <100.00%> (ø)
...m/models/full_battery_models/base_battery_model.py 99.76% <100.00%> (ø)
... and 71 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 134585f...c76b36f. Read the comment docs.

@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! I think the new parameter files are a little hard to read at first, but once you get your head around it they are actually clearer than before.

Comment thread pybamm/models/submodels/interface/base_interface.py Outdated
Comment thread pybamm/models/submodels/interface/base_interface.py Outdated
Comment thread pybamm/models/submodels/interface/base_interface.py Outdated
Comment thread pybamm/models/submodels/interface/base_interface.py Outdated
Comment thread pybamm/models/submodels/interface/base_interface.py Outdated
Comment thread pybamm/models/submodels/interface/base_interface.py
Comment thread pybamm/models/submodels/interface/base_interface.py

@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 Valentin, thanks!

@valentinsulzer
valentinsulzer merged commit f649e6a into develop May 24, 2022
@valentinsulzer
valentinsulzer deleted the parameter-domains branch May 24, 2022 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants