PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Functions/Subroutines | Variables
slepc_ops Module Reference

Operations that use SLEPC (and PETSC) routines. More...

Functions/Subroutines

integer function, public solve_ev_system_slepc (mds, grid_sol, X, vac, sol)
 Solve the eigenvalue system using SLEPC. More...
 
integer function, public start_slepc (n_r_sol)
 This subroutine starts PETSC and SLEPC with the correct number of processors. More...
 
integer function, public setup_mats (mds, grid_sol, X, A, B)
 Sets up the matrices \(\overline{\text{A}}\) and \(\overline{\text{B}}\) in the EV problem \( \overline{\text{A}} \vec{X} = \lambda \overline{\text{B}} \vec{X}. \). More...
 
integer function, public set_bc (mds, grid_sol, X, vac, A, B)
 Sets the boundary conditions deep in the plasma (1) and at the edge (2). More...
 
integer function, public setup_solver (X, A, B, solver)
 Sets up EV solver. More...
 
integer function, public setup_guess (sol, A, solver)
 Sets up guess in solver. More...
 
integer function, public get_solution (solver)
 Get the solution vectors. More...
 
integer function, public summarize_solution (solver, max_n_EV)
 Summarizes solution. More...
 
integer function, public store_results (mds, grid_sol, sol, solver, max_n_EV, A, B)
 Stores the results. More...
 
integer function, public stop_slepc (A, B, solver)
 Stop PETSC and SLEPC. More...
 

Variables

logical, public debug_setup_mats = .false.
 plot debug information for setup_mats More...
 
logical, public debug_set_bc = .false.
 plot debug information for set_BC More...
 
logical, public test_diff = .false.
 test introduction of numerical diff More...
 

Detailed Description

Operations that use SLEPC (and PETSC) routines.

Note
The routines here require a TRIMMED solution grid!
See also
References: [7]

Function/Subroutine Documentation

◆ get_solution()

integer function, public slepc_ops::get_solution ( intent(inout)  solver)

Get the solution vectors.

Returns
ierr

Definition at line 1534 of file SLEPC_ops.f90.

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

◆ set_bc()

integer function, public slepc_ops::set_bc ( type(modes_type), intent(in)  mds,
type(grid_type), intent(in)  grid_sol,
type(x_2_type), intent(in)  X,
type(vac_type), intent(in)  vac,
intent(inout)  A,
intent(inout)  B 
)

Sets the boundary conditions deep in the plasma (1) and at the edge (2).

Through norm_disc_style_sol it can be chosen whether the finite differences are:

  1. central finite differences
  2. left finite differences

Possibilities for BC_style:

  1. Set to zero:
    • An artificial Eigenvalue EV_BC is introduced by setting the diagonal components of A to EV_BC and of B to 1, and the off-diagonal elements to zero.
  2. Minimization of surface energy through asymmetric fin. differences:
    • For symmetric finite differences, the last ndps grid points are treated asymmetrically in order not go over the edge and the vacuum term is added to the edge element.
    • For left differences, this is already standard, so the method becomes identical to 2.
  3. Minimization of surface energy through extension of grid:
    • For symmetric finite differences, ndps extra grid points are introduced after the edge and the vacuum term is added to the edge element.
    • For left finite differences, the vacuum term is just added to the edge element, so this method becomes idential to 3.
  4. Explicit introduction of the surface energy minimization:
    • The equation due to the minimization of the vacuum term is introduced explicitely as an asymmetric finite difference equation in the last row. -This is done using left finite differences.

Makes use of n_r.

Returns
ierr
Parameters
[in]mdsgeneral modes variables
[in]grid_solsolution grid
[in]xfield-averaged perturbation variables (so only first index)
[in]vacvacuum variables

Definition at line 933 of file SLEPC_ops.f90.

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

◆ setup_guess()

integer function, public slepc_ops::setup_guess ( type(sol_type), intent(in)  sol,
intent(in)  A,
intent(inout)  solver 
)

Sets up guess in solver.

Returns
ierr
Parameters
[in]solsolution variables

Definition at line 1453 of file SLEPC_ops.f90.

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

◆ setup_mats()

