Skip to content

Commit

Permalink
Merge pull request #1859 from pybamm-team/stress-induced-diffusion-op…
Browse files Browse the repository at this point in the history
…tion

default stress-induced diffusion
  • Loading branch information
valentinsulzer authored Dec 15, 2021
2 parents 85c66a7 + 075db57 commit 93d6ddc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,15 @@ def __init__(self, extra_options):
# provided

# Change the default for stress-induced diffusion based on which particle
# mechanics option is provided
# mechanics option is provided. If the user doesn't supply a particle mechanics
# option set the default stress-induced diffusion option based on the default
# particle mechanics option which may change depending on other options
# (e.g. for stress-driven LAM the default mechanics option is "swelling only")
mechanics_option = extra_options.get("particle mechanics", "none")
if mechanics_option == "none":
if (
mechanics_option == "none"
and default_options["particle mechanics"] == "none"
):
default_options["stress-induced diffusion"] = "false"
else:
default_options["stress-induced diffusion"] = "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'SEI': 'none' (possible: ['none', 'constant', 'reaction limited', 'solvent-diffusion limited', 'electron-migration limited', 'interstitial-diffusion limited', 'ec reaction limited'])
'SEI film resistance': 'none' (possible: ['none', 'distributed', 'average'])
'SEI porosity change': 'false' (possible: ['false', 'true'])
'stress-induced diffusion': 'false' (possible: ['false', 'true'])
'stress-induced diffusion': 'true' (possible: ['false', 'true'])
'surface form': 'differential' (possible: ['false', 'differential', 'algebraic'])
'thermal': 'x-full' (possible: ['isothermal', 'lumped', 'x-lumped', 'x-full'])
'total interfacial current density as a state': 'false' (possible: ['false', 'true'])
Expand Down Expand Up @@ -250,6 +250,10 @@ def test_options(self):
)
}
)
# check default options change
model = pybamm.BaseBatteryModel({"loss of active material": "stress-driven"})
self.assertEqual(model.options["particle mechanics"], "swelling only")
self.assertEqual(model.options["stress-induced diffusion"], "true")

# crack model
with self.assertRaisesRegex(pybamm.OptionError, "particle mechanics"):
Expand Down

0 comments on commit 93d6ddc

Please sign in to comment.