PB3D
[2.45]
Ideal linear high-n MHD stability in 3-D
|
Operations on the solution vectors such as decompososing the energy, etc... More...
Functions/Subroutines | |
subroutine, public | plot_sol_vals (sol, last_unstable_id) |
Plots Eigenvalues. More... | |
integer function, public | plot_sol_vec (mds_X, mds_sol, grid_eq, grid_X, grid_sol, eq_1, eq_2, X, sol, XYZ, X_id, plot_var) |
Plots Eigenvectors. More... | |
integer function, public | plot_harmonics (mds, grid_sol, sol, X_id, res_surf) |
Plots the harmonics and their maximum in 2-D. More... | |
integer function, public | decompose_energy (mds_X, mds_sol, grid_eq, grid_X, grid_sol, eq_1, eq_2, X, sol, vac, X_id, B_aligned, XYZ, E_pot_int, E_kin_int) |
Decomposes the plasma potential and kinetic energy in its individual terms for an individual Eigenvalue. More... | |
integer function | calc_e (mds_X, mds_sol, grid_eq, grid_X, grid_sol, eq_1, eq_2, X, sol, vac, B_aligned, X_id, E_pot, E_kin, E_pot_int, E_kin_int) |
Calculate the energy terms in the energy decomposition. More... | |
integer function, public | print_output_sol (grid, sol, data_name, rich_lvl, remove_previous_arrs) |
Print solution quantities to an output file: More... | |
Variables | |
logical, public | debug_plot_sol_vec = .false. |
plot debug information for plot_sol_vec() More... | |
logical, public | debug_calc_e = .false. |
plot debug information for calc_E() More... | |
logical, public | debug_x_norm = .false. |
plot debug information X_norm More... | |
logical, public | debug_du = .false. |
plot debug information for calculation of DU More... | |
Operations on the solution vectors such as decompososing the energy, etc...
integer function sol_ops::calc_e | ( | type(modes_type), intent(in) | mds_X, |
type(modes_type), intent(in) | mds_sol, | ||
type(grid_type), intent(in) | grid_eq, | ||
type(grid_type), intent(in) | grid_X, | ||
type(grid_type), intent(in) | grid_sol, | ||
type(eq_1_type), intent(in) | eq_1, | ||
type(eq_2_type), intent(in) | eq_2, | ||
type(x_1_type), intent(in) | X, | ||
type(sol_type), intent(in) | sol, | ||
type(vac_type), intent(in) | vac, | ||
logical, intent(in) | B_aligned, | ||
integer, intent(in) | X_id, | ||
complex(dp), dimension(:,:,:,:), intent(inout), allocatable | E_pot, | ||
complex(dp), dimension(:,:,:,:), intent(inout), allocatable | E_kin, | ||
complex(dp), dimension(7), intent(inout) | E_pot_int, | ||
complex(dp), dimension(2), intent(inout) | E_kin_int | ||
) |
Calculate the energy terms in the energy decomposition.
[in] | mds_x | general modes variables in perturbation grid |
[in] | mds_sol | general modes variables in solution grid |
[in] | grid_eq | equilibrium grid |
[in] | grid_x | perturbation grid |
[in] | grid_sol | and solution grid |
[in] | eq_1 | flux equilibrium |
[in] | eq_2 | metric equilibrium |
[in] | x | perturbation variables |
[in] | sol | solution variables |
[in] | vac | vacuum variables |
[in] | b_aligned | whether grid is field-aligned |
[in] | x_id | nr. of Eigenvalue |
[in,out] | e_pot | potential energy |
[in,out] | e_kin | kinetic energy |
[in,out] | e_pot_int | integrated potential energy |
[in,out] | e_kin_int | integrated kinetic energy |
Definition at line 1205 of file sol_ops.f90.
integer function, public sol_ops::decompose_energy | ( | type(modes_type), intent(in) | mds_X, |
type(modes_type), intent(in) | mds_sol, | ||
type(grid_type), intent(in) | grid_eq, | ||
type(grid_type), intent(in) | grid_X, | ||
type(grid_type), intent(in) | grid_sol, | ||
type(eq_1_type), intent(in) | eq_1, | ||
type(eq_2_type), intent(in) | eq_2, | ||
type(x_1_type), intent(in) | X, | ||
type(sol_type), intent(in) | sol, | ||
type(vac_type), intent(in) | vac, | ||
integer, intent(in) | X_id, | ||
logical, intent(in) | B_aligned, | ||
real(dp), dimension(:,:,:,:), intent(in), optional | XYZ, | ||
complex(dp), dimension(7), intent(inout), optional | E_pot_int, | ||
complex(dp), dimension(2), intent(inout), optional | E_kin_int | ||
) |
Decomposes the plasma potential and kinetic energy in its individual terms for an individual Eigenvalue.
Use is made of variables representing the potential and kinetic energy [17].
The energy terms are calculated normally on the sol grid, interpolating the quantities defined on the eq grid, and angularly in the eq grid.
Optionally, the results can be plotted by providing X, Y and Z. By default, they are instead written to an output file.
Also, the fraction between potential and kinetic energy can be returned, compared with the eigenvalue.
[in] | mds_x | general modes variables in pertubation grid |
[in] | mds_sol | general modes variables in solution grid |
[in] | grid_eq | equilibrium grid |
[in] | grid_x | perturbation grid |
[in] | grid_sol | solution grid |
[in] | eq_1 | flux equilibrium |
[in] | eq_2 | metric equilibrium |
[in] | x | perturbation variables |
[in] | sol | solution variables |
[in] | vac | vacuum variables |
[in] | x_id | nr. of Eigenvalue |
[in] | b_aligned | whether grid is field-aligned |
[in] | xyz | X, Y and Z for plotting |
[in,out] | e_pot_int | integrated potential energy |
[in,out] | e_kin_int | integrated kinetic energy |
Definition at line 991 of file sol_ops.f90.
integer function, public sol_ops::plot_harmonics | ( | type(modes_type), intent(in) | mds, |
type(grid_type), intent(in) | grid_sol, | ||
type(sol_type), intent(in) | sol, | ||
integer, intent(in) | X_id, | ||
real(dp), dimension(:,:), intent(in) | res_surf | ||
) |
Plots the harmonics and their maximum in 2-D.
[in] | mds | general modes variables in solution grid |
[in] | grid_sol | solution grid |
[in] | sol | solution variables |
[in] | x_id | nr. of Eigenvalue (for output name) |
[in] | res_surf | resonant surfaces |
Definition at line 646 of file sol_ops.f90.
subroutine, public sol_ops::plot_sol_vals | ( | type(sol_type), intent(in) | sol, |
integer, intent(in) | last_unstable_id | ||
) |
Plots Eigenvalues.
[in] | sol | solution variables |
[in] | last_unstable_id | index of last unstable EV |
Definition at line 37 of file sol_ops.f90.
integer function, public sol_ops::plot_sol_vec | ( | type(modes_type), intent(in) | mds_X, |
type(modes_type), intent(in) | mds_sol, | ||
type(grid_type), intent(in) | grid_eq, | ||
type(grid_type), intent(in) | grid_X, | ||
type(grid_type), intent(in) | grid_sol, | ||
type(eq_1_type), intent(in) | eq_1, | ||
type(eq_2_type), intent(in) | eq_2, | ||
type(x_1_type), intent(in) | X, | ||
type(sol_type), intent(in) | sol, | ||
real(dp), dimension(:,:,:,:), intent(in) | XYZ, | ||
integer, intent(in) | X_id, | ||
logical, dimension(2), intent(in) | plot_var | ||
) |
Plots Eigenvectors.
This is done using the angular part of the the provided equilibrium grid and the normal part of the provided solution grid.
The perturbation grid is assumed to have the same angular coordinates as the equilibrium grid, and the normal coordinates correspond to either the equilibrium grid (X_grid_style
1), the solution grid (X_grid_style
2) or the enriched equilibrium grid (X_grid_style
3).
The output grid, furthermore, has the angular part corresponding to the equilibrium grid, and the normal part to the solution grid.
\[\begin{aligned} \vec{\xi} &\sim \frac{X_0}{R_0 B_0} \ , \\ \vec{Q} &\sim \frac{X_0}{R_0^2} \ , \\ \end{aligned}\]
which translates to
\[\begin{aligned} X &\sim X_0 \ , \\ U &\sim \frac{X_0}{R_0^2 B_0} \ , \\ Qn &\sim \frac{X_0 B_0}{R_0} \ , \\ Qg &\sim \frac{X_0}{R_0^3} \ , \end{aligned}\]
where \(X_0\) is not determined but is common to all factors.
[in] | mds_x | general modes variables in perturbation grid |
[in] | mds_sol | general modes variables in solution grid |
[in] | grid_eq | equilibrium grid |
[in] | grid_x | perturbation grid |
[in] | grid_sol | solution grid |
[in] | eq_1 | flux equilibrium |
[in] | eq_2 | metric equilibrium |
[in] | x | perturbation variables |
[in] | sol | solution variables |
[in] | xyz | X, Y and Z of extended eq_grid |
[in] | x_id | nr. of Eigenvalue (for output name) |
[in] | plot_var | whether variables are plotted (1: plasma perturbation, 2: magnetic perturbation) |
Definition at line 116 of file sol_ops.f90.
integer function, public sol_ops::print_output_sol | ( | type(grid_type), intent(in) | grid, |
type(sol_type), intent(in) | sol, | ||
character(len=*), intent(in) | data_name, | ||
integer, intent(in), optional | rich_lvl, | ||
logical, intent(in), optional | remove_previous_arrs | ||
) |
Print solution quantities to an output file:
val
vec
If rich_lvl
is provided, "_[R_rich_lvl]"
is appended to the data name if it is >0
.
[in] | grid | solution grid variables |
[in] | sol | solution variables |
[in] | data_name | name under which to store |
[in] | rich_lvl | Richardson level to print |
[in] | remove_previous_arrs | remove previous variables if present |
Definition at line 1566 of file sol_ops.f90.
logical, public sol_ops::debug_calc_e = .false. |
plot debug information for calc_E()
Definition at line 29 of file sol_ops.f90.
logical, public sol_ops::debug_du = .false. |
plot debug information for calculation of DU
Definition at line 31 of file sol_ops.f90.
logical, public sol_ops::debug_plot_sol_vec = .false. |
plot debug information for plot_sol_vec()
Definition at line 27 of file sol_ops.f90.
logical, public sol_ops::debug_x_norm = .false. |