示例#1
0
def open_circuit(c_n_surf, c_p_surf, T0, T1, param):
    """
    Computes the open circuit voltage.
    Parameters
    ----------
    c_n_surf: array_like
        The value of the concetration at the surface of the negative electrode
        particle.
    c_n_surf: array_like
        The value of the concetration at the surface of the negative electrode
        particle.
    c_e: array_like
        Array of the electrolyte concetration.
    T0: array_like
        Array of the leading-order temperature.
    T1: array_like
        Array of the first-order temperature.
    param: object
        Object containing model parameters.
    Returns
    ----------
    float
        The open circuit voltage.
    """
    U_eq = (
        ocp.U_p(c_p_surf, T0, param) - ocp.U_n(c_n_surf, T0, param) +
        param.delta *
        (ocp.dUdT_p(c_p_surf, param) * T1 - ocp.dUdT_n(c_n_surf, param) * T1))
    return U_eq
示例#2
0
def SPM_fun(I, c_n, c_p, param):
    g_n = param.m_n * param.C_hat_n * np.sqrt(c_n) * np.sqrt(1 - c_n)
    g_p = param.m_p * param.C_hat_p * np.sqrt(c_p) * np.sqrt(1 - c_p)
    result = (ocp.U_p(c_p, param.T_0, param) -
              ocp.U_n(param.c_n, param.T_0, param) -
              (2 / param.Lambda) * np.arcsinh(I / (g_p * param.L_p)) -
              (2 / param.Lambda) * np.arcsinh(I / (g_n * param.L_n)))
    return result
示例#3
0
def plot_OCP(soln, mesh, param):
    # Get variables
    c_n, c_p, c_e_n, c_e_s, c_e_p, T0, T1 = get_vars_time(soln.y, mesh)
    t = soln.t

    # Surface concentration for BV
    c_n_surf = c_n[-1, :] + (c_n[-1, :] - c_n[-2, :]) / 2
    c_p_surf = c_p[-1, :] + (c_p[-1, :] - c_p[-2, :]) / 2

    # LIONSIMBA results
    # t column 0, OCP 14 - 17
    t_LION, U_n, U_p, dUdT_n, dUdT_p = np.loadtxt('LIONSIMBA001_t.txt',
                                                  usecols=(0, 14, 15, 16, 17),
                                                  unpack=True)
    # Font stuff
    plt.rc('text', usetex=True)
    plt.rc('font', family='serif')

    # Plot OCP and entropic coefficient at a fixed T
    fig = plt.figure()
    plt.subplot(2, 2, 1)
    plt.plot(t * param.tau_d_star,
             ocp.U_n(c_n_surf, T0, param) * param.Phi_star)
    plt.plot(t_LION, U_n, 'o')
    plt.xlabel(r'$t$ [s]', fontsize=11)
    plt.ylabel(r'$U_{{\mathrm{{n}}}}$', fontsize=11)
    plt.subplot(2, 2, 3)
    plt.plot(t * param.tau_d_star,
             ocp.dUdT_n(c_n_surf, param) * param.Phi_star / param.Delta_T_star)
    plt.plot(t_LION, dUdT_n, 'o')
    plt.xlabel(r'$t$ [s]', fontsize=11)
    plt.ylabel(r'$\mathrm{{d}}U_{{\mathrm{{n}}}}$'
               r'$ / \mathrm{{d}}T$', fontsize=11)
    plt.subplot(2, 2, 2)
    plt.plot(t * param.tau_d_star,
             ocp.U_p(c_p_surf, T0, param) * param.Phi_star)
    plt.plot(t_LION, U_p, 'o')
    plt.xlabel(r'$t$ [s]', fontsize=11)
    plt.ylabel(r'$U_{{\mathrm{{p}}}}$', fontsize=11)
    plt.subplot(2, 2, 4)
    plt.plot(t * param.tau_d_star,
             ocp.dUdT_p(c_p_surf, param) * param.Phi_star / param.Delta_T_star)
    plt.plot(t_LION, dUdT_p, 'o')
    plt.xlabel(r'$t$ [s]', fontsize=11)
    plt.ylabel(r'$\mathrm{{d}}U_{{\mathrm{{p}}}}$'
               r'$ / \mathrm{{d}}T$', fontsize=11)
    fig.tight_layout()
示例#4
0
def voltage_cutoff(t, y, mesh, param, I_app):
    # Get variables
    c_n, c_p, c_e_n, c_e_s, c_e_p, T0, T1 = get_vars(y, mesh)

    # Surface concentration for BV
    c_n_surf = c_n[-1] + (c_n[-1] - c_n[-2]) / 2
    c_p_surf = c_p[-1] + (c_p[-1] - c_p[-2]) / 2

    # OCV
    OCV = ocp.U_p(c_p_surf, T0, param) - ocp.U_n(c_n_surf, T0, param)

    # Overpotential
    g_n = (param.m_n * param.C_hat_n * c_n_surf**(1 / 2) *
           (1 - c_n_surf)**(1 / 2))
    g_p = (param.m_p * param.C_hat_p * c_p_surf**(1 / 2) *
           (1 - c_p_surf)**(1 / 2))
    eta_r = (-2 * (1 + param.Theta * T0) / param.Lambda *
             np.arcsinh(I_app / g_p / param.L_p / param.Ly) - 2 *
             (1 + param.Theta * T0) / param.Lambda *
             np.arcsinh(I_app / g_n / param.L_n / param.Ly))
    voltage = OCV + eta_r
    TOL = 1e-3
    return voltage - param.V_min - TOL
示例#5
0
def plot_OCP(c, T, param):
    # Font stuff
    plt.rc("text", usetex=True)
    plt.rc("font", family="serif")

    # Plot OCP and entropic coefficient at a fixed T
    fig = plt.figure()
    plt.subplot(2, 2, 1)
    plt.plot(c, ocp.U_n(c, T, param) * param.Phi_star)
    plt.xlabel(r"$c_{{\mathrm{{n}}}}$")
    plt.ylabel(r"$U_{{\mathrm{{n}}}}$")
    plt.subplot(2, 2, 3)
    plt.plot(c, ocp.dUdT_n(c, param) * param.Phi_star / param.Delta_T_star)
    plt.xlabel(r"$c_{{\mathrm{{n}}}}$")
    plt.ylabel(r"$\frac{{\mathrm{{d}} U_{{\mathrm{{n}}}}}}{{\mathrm{{d}}T}}$")
    plt.subplot(2, 2, 2)
    plt.plot(c, ocp.U_p(c, T, param) * param.Phi_star)
    plt.xlabel(r"$c_{{\mathrm{{p}}}}$")
    plt.ylabel(r"$U_{{\mathrm{{p}}}}$")
    plt.subplot(2, 2, 4)
    plt.plot(c, ocp.dUdT_p(c, param) * param.Phi_star / param.Delta_T_star)
    plt.xlabel(r"$c_{{\mathrm{{p}}}}$")
    plt.ylabel(r"$\frac{{\mathrm{{d}} U_{{\mathrm{{p}}}}}}{{\mathrm{{d}}T}}$")
    fig.tight_layout()