integer function, public slepc_ops::setup_mats ( type(modes_type), intent(in)  mds,
type(grid_type), intent(in)  grid_sol,
type(x_2_type), intent(in), target  X,
intent(inout)  A,
intent(inout)  B 
)

Sets up the matrices \(\overline{\text{A}}\) and \(\overline{\text{B}}\) in the EV problem \( \overline{\text{A}} \vec{X} = \lambda \overline{\text{B}} \vec{X}. \).

The matrices are set up in the solution grid, so some processes might not have any part in the storage thereof (if sol_n_procs < n_procs), but each process sets up the part of the grid that corresponds to their own normal range in the solution grid.

Returns
ierr
Parameters
[in]mdsgeneral modes variables
[in]grid_solsolution grid
[in]xfield-averaged perturbation variables (so only first index)

Definition at line 409 of file SLEPC_ops.f90.

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

◆ setup_solver()

integer function, public slepc_ops::setup_solver ( type(x_2_type), intent(in)  X,
intent(in)  A,
intent(in)  B,
intent(inout)  solver 
)

Sets up EV solver.

Returns
ierr
Parameters
[in]xfield-averaged perturbation variables (so only first index)

Definition at line 1326 of file SLEPC_ops.f90.

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

◆ solve_ev_system_slepc()

integer function, public slepc_ops::solve_ev_system_slepc ( type(modes_type), intent(in)  mds,
type(grid_type), intent(in)  grid_sol,
type(x_2_type), intent(in)  X,
type(vac_type), intent(in)  vac,
type(sol_type), intent(inout)  sol 
)

Solve the eigenvalue system using SLEPC.

This subroutine sets up the matrices A ad B of the generalized EV system described in [16] and solves them using the SLEPC suite. The solutions closest to a target indicated by EV_guess are obtained.

See also
read_input_opts()
Returns
ierr
Parameters
[in]mdsgeneral modes variables
[in]grid_solsolution grid
[in]xfield-averaged perturbation variables (so only first index)
[in]vacvacuum variables
[in,out]solsolution variables

Definition at line 62 of file SLEPC_ops.f90.

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

◆ start_slepc()

integer function, public slepc_ops::start_slepc ( integer, intent(in)  n_r_sol)

This subroutine starts PETSC and SLEPC with the correct number of processors.

Returns
ierr
Parameters
[in]n_r_solnr. of normal points in solution grid

Definition at line 333 of file SLEPC_ops.f90.

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

◆ stop_slepc()

integer function, public slepc_ops::stop_slepc ( intent(in)  A,
intent(in)  B,
intent(in)  solver 
)

Stop PETSC and SLEPC.

Returns
ierr

Definition at line 2054 of file SLEPC_ops.f90.

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

◆ store_results()

integer function, public slepc_ops::store_results ( type(modes_type), intent(in)  mds,
type(grid_type), intent(in)  grid_sol,
type(sol_type), intent(inout)  sol,
intent(inout)  solver,
intent(inout)  max_n_EV,
intent(inout)  A,
intent(inout)  B 
)

Stores the results.

Returns
ierr
Parameters
[in]mdsgeneral modes variables
[in]grid_solsolution grid
[in,out]solsolution variables

Definition at line 1634 of file SLEPC_ops.f90.

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

◆ summarize_solution()

integer function, public slepc_ops::summarize_solution ( intent(inout)  solver,
intent(inout)  max_n_EV 
)

Summarizes solution.

Returns
ierr

Definition at line 1564 of file SLEPC_ops.f90.

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

Variable Documentation

◆ debug_set_bc

logical, public slepc_ops::debug_set_bc = .false.

plot debug information for set_BC

Note
Debug version only

Definition at line 46 of file SLEPC_ops.f90.

◆ debug_setup_mats

logical, public slepc_ops::debug_setup_mats = .false.

plot debug information for setup_mats

Note
Debug version only

Definition at line 45 of file SLEPC_ops.f90.

◆ test_diff

logical, public slepc_ops::test_diff = .false.

test introduction of numerical diff

Note
Debug version only

Definition at line 47 of file SLEPC_ops.f90.