Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def __init__(self, extra_options):
# phases option is provided.
# return "1" if option not given
phases_option = extra_options.get("particle phases", "1")
if phases_option == "1":
if phases_option in ["1", ("1", "1"), ["1", "1"]]:
default_options["surface form"] = "false"
else:
default_options["surface form"] = "algebraic"
Expand Down Expand Up @@ -703,7 +703,7 @@ def __init__(self, extra_options):
# then "total interfacial current density as a state" must be "true"
if (
options["SEI film resistance"] != "none"
and options["particle phases"] != "1"
and options["particle phases"] not in ["1", ("1", "1"), ["1", "1"]]
):
options["total interfacial current density as a state"] = "true"
# Check that extra_options did not try to provide a clashing option
Expand Down Expand Up @@ -849,7 +849,7 @@ def __init__(self, extra_options):
"current collectors in a half-cell configuration"
)

if options["particle phases"] not in ["1", ("1", "1")]:
if options["particle phases"] not in ["1", ("1", "1"), ["1", "1"]]:
if not (
options["surface form"] != "false"
and options["particle"] == "Fickian diffusion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def default_quick_plot_variables(self):
def calc_esoh(self):
"""Whether to include eSOH variables in the summary variables."""
if (
self.options["particle phases"] not in ["1", ("1", "1")]
self.options["particle phases"] not in ["1", ("1", "1"), ["1", "1"]]
or self.options["working electrode"] != "both"
):
self._calc_esoh = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,14 @@ def test_default_options_cover_all_possible_options(self):
for key in options.possible_options:
assert key in options, f"Missing default for option '{key}'"

def test_explicit_single_phase_surface_form(self):
"""Explicit single-phase specification ("1", "1") should default surface form to false."""
options_default = BatteryModelOptions({})
assert options_default["surface form"] == "false"

options_explicit_tuple = BatteryModelOptions({"particle phases": ("1", "1")})
assert options_explicit_tuple["surface form"] == "false"


class TestVaasNormalization:
"""Test the centralized VAAS + surface form policy."""
Expand Down