Skip to content

Variable scale and reference - #2440

Merged
valentinsulzer merged 20 commits into
developfrom
dimensional-dfn
Nov 10, 2022
Merged

Variable scale and reference#2440
valentinsulzer merged 20 commits into
developfrom
dimensional-dfn

Conversation

@valentinsulzer

@valentinsulzer valentinsulzer commented Nov 9, 2022

Copy link
Copy Markdown
Member

Description

Adds scale and reference attributes to a variable, which are used to multiply and/or add a value to a variable to make the resulting numerics better conditioned.
Progress towards #2418

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 changed the base branch from develop to more-simplifications November 9, 2022 22:59
@codecov

codecov Bot commented Nov 9, 2022

Copy link
Copy Markdown

Codecov Report

Base: 99.72% // Head: 99.72% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (a880bd1) compared to base (c2c0f28).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           more-simplifications    #2440   +/-   ##
=====================================================
  Coverage                 99.72%   99.72%           
=====================================================
  Files                       258      258           
  Lines                     19211    19258   +47     
=====================================================
+ Hits                      19158    19205   +47     
  Misses                       53       53           
Impacted Files Coverage Δ
...models/full_battery_models/lead_acid/basic_full.py 100.00% <ø> (ø)
...odels/full_battery_models/lithium_ion/basic_dfn.py 100.00% <ø> (ø)
..._battery_models/lithium_ion/basic_dfn_half_cell.py 99.01% <ø> (ø)
...lyte_conductivity/base_electrolyte_conductivity.py 100.00% <ø> (ø)
...dels/electrolyte_conductivity/full_conductivity.py 100.00% <ø> (ø)
pybamm/discretisations/discretisation.py 99.80% <100.00%> (+<0.01%) ⬆️
pybamm/expression_tree/concatenations.py 100.00% <100.00%> (ø)
pybamm/expression_tree/symbol.py 100.00% <100.00%> (ø)
pybamm/expression_tree/variable.py 100.00% <100.00%> (ø)
...e_potential_form/full_surface_form_conductivity.py 100.00% <100.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@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 good, but the dimensional DFN is not there yet, is it?

(can be model.rhs, model.algebraic, model.initial_conditions or
model.variables)
ics : bool, optional
Whether the equations are initial conditions. If True, the equations are

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.

Suggested change
Whether the equations are initial conditions. If True, the equations are
Whether the equations have initial conditions. If True, the equations are

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.

This is meant to be are, this is the function that discretises the equations (rhs, algebraic, initial conditions) and there is a special case for initial conditions (reference only gets taken away from initial conditions)

return self.kappa_e_dimensional(c_e_dimensional, self.T_ref) / kappa_scale

def chiT_over_c(self, c_e, T):
def chiRT_over_Fc(self, c_e, T):

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.

What's the meaning of Fc?

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.

Faraday's constant times c

@valentinsulzer

Copy link
Copy Markdown
Member Author

I removed the dimensional DFN since when we eventually dimensionalize all the models it will not be there, so I don't want people adding it to their code. This PR now only adds the scaling and reference

@valentinsulzer valentinsulzer changed the title Dimensional dfn Variable scale and reference Nov 10, 2022
Base automatically changed from more-simplifications to develop November 10, 2022 13:21
@valentinsulzer
valentinsulzer merged commit ee419ce into develop Nov 10, 2022
@valentinsulzer
valentinsulzer deleted the dimensional-dfn branch November 10, 2022 13:21
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.

2 participants