Base classes#
Base classes for kinetic backgrounds.
- class struphy.kinetic_background.base.KineticBackground[source]#
Bases:
objectBase class for kinetic background distributions defined on \([0, 1]^3 \times \mathbb R^n, n \geq 1,\) with logical position coordinates \(\boldsymbol{\eta} \in [0, 1]^3\).
Explicit expressions for the following number density \(n\) and mean velocity \(\mathbf u\) must be implemented:
\[ \begin{align}\begin{aligned}n &= \int f \,\mathrm{d} \mathbf v\\\mathbf u &= \frac 1n \int \mathbf v f \,\mathrm{d} \mathbf v\,.\end{aligned}\end{align} \]- abstract property coords#
Coordinates of the distribution.
- abstract property vdim#
Dimension of the velocity space (vdim = n).
- abstract property is_polar#
List of booleans of length vdim. True for a velocity coordinate that is a radial polar coordinate (v_perp).
- abstract property volume_form: bool#
True if the background is represented as a volume form (thus including the velocity Jacobian).
- abstract velocity_jacobian_det(eta1, eta2, eta3, *v)[source]#
Jacobian determinant of the velocity coordinate transformation.
- abstract n(*etas)[source]#
Number density (0-form).
- Parameters:
etas (numpy.arrays) – Evaluation points. All arrays must be of same shape (can be 1d for flat evaluation).
- Return type:
A numpy.array with the density evaluated at evaluation points (same shape as etas).
- abstract u(*etas)[source]#
Mean velocities (Cartesian components evaluated at x = F(eta)).
- Parameters:
etas (numpy.arrays) – Evaluation points. All arrays must be of same shape (can be 1d for flat evaluation).
- Return type:
A list[float] (background values) or a list[numpy.array] of the evaluated velocities.
- class struphy.kinetic_background.base.SumKineticBackground(f1, f2)[source]#
Bases:
KineticBackground- property coords#
Coordinates of the distribution.
- property vdim#
Dimension of the velocity space (vdim = n).
- property is_polar#
List of booleans. True if the velocity coordinates are polar coordinates.
- property volume_form#
Boolean. True if the background is represented as a volume form (thus including the velocity Jacobian).
- property equil: FluidEquilibriumWithB#
Fluid background with B-field.
- velocity_jacobian_det(eta1, eta2, eta3, *v)[source]#
Jacobian determinant of the velocity coordinate transformation.
- class struphy.kinetic_background.base.ScalarMultiplyKineticBackground(f0, a)[source]#
Bases:
KineticBackground- property coords#
Coordinates of the distribution.
- property vdim#
Dimension of the velocity space (vdim = n).
- property is_polar#
List of booleans. True if the velocity coordinates are polar coordinates.
- property volume_form#
Boolean. True if the background is represented as a volume form (thus including the velocity Jacobian).
- velocity_jacobian_det(eta1, eta2, eta3, *v)[source]#
Jacobian determinant of the velocity coordinate transformation.
- class struphy.kinetic_background.base.Maxwellian[source]#
Bases:
KineticBackgroundBase class for a Maxwellian distribution function. It is defined on \([0, 1]^3 \times \mathbb R^n, n \geq 1,\) with logical position coordinates \(\boldsymbol{\eta} \in [0, 1]^3\):
\[f(\boldsymbol{\eta}, v_1,\ldots,v_n) = n(\boldsymbol{\eta}) \prod_{i=1}^n \frac{1}{\sqrt{2\pi}\,v_{\mathrm{th},i}(\boldsymbol{\eta})} \exp\left[-\frac{(v_i-u_i(\boldsymbol{\eta}))^2}{2\,v_{\mathrm{th},i}(\boldsymbol{\eta})^2}\right],\]defined by its velocity moments: the density \(n(\boldsymbol{\eta})\), the mean-velocities \(u_i(\boldsymbol{\eta})\), and the thermal velocities \(v_{\mathrm{th},i}(\boldsymbol{\eta})\).
- abstract vth(*etas)[source]#
Thermal velocities (0-forms).
- Parameters:
etas (numpy.arrays) – Evaluation points. All arrays must be of same shape (can be 1d for flat evaluation).
- Return type:
A list[float] (background values) or a list[numpy.array] of the evaluated thermal velocities.
- abstract property maxw_params: dict#
Parameters dictionary defining moments of the Maxwellian.
- classmethod gaussian(v, u=0.0, vth=1.0, polar=False, volume_form=False)[source]#
1-dim. normal distribution, to which array-valued mean- and thermal velocities can be passed.
- Parameters:
v (float | array-like) – Velocity coordinate(s).
u (float | array-like) – Mean velocity evaluated at position array.
vth (float | array-like) – Thermal velocity evaluated at position array, same shape as u.
polar (bool) – True if the velocity coordinate is the radial one of polar coordinates (v >= 0).
volume_form (bool) – If True, the polar Gaussian is multiplied by the polar velocity Jacobian |v|.
- Return type:
An array of size(v).
- property add_perturbation: bool#