Skip to content

Commit

Permalink
#2418 testing polynomial models
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Nov 10, 2022
1 parent d16497d commit a99f2f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
8 changes: 7 additions & 1 deletion examples/scripts/compare_lithium_ion.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
sims.append(sim)

# plot
pybamm.dynamic_plot(sims)
pybamm.dynamic_plot(
sims,
[
"Average negative particle concentration [mol.m-3]",
"Average positive particle concentration [mol.m-3]",
],
)
8 changes: 4 additions & 4 deletions examples/scripts/compare_particle_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

# load models
models = [
pybamm.lithium_ion.DFN(
pybamm.lithium_ion.SPM(
options={"particle": "Fickian diffusion"}, name="Fickian diffusion"
),
pybamm.lithium_ion.DFN(
pybamm.lithium_ion.SPM(
options={"particle": "uniform profile"}, name="uniform profile"
),
pybamm.lithium_ion.DFN(
pybamm.lithium_ion.SPM(
options={"particle": "quadratic profile"}, name="quadratic profile"
),
pybamm.lithium_ion.DFN(
pybamm.lithium_ion.SPM(
options={"particle": "quartic profile"}, name="quartic profile"
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def set_rhs(self, variables):
R = variables[f"X-averaged {domain} particle sizes [m]"]

# eq 15 of Subramanian2005
# equivalent to dcdt = -i_cc / (eps * F * L)
dcdt = -3 * j_xav / param.F / R

if self.size_distribution is False:
Expand Down
3 changes: 3 additions & 0 deletions pybamm/parameters/parameter_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ def _process_symbol(self, symbol):
new_symbol.bounds = tuple([self.process_symbol(b) for b in symbol.bounds])
return new_symbol

elif isinstance(symbol, numbers.Number):
return pybamm.Scalar(symbol)

else:
# Backup option: return the object
return symbol
Expand Down

0 comments on commit a99f2f7

Please sign in to comment.