PB3D [2.47]
Ideal linear high-n MHD stability in 3-D
Loading...
Searching...
No Matches
sol_ops Module Reference

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.
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.
integer function, public plot_harmonics (mds, grid_sol, sol, x_id, res_surf)
 Plots the harmonics and their maximum in 2-D.
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.
integer function, public print_output_sol (grid, sol, data_name, rich_lvl, remove_previous_arrs)
 Print solution quantities to an output file:

Variables

logical, public debug_plot_sol_vec = .false.
 plot debug information for plot_sol_vec()
logical, public debug_calc_e = .false.
 plot debug information for calc_E()
logical, public debug_x_norm = .false.
 plot debug information X_norm
logical, public debug_du = .false.
 plot debug information for calculation of DU

Detailed Description

Operations on the solution vectors such as decompososing the energy, etc...

Function/Subroutine Documentation

◆ decompose_energy()

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

  • \(E_\text{pot}\):
    • normal line bending term: \(\frac{1}{\mu_0} \frac{Q_n^2}{h^{22}}\),
    • geodesic line bending term: \(\frac{1}{\mu_0} \mathcal{J}^2 \frac{h^{22}}{g_{33}} Q_g^2\),
    • normal ballooning term: \(-2 p' X^2 \kappa_n\),
    • geodesic ballooning term: \(-2 p' X U^* \kappa_g\),
    • normal kink term: \(-\sigma X^*Q_g\),
    • geodesic kink term: \(\sigma U^*Q_n\),
  • \(E_\text{kin}\):
    • normal kinetic term: \(\rho \frac{X^2}{h^{22}}\),
    • geodesic kinetic term: \(\rho \mathcal{J}^2 \frac{h^{22}}{g_{33}} U^2\).

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.

Returns
ierr
Parameters
[in]mds_xgeneral modes variables in pertubation grid
[in]mds_solgeneral modes variables in solution grid
[in]grid_eqequilibrium grid
[in]grid_xperturbation grid
[in]grid_solsolution grid
[in]eq_1flux equilibrium
[in]eq_2metric equilibrium
[in]xperturbation variables
[in]solsolution variables
[in]vacvacuum variables
[in]x_idnr. of Eigenvalue
[in]b_alignedwhether grid is field-aligned
[in]xyzX, Y and Z for plotting
[in,out]e_pot_intintegrated potential energy
[in,out]e_kin_intintegrated kinetic energy

Definition at line 988 of file sol_ops.f90.

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

◆ plot_harmonics()

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.

Returns
ierr
Parameters
[in]mdsgeneral modes variables in solution grid
[in]grid_solsolution grid
[in]solsolution variables
[in]x_idnr. of Eigenvalue (for output name)
[in]res_surfresonant surfaces

Definition at line 645 of file sol_ops.f90.

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

◆ plot_sol_vals()

subroutine, public sol_ops::plot_sol_vals ( type(sol_type), intent(in) sol,
integer, intent(in) last_unstable_id )

Plots Eigenvalues.

Parameters
[in]solsolution variables
[in]last_unstable_idindex of last unstable EV

Definition at line 36 of file sol_ops.f90.

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

◆ plot_sol_vec()

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.

Note
The normalization factors are taken into account and the output is transformed back to unnormalized values:

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

Returns
ierr
Parameters
[in]mds_xgeneral modes variables in perturbation grid
[in]mds_solgeneral modes variables in solution grid
[in]grid_eqequilibrium grid
[in]grid_xperturbation grid
[in]grid_solsolution grid
[in]eq_1flux equilibrium
[in]eq_2metric equilibrium
[in]xperturbation variables
[in]solsolution variables
[in]xyzX, Y and Z of extended eq_grid
[in]x_idnr. of Eigenvalue (for output name)
[in]plot_varwhether variables are plotted (1: plasma perturbation, 2: magnetic perturbation)

Definition at line 114 of file sol_ops.f90.

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

◆ print_output_sol()

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:

  • sol:
    • val
    • vec

If rich_lvl is provided, "_[R_rich_lvl]" is appended to the data name if it is >0.

Returns
ierr
Parameters
[in]gridsolution grid variables
[in]solsolution variables
[in]data_namename under which to store
[in]rich_lvlRichardson level to print
[in]remove_previous_arrsremove previous variables if present

Definition at line 1564 of file sol_ops.f90.

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

Variable Documentation

◆ debug_calc_e

logical, public sol_ops::debug_calc_e = .false.

plot debug information for calc_E()

Note
Debug version only

Definition at line 29 of file sol_ops.f90.

◆ debug_du

logical, public sol_ops::debug_du = .false.

plot debug information for calculation of DU

Note
Debug version only

Definition at line 31 of file sol_ops.f90.

◆ debug_plot_sol_vec

logical, public sol_ops::debug_plot_sol_vec = .false.

plot debug information for plot_sol_vec()

Note
Debug version only

Definition at line 27 of file sol_ops.f90.

◆ debug_x_norm

logical, public sol_ops::debug_x_norm = .false.

plot debug information X_norm

Note
Debug version only

Definition at line 30 of file sol_ops.f90.