-
-
Notifications
You must be signed in to change notification settings - Fork 572
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
Cracking submodel #1232
Cracking submodel #1232
Conversation
Test automated build and delployment
There are errors for testing the crack model, because of not matching shapes as below. Does anyone know how to define them in test functions, e.g.
|
For Edit: the parameter values can be fixed by setting e.g. options = {"particle": "Fickian diffusion", "particle cracking": None}
model = pybamm.lithium_ion.SPM(options)
chemistry = pybamm.parameter_sets.Ai2020
parameter_values = pybamm.ParameterValues(chemistry=chemistry)
modeltest = tests.StandardModelTest(model, parameter_values=parameter_values)
modeltest.test_all() but then it fails the standard model tests. We can fix in a separate issue |
Thanks! Any suggestions to improve the coverage of the functions in parameters? It is strange that they are not covered in BTW, can I simply delete |
tests/unit/test_parameters/test_parameter_sets/test_LCO_Ai2020.py
Outdated
Show resolved
Hide resolved
"anode", | ||
"both", | ||
]: | ||
raise pybamm.OptionError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To cover this, add a line either in test_base_battery_model.py
(see test_options
in it) and add a test that catches the error when you pass a bad cracking model
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange because I have added one like in lines 169-171 of test_base_battery_model.py
# crack model
with self.assertRaisesRegex(pybamm.OptionError, "particle cracking"):
pybamm.BaseBatteryModel({"particle cracking": "bad particle cracking"})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Then I think you need to add a line in test_options
in test_lithium_ion_parameters.py
and that should fix it. I think with this, the testing of the parameters and Rob's fix for the DFN & other tests the coverage should be pretty much sorted out.
looks like the issue with the test is because for some reason
|
If you change the definition of def _evaluate_for_shape(self):
""" See :meth:`pybamm.Symbol.evaluate_for_shape_using_domain()` """
return pybamm.evaluate_for_shape_using_domain(
self.domain, self.auxiliary_domains
) then it fixes the tests. Weird that this hadn't caused an error before... |
|
||
chemistry = pybamm.parameter_sets.Ai2020 | ||
parameter_values = pybamm.ParameterValues(chemistry=chemistry) | ||
options = {"particle": "Fickian diffusion", "particle cracking": "anode"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are almost there. To increase the coverage in the LiCo2 parameters you should include the cathode
here, either in this model, or just copy the whole test and run it with cracking in the cathode. This will also improve the coverage in base_lithium_ion_model.py
.
@@ -156,6 +156,33 @@ def test_well_posed_ec_reaction_limited(self): | |||
model.check_well_posedness() | |||
|
|||
|
|||
# class TestSPMeWithCrack(unittest.TestCase): | |||
# def test_well_posed_none_crack(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Rob's fix sorted out the issue with this test, then uncommenting these lines (for all models) should get the coverage sorted out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Really nice work Weilong :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing all our comments @weilongai, this looks great now! We should still figure out at some point what the discrepancy is with your model in Matlab
@all-contributors add @weilongai for code, example, test |
@tinosulzer I've put up a pull request to add @weilongai! 🎉 |
Thanks for all your help! |
Description
A new submodel for particle cracking in pybamm. No dependencies that are required for this change.
Fixes #671
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.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks:
Additional notes of the actions: