galpynostatic.simulation module
GalvanostaticProfile class of simulation module.
- class galpynostatic.simulation.GalvanostaticMap(density=1.0, isotherm=None, specific_capacity=1.0, mass=1.0, vcut=-0.15, g=0.0, geometrical_param=3, temperature=298.0, logxi_lle=2.0, logxi_ule=-4.0, num_xi=32, logell_lle=2.0, logell_ule=-4.0, num_ell=32, grid_size=1000, time_steps=100000, nthreads=-1)
Bases:
objectDiagnostic map tool for galvanostatic intercalation material analysis.
The present software performs a series of galvanostatic simulations to systematically investigate the maximum state of charge (SoC) that a material is capable of accommodating at the single particle level under different experimental conditions. These simulations are used to produce a diagnostic map or zone diagram [2, 3]_. A similar concept is used here to construct level diagrams for galvanostatic simulations using two variables:
\(\Xi = k^{0}\left (\frac{t_{h}}{C_{r}D} \right )^{1/2}\) and \(\ell=\frac{r^{2}C_{r}}{zt_{h}D}\) at constant \(D\) and \(k_0\).
The SOC are calculated by means of the interpolation of the experimental or theoretical isotherm, the Fick’s diffusion law and the Butler-Volmer charge transfer equation with a transfer coefficient of 0.5. The Fick diffusion equation is solved using the Crank-Nicolson method.
- Parameters:
density (float, default=1.0) – Density of the electrode active material in \(g/cm^3\).
isotherm (bool or pandas.DataFrame, default=False) – A dataset containing the experimental isotherm values in the format potential vs capacity. The isotherm is used to calculate the equilibrium potential for a given SOC. If False the equilibrium potential is calculated using the theroretical model … [].
specific_capacity (bool or float, default=1.0) – Specific capacity of the material in mAh/g. If isotherm is None the specific capacity must be defined.
mass (float) – Total mass of the electrode active material in \(g\).
vcut (float, default=-0.15) – Cut potential of the simulation.
g (float, default=0.0) – Interaction parameter of the theroretical model used to obtain the equilibrium potential if isotherm=False.
geometrical_param (int default=3) – Active material particle geometrical_parammetry. 1=planar, 1=cylindrical, 3=spherical.
temperature (float, default=298.0) – Working temperature of the cell.
logxi_lle (float, default=2.0) – Initial value of the \(\log(\Xi)\).
logxi_ule (float, default=-4.0) – Final value of the \(\log(\Xi)\).
num_xi (int, default=5) – Number of \(\log(\Xi)\) values.
logell_lle (float, default=2.0) – Initial value of the \(\log(\ell)\).
logell_ule (float, default=-4.0) – Final value of the \(\log(\ell)\).
num_ell (int, default=5) – Number of \(\log(\ell)\) values.
grid_size (int, default=1000) – Size of the spatial grid in wich the Fick’s equation will be solved.
time_steps (int, default=100000) – Size of the time grid in wich the Fick’s equation will be solved.
nthreads (int, default=-1) – Number of threads in which the diagram calculation will be performed. -1 means use all available threads.
- run()
Run the diagram simulation.
- property map_dataframe
Convert the diagram dataset into a dataframe.
- map_plot(ax=None, plt_kws=None, clb=True, clb_label='SoC$_{max}$')
Plot the two dimensional diagram.
- Parameters:
ax (axis, default=None) – Axis of wich the diagram plot.
plt_kws (dict, default=None) – A dictionary containig the parameters to be passed to the axis.
clb (bool, default=True) – Parameter that determines if the color bar will be displayed.
clb_label (str, default="SOC") – Name of the color bar.
- real_plot(dcoeff, k0, ax=None, plt_kws=None, clb=True, clb_label='$SoC_{max}$')
Real diagram axis.
- Parameters:
dcoeff (float) – Diffusion coefficient, \(D\), in \(cm^2/s\).
k0 (float) – Kinetic rate constant, \(k^0\), in \(cm/s\).
ax (axis, default=None) – Axis of wich the diagram plot.
plt_kws (dict, default=None) – A dictionary containig the parameters to be passed to the axis.
clb (bool, default=True) – Parameter that determines if the color bar will be displayed.
clb_label (str, default="SOC") – Name of the color bar.
- class galpynostatic.simulation.GalvanostaticProfile(xi, ell, density=1.0, isotherm=False, specific_capacity=1.0, mass=1.0, vcut=-0.15, geometrical_param=3, g=0.0, profile_soc=0.5, temperature=298.0, grid_size=1000, time_steps=100000, each=100)
Bases:
objectA tool to extrapolate isotherms varing C-rate and particle size.
This software simulates new isotherms individually, from an experimental or theoretical one, dependding on the value of \(\log(\ell)\) and \(\log(\Xi)\). Given an isotherm for a particular particle size and C-rate this tool will predict the system behaviour varing \(\log(\ell)\) and \(\log(\Xi)\). The resulting isotherms are calculated by means of the interpolation of the experimental or theoretical isotherm, the Fick’s diffusion law and the Butler-Volmer charge transfer equation with a transfer coefficient of 0.5. The Fick diffusion equation is solved using the Crank-Nicolson method.
- Parameters:
density (float, default=1.0) – Density of the electrode active material in \(g/cm^3\).
xi (float, default=2.0) – Value of the \(\log(\Xi)\).
ell (float, default=2.0) – Value of the \(\log(\ell)\).
isotherm (bool or pandas.DataFrame, default=False) – A dataset containing the experimental isotherm values in the format SOC vs potential. The isotherm is used to calculate the equilibrium potential for a given SOC. If False the equilibrium potential is calculated using the theroretical model … [].
specific_capacity (bool or float, default=1.0) – Specific capacity of the material in mAh/g. If isotherm is None the specific capacity must be defined.
mass (float, default=1) – Total mass of the electrode active material in \(g\).
vcut (float, default=-0.15) – Cut potential if isotherm=False.
geometrical_param (int default=3) – Active material particle geometrical_parammetry. 1=planar, 1=cylindrical, 3=spherical.
g (float, default=0.0) – Interaction parameter of the theroretical model used to obtain the equilibrium potential if isotherm=False.
profile_soc (float default=0.5) – SOC value at wich the concentration profile will be calculated.
temperature (float, default=298.0) – Working temperature of the cell.
grid_size (int, default=1000) – Size of the spatial grid in wich the Fick’s equation will be solved.
time_steps (int, default=100000) – Size of the time grid in wich the Fick’s equation will be solved.
each (int, default=100) – time_steps/each time points at which SOC and potential are printed.
- isotherm_df
A dataset containig the resulting isotherm in the potential vs SOC format.
- Type:
pandas.DataFrame
- concentration_df
A dataset containing the resulting concentration profile in the form \(\theta\) (concentration) vs \(r\) (distance to the center of the particle).
- Type:
pandas.DataFrame
- run()
Run the isotherm simulation.
- property profile_dataframe
Simulated isotherm data set in a pandas format.
- property concentration_dataframe
Concentration dataset in a pandas format.
- isotherm_plot(ax=None, plt_kws=None)
Plot the simulated isotherm.
- Parameters:
ax (axis, default=None) – Axis of wich the diagram plot.
plt_kws (dict, default=None) – A dictionary containig the parameters to be passed to the axis.
- consentration_plot(ax=None, plt_kws=None)
Plot the consentration inside the particle.
- Parameters:
ax (axis, default=None) – Axis of wich the diagram plot.
plt_kws (dict, default=None) – A dictionary containig the parameters to be passed to the axis.
- class galpynostatic.simulation.SplineCoeff(dataset)
Bases:
objectSpline coefficients class.
Spline coefficients of a given equilibrium isotherm. The coefficients are obtained using the interpolate.CubicSpline function of the scipy package. These coefficients are used to interpolate the equilibrium potential values as \(E^0(x_d)=a_i+b_i(x_d-x_j)+c_i(x_d-x_j)^2+d_i(x_d-x_i)^3\)
- Parameters:
dataset (pandas.DataFrame) – A dataset containing the experimental isotherm values in the format SOC vs potential.
- spl_ai
Array of the independent term coefficients of the cubic spline.
- Type:
numpy.ndarray
- spl_bi
Array of the lineal term coefficients of the cubic spline.
- Type:
numpy.ndarray
- spl_ci
Array of the cuadratic term coefficients of the cubic spline.
- Type:
numpy.ndarray
- spl_di
Array of the cubic term coefficients of the cubic spline.
- Type:
numpy.ndarray
- get_coeffs()
Calculate the spline coefficients.
The function get_coeffs takes the normalized experimental capacity or the smooth isotherm. It returns the parameters ai, bi, ci, and di of the cubic spline of the isotherm. These parameters can be used to calculate the equilibrium potential.
- class galpynostatic.simulation.ProfileFitting(isotherm, objective_iso, crate, particle_size, vcut=-0.15, geometrical_param=3)
Bases:
objectTool to fit \(k^0\) and \(D\) for non equilibrium isotherms.
\(k^0\) and \(D\) are obtained using a simulated isotherm as imput of a scipy.optimize.curve_fit considering an experimental equilibrium isotherm and an out equilibrium isotherm.
- Parameters:
equilibrium_iso (pandas.DataFrame) – A dataset containing the experimental equilibrium isotherm values in the format SOC vs potential.
objective_iso (pandas.DataFrame) – A dataset containing the experimental no equilibrium isotherm values in the format SOC vs potential.
crate (int or float) – Crate of the non equilibrium isotherm.
particle_size (float) – Experimental active material diffusion length in :math: cm.
vcut (float, default=-0.15) – Cut potential if isotherm=False in :math V.
geometrical_param (int, default=2) – Active material particle geometrical_parammetry. 1=planar, 2=cylindrical, 3=spherical.
- logxi
Fitted log value in base 10 of \(\Xi\).
- Type:
float
- logell
Fitted log value in base 10 of \(\ell\).
- Type:
float
- dcoeff
Diffusion coefficient, \(D\), in \(cm^2/s\).
- Type:
float
- k0
Kinetic rate constant, \(k^0\), in \(cm/s\).
- Type:
float
- fit_data()
Fit the non equilibrium isotherm.
- plot_fit(ax=None, plt_kws=None)
Plot the fitted non equilibrium isotherm.
- Parameters:
ax (axis, default=None) – Axis of wich the diagram plot.
plt_kws (dict, default=None) – A dictionary containig the parameters to be passed to the axis.