Skip to content

Commit

Permalink
fix tests and mpm issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aabills committed Jan 28, 2025
1 parent b7477f8 commit 34512ba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Class for varying active material volume fraction, driven by stress
# Class for varying active material volume fraction
#
import pybamm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, param, domain, x_average, options, phase="primary"):
def get_fundamental_variables(self):
domain, Domain = self.domain_Domain
phase_name = self.phase_param.phase_name
if self.x_average is True:
if self.x_average:
if self.size_distribution:
l_cr_av_dist = pybamm.Variable(
f"X-averaged {domain} {phase_name}particle crack length distribution [m]",
Expand All @@ -47,8 +47,10 @@ def get_fundamental_variables(self):
},
scale=self.phase_param.l_cr_0,
)
l_cr_dist = pybamm.SecondaryBroadcast(
l_cr_av_dist, f"{domain} electrode"
)
l_cr_av = pybamm.size_average(l_cr_av_dist)
l_cr_dist = pybamm.PrimaryBroadcast(l_cr_av_dist, f"{domain} electrode")
else:
l_cr_av = pybamm.Variable(
f"X-averaged {domain} {phase_name}particle crack length [m]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ def test_well_posed_psd_mechanics(self):
options = {
"particle size": "distribution",
"particle mechanics": "swelling and cracking",
"surface form": "algebraic",
}
self.check_well_posedness(options)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,6 @@ def test_nonspherical_particle_not_implemented(self):
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_loss_active_material_stress_negative_not_implemented(self):
options = {"loss of active material": ("stress-driven", "none")}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_loss_active_material_stress_positive_not_implemented(self):
options = {"loss of active material": ("none", "stress-driven")}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_loss_active_material_stress_both_not_implemented(self):
options = {"loss of active material": "stress-driven"}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_reversible_plating_with_porosity_not_implemented(self):
options = {
"lithium plating": "reversible",
Expand All @@ -101,11 +86,6 @@ def test_reversible_plating_with_porosity_not_implemented(self):
with pytest.raises(pybamm.OptionError, match="distributions"):
pybamm.lithium_ion.MPM(options)

def test_stress_induced_diffusion_not_implemented(self):
options = {"stress-induced diffusion": "true"}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_msmr(self):
options = {
"open-circuit potential": "MSMR",
Expand Down Expand Up @@ -186,25 +166,3 @@ def test_ec_reaction_limited_not_implemented(self):
}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)


class TestMPMWithMechanics:
def test_well_posed_negative_cracking_not_implemented(self):
options = {"particle mechanics": ("swelling and cracking", "none")}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_well_posed_positive_cracking_not_implemented(self):
options = {"particle mechanics": ("none", "swelling and cracking")}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_well_posed_both_cracking_not_implemented(self):
options = {"particle mechanics": "swelling and cracking"}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

def test_well_posed_both_swelling_only_not_implemented(self):
options = {"particle mechanics": "swelling only"}
with pytest.raises(NotImplementedError):
pybamm.lithium_ion.MPM(options)

0 comments on commit 34512ba

Please sign in to comment.