The red dot gives the half wave potential

$E_{1/2}=E^\circ + \dfrac{RT}{nF}\ln\left(\dfrac{m_R}{m_O}\\right)$

The blue dot gives the Nernst potential to help differentiate the effect of both parameters on the curve.

Here, 1 electron exchanged and the standard potential is equal to 0.77 V/ESH. The electrode area is supposed to be equal to 1 m$^2$."""

#===========================================================
# --- Initial parameters  ---------------------
#===========================================================

parameters = {
    'ratm':
    widgets.FloatSlider(value=1.,
                        description='ratio -- $\dfrac{m_R}{m_O}$',
                        min=0.00001,
                        max=10),
    'ratC':
    widgets.FloatSlider(value=1,
                        description='$\dfrac{C_R}{C_O}$',
                        min=0.00001,
                        max=10),
}
#default parameter for the potential of the couple considered : E0, temperature T, number of exchanged electrons n
E0 = 0.77
T = 298.15
n = 1.
F = constants.physical_constants['Faraday constant'][0]
R = constants.R

Пример #2
0
    lines['dewr'].set_data([0., 1.], Temps[0])
    #Plotting horizontal lines for the ebullition point
    lines['ebl'].set_data([0., 1.], Temps[1])
    lines['ebr'].set_data([0., 1.], Temps[1])
    #Plotting an horizontal line for the value of x0
    lines['x'].set_data([x, x], [min(TempRange), max(TempRange)])
    ax4.set_title('Cooling curve for x = {:3.2f}'.format(x))
    fig.canvas.draw_idle()


if __name__ == "__main__":

    parameters = {
        'x':
        widgets.FloatSlider(value=0.5,
                            description='x_B',
                            min=0.0001,
                            max=0.999999),
    }
    #Save the data as a csv file
    saveCsv = True
    fileCsv = "diagbin.csv"
    Teb = np.array([353.3, 383.8])  #Benzene, Toluene
    Hvap = np.array([30.72e3, 33.18e3])
    Cpl = np.array([135.6, 157.])
    Cpg = np.array([
        82.44,
        103.7,
    ])
    Hl = np.array([49.e3, 12.e3])
    Hg = Hl + Hvap
Пример #3
0
description = """This program simulates the i-E curves when the current is limited by the electronic transfer. 

$I=I_0\left( \exp\left( \dfrac{\\alpha n F \eta}{RT} \\right)  - \exp\left( -\dfrac{\left( 1-\\alpha \\right) n F \eta}{RT} \\right)\\right)$

$\eta=E-E^0$, $\\alpha$ is the transfer coefficient for the oxydation

