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

Numerical utilities related to the vacuum response. More...

Functions/Subroutines

subroutine, public calc_gh_int_1 (G, H, x_s, x_in, norm_s, h_fac_in, step_size, tol)
 Calculate G_ij and H_ij on an interval for field line aligned configurations. More...
 
subroutine, public calc_gh_int_2 (G, H, t_s, t_in, x_s, x_in, norm_s, norm_in, Aij, ql, tol, b_coeff, n_tor)
 Calculate G_ij and H_ij on an interval for axisymmetric configurations. More...
 
integer function, public vec_dis2loc (ctxt, vec_dis, lims, vec_loc, proc)
 Gathers a distributed vector on a single process. More...
 
integer function, public mat_dis2loc (ctxt, mat_dis, lims_r, lims_c, mat_loc, proc)
 Gathers a distributed vector on a single process. More...
 
integer function, public interlaced_vac_copy (vac_old, vac)
 Copies vacuum variables of a previous level into the appropriate, interlaced place of a next level. More...
 

Detailed Description

Numerical utilities related to the vacuum response.

See also
vac_ops for information.

Function/Subroutine Documentation

◆ calc_gh_int_1()

subroutine, public vac_utilities::calc_gh_int_1 ( real(dp), dimension(2), intent(inout)  G,
real(dp), dimension(2), intent(inout)  H,
real(dp), dimension(2,3), intent(in)  x_s,
real(dp), dimension(3), intent(in)  x_in,
real(dp), dimension(2,3), intent(in)  norm_s,
real(dp), dimension(4), intent(in)  h_fac_in,
real(dp), dimension(2), intent(in)  step_size,
real(dp), intent(in)  tol 
)

Calculate G_ij and H_ij on an interval for field line aligned configurations.

The indices for the source variables are [left:right,dim] where dim is the Cartesian dimension. The same holds for ql.

For subintegrals close to the singularity, the procedure uses the analytical approximation.

Note
This routine does not calculate the contribution \(2\beta\).
Parameters
[in]x_sposition vector at left and right limit of source interval
[in]x_inposition vector at which to calculate influence
[in]norm_snormal vector at left and right limit of source interval
[in]h_fac_inmetric factors at which to calculate influence
[in]step_sizestep sizes in parallel direction and alpha
[in]toltolerance on distance between points

Definition at line 33 of file vac_utilities.f90.

+ Here is the caller graph for this function:

◆ calc_gh_int_2()

subroutine, public vac_utilities::calc_gh_int_2 ( real(dp), dimension(2), intent(inout)  G,
real(dp), dimension(2), intent(inout)  H,
real(dp), dimension(2), intent(in)  t_s,
real(dp), intent(in)  t_in,
real(dp), dimension(2,2), intent(in)  x_s,
real(dp), dimension(2), intent(in)  x_in,
real(dp), dimension(2,2), intent(in)  norm_s,
real(dp), dimension(2), intent(in)  norm_in,
real(dp), dimension(2), intent(in)  Aij,
real(dp), dimension(2,2), intent(in)  ql,
real(dp), intent(in)  tol,
real(dp), dimension(2), intent(in)  b_coeff,
integer, intent(in)  n_tor 
)

Calculate G_ij and H_ij on an interval for axisymmetric configurations.

The indices for the source variables are [left:right,dim] where dim is the Cartesian dimension. The same holds for ql.

For subintegrals close to the singularity (i.e. where the tolerance is no being met), the routine approximates the toroidal functions with the analytical approximation. If one of the boundaries of the subintegral is far enough from the singularity, there is an additional contribution due to the difference between the actual toroidal function and the approximation. This contribution is zero if both boundaries are close, because in this case it is assumed that the entire integral is given by the analytical approximation.

Note
This routine does not calculate the contribution \(2\beta\).
Parameters
[in]t_spol. angle at left and right limit of source interval
[in]t_inpol. angle at which to calculate influence
[in]x_sposition vector at left and right limit of source interval
[in]x_inposition vector at which to calculate influence
[in]norm_snormal vector at left and right limit of source interval
[in]norm_innormal vector at which to calculate influence
[in]aijAij helper variable for H
[in]qlql for n-1 and n at left and right limit of source interval
[in]toltolerance on rho2
[in]b_coeff\(b = \sum_{k=1}^n \frac{2}{2k-1}\) for n and n-1
[in]n_tortoroidal mode number

Definition at line 99 of file vac_utilities.f90.

+ Here is the caller graph for this function:

◆ interlaced_vac_copy()

integer function, public vac_utilities::interlaced_vac_copy ( type(vac_type), intent(in)  vac_old,
type(vac_type), intent(inout)  vac 
)

Copies vacuum variables of a previous level into the appropriate, interlaced place of a next level.

This is done by multiplying left by \(\overline{\text{T}}\) and right by \(\overline{\text{T}}^T\) with

\[ a_{ij} = \left\{\begin{aligned} 1 \quad &\text{for} \left(i,j\right) = \left(2j-1+(i-1)n_\text{old},j+(i-1)n_\text{old}\right) \\ 0 \quad &\text{otherwise} \end{aligned}\right. \]

where \(i\) ranges from \(1\) to \(n_\text{old}\) and \(j\) from \(1\) to \(m_\text{old}\), with the size of \(\overline{\text{T}}\) equal to \(n_\text{new} \times n_\text{old} \) where \(n\) refers to n_bnd(1) and \(m\) to n_bnd(2).

Parameters
[in]vac_oldold vacuum
[in,out]vacvacuum

Definition at line 355 of file vac_utilities.f90.

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

◆ mat_dis2loc()

integer function, public vac_utilities::mat_dis2loc ( integer, intent(in)  ctxt,
real(dp), dimension(:,:), intent(in)  mat_dis,
integer, dimension(:,:), intent(in)  lims_r,
integer, dimension(:,:), intent(in)  lims_c,
real(dp), dimension(:,:), intent(inout)  mat_loc,
integer, intent(in), optional  proc 
)

Gathers a distributed vector on a single process.

See also
See vec_dis2loc() for exaplanation.
Parameters
[in]ctxtcontext for matrix
[in]mat_disdistributed matrix
[in]lims_rlimits for different subrows
[in]lims_climits for different subcolumns
[in,out]mat_loclocal matrix
[in]procwhich process receives result

Definition at line 277 of file vac_utilities.f90.

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

◆ vec_dis2loc()

integer function, public vac_utilities::vec_dis2loc ( integer, intent(in)  ctxt,
real(dp), dimension(:), intent(in)  vec_dis,
integer, dimension(:,:), intent(in)  lims,
real(dp), dimension(:), intent(inout)  vec_loc,
integer, intent(in), optional  proc 
)

Gathers a distributed vector on a single process.

For the distributed vector, the limits of the different subrows need to be provided, as discussed in init_vac().

By default, the result lands on the master process, but this can be changed using proc. If it is negative, all processes receive the result. In any case, vec_loc will be utilized.

Note
vec_loc needs to be allocated to the total dimensions, even when the results is not received by the process.
Parameters
[in]ctxtcontext for vector
[in]vec_disdistributed vector
[in]limslimits for different subrows
[in,out]vec_loclocal vector
[in]procwhich process receives result

Definition at line 223 of file vac_utilities.f90.

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