Skip to content

Commit

Permalink
removing dissolution for exchange current density
Browse files Browse the repository at this point in the history
  • Loading branch information
sravanpannala committed Sep 25, 2023
1 parent bff016d commit 46e8227
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 10 deletions.
79 changes: 79 additions & 0 deletions degradation_model/try_spme_deg.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pybamm\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import math\n",
"import dfols\n",
"import signal\n",
"from scipy.integrate import solve_ivp\n",
"from scipy.fft import fft, fftfreq, fftshift\n",
"from scipy.signal import savgol_filter\n",
"from scipy.signal import find_peaks\n",
"from scipy.io import savemat\n",
"from scipy import interpolate\n",
"import os, sys\n",
"import pickle\n",
"sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(\"__file__\"))))\n",
"from batfuns import *\n",
"plt.rcParams = set_rc_params(plt.rcParams)\n",
"\n",
"eSOH_DIR = \"./data/esoh/\"\n",
"oCV_DIR = \"./data/ocv/\"\n",
"cyc_DIR = \"./data/cycling/\"\n",
"fig_DIR = \"./figures/\"\n",
"res_DIR = \"./results/\"\n",
"resistance_DIR = \"./data/resistance/\"\n",
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# loading parameter values without aging model parameters, just battery parameters\n",
"parameter_values = get_parameter_values()\n",
"# we are defing the model\n",
"spme = pybamm.lithium_ion.SPMe(\n",
" {\n",
" \"SEI\": \"ec reaction limited\",\n",
" \"loss of active material\": \"stress-driven\",\n",
" \"lithium plating\": \"irreversible\",\n",
" \"stress-induced diffusion\": \"false\",\n",
" }\n",
")\n",
"param=spme.param"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "windows-dev",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
10 changes: 10 additions & 0 deletions degradation_model/try_spme_deg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pybamm

spme = pybamm.lithium_ion.SPMe(
{
"SEI": "ec reaction limited",
"loss of active material": "stress-driven",
"lithium plating": "irreversible",
"stress-induced diffusion": "false",
}
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp, constants


def graphite_electrolyte_exchange_current_density_Siegel(c_e, c_s_surf, c_s_max, T, N_nick):
def graphite_electrolyte_exchange_current_density_Siegel(c_e, c_s_surf, c_s_max, T):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp, constants


def NMC_electrolyte_exchange_current_density_Siegel(c_e, c_s_surf, c_s_max, T, N_nick):
def NMC_electrolyte_exchange_current_density_Siegel(c_e, c_s_surf, c_s_max, T):
"""
Exchange-current density for Butler-Volmer reactions between NMC and LiPF6 in
EC:DMC.
Expand Down
6 changes: 4 additions & 2 deletions pybamm/models/submodels/interface/base_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def _get_exchange_current_density(self, variables):
c_e = variables[f"{Domain} electrolyte concentration"]
T = variables[f"{Domain} electrode temperature"]

N_nick= variables["X-averaged positive electrode loss nickel dissolution"]
#N_nick= variables["X-averaged positive electrode loss nickel dissolution"]

# N_nick= variables[f"{Domain} loss nickel dissolution"]

if self.reaction == "lithium-ion main":
# For "particle-size distribution" submodels, take distribution version
Expand Down Expand Up @@ -114,7 +116,7 @@ def _get_exchange_current_density(self, variables):
c_e = c_e.orphans[0]
T = T.orphans[0]

j0 = phase_param.j0(c_e, c_s_surf, T, N_nick)
j0 = phase_param.j0(c_e, c_s_surf, T)

elif self.reaction == "lithium metal plating":
j0 = param.j0_plating(c_e, 1, T)
Expand Down
11 changes: 5 additions & 6 deletions pybamm/parameters/lithium_ion_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ def D_dimensional(self, sto, T):
inputs,
)

def j0_dimensional(self, c_e, c_s_surf, T, N_nick):
def j0_dimensional(self, c_e, c_s_surf, T):
"""Dimensional exchange-current density [A.m-2]"""
inputs = {
"Electrolyte concentration [mol.m-3]": c_e,
Expand All @@ -833,8 +833,7 @@ def j0_dimensional(self, c_e, c_s_surf, T, N_nick):
"surface concentration [mol.m-3]": self.c_max,
"Temperature [K]": T,
f"{self.phase_prefactor}Maximum {self.domain.lower()} particle "
"surface concentration [mol.m-3]": self.c_max,
f"{self.domain} dissolution nickel intercalation coefficient": N_nick,
"surface concentration [mol.m-3]": self.c_max,

}
return pybamm.FunctionParameter(
Expand Down Expand Up @@ -906,7 +905,7 @@ def _set_scales(self):

# Reference exchange-current density
self.j0_ref_dimensional = (
self.j0_dimensional(main.c_e_typ, self.c_max / 2, main.T_ref, 0) * 2
self.j0_dimensional(main.c_e_typ, self.c_max / 2, main.T_ref) * 2
)

# Reaction timescales
Expand Down Expand Up @@ -1052,7 +1051,7 @@ def D(self, c_s, T):
T_dim = self.main_param.Delta_T * T + self.main_param.T_ref
return self.D_dimensional(sto, T_dim) / self.D_typ_dim

def j0(self, c_e, c_s_surf, T, N_nick):
def j0(self, c_e, c_s_surf, T):
"""Dimensionless exchange-current density"""
tol = pybamm.settings.tolerances["j0__c_e"]
c_e = pybamm.maximum(c_e, tol)
Expand All @@ -1062,7 +1061,7 @@ def j0(self, c_e, c_s_surf, T, N_nick):
c_s_surf_dim = c_s_surf * self.c_max
T_dim = self.main_param.Delta_T * T + self.main_param.T_ref

return self.j0_dimensional(c_e_dim, c_s_surf_dim, T_dim,N_nick) / self.j_scale
return self.j0_dimensional(c_e_dim, c_s_surf_dim, T_dim) / self.j_scale

def U(self, c_s, T, lithiation=None):
"""Dimensionless open-circuit potential in the electrode"""
Expand Down

0 comments on commit 46e8227

Please sign in to comment.