PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Functions/Subroutines | Variables
slepc_utilities Module Reference

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...
 

Detailed Description

Numerical utilities related to SLEPC (and PETSC) operations.

See also
References: [7]

Function/Subroutine Documentation

◆ insert_block_mat()

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.

Note
The grid in which the modes variables 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.
Returns
ierr
Parameters
[in]mdsgeneral modes variables

Definition at line 83 of file SLEPC_utilities.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ debug_insert_block_mat

logical, public slepc_utilities::debug_insert_block_mat = .false.

plot debug information for insert_block_mat()

Note
Debug version only

Definition at line 31 of file SLEPC_utilities.f90.