You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, I would like to run some half cell graphite simulations using particle size distribution and stoichiometry dependant diffusion within the particles. However I'm getting an error related to discretisation. Did someone already face the same issue? Thanks for the help! Cheers, Marc-Antoine
Steps to Reproduce
importpybammimportmatplotlib.pyplotaspltoptions_psd= {"working electrode" : "positive", "particle size": "distribution"}
model=pybamm.lithium_ion.DFN(options=options_psd)
parameter_values=pybamm.ParameterValues("OKane2022")
parameter_values=pybamm.get_size_distribution_parameters(parameter_values, sd_n=0.2, sd_p=0.4)
parameter_values["Maximum concentration in positive electrode [mol.m-3]"] =parameter_values["Maximum concentration in negative electrode [mol.m-3]"]
parameter_values["Initial concentration in positive electrode [mol.m-3]"] =0.001*parameter_values["Initial concentration in negative electrode [mol.m-3]"]
parameter_values["Positive electrode OCP [V]"] =parameter_values["Negative electrode OCP [V]"]
parameter_values["Lower voltage cut-off [V]"] =0.001parameter_values["Upper voltage cut-off [V]"] =1.6parameter_values["Positive electrode active material volume fraction"] =parameter_values["Negative electrode active material volume fraction"]
parameter_values["Positive electrode porosity"] =parameter_values["Negative electrode porosity"]
defgraphite_LGM50_diffusivity_ORegan2022(sto, T):
""" LG M50 Graphite diffusivity as a function of stochiometry, in this case the diffusivity is taken to be a constant. The value is taken from [1]. References ---------- .. [1] Kieran O’Regan, Ferran Brosa Planella, W. Dhammika Widanage, and Emma Kendrick. "Thermal-electrochemical parameters of a high energy lithium-ion cylindrical battery." Electrochimica Acta 425 (2022): 140700 Parameters ---------- sto: :class:`pybamm.Symbol` Electrode stochiometry T: :class:`pybamm.Symbol` Dimensional temperature Returns ------- :class:`pybamm.Symbol` Solid diffusivity """a0=11.17a1=-1.553a2=-6.136a3=-9.725a4=1.85b1=0.2031b2=0.5375b3=0.9144b4=0.5953c0=-15.11c1=0.0006091c2=0.06438c3=0.0578c4=0.001356d=2092D_ref= (
10** (
a0*sto+c0+a1*pybamm.exp(-((sto-b1) **2) /c1)
+a2*pybamm.exp(-((sto-b2) **2) /c2)
+a3*pybamm.exp(-((sto-b3) **2) /c3)
+a4*pybamm.exp(-((sto-b4) **2) /c4)
)
*3.0321# correcting factor (see O'Regan et al 2021)
)
E_D_s=d*pybamm.constants.Rarrhenius=pybamm.exp(E_D_s/pybamm.constants.R* (1/298.15-1/T))
returnD_ref*arrheniusparameter_values["Positive electrode diffusivity [m2.s-1]"] =graphite_LGM50_diffusivity_ORegan2022experiment=pybamm.Experiment(["Discharge at 1C until 0.01V (5 second period)"])
sim=pybamm.Simulation(model, parameter_values=parameter_values, experiment=experiment, solver=pybamm.CasadiSolver(rtol=1e-3))
sim.solve()
plt.figure('Half cell model results')
plt.plot(sim.solution['Discharge capacity [A.h]'].entries, sim.solution['Terminal voltage [V]'].entries, label='PyBaMM')
plt.xlabel('Capacity [A.h]')
plt.ylabel('Terminal voltage [V]')
plt.legend()
plt.grid(True)
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
I suspect the issue is with the stoichiometry dependent diffusion coefficient, because commenting parameter_values["Positive electrode diffusivity [m2.s-1]"] = graphite_LGM50_diffusivity_ORegan2022 works fine. I am not too familiar with how the PSD models work though, so hard for me to tell where the problem is.
Hi @brosaplanella , yes exactly, both PSD and stoichiometry dependent diffusion coefficient work well separately, but not together. According to the error, when PSD and stoichiometry dependent diffusion are used together the integration_dimension goes to 'tertiary' when defining the integral matrix in definite_integral_matrix function (pybamm/spatial_methods/finite_volume). I tried to add a tertiary case without great success until now, thanks for the help!
PyBaMM Version
23.4.1
Python Version
23.4.1
Describe the bug
Hello everyone, I would like to run some half cell graphite simulations using particle size distribution and stoichiometry dependant diffusion within the particles. However I'm getting an error related to discretisation. Did someone already face the same issue? Thanks for the help! Cheers, Marc-Antoine
Steps to Reproduce
Relevant log output
No response
The text was updated successfully, but these errors were encountered: