6D accumulation kernels#
Accumulation kernels for full-orbit (6D) particles.
Function naming conventions:
use the model name, all lower-case letters (e.g.
lin_vlasov_maxwell)in case of multiple accumulations in one model, attach
_1,_2or the species name.
These kernels are passed to struphy.pic.accumulation.particles_to_grid.Accumulator.
- struphy.pic.accumulation.accum_kernels.charge_density_0form(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, vec: float[:, :, :])[source]#
Kernel for
AccumulatorVectorinto V0 with the filling\[B_p^\mu = \frac{w_p}{N} \,.\]
- struphy.pic.accumulation.accum_kernels.hybrid_fA_density(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat: float[:, :, :, :, :, :], Nel: int[:], quad: int[:], quad_pts_x: float[:], quad_pts_y: float[:], quad_pts_z: float[:], p_shape: int[:], p_size: float[:])[source]#
Accumulates the values of density at quadrature points with the filling functions
\[n = \sum_p w_p S(x - x_p)\]- Parameters:
do (To)
Note
The above parameter list contains only the model specific input arguments.
Accumulates into V1 with the filling functions
\[ \begin{align}\begin{aligned}A_p^{\mu, \nu} &= f_0(\eta_p, v_p) * [ DF^{-1}(\eta_p) * v_p ]_\mu * [ DF^{-1}(\eta_p) * v_p ]_\nu\\B_p^\mu &= \sqrt{f_0(\eta_p, v_p)} * w_p * [ DF^{-1}(\eta_p) * v_p ]_\mu\end{aligned}\end{align} \]Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels.linear_vlasov_ampere(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11: float[:, :, :, :, :, :], mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat22: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], mat33: float[:, :, :, :, :, :], vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], f0_values: float[:])[source]#
Accumulates into V1 with the filling functions
\[ \begin{align}\begin{aligned}A_p^{\mu, \nu} &= \frac{\alpha^2 \kappa^2}{v_{\text{th}}^2} \frac{1}{N\, s_0} f_0(\mathbf{\eta}_p, \mathbf{v}_p) [ DF^{-1}(\mathbf{\eta}_p) \mathbf{v}_p ]_\mu [ DF^{-1}(\mathbf{\eta}_p) \mathbf{v}_p ]_\nu \,,\\B_p^\mu &= \alpha^2 \kappa \sqrt{f_0(\mathbf{\eta}_p, \mathbf{v}_p)} w_p [ DF^{-1}(\mathbf{\eta}_p) \mathbf{v}_p ]_\mu \,.\end{aligned}\end{align} \]- Parameters:
array[float] (f0_values ;) – Value of f0 for each particle.
Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels.vlasov_maxwell(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11: float[:, :, :, :, :, :], mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat22: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], mat33: float[:, :, :, :, :, :], vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :])[source]#
Accumulates into V1 with the filling functions
\[\begin{split}A_p^{\mu, \nu} &= w_p \, G^{-1}_{\mu, \nu}(\boldsymbol \eta_p) \,, \\[2mm] B_p^\mu &= w_p [DF^{-1}(\boldsymbol \eta_p) \cdot \mathbf{v}_p ]_\mu \,.\end{split}\]Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels.cc_lin_mhd_6d_1(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], b2_1: float[:, :, :], b2_2: float[:, :, :], b2_3: float[:, :, :], basis_u: int, scale_mat: float, boundary_cut: float)[source]#
Accumulates into V1 with the filling functions
\[A_p^{\mu, \nu} = w_p * [ G^{-1}(\eta_p) * B2_{\times}(\eta_p) * G^{-1}(\eta_p) ]_{\mu, \nu}\]where \(B2_{\times} * a := B2 \times a\) for \(a \in \mathbb R^3\).
- Parameters:
b2_1 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2_2 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2_3 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels.cc_lin_mhd_6d_2(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11: float[:, :, :, :, :, :], mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat22: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], mat33: float[:, :, :, :, :, :], vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], b2_1: float[:, :, :], b2_2: float[:, :, :], b2_3: float[:, :, :], basis_u: int, scale_mat: float, scale_vec: float, boundary_cut: float)[source]#
Accumulates into V1 with the filling functions
\[ \begin{align}\begin{aligned}A_p^{\mu, \nu} &= w_p * [ G^{-1}(\eta_p) * B2_{\times}(\eta_p) * G^{-1}(\eta_p) * B2_{\times}(\eta_p)^\top * G^{-1}(\eta_p) ]_{\mu, \nu}\\B_p^\mu &= w_p * [ G^{-1}(\eta_p) * B2_{\times}(\eta_p) * DF^{-1}(\eta_p) * v_p ]_\mu\end{aligned}\end{align} \]where \(B2_{\times} * a := B2 \times a\) for \(a \in \mathbb R^3\).
- Parameters:
b2_1 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2_2 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2_3 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels.pc_lin_mhd_6d_full(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11_11: float[:, :, :, :, :, :], mat12_11: float[:, :, :, :, :, :], mat13_11: float[:, :, :, :, :, :], mat22_11: float[:, :, :, :, :, :], mat23_11: float[:, :, :, :, :, :], mat33_11: float[:, :, :, :, :, :], mat11_12: float[:, :, :, :, :, :], mat12_12: float[:, :, :, :, :, :], mat13_12: float[:, :, :, :, :, :], mat22_12: float[:, :, :, :, :, :], mat23_12: float[:, :, :, :, :, :], mat33_12: float[:, :, :, :, :, :], mat11_13: float[:, :, :, :, :, :], mat12_13: float[:, :, :, :, :, :], mat13_13: float[:, :, :, :, :, :], mat22_13: float[:, :, :, :, :, :], mat23_13: float[:, :, :, :, :, :], mat33_13: float[:, :, :, :, :, :], mat11_22: float[:, :, :, :, :, :], mat12_22: float[:, :, :, :, :, :], mat13_22: float[:, :, :, :, :, :], mat22_22: float[:, :, :, :, :, :], mat23_22: float[:, :, :, :, :, :], mat33_22: float[:, :, :, :, :, :], mat11_23: float[:, :, :, :, :, :], mat12_23: float[:, :, :, :, :, :], mat13_23: float[:, :, :, :, :, :], mat22_23: float[:, :, :, :, :, :], mat23_23: float[:, :, :, :, :, :], mat33_23: float[:, :, :, :, :, :], mat11_33: float[:, :, :, :, :, :], mat12_33: float[:, :, :, :, :, :], mat13_33: float[:, :, :, :, :, :], mat22_33: float[:, :, :, :, :, :], mat23_33: float[:, :, :, :, :, :], mat33_33: float[:, :, :, :, :, :], vec1_1: float[:, :, :], vec2_1: float[:, :, :], vec3_1: float[:, :, :], vec1_2: float[:, :, :], vec2_2: float[:, :, :], vec3_2: float[:, :, :], vec1_3: float[:, :, :], vec2_3: float[:, :, :], vec3_3: float[:, :, :], ep_scale: float)[source]#
Accumulates into V1 with the filling functions
\[ \begin{align}\begin{aligned}V_{p,i} A_p^{\mu, \nu} V_{p,j} &= w_p * [ DF^{-1}(\eta_p) DF^{-\top}(\eta_p) ]_{\mu, \nu} * V_{p,i} * V_{p,j}\\V_{p,i} B_p^\mu &= w_p * [DF^{-1}(\eta_p)]_\mu * V_{p,i}\end{aligned}\end{align} \]Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels.pc_lin_mhd_6d(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11_11: float[:, :, :, :, :, :], mat12_11: float[:, :, :, :, :, :], mat13_11: float[:, :, :, :, :, :], mat22_11: float[:, :, :, :, :, :], mat23_11: float[:, :, :, :, :, :], mat33_11: float[:, :, :, :, :, :], mat11_12: float[:, :, :, :, :, :], mat12_12: float[:, :, :, :, :, :], mat13_12: float[:, :, :, :, :, :], mat22_12: float[:, :, :, :, :, :], mat23_12: float[:, :, :, :, :, :], mat33_12: float[:, :, :, :, :, :], mat11_13: float[:, :, :, :, :, :], mat12_13: float[:, :, :, :, :, :], mat13_13: float[:, :, :, :, :, :], mat22_13: float[:, :, :, :, :, :], mat23_13: float[:, :, :, :, :, :], mat33_13: float[:, :, :, :, :, :], mat11_22: float[:, :, :, :, :, :], mat12_22: float[:, :, :, :, :, :], mat13_22: float[:, :, :, :, :, :], mat22_22: float[:, :, :, :, :, :], mat23_22: float[:, :, :, :, :, :], mat33_22: float[:, :, :, :, :, :], mat11_23: float[:, :, :, :, :, :], mat12_23: float[:, :, :, :, :, :], mat13_23: float[:, :, :, :, :, :], mat22_23: float[:, :, :, :, :, :], mat23_23: float[:, :, :, :, :, :], mat33_23: float[:, :, :, :, :, :], mat11_33: float[:, :, :, :, :, :], mat12_33: float[:, :, :, :, :, :], mat13_33: float[:, :, :, :, :, :], mat22_33: float[:, :, :, :, :, :], mat23_33: float[:, :, :, :, :, :], mat33_33: float[:, :, :, :, :, :], vec1_1: float[:, :, :], vec2_1: float[:, :, :], vec3_1: float[:, :, :], vec1_2: float[:, :, :], vec2_2: float[:, :, :], vec3_2: float[:, :, :], vec1_3: float[:, :, :], vec2_3: float[:, :, :], vec3_3: float[:, :, :], ep_scale: float)[source]#
Accumulates into V1 with the filling functions
\[ \begin{align}\begin{aligned}{V_{p,i}}_\perp A_p^{\mu, \nu} {V_{p,j}}_\perp &= w_p * [ DF^{-1}(\eta_p) DF^{-\top}(\eta_p) ]_{\mu, \nu} * {V_{p,i}}_\perp * {V_{p,j}}_\perp\\{V_{p,i}}_\perp B_p^\mu &= w_p * [DF^{-1}(\eta_p)]_\mu * {V_{p,i}}_\perp\end{aligned}\end{align} \]Note
The above parameter list contains only the model specific input arguments.
5D accumulation kernels#
Accumulation kernels for gyro-center (5D) particles.
Function naming conventions:
use the model name, all lower-case letters (e.g.
lin_vlasov_maxwell)in case of multiple accumulations in one model, attach
_1,_2or the species name.
These kernels are passed to struphy.pic.accumulation.particles_to_grid.Accumulator.
- struphy.pic.accumulation.accum_kernels_gc.gc_density_0form(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, vec: float[:, :, :])[source]#
Kernel for
AccumulatorVectorinto V0 with the filling\[B_p^\mu = \frac{w_p}{N} \,.\]
- struphy.pic.accumulation.accum_kernels_gc.gc_mag_density_0form(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, vec: float[:, :, :], scale: float)[source]#
Kernel for
AccumulatorVectorinto V0 with the filling\[B_p^\mu = \mu \frac{w_p}{N} \,.\]
- struphy.pic.accumulation.accum_kernels_gc.cc_lin_mhd_5d_D(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], epsilon: float, ep_scale: float, b2_1: float[:, :, :], b2_2: float[:, :, :], b2_3: float[:, :, :], norm_b11: float[:, :, :], norm_b12: float[:, :, :], norm_b13: float[:, :, :], curl_norm_b1: float[:, :, :], curl_norm_b2: float[:, :, :], curl_norm_b3: float[:, :, :], basis_u: int)[source]#
Accumulation kernel for the propagator
CurrentCoupling5DDensity.Accumulates \(\alpha\)-form matrix with the filling functions (\(\alpha = 2\))
\[A_p^{\mu, \nu} = w_p \frac{1}{\epsilon} \left( 1-\frac{\hat B_\parallel}{\hat B^*_\parallel} \right) g^{-1} (\mathbf B^2_\times)_{\mu, \nu} \,.\]- Parameters:
epsilon (float) – scaling factor.
b2_1 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2_2 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2_3 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
norm_b11 (array[float]) – FE coefficients c_ijk of the unit magnetic field as a 1-form.
norm_b12 (array[float]) – FE coefficients c_ijk of the unit magnetic field as a 1-form.
norm_b12 – FE coefficients c_ijk of the unit magnetic field as a 1-form.
curl_norm_b1 (array[float]) – FE coefficients c_ijk of the curl of the unit magnetic field as a 2-form.
curl_norm_b2 (array[float]) – FE coefficients c_ijk of the curl of the unit magnetic field as a 2-form.
curl_norm_b3 (array[float]) – FE coefficients c_ijk of the curl of the unit magnetic field as a 2-form.
Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels_gc.cc_lin_mhd_5d_curlb(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11: float[:, :, :, :, :, :], mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat22: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], mat33: float[:, :, :, :, :, :], vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], epsilon: float, ep_scale: float, b1: float[:, :, :], b2: float[:, :, :], b3: float[:, :, :], norm_b11: float[:, :, :], norm_b12: float[:, :, :], norm_b13: float[:, :, :], curl_norm_b1: float[:, :, :], curl_norm_b2: float[:, :, :], curl_norm_b3: float[:, :, :], basis_u: int)[source]#
Accumulation kernel for the propagator
CurrentCoupling5DCurlb.Accumulates \(\alpha\)-form matrix and vector with the filling functions (\(\alpha = 2\))
\[ \begin{align}\begin{aligned}A_p^{\mu, \nu} &= w_p \left[\left( \frac{v_{\parallel,p}}{g\hat B^*_\parallel}\right)^2 \mathbf B^2_{\times} \left| \hat \nabla \times \hat{\mathbf b}^1_0 \right|^2 (\mathbf B^2_{\times})^\top \right]_{\mu, \nu}\,,\\B_p^\mu &= w_p \left( \frac{v^2_{\parallel,p}}{g\hat B^*_\parallel} \mathbf B^2_{\times} \right)_\mu \,,\end{aligned}\end{align} \]where \(\mathbf B^2_{\times} \mathbf a := \hat{\mathbf B}^2 \times \mathbf a\) for \(a \in \mathbb R^3\).
- struphy.pic.accumulation.accum_kernels_gc.cc_lin_mhd_5d_M(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11: float[:, :, :, :, :, :], mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat22: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], mat33: float[:, :, :, :, :, :], vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], norm_b11: float[:, :, :], norm_b12: float[:, :, :], norm_b13: float[:, :, :], scale_vec: float)[source]#
Accumulation kernel for the propagator
ShearAlfvenCurrentCoupling5DandMagnetosonicCurrentCoupling5D.Accumulates 2-form vector with the filling functions:
\[B^\mu_p = \omega_p \mu_p\left(\sqrt{g}^{-1} \hat{\mathbf{b}}¹_0\right)_\mu \,.\]- Parameters:
norm_b11 (array[float]) – FE coefficients c_ijk of the normalized magnetic field as a 1-form.
norm_b12 (array[float]) – FE coefficients c_ijk of the normalized magnetic field as a 1-form.
norm_b13 (array[float]) – FE coefficients c_ijk of the normalized magnetic field as a 1-form.
Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels_gc.cc_lin_mhd_5d_gradB(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, mat11: float[:, :, :, :, :, :], mat12: float[:, :, :, :, :, :], mat13: float[:, :, :, :, :, :], mat22: float[:, :, :, :, :, :], mat23: float[:, :, :, :, :, :], mat33: float[:, :, :, :, :, :], vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], epsilon: float, ep_scale: float, b1: float[:, :, :], b2: float[:, :, :], b3: float[:, :, :], norm_b11: float[:, :, :], norm_b12: float[:, :, :], norm_b13: float[:, :, :], curl_norm_b1: float[:, :, :], curl_norm_b2: float[:, :, :], curl_norm_b3: float[:, :, :], grad_PB1: float[:, :, :], grad_PB2: float[:, :, :], grad_PB3: float[:, :, :], basis_u: int)[source]#
Accumulation kernel for the propagator
CurrentCoupling5DGradB.Accumulates math:alpha -form vector with the filling functions
\[B_p^\mu &= \omega_p \left[\left(\frac{\mu_p}{\sqrt{g}\hat B^*_\parallel}\right) \mathbf B^2_{\times} G^{-1} \mathbf b^2_{0 \times} G^{-1} \nabla B_\parallel¹\right]_\mu \,,\]where \(B2_{\times} * a := B2 \times a\) for \(a \in \mathbb R^3\).
- Parameters:
b1 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b2 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
b3 (array[float]) – FE coefficients c_ijk of the magnetic field as a 2-form.
norm_b11 (array[float]) – FE coefficients c_ijk of the normalized magnetic field as a 1-form.
norm_b12 (array[float]) – FE coefficients c_ijk of the normalized magnetic field as a 1-form.
norm_b13 (array[float]) – FE coefficients c_ijk of the normalized magnetic field as a 1-form.
curl_norm_b1 (array[float]) – FE coefficients c_ijk of the curl of normalized magnetic field as a 2-form.
curl_norm_b2 (array[float]) – FE coefficients c_ijk of the curl of normalized magnetic field as a 2-form.
curl_norm_b3 (array[float]) – FE coefficients c_ijk of the curl of normalized magnetic field as a 2-form.
grad_PB1 (array[float]) – FE coefficients c_ijk of gradient of parallel magnetic field as a 1-form.
grad_PB2 (array[float]) – FE coefficients c_ijk of gradient of parallel magnetic field as a 1-form.
grad_PB3 (array[float]) – FE coefficients c_ijk of gradient of parallel magnetic field as a 1-form.
Note
The above parameter list contains only the model specific input arguments.
- struphy.pic.accumulation.accum_kernels_gc.cc_lin_mhd_5d_gradB_dg_init(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], epsilon: float, ep_scale: float, b1: float[:, :, :], b2: float[:, :, :], b3: float[:, :, :], beq1: float[:, :, :], beq2: float[:, :, :], beq3: float[:, :, :], norm_b11: float[:, :, :], norm_b12: float[:, :, :], norm_b13: float[:, :, :], curl_norm_b1: float[:, :, :], curl_norm_b2: float[:, :, :], curl_norm_b3: float[:, :, :], grad_PB1: float[:, :, :], grad_PB2: float[:, :, :], grad_PB3: float[:, :, :], grad_PBeq1: float[:, :, :], grad_PBeq2: float[:, :, :], grad_PBeq3: float[:, :, :], basis_u: int)[source]#
TODO
- struphy.pic.accumulation.accum_kernels_gc.cc_lin_mhd_5d_gradB_dg(args_markers: MarkerArguments, args_derham: DerhamArguments, args_domain: DomainArguments, vec1: float[:, :, :], vec2: float[:, :, :], vec3: float[:, :, :], epsilon: float, ep_scale: float, b1: float[:, :, :], b2: float[:, :, :], b3: float[:, :, :], beq1: float[:, :, :], beq2: float[:, :, :], beq3: float[:, :, :], norm_b11: float[:, :, :], norm_b12: float[:, :, :], norm_b13: float[:, :, :], curl_norm_b1: float[:, :, :], curl_norm_b2: float[:, :, :], curl_norm_b3: float[:, :, :], grad_PB1: float[:, :, :], grad_PB2: float[:, :, :], grad_PB3: float[:, :, :], grad_PBeq1: float[:, :, :], grad_PBeq2: float[:, :, :], grad_PBeq3: float[:, :, :], basis_u: int, const: float)[source]#
TODO
Filters#
Filtering kernels
- struphy.pic.accumulation.filter_kernels.apply_three_point_filter_3d(vec: float[:, :, :], dir: int, form: int, Nel: int[:], spl_kind: bool[:], pn: int[:], starts: int[:], ends: int[:], alpha: float)[source]#
Applying three point filter to the spline coefficients of the accumulated vector (
._dataof the StencilVector):\[v^{\textnormal{filtered}}_{i,j,k} = \sum^2_{l_1=0} \sum^2_{l_2=0} \sum^2_{l_3=0} S(l_1) S(l_2) S(l_3)\, v_{i-1+l_1,\, j-1+l_2,\, k-1+l_3} \,,\]where the 1d mask \(S\) is defined as
\[\begin{split}S(i) = \left\{ \begin{aligned} &(1 - \alpha)/2 \quad && \text{if} \quad i=0 \\ &\alpha && \text{if} \quad i=1 \\ &(1 - \alpha)/2 \quad && \text{if} \quad i=2 \end{aligned} \right. \,.\end{split}\]