PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Interfaces and Types | Functions/Subroutines
x_utilities Module Reference

Numerical utilities related to perturbation operations. More...

Interfaces and Types

interface  sec_ind_loc2tot
 Returns the sec_ind_tot used to refer to a perturbation quantity. More...
 

Functions/Subroutines

subroutine, public get_sec_x_range (sec_X_range_loc, sec_X_range_tot, m, sym, lim_sec_X)
 Gets one of the the local ranges of contiguous tensorial perturbation variables to be printed or read during one call of the corresponding HDF5 variables. More...
 
logical function, public do_x ()
 Tests whether this perturbatino job should be done. More...
 
logical function, public is_necessary_x (sym, sec_X_id, lim_sec_X)
 Determines whether a variable needs to be considered: More...
 
integer function, public calc_memory_x (ord, arr_size, n_mod, mem_size)
 Calculate memory in MB necessary for X variables. More...
 
integer function, public trim_modes (mds_i, mds_o, id_lim_i, id_lim_o)
 Limit input mode range to output mode range. More...
 

Detailed Description

Numerical utilities related to perturbation operations.

Function/Subroutine Documentation

◆ calc_memory_x()

integer function, public x_utilities::calc_memory_x ( integer, intent(in)  ord,
integer, intent(in)  arr_size,
integer, intent(in)  n_mod,
real(dp), intent(inout)  mem_size 
)

Calculate memory in MB necessary for X variables.

This depends on the order:

  • order 1:
    • 4x n_par_X x n_geo x loc_n_r x n_mod
  • order 2:
    • 2x n_par_X x n_geo x loc_n_r x n_mod^2
    • 4x n_par_X x n_geo x loc_n_r x n_mod(n_mod+1)/2
  • higher order: not used

where n_par_X x n_geo x loc_n_r should be passed as arr_size and n_mod as well.

Returns
ierr
Parameters
[in]ordorder of data
[in]arr_sizesize of part of X array
[in]n_modnumber of modes
[in,out]mem_sizetotal size

Definition at line 236 of file X_utilities.f90.

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

◆ do_x()

logical function, public x_utilities::do_x

Tests whether this perturbatino job should be done.

Also increments X_job_nr

Definition at line 179 of file X_utilities.f90.

+ Here is the caller graph for this function:

◆ get_sec_x_range()

subroutine, public x_utilities::get_sec_x_range ( integer, dimension(2), intent(inout)  sec_X_range_loc,
integer, dimension(2), intent(inout)  sec_X_range_tot,
integer, intent(in)  m,
logical, intent(in)  sym,
integer, dimension(2,2), intent(in), optional  lim_sec_X 
)

Gets one of the the local ranges of contiguous tensorial perturbation variables to be printed or read during one call of the corresponding HDF5 variables.

More specifically, a range of indices k in the first dimension is given for every value of the indices m in the second dimension.

An example is now given for the subrange [2:3,2:5] of a the total range [1:5, 1:5]. For asymmetric variables the situation is simple: The k range is [2:3] for all 5 values of m. However, for symmetric variables, the upper diagonal values are not stored, which gives k ranges [2:3], [3:3] and no range for m = 4 and 5.

This routine then translates these ranges to the corresponding 1-D ranges that are used in the actual variables. For above example, the total indices are

\[ \left(\begin{array}{ccccc} 1 & 6 & 11 & 16 & 21 \\ 2 & 7 & 12 & 17 & 22 \\ 3 & 8 & 13 & 18 & 23 \\ 4 & 9 & 14 & 19 & 24 \\ 5 & 10 & 15 & 20 & 25 \end{array}\right) \rightarrow \left[7:8\right], \left[12:13\right], \left[17:18\right] \ \text{and} \ \left[22:23\right], \]

for asymmetric variables and

\[ \left(\begin{array}{ccccc} 1 & 2 & 3 & 4 & 5 \\ 2 & 6 & 7 & 8 & 9 \\ 3 & 7 & 10 & 11 & 12 \\ 4 & 8 & 11 & 13 & 14 \\ 5 & 9 & 12 & 14 & 15 \end{array}\right) \rightarrow \left[6:7\right], \left[10:10\right], \left[:\right] \ \text{and} \ \left[:\right], \]

for symmetric variables.

These can then related to the local indices for the variables in this perturbation job.

For above example, the results are:

[1:2], [3:4], [5:6] and [7:8],

for asymmetric variables and

[1:2], [3:3], [:] and [:],

for symmetric variables.

As can be seen, the local ranges of the variables in the submatrix of this perturbation job are (designed to be) contiguous, but the total ranges of the variables in the submatrix are clearly not in general.

The procedure outputs both the local and total ranges.

Parameters
[in,out]sec_x_range_locstart and end of local range in dimension 1 (vertical)
[in,out]sec_x_range_totstart and end of total range in dimension 1 (vertical)
[in]mdimension 2 (horizontal)
[in]symwhether the variable is symmetric
[in]lim_sec_xlimits of m_X (pol. flux) or n_X (tor. flux)

Definition at line 128 of file X_utilities.f90.

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

◆ is_necessary_x()

logical function, public x_utilities::is_necessary_x ( logical, intent(in)  sym,
integer, dimension(2), intent(in)  sec_X_id,
integer, dimension(2,2), intent(in), optional  lim_sec_X 
)

Determines whether a variable needs to be considered:

This depends on whether the quantity is symmetric or not:

  • Only if it is on or below the diagonal for symmetric quantities.
  • Always for asymmetric quantities
    Parameters
    [in]symwhether the variable is symmetric
    [in]sec_x_idmode indices
    [in]lim_sec_xlimits of m_X (pol flux) or n_X (tor flux) for both dimensions

Definition at line 197 of file X_utilities.f90.

+ Here is the caller graph for this function:

◆ trim_modes()

integer function, public x_utilities::trim_modes ( type(modes_type), intent(in)  mds_i,
type(modes_type), intent(in)  mds_o,
integer, dimension(2), intent(inout)  id_lim_i,
integer, dimension(2), intent(inout)  id_lim_o 
)

Limit input mode range to output mode range.

Parameters
[in]mds_igeneral modes variables for input
[in]mds_ogeneral modes variables for output
[in,out]id_lim_ilimits on input modes
[in,out]id_lim_olimits on output modes

Definition at line 293 of file X_utilities.f90.

+ Here is the caller graph for this function: