In [1]:
%matplotlib inline
%load_ext autoreload
%autoreload 2
In [2]:
import numpy as np
import scipy as sp
import scipy.special
import scipy.optimize
from scipy.special import erf, dawsn
import matplotlib.pyplot as plt
In [3]:
def D(x):
return dawsn(x)*np.exp(x**2)
def f(x, Zt):
a = 2/np.sqrt(np.pi*Zt)
return 1.0-(a*np.exp(-(1.0+Zt)*x)*D(np.sqrt(x))+erf(np.sqrt(Zt*x)))
def scaled_phiw(Z, t, Mm):
f1 = lambda x: f(x, Z*t)
psi1 = scipy.optimize.brentq(f1, 0, 1)
a = np.sqrt(Mm*Z/(4*np.pi))
c = 2*np.exp(-psi1)*D(np.sqrt(psi1))
return -np.log(a*np.pi/(Z+1.0/t)/c)
In [4]:
Z = 1.0
t = 1.0
Mm = 1836
In [5]:
f1 = lambda x: f(x, Z*t)
psi1 = scipy.optimize.brentq(f1, 0, 10)
x_vals = np.linspace(np.max(0, psi1-.5), psi1+.5, 100)
plt.plot(x_vals, f1(x_vals))
plt.axvline(psi1, color='g', linestyle='--')
psi1
Out[5]:
In [6]:
sphiw = scaled_phiw(Z, t, Mm)
sphiw
Out[6]:
In [7]:
t_vals = np.linspace(.1, 6, 10)
plt.plot(1.0/t_vals, [-scaled_phiw(Z, tt, Mm) for tt in t_vals])
plt.plot(1.0/t_vals, .5*np.log(np.sqrt(Mm*Z*t_vals)))
Out[7]:
In [8]:
t_vals = np.linspace(.1, 10, 20)
plt.semilogx(1.0/t_vals, [-scaled_phiw(Z, tt, Mm) for tt in t_vals])
plt.ylabel(r"$e\phi_{w}/kT_{e}$")
plt.xlabel(r"$T_i/T_e$")
plt.savefig("emmert-sheath-zerod-psiw.pdf")
In [8]: