|
PB3D [2.47]
Ideal linear high-n MHD stability in 3-D
|
Operations considering perturbation quantities. More...
Interfaces and Types | |
| interface | calc_x |
| Calculates either vectorial or tensorial perturbation variables. More... | |
| interface | redistribute_output_x |
| Redistribute the perturbation variables. More... | |
| interface | print_output_x |
| Print either vectorial or tensorial perturbation quantities of a certain order to an output file. More... | |
Functions/Subroutines | |
| integer function, public | init_modes (grid_eq, eq) |
| Initializes some variables concerning the mode numbers. | |
| integer function, public | setup_modes (mds, grid_eq, grid, plot_name) |
| Sets up some variables concerning the mode numbers. | |
| integer function, public | check_x_modes (grid_eq, eq) |
| Checks whether the high-n approximation is valid: | |
| integer function, public | calc_res_surf (mds, grid_eq, eq, res_surf, info, jq) |
| Calculates resonating flux surfaces for the perturbation modes. | |
| integer function, public | resonance_plot (mds, grid_eq, eq) |
| plot \(q\)-profile or \(\iota\)-profile in flux coordinates with \(nq-m = 0\) or \(n-\iota m = 0\) indicated if requested. | |
| integer function, public | calc_magn_ints (grid_eq, grid_x, eq, x, x_int, prev_style, lim_sec_x) |
| Calculate the magnetic integrals from \(\widetilde{PV}_{k,m}^i\) and \(\widetilde{KV}_{k,m}^i\) in an equidistant grid where the step size can vary depending on the normal coordinate. | |
| integer function, public | divide_x_jobs (arr_size) |
| Divides the perturbation jobs. | |
| integer function, public | print_debug_x_1 (mds, grid_x, x_1) |
| Prints debug information for X_1 driver. | |
| integer function, public | print_debug_x_2 (mds, grid_x, x_2_int) |
| Prints debug information for X_2 driver. | |
Variables | |
| logical, public | debug_check_x_modes_2 = .false. |
| plot debug information for check_x_modes_2() | |
Operations considering perturbation quantities.
| integer function, public x_ops::calc_magn_ints | ( | type(grid_type), intent(in) | grid_eq, |
| type(grid_type), intent(in) | grid_x, | ||
| type(eq_2_type), intent(in), target | eq, | ||
| type(x_2_type), intent(in) | x, | ||
| type(x_2_type), intent(inout) | x_int, | ||
| integer, intent(in), optional | prev_style, | ||
| integer, dimension(2,2), intent(in), optional | lim_sec_x ) |
Calculate the magnetic integrals from \(\widetilde{PV}_{k,m}^i\) and \(\widetilde{KV}_{k,m}^i\) in an equidistant grid where the step size can vary depending on the normal coordinate.
All the variables should thus be field-line oriented. The result is saved in the first index of the X variables, the other can be ignored.
Using prev_style, the results of this calculation on X can be combined with the ones already present in X_int.
prev_style=0: Overwrite [def].prev_style=1: Add to current integral.prev_style=2: Divide by 2 and add to current integral. Also modify the indices of the current integral:magn_int_style = 1: 1 2 2 2 2 2 1 -> 2 2 2 2 2 2,magn_int_style = 2: 1 3 3 2 3 3 1 -> 3 2 3 3 2 3.prev_style=3: Add to current integral. Also modify the indices of the current integral as in prev_style = 2.Therefore, it is to be used in order. For example:
Afterwards, it would cycle through 2 and 3, as style 0 and 1 are only for the first Richardson level.
X_2, but it is assumed that the first index has dimension 1, the rest is ignored.min_n_par_X)use_pol_flux_F [6].| [in] | grid_eq | equilibrium grid |
| [in] | grid_x | perturbation grid |
| [in] | eq | metric equilibrium |
| [in] | x | tensorial perturbation variables |
| [in,out] | x_int | interpolated tensorial perturbation variables, containing all mode combinations |
| [in] | prev_style | style to treat X_prev |
| [in] | lim_sec_x | limits of m_X (pol flux) or n_X (tor flux) for both dimensions |
Definition at line 3079 of file X_ops.f90.
| integer function, public x_ops::calc_res_surf | ( | type(modes_type), intent(in) | mds, |
| type(grid_type), intent(in) | grid_eq, | ||
| type(eq_1_type), intent(in) | eq, | ||
| real(dp), dimension(:,:), intent(inout), allocatable | res_surf, | ||
| logical, intent(in), optional | info, | ||
| real(dp), dimension(:), intent(inout), optional, allocatable | jq ) |
Calculates resonating flux surfaces for the perturbation modes.
The output consists of mode number, resonating normal position and the fraction \(\frac{m}{n}\) or \(\frac{n}{m}\). for those modes for which a solution is found that is within the plasma range.
It contains three pieces of information:
for every single mode in sec of mds, which can be tabulated in an arbitrary grid, not necessarily the equilibrium one.
Optionally, the total safety factor or rotational transform can be returned to the master.
Also, information can be displayed with info.
| [in] | mds | general modes variables |
| [in] | grid_eq | equilibrium grid_eq |
| [in] | eq | flux equilibrium |
| [in,out] | res_surf | resonant surface |
| [in] | info | if info is displayed |
| [in,out] | jq | either safety factor or rotational transform |
Definition at line 1637 of file X_ops.f90.
| integer function, public x_ops::check_x_modes | ( | type(grid_type), intent(in) | grid_eq, |
| type(eq_1_type), intent(in) | eq ) |
Checks whether the high-n approximation is valid:
This depends on the X_style:
For X_style 1 (prescribed): every mode should resonate at least somewhere in the whole normal range:
where \(T\) = tol << 1.
This condition is determined by the sign of \(q\) (or \(\iota\)) and given by:
for poloidal flux.
For toroidal flux, \(q\) should be replaced by \(\iota\) and \(\frac{m}{n}\) by \(\frac{n}{m}\).
For X_style 2 (fast): the resonance has been taken care of, but it remains to be checked whether the number of modes is efficient.
| [in] | grid_eq | equilibrium grid |
| [in] | eq | flux equilibrium |
Definition at line 1349 of file X_ops.f90.
| integer function, public x_ops::divide_x_jobs | ( | integer, intent(in) | arr_size | ) |
Divides the perturbation jobs.
This concerns the calculation of the magnetic integrals of blocks of tensorial perturbation variables. These are set up using the equilibrium and vectorial perturbation variables that are stored in memory, but only the integrated tensorial result is stored in memory, with negligible variables size.
The size of the (k,m) pairs to be calculated is determined by looking at what fits in memory when the equilibrium and vectorial perturbation variables are stored in memory first.
| [in] | arr_size | array size (using loc_n_r) |
Definition at line 3363 of file X_ops.f90.
| integer function, public x_ops::init_modes | ( | type(grid_type), intent(in) | grid_eq, |
| type(eq_1_type), intent(in) | eq ) |
Initializes some variables concerning the mode numbers.
Setup minimum and maximum of mode numbers at every flux surface in equilibrium coordinates
min_n_X, max_n_X min_m_X, max_m_X,It functions depending on the X_style used: 1 (prescribed) or 2 (fast). For the fast style, at every flux surface the range of modes is sought that resonates most:
where \(N\) = n_mod_X.
However, at the same time, both m and n have to be larger, in absolute value, than min_sec_X. Therefore, the range of width n_mod_X can be shifted upwards.
| [in] | grid_eq | equilibrium grid |
| [in] | eq | flux equilibrium |
Definition at line 918 of file X_ops.f90.
| integer function, public x_ops::print_debug_x_1 | ( | type(modes_type), intent(in) | mds, |
| type(grid_type), intent(in) | grid_x, | ||
| type(x_1_type), intent(in) | x_1 ) |
| integer function, public x_ops::print_debug_x_2 | ( | type(modes_type), intent(in) | mds, |
| type(grid_type), intent(in) | grid_x, | ||
| type(x_2_type), intent(in) | x_2_int ) |
| integer function, public x_ops::resonance_plot | ( | type(modes_type), intent(in) | mds, |
| type(grid_type), intent(in) | grid_eq, | ||
| type(eq_1_type), intent(in) | eq ) |
plot \(q\)-profile or \(\iota\)-profile in flux coordinates with \(nq-m = 0\) or \(n-\iota m = 0\) indicated if requested.
The plot will be done in the grid in which mds is tabulated, which is not necessarily the equilibrium one.
| [in] | mds | general modes variables |
| [in] | grid_eq | equilibrium grid |
| [in] | eq | flux equilibrium |
Definition at line 1813 of file X_ops.f90.
| integer function, public x_ops::setup_modes | ( | type(modes_type), intent(inout), target | mds, |
| type(grid_type), intent(in) | grid_eq, | ||
| type(grid_type), intent(in) | grid, | ||
| character(len=*), intent(in), optional | plot_name ) |
Sets up some variables concerning the mode numbers.
Apart from the mode numbers
n, m,also the variables of the secondary modes
are set up in the coordinates of the grid passed. The normal values of this grid are saved as well, in
All variables are tabulated in the full normal grid. The mode indices, however, are chosen so that there is maximum overlap between different normal positions. This is trivial for X_style 1 (prescribed), but for X_style 2 (fast), this is best explained by an example:
1 10 11 12 <- start 2 10 11 12 <- no change in limits 2 13 11 12 <- limits shift up by one 3 13 11 12 <- no change in limits 4 13 14 12 <- limits shift up by one 5 16 14 15 <- limits shift up by two 6 13 14 15 <- limits shift down by one
This procedure makes use of the global variables
min_m_X, max_m_X, min_n_X, max_m_Xthat have to be set up using init_nm_x().
Optionally, n and m can be plot.
| [in,out] | mds | modes variables |
| [in] | grid_eq | equilibrium grid |
| [in] | grid | grid at which to calculate modes |
| [in] | plot_name | name to be used when plotting n and m |
Definition at line 1059 of file X_ops.f90.