diff --git a/results/LGM50/DFN.py b/results/LGM50/DFN.py index ade8cebfcd..10347b7a87 100644 --- a/results/LGM50/DFN.py +++ b/results/LGM50/DFN.py @@ -1,5 +1,7 @@ import pybamm import numpy as np +from scipy import interpolate +import pandas as pd # load model model = pybamm.lithium_ion.DFN() @@ -8,12 +10,32 @@ geometry = model.default_geometry # load parameter values and process model and geometry +def OCV_cathode(soc): + data = pd.read_csv("/home/ferranbrosa/PyBaMM/input/parameters/lithium-ion/nmc_LGM50_ocp_CC3.csv") + interpolated_OCV_cathode = interpolate.interp1d( + data.to_numpy()[:,0], + data.to_numpy()[:,1], + bounds_error=False, + fill_value="extrapolate" + ) + return float(interpolated_OCV_cathode(soc)) + +def OCV_anode(sto): + data = pd.read_csv("/home/ferranbrosa/PyBaMM/input/parameters/lithium-ion/graphite_LGM50_ocp_CC3.csv") + interpolated_OCV_anode = interpolate.interp1d( + data.to_numpy()[:,0], + data.to_numpy()[:,1], + bounds_error=False, + fill_value="extrapolate" + ) + return float(interpolated_OCV_anode(sto)) + param = pybamm.ParameterValues("input/parameters/lithium-ion/LGM50_parameters.csv") param.update({ "Electrolyte conductivity": "electrolyte_conductivity_Petibon2016.py", "Electrolyte diffusivity": "electrolyte_diffusivity_Stewart2008.py", - "Negative electrode OCV": "graphite_LGM50_ocp_CC3.py", - "Positive electrode OCV": "nmc_LGM50_ocp_CC3.py", + "Negative electrode OCV": OCV_anode, + "Positive electrode OCV": OCV_cathode, "Negative electrode diffusivity": "graphite_LGM50_diffusivity_CC3.py", "Positive electrode diffusivity": "nmc_LGM50_diffusivity_CC3.py", "Negative electrode OCV entropic change": "graphite_entropic_change_Moura.py",