Fitting beta for a finite-length probeΒΆ

For large voltages, \eta=qV/kT\gg 1, the normalized current collected from the attracted species according to the OML theory may be written as power law:

\frac{I}{I_\mathrm{th}} \approx c\eta^\beta

where \beta is 0, 0.5 or 1 for a plane, cylinder or sphere, respectively. It is customary to use this same expression for probes of finite length as well, but with \beta varying between 0.5 and 1. This example demonstrates how to use a standard curve fitting algorithm to find \beta for a cylindrical probe of ten Debye lengths:

from langmuir import *
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit

elec = Electron()
eta = np.linspace(10,100,100)
geo = Cylinder(r=0.1*elec.debye, l=10*elec.debye)
I = finite_length_current(geo, elec, eta=eta, normalization='th')

def power_law(eta, c, beta):
    return c*eta**beta

popt, pcov = curve_fit(power_law, eta, I)

plt.plot(eta, I, label='Finite-length model')
plt.plot(eta, power_law(eta, *popt), ':k',
         label=r'Power law ($c={:.2f}, \beta={:.2f})$'.format(*popt))

plt.xlabel(r'$\eta$')
plt.ylabel(r'$I/I_\mathrm{th}$')
plt.legend()
plt.show()
_images/beta.png

In the code we start by evaluating the charactersitic at 100 points along \eta\in[10,100). Note that we keep the normalized voltage always above 10 such that the large voltage approximation is satisfied. We then define the function we want to fit the characteristic to, power_law, with the input as the first argument, followed by an arbitrary number of fitting coefficients (in our case two). The SciPy function curve_fit makes a best fit of these coefficients, returned in the tuple popt. With these coefficients, the fit (dotted line) is in excellent agreement with the actual characteristic (solid line), and \beta=0.72.