PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Modules | Functions/Subroutines | Variables
grid_ops.f90 File Reference

Go to the source code of this file.

Modules

module  grid_ops
 Operations that have to do with the grids and different coordinate systems.
 

Functions/Subroutines

integer function, public grid_ops::calc_norm_range (style, in_limits, eq_limits, X_limits, sol_limits, r_F_eq, r_F_X, r_F_sol, jq)
 Calculates normal range for the input grid, the equilibrium grid and/or the solution grid. More...
 
integer function calc_norm_range_pb3d_in (in_limits)
 PB3D input version. More...
 
subroutine calc_norm_range_pb3d_eq (eq_limits)
 PB3D equilibrium version. More...
 
integer function calc_norm_range_pb3d_x (eq_limits, X_limits, r_F_eq, r_F_X, jq)
 PB3D perturbation version. More...
 
integer function calc_norm_range_pb3d_sol (sol_limits, r_F_sol, n_procs)
 PB3D solution version. More...
 
subroutine calc_norm_range_post (eq_limits, X_limits, sol_limits, r_F_eq, r_F_X, r_F_sol)
 POST version. More...
 
integer function, public grid_ops::setup_grid_eq (grid_eq, eq_limits)
 Sets up the equilibrium grid. More...
 
integer function, public grid_ops::setup_grid_eq_b (grid_eq, grid_eq_B, eq, only_half_grid)
 Sets up the field-aligned equilibrium grid. More...
 
integer function, public grid_ops::setup_grid_x (grid_eq, grid_X, r_F_X, X_limits)
 Sets up the general perturbation grid, in which the perturbation variables are calculated. More...
 
integer function, public grid_ops::setup_grid_sol (grid_eq, grid_X, grid_sol, r_F_sol, sol_limits)
 Sets up the general solution grid, in which the solution variables are calculated. More...
 
integer function, public grid_ops::calc_ang_grid_eq_b (grid_eq, eq, only_half_grid)
 Calculate equilibrium grid that follows magnetic field lines. More...
 
integer function, public grid_ops::redistribute_output_grid (grid, grid_out, no_outer_trim)
 Redistribute a grid to match the normal distribution of solution grid. More...
 
integer function, public grid_ops::magn_grid_plot (grid)
 Plots the grid in real 3-D space. More...
 
integer function, public grid_ops::print_output_grid (grid, grid_name, data_name, rich_lvl, par_div, remove_previous_arrs)
 Print grid variables to an output file. More...
 

Variables

logical, public grid_ops::debug_calc_ang_grid_eq_b = .false.
 plot debug information for calc_ang_grid_eq_b() More...
 

Function/Subroutine Documentation

◆ calc_norm_range_pb3d_eq()

subroutine calc_norm_range::calc_norm_range_pb3d_eq ( integer, dimension(2), intent(inout)  eq_limits)

PB3D equilibrium version.

The normal range is calculated by dividing the full equilibrium range passed from the input phase between the processes.

Note
For X_style 2 (solution) or 3 (optimized), at the end of the equilibrium phase, there will be an exchange of data from each process to each process so that they all have the tightest possible fit of data of the corresponding perturbation limits.
Parameters
[in,out]eq_limitsmin. and max. index of eq. grid for this process

Definition at line 246 of file grid_ops.f90.

+ Here is the caller graph for this function:

◆ calc_norm_range_pb3d_in()

integer function calc_norm_range::calc_norm_range_pb3d_in ( integer, dimension(2), intent(inout)  in_limits)

PB3D input version.

The normal range is calculated by finding the tightest range of the input variables encompassing the entire solution range. Additionally, the global max_flux variables are set as well..

Note
This is the global, undivided range. The division information is calculated in 'eq_limits'. Furthermore, the input variables have to be tabulated on the full grid provided by the equilibrium code to be able to be used in PB3D and POST.
Parameters
[in,out]in_limitstotal min. and max. index of eq. grid for this process

Definition at line 137 of file grid_ops.f90.

+ Here is the caller graph for this function:

◆ calc_norm_range_pb3d_sol()

integer function calc_norm_range::calc_norm_range_pb3d_sol ( integer, dimension(2), intent(inout)  sol_limits,
real(dp), dimension(:), intent(inout)  r_F_sol,
integer, intent(in), optional  n_procs 
)

PB3D solution version.

The normal range is determined by simply dividing the solution range, a ghost range is required.

By default, this routine uses sol_n_procs processes, but this can be overruled.

Parameters
[in,out]sol_limitsmin. and max. index of sol grid for this process
[in,out]r_f_solsolution r_F
[in]n_procshow many processes used

Definition at line 388 of file grid_ops.f90.

+ Here is the caller graph for this function:

◆ calc_norm_range_pb3d_x()

integer function calc_norm_range::calc_norm_range_pb3d_x ( integer, dimension(2), intent(in)  eq_limits,
integer, dimension(2), intent(inout)  X_limits,
real(dp), dimension(:), intent(in)  r_F_eq,
real(dp), dimension(:), intent(inout), allocatable  r_F_X,
real(dp), dimension(:), intent(in)  jq 
)

PB3D perturbation version.

The normal range is determined according to X_grid style:

  1. taken identical to the equilibrium grid, which means that after the perturbation phase the integrated tensorial quantities have to be interpolated in interp_v() in driver_sol() after having been redistributed at the start of the solution driver.
  2. taken identical to the solution grid, which means that the the equilibrium quantities have to be interpolated in calc_u(), calc_kv() and calc_pv() after having been redistributed at the end of the equilibrium driver.
  3. by considering an optimal interpolation extension of the equilibrium range, adding intermediairy points between grid points where the safety factor changes too quickly, according to the variable 'max_njq_change'. This uses prim_X.
    Parameters
    [in]eq_limitsmin. and max. index of eq grid for this process
    [in,out]x_limitsmin. and max. index of X grid for this process
    [in]r_f_eqequilibrium r_F
    [in,out]r_f_xperturbation r_F
    [in]jqq_saf (pol. flux) or rot_t (tor. flux) in total Flux variables

Definition at line 285 of file grid_ops.f90.

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

◆ calc_norm_range_post()

subroutine calc_norm_range::calc_norm_range_post ( integer, dimension(2), intent(inout)  eq_limits,
integer, dimension(2), intent(inout)  X_limits,
integer, dimension(2), intent(inout)  sol_limits,
real(dp), dimension(:), intent(in)  r_F_eq,
real(dp), dimension(:), intent(in)  r_F_X,
real(dp), dimension(:), intent(in)  r_F_sol 
)

POST version.

The normal range is determined by simply dividing a possible subset of the solution range, indicated by min_r_plot and max_r_sol, including a ghost range and getting a bounding equilibrium and perturbation range.

Parameters
[in,out]eq_limitsmin. and max. index of eq grid for this process
[in,out]x_limitsmin. and max. index of X grid for this process
[in,out]sol_limitsmin. and max. index of sol grid for this process
[in]r_f_eqeq r_F
[in]r_f_xX r_F
[in]r_f_solsol r_F

Definition at line 453 of file grid_ops.f90.

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