In [7]:
from stangeby import Stangeby
import matplotlib.pyplot as plt
import numpy as np

%matplotlib inline

plt.rcParams['font.size'] = 26
plt.rcParams['lines.linewidth'] = 2

Execute Stangeby's model for a test plasma


In [8]:
T_e = 10
T_i = 0.4
m_i = 2
alpha = 3
B_T = 2.21
B = [B_T *np.cos(alpha *np.pi/180), 0, B_T *np.sin(alpha *np.pi/180)]
model = Stangeby(T_e, T_i, m_i, B)


/usr/lib64/python3.4/site-packages/scipy/optimize/zeros.py:173: RuntimeWarning: Tolerance of -1.60074243832e-07 reached
  warnings.warn(msg, RuntimeWarning)

In [9]:
fig, ax = plt.subplots(figsize=(6,6))

#plot drift velocity components
plt.plot(model.zeta, model.u, label = 'u')
plt.plot(model.zeta, model.w, label = 'w')
plt.plot(model.zeta, model.v, label = 'v')

#decorate the plots
plt.xlabel(r'$\zeta$')
plt.ylabel(r'$u$')
plt.title('Drift velocity')
plt.legend(fontsize=20)
plt.xlim(0, 6)
plt.tight_layout()
plt.show()



In [10]:
#plot density and potential profiles
fig, ax = plt.subplots(1, 2, figsize=(12,6))

#plot drift velocity components
ax[0].plot(model.zeta, model.potential, label = 'potential')
ax[0].set_xlabel(r'$\zeta$')
ax[0].set_ylabel(r'$U$, [V]')
ax[0].set_title('Potential')
ax[0].set_xlim(0, 20)

#plot density profile
ax[1].plot(model.zeta, model.density, label = 'density')
ax[1].plot([0, 100], [1,1], color='gray', linewidth=1, dashes=[10, 5])
ax[1].set_xlabel(r'$\zeta$')
ax[1].set_ylabel(r'$n_i/n_0$')
ax[1].set_title('Density')
ax[1].set_xlim(0, 20)

plt.show()


Reproducing figure 5 from Stangeby's paper


In [11]:
alphas = [1,2,3,5]
m_i = 2
T_i = T_e = 1

alpha = 3
B_T = 1

fig, ax = plt.subplots(figsize=(6,6))

for alpha in alphas:
    B = [B_T *np.cos(alpha *np.pi/180), 0, B_T *np.sin(alpha *np.pi/180)]
    model = Stangeby(T_e, T_i, m_i, B)
    plt.plot(model.zeta, model.u, label = r'$\alpha={0}$'.format(alpha))

#decorate the plots
plt.xlabel(r'$\zeta$')
plt.ylabel(r'$u$')
plt.title('Drift velocity')
plt.legend(fontsize=20)
plt.xlim(0, 6)
plt.ylim(0, 1)
plt.show()


/usr/lib64/python3.4/site-packages/scipy/optimize/zeros.py:173: RuntimeWarning: Tolerance of -1.60074243832e-07 reached
  warnings.warn(msg, RuntimeWarning)
/usr/lib64/python3.4/site-packages/scipy/optimize/zeros.py:173: RuntimeWarning: Tolerance of 4.61327090556e-08 reached
  warnings.warn(msg, RuntimeWarning)