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

Calculation of toroidal functions \(P_{n-1/2}^m \left(z\right)\) and \(Q_{n-1/2}^m \left(z\right)\). More...

Functions/Subroutines

integer function, public dtorh1 (z, m, nmax, pl, ql, newn, mode, ipre)
 Calculates toroidal harmonics of a fixed order m and degrees up to nmax. More...
 

Detailed Description

Calculation of toroidal functions \(P_{n-1/2}^m \left(z\right)\) and \(Q_{n-1/2}^m \left(z\right)\).

Note
Copied and adapted from the DTORH1 routine by Segura and Gil [14] .

Function/Subroutine Documentation

◆ dtorh1()

integer function, public dtorh::dtorh1 ( real(dp), intent(in)  z,
integer, intent(in)  m,
integer, intent(in)  nmax,
real(dp), dimension(0:nmax), intent(inout)  pl,
real(dp), dimension(0:nmax), intent(inout)  ql,
integer, intent(inout)  newn,
integer, intent(in), optional  mode,
integer, intent(in), optional  ipre 
)

Calculates toroidal harmonics of a fixed order m and degrees up to nmax.

Optionally, the mode can be specified to be different from 0 [default]

  • if mode=1:
    • The set of functions evaluated is:

      \[\frac{P_{n-1/2}^m \left(z\right)}{\Gamma(m+1/2)} \ ,\quad \frac{Q_{n-1/2}^m \left(z\right)}{\Gamma(m+1/2)},\]

      which are respectively stored in the arrays pl(n), ql(n).
    • newn refers to this new set of functions.
    • Note 1. and note 2. also apply in this case.
  • if mode=2:
    • The code performs as for mode 1, but the restriction \( z<20 \).
    • For the evaluation of the continued fraction is not considered.

Also, the parameter ipre can be used to select a different precision:

  • For ipre=1, the precision is \(10^{-12}\), taking \(\epsilon<10^{-12}\)
  • For ipre=2, the precision is \(10^{-8}\), taking \(\epsilon<10^{-8}\)

where \(\epsilon\) controls the accuracy.

Warning
Use mode 2 only if high m 's for \(z>20\) are required. The evaluation of the cf may fail to converge for too high z 's.
Note
  1. For a precision of \(10^{-12}\), if \(z>5\) and \(z/m>0.22\), the code uses a series expansion for pl(0).
    When \(z<20\) and \(z/m<0.22\) a continued fraction is applied.
  2. For a precision of \(10^{-8}\), if \(z>5\) and \(z/m>0.12\), the code uses a series expansion for pl(0).
    When \(z<20\) and \(z/m<0.12\) a continued fraction is applied.
Returns
ierr
Parameters
[in]z(real) point at which toroidal harmonics are evaluated
[in]morder of toroidal harmonics (m>0)
[in]nmaxmaximum degree of toroidal harmonics (nmax>0)
[in,out]pltoroidal harmonics of first kind \(P_{n-1/2}^m\left(z\right)\)
[in,out]qltoroidal harmonics of second kind \(Q_{n-1/2}^m\left(z\right)\)
[in,out]newnmaximum order of functions calculated when pl(nmax+1)>1/tiny with tiny= \(10^{-290}\)
[in]modemode that controls output
[in]ipreprecision

Definition at line 75 of file dtorh.f90.

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