Skip to content

Commit 865c32e

Browse files
#1456 compare_lithium_ion now works
1 parent 2cd0bb3 commit 865c32e

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

examples/scripts/compare_lithium_ion.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#
44
import pybamm
55

6-
pybamm.set_logging_level("DEBUG")
6+
pybamm.set_logging_level("INFO")
77

88
# load models
99
models = [
10-
# pybamm.lithium_ion.SPM(),
11-
# pybamm.lithium_ion.SPMe(),
10+
pybamm.lithium_ion.SPM(),
11+
pybamm.lithium_ion.SPMe(),
1212
pybamm.lithium_ion.DFN(),
13-
# pybamm.lithium_ion.NewmanTobias(),
13+
pybamm.lithium_ion.NewmanTobias(),
1414
]
1515

1616
# create and run simulations

pybamm/expression_tree/binary_operators.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,10 @@ def simplified_matrix_multiplication(left, right):
11921192
if right.right.evaluates_to_constant_number():
11931193
r_left, r_right = right.orphans
11941194
new_left = left / r_right
1195-
return new_left @ r_left
1195+
new_mul = new_left @ r_left
1196+
# Keep the domain of the old left
1197+
new_mul.copy_domains(left)
1198+
return new_mul
11961199

11971200
# Simplify A @ (B @ c) to (A @ B) @ c if (A @ B) is constant
11981201
# This is a common construction that appears from discretisation of spatial

pybamm/models/submodels/electrolyte_diffusion/full_diffusion.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ def get_coupled_variables(self, variables):
5353
c_e_s = eps_c_e_s / eps_s
5454
c_e_p = eps_c_e_p / eps_p
5555

56-
eps = variables["Porosity"]
57-
c_e = variables["Porosity times concentration"] / eps
5856
variables.update(
5957
self._get_standard_concentration_variables(c_e_n, c_e_s, c_e_p)
6058
)
61-
variables["Electrolyte concentration"] = c_e
6259

60+
eps = variables["Porosity"]
61+
c_e = variables["Electrolyte concentration"]
6362
tor = variables["Electrolyte tortuosity"]
6463
i_e = variables["Electrolyte current density"]
6564
v_box = variables["Volume-averaged velocity"]
@@ -82,7 +81,6 @@ def set_rhs(self, variables):
8281

8382
param = self.param
8483

85-
eps = variables["Porosity"]
8684
eps_c_e = variables["Porosity times concentration"]
8785
c_e = variables["Electrolyte concentration"]
8886
N_e = variables["Electrolyte flux"]
@@ -106,17 +104,10 @@ def set_initial_conditions(self, variables):
106104
def set_boundary_conditions(self, variables):
107105

108106
c_e = variables["Electrolyte concentration"]
109-
c_e_n = variables["Negative electrolyte concentration"]
110-
c_e_s = variables["Separator electrolyte concentration"]
111-
c_e_p = variables["Positive electrolyte concentration"]
112107

113108
self.boundary_conditions = {
114109
c_e: {
115110
"left": (pybamm.Scalar(0), "Neumann"),
116111
"right": (pybamm.Scalar(0), "Neumann"),
117112
},
118-
pybamm.concatenation(c_e_n, c_e_s, c_e_p): {
119-
"left": (pybamm.Scalar(0), "Neumann"),
120-
"right": (pybamm.Scalar(0), "Neumann"),
121-
},
122113
}

0 commit comments

Comments
 (0)