gbspy.drifts module
Routines for computing drift velocities
This module provides a collection of functions to compute drift velocities appearing the continuity equation. All drift velocities are normalized to the plasma sound speed, \(c_{s0}\).
The following form of the normalized continuity equation is assumed (ignoring sources and sinks due to neutrals),
In the equation above, we identify the
\(E\times{}B\) drift velocity
electron diamagnetic drift velocity
parallel electron velocity
parallel diffusion velocity
perpendicular diffusion velocity
- gbspy.drifts.diamagnetic_e_velocity(sim, theta, exptempe)
Computes the normalized electron diamagnetic drift velocity
The radial and vertical components of the electron diamagnetic drift are returned in normalized units,
\[\vec{v}_{de} = \frac{\vec{\nabla}p_e\times{}\vec{b}}{nB}\]- Parameters
sim (gbspy.pp.Sim) – Simulation object
theta (numpy.ndarray) – Logarithmic plasma density as a 4D array
exptempe (numpy.ndarray) – Electron temperature as a 4D array
- Returns
v_de_x (numpy.ndarray) – Radial component of the normalized drift velocity
v_de_y (numpy.ndarray) – Vertical component of the normalized drift velocity
- gbspy.drifts.exb_velocity(sim, strmf)
Computes the normalized ExB drift velocity
The radial and vertical components of the \(E\times{}B\) drift are returned in normalized units,
\[\vec{v}_E = \frac{-\vec{\nabla}\phi\times\vec{b}}{B}\]- Parameters
sim (gbspy.pp.Sim) – Simulation object
strmf (numpy.ndarray) – Electrostatic potential as a 4D array
- Returns
v_exb_x (numpy.ndarray) – Radial component of the normalized drift velocity
v_exb_y (numpy.ndarray) – Vertical component of the normalized drift velocity
- gbspy.drifts.parallel_diffusion_velocity(sim, theta, psi_em=None, ignore_em=False)
Computes the normalized parallel diffusion velocity
When considered without electromagnetic effects, the radial and vertical components of the parallel diffusion velocity are returned in normalized units,
\[v_{\parallel{}\text{diff}} \vec{b}_p = -D_{\parallel{}n} \frac{\nabla_{\parallel}n}{n} \left[\hat{e}_{\varphi}\times(\rho_{\ast}\vec{\nabla}\Psi)\right]\]where \(\Psi\) is the equilibrium magnetic flux function. When introducing electromagnetic perturbations, one has instead
\[v_{\parallel{}\text{diff}} (\vec{b}_p + \delta\vec{b}_p) = -D_{\parallel{}n} \frac{\nabla_{\parallel}n}{n} \left[ \hat{e}_{\varphi}\times(\rho_{\ast}\vec{\nabla}\Psi) - \vec{\nabla}\times(\rho_{\ast}\psi\hat{e}_{\varphi}) \right]\]- Parameters
sim (gbspy.pp.Sim) – Simulation object
theta (numpy.ndarray) – Logarithmic plasma density as a 4D array
psi_em (numpy.ndarray, optional) – Electromagnetic perturbation as a 4D array. This parameter is required if the simulation enables electromagnetic effects and
ignore_em=False
.ignore_em (bool, optional) – Compute the velocity without electromagnetic corrections even when the simulation ran with such effects enabled.
- Returns
v_diff_x (numpy.ndarray) – Radial component of the normalized velocity
v_diff_y (numpy.ndarray) – Vertical component of the normalized velocity
- Raises
AttributeError – If the simulation object has no magnetic field derivatives loaded.
- gbspy.drifts.parallel_e_velocity(sim, vpare, psi_em=None, ignore_em=False)
Computes the normalized electron parallel velocity
When considered without electromagnetic effects, the radial and vertical components of the electron parallel velocity are returned in normalized units,
\[v_{\parallel{}e} \vec{b}_p = v_{\parallel{}e} \left[\hat{e}_{\varphi}\times(\rho_{\ast}\vec{\nabla}\Psi)\right]\]where \(\Psi\) is the equilibrium magnetic flux function. When introducing electromagnetic perturbations, one has instead
\[v_{\parallel{}e} (\vec{b}_p + \delta\vec{b}_p) = v_{\parallel{}e} \left[ \hat{e}_{\varphi}\times(\rho_{\ast}\vec{\nabla}\Psi) - \vec{\nabla}\times(\rho_{\ast}\psi\hat{e}_{\varphi}) \right]\]- Parameters
sim (gbspy.pp.Sim) – Simulation object
vpare (numpy.ndarray) – Electron parallel velocity as a 4D array
psi_em (numpy.ndarray, optional) – Electromagnetic perturbation as a 4D array. This parameter is required if the simulation enables electromagnetic effects and
ignore_em=False
.ignore_em (bool, optional) – Compute the projected velocity without electromagnetic corrections even when the simulation ran with such effects enabled.
- Returns
v_par_x (numpy.ndarray) – Radial component of the normalized velocity
v_par_y (numpy.ndarray) – Vertical component of the normalized velocity
- Raises
AttributeError – If the simulation object has no magnetic field derivatives loaded.
- gbspy.drifts.perpendicular_diffusion_velocity(sim, theta)
Computes the normalized perpendicular diffusion velocity
The radial and vertical components of the perpendicular diffusion velocity are returned in normalized units,
\[\vec{v}_{\perp{}\text{diff}} = -\rho_{\ast} D_{\perp{}n} \frac{\vec{\nabla}_{\perp}n}{n}\]- Parameters
sim (gbspy.pp.Sim) – Simulation object
theta (numpy.ndarray) – Logarithmic plasma density as a 4D array
- Returns
v_diff_x (numpy.ndarray) – Radial component of the normalized velocity
v_diff_y (numpy.ndarray) – Vertical component of the normalized velocity