Here, 1 electron exchanged and the standard potential is equal to 0.77 V/ESH. The electrode area is supposed to be equal to 1 m$^2$."""

#===========================================================
# --- Initial parameters  ---------------------
#===========================================================

parameters = {
    'alpha':
    widgets.FloatSlider(value=0.5,
                        description='transfer coefficient -- $\\alpha$',
                        min=0,
                        max=1),
    'logI':
    widgets.FloatSlider(value=-1.35, description='$\log(I_0)$', min=-5, max=5),
}
#default parameter for the potential of the couple considered : E0, temperature T, number of exchanged electrons n
E0 = 0.77
T = 298.15
n = 1
F = constants.physical_constants['Faraday constant'][0]
R = constants.R

#===========================================================
# --- Functions to plot-------------------------------------
#===========================================================
Пример #4
0
    fig.canvas.draw_idle()


# Main program
if __name__ == "__main__":
    #kinetic constants
    k1 = 100  #s^-1
    k2 = 1  #s^-1
    k3 = 100  #s^-1
    #Initial conditions : only A is present
    C0 = [1., 0., 0., 0.]

    parameters = {
        'ratio':
        widgets.FloatSlider(value=-2,
                            description='$\log(k_2/k_1)$',
                            min=-3,
                            max=3),
    }
    fig, axes = plt.subplots(2, 2)
    ax1 = plt.subplot(2, 2, 1)
    ax2 = plt.subplot(2, 2, 2)
    ax3 = plt.subplot(2, 2, 3)
    ax4 = plt.subplot(2, 2, 4)
    ax1.set_title('Concentrations versus time')
    ax2.set_title('Concentrations versus time')
    #ax2.set_title('B')
    ax3.set_title('$v_d(\mathrm{B})$ and $v_a(\mathrm{D})$ versus time')
    ax4.set_title('$v_a(\mathrm{D})=f(v_d(\mathrm{B}))$')
    #ax4.set_title('D')

    lines = {}
Пример #5
0
def plot_data(lambdaa):
    energies = Eg(lambdaa,cutR)
    lines2['Eg'].set_data(cutR,energies)
    lines2['Eu'].set_data(cutR,Eu(lambdaa,cutR))
    lines2['min'].set_data(cutR[np.argmin(energies)],np.min(energies))

    energies2= Eg(lambdaa,cutR)
    energies2[energies2>0]=0.
    lines['plane'].set_data(lambdaa*np.ones_like(cutR),cutR)
    lines['plane'].set_3d_properties(energies2)     

# Main program
if __name__ == "__main__":
    parameters = {
        'lambdaa' : widgets.FloatSlider(value=1., description='$\lambda$', min=0.0001, max=2),
    }
    #figure
    fig = plt.figure(figsize=(8,8))
    gs = fig.add_gridspec(2, 1,  left=0.08, right=0.95, bottom=0.05, top=0.95, wspace=0.18, hspace=0.3)
    ax1 = fig.add_subplot(gs[0,0])
    ax2 = fig.add_subplot(gs[1,0],projection='3d', proj_type='ortho')
    #ax3 = fig.add_subplot(gs[1,0])
    #ax4 = fig.add_subplot(gs[1,1])
    xs = np.linspace(0.0001,4,500)
    ax1.set_xlim(0.,4.)
    ax1.set_ylim(-0.7,0.5)
    grid, delta = createGrid(0, 2, 250,0.0001, 4, 250) 
    zetas,Rs = grid    
    Z = Eg(zetas,Rs)
    Z[Z>0]=0
Пример #6
0
    lines['ref'].set_data([omega_0, omega_0], [0, 0.25 * maxi])
    ax1.set_xlim(2886. + 300, 2886. - 300)
    ax1.set_ylim(0, maxi * 1.1)
    for x in xs:
        textsR[int(x)].set_position(
            (BrancheR(x + 1, omega_0, B, a) - 4, pop(x + 1, omega_0, B, a, T)))
        textsP[int(x)].set_position(
            (BrancheP(x, omega_0, B, a) + 10, pop(x, omega_0, B, a, T)))


# Main program
if __name__ == "__main__":
    parameters = {
        'omega_0':
        widgets.FloatSlider(value=2886.,
                            description='$\omega_0$',
                            min=2700,
                            max=3000),
        'B':
        widgets.FloatSlider(value=10.75, description='$B$', min=0, max=20),
        'a':
        widgets.FloatSlider(value=0., description='$a$', min=0, max=0.25),
        'T':
        widgets.FloatSlider(value=300., description='$T$', min=100, max=500),
    }

    fig = plt.figure(figsize=(8, 8))
    gs = fig.add_gridspec(1,
                          1,
                          left=0.08,
                          right=0.95,
                          bottom=0.05,
Пример #7
0
    rects['SCN'].set_width(nSCN / nmax * 0.12)
    rects['FeSCN'].set_width(nFeSCN / nmax * 0.12)
    rects['Feeq'].set_x(0.48 + nFeeq / nmax * 0.12)
    rects['SCNeq'].set_x(0.68 + nSCNeq / nmax * 0.12)
    rects['FeSCNeq'].set_x(0.88 + nFeSCNeq / nmax * 0.12)

    fig.canvas.draw_idle()


if __name__ == "__main__":
    nmax = 1e-2

    parameters = {
        'nFe0':
        widgets.FloatSlider(value=0.05,
                            description='$n^0_{\\mathrm{Fe^{3+}}}$',
                            min=0.0,
                            max=nmax),
        'nSCN0':
        widgets.FloatSlider(value=0.05,
                            description='$n^0_{\\mathrm{SCN^{-}}}$',
                            min=0.0,
                            max=nmax),
        'nFeSCN0':
        widgets.FloatSlider(value=0,
                            description='$n^0_{\\mathrm{FeSCN^{2+}}}$',
                            min=0.0,
                            max=nmax),
        'xi':
        widgets.FloatSlider(value=0.00000001,
                            description='$x$',
                            min=-0.01,