PB3D
[2.45]
Ideal linear high-n MHD stability in 3-D
|
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... | |
Numerical utilities related to the vacuum response.
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.
[in] | x_s | position vector at left and right limit of source interval |
[in] | x_in | position vector at which to calculate influence |
[in] | norm_s | normal vector at left and right limit of source interval |
[in] | h_fac_in | metric factors at which to calculate influence |
[in] | step_size | step sizes in parallel direction and alpha |
[in] | tol | tolerance on distance between points |
Definition at line 33 of file vac_utilities.f90.
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.
[in] | t_s | pol. angle at left and right limit of source interval |
[in] | t_in | pol. angle at which to calculate influence |
[in] | x_s | position vector at left and right limit of source interval |
[in] | x_in | position vector at which to calculate influence |
[in] | norm_s | normal vector at left and right limit of source interval |
[in] | norm_in | normal vector at which to calculate influence |
[in] | aij | Aij helper variable for H |
[in] | ql | ql for n-1 and n at left and right limit of source interval |
[in] | tol | tolerance on rho2 |
[in] | b_coeff | \(b = \sum_{k=1}^n \frac{2}{2k-1}\) for n and n-1 |
[in] | n_tor | toroidal mode number |
Definition at line 99 of file vac_utilities.f90.
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)
.
[in] | vac_old | old vacuum |
[in,out] | vac | vacuum |
Definition at line 355 of file vac_utilities.f90.
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.
[in] | ctxt | context for matrix |
[in] | mat_dis | distributed matrix |
[in] | lims_r | limits for different subrows |
[in] | lims_c | limits for different subcolumns |
[in,out] | mat_loc | local matrix |
[in] | proc | which process receives result |
Definition at line 277 of file vac_utilities.f90.
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.
vec_loc
needs to be allocated to the total dimensions, even when the results is not received by the process. [in] | ctxt | context for vector |
[in] | vec_dis | distributed vector |
[in] | lims | limits for different subrows |
[in,out] | vec_loc | local vector |
[in] | proc | which process receives result |
Definition at line 223 of file vac_utilities.f90.