PB3D
[2.45]
Ideal linear high-n MHD stability in 3-D
|
Numerical utilities related to SLEPC (and PETSC) operations. More...
Functions/Subroutines | |
integer function, public | insert_block_mat (mds, block, mat, r_id, ind, n_r, transp, overwrite, ind_insert) |
Insert a block pertaining to 1 normal point into a matrix. More... | |
Variables | |
logical, public | debug_insert_block_mat = .false. |
plot debug information for insert_block_mat() More... | |
Numerical utilities related to SLEPC (and PETSC) operations.
integer function, public slepc_utilities::insert_block_mat | ( | type(modes_type), intent(in), target | mds, |
dimension(:,:), intent(in) | block, | ||
intent(inout) | mat, | ||
intent(in) | r_id, | ||
dimension(2), intent(in) | ind, | ||
intent(in) | n_r, | ||
optional | transp, | ||
optional | overwrite, | ||
optional | ind_insert | ||
) |
Insert a block pertaining to 1 normal point into a matrix.
Optionally, also set the Hermitian transpose and / or overwrite instead of add value.
This routine takes into account that if the mode numbers change as a function of the normal coordinate, as is the case for X_style 2 (fast), part of the local blocks, which were set up without taking this into account, can have information that correspond to mode numbers that are not present any more for off-diagonal entries, and lack an equal amount of information that corresponds to the mode numbers that have taken their places.
Omission of this effect is justifiable if there are many more mode couplings that are not omitted (i.e. when n_mod_X
is large), so that it is a small effect, and/or when the coupling between these modes is already negligible.
Unfortunately, it can be argued that this is not generally the case for the fast version (X_style
= 2) since \(\widetilde{PV}^1\) and \(\widetilde{PV}^2\) are both \(\sim (nq-m)\), which indicates that the smallest elements in the corresponding off-diagonal blocks lie in the central columns for \(\widetilde{PV}^1\) and in the central columns and rows for \(\widetilde{PV}^2\), while the problematic elements lie farthest away from the central columns for \(\widetilde{PV}^1\) and the central columns and rows for \(\widetilde{PV}^2\), so these are generally not small.
The coefficients due to normal discretization get increasingly small for higher orders, though, which compensates this for higher orders.
Finally, an alternative would be to set the problematic elements not to zero but extrapolated from the closest elements, but then consistency would be sacrified, for example in the energy reconstruction of the POST-processing: In the energy reconstruction the exact same terms are neglected as well.
To conclude, for fast X_style
2, the number of modes (n_mod_X
) has to be chosen high enough compared with the variation of the mode numbers; i.e. the variation of the safety factor or rotational transform.
mds
are tabulated up must be the same as the one in which mat
is set up. If this is not the case, the indices in mds
have to be adapted.[in] | mds | general modes variables |
Definition at line 83 of file SLEPC_utilities.f90.
logical, public slepc_utilities::debug_insert_block_mat = .false. |
plot debug information for insert_block_mat()
Definition at line 31 of file SLEPC_utilities.f90.