NESSie.TestModel

Utility functions

NESSie.TestModel.coefficientsFunction
function coefficients(
    model::XieModel{T},
    len  ::Int
)

Computes the coefficients $A_{in}$ with $i=1, 2, 3$ for the given XieModel and the desired number of terms.

Return type

Tuple{ Array{T, 2}, Array{T, 2}, Array{T, 2} }

source
NESSie.TestModel.legendreFunction
legendre(
    maxn::Int,
    x   ::T
)

Precomputes the Legendre polynomials $Pₙ(x)$ for $n = 0, 1, ..., \texttt{maxn}-1$ and returns a generic function to access the values.

Return type

(generic function)

(n::Int) -> Pₙ(x)   # return type: T

Example

julia> p = legendre(3, 0.5);

julia> [p(n) for n in 0:2]    # [P₀(0.5), P₁(0.5), P₂(0.5)]
3-element Vector{Float64}:
  1.0
  0.5
 -0.125
source
NESSie.TestModel.scalemodelFunction
function scalemodel(
    charges::Vector{Charge{T}},
    radius ::T;
    # kwargs
    compat ::Bool              = false
)

Translates and rescales the given point charge model to fit inside an origin-centered sphere with the specified radius. More specifically, the function will center the given model at the origin and scaled in a way such that the outermost point charge will be located at 80% radius distance from the origin.

Arguments

  • compat Enables compatibility mode and scales the model exactly like the reference implementation ([Xie16]). Use this flag if you intend to compare the results to the reference.

Return type

Vector{Charge{T}}

source
NESSie.TestModel.spherical_besseliFunction
spherical_besseli(
    maxn::Int,
    r   ::T
)

Precomputes the modified spherical Bessel function of the first kind $iₙ(r)$ for $n=-1, 0, ..., \texttt{maxn}$ and returns a generic function to access the values. $iₙ(r)$ is defined as

\[iₙ(r) = \sqrt{\frac{π}{2r}} I_{n+0.5}(r),\]

where $I_ν$ is the modified Bessel function of the first kind [Xie16].

Return type

(generic function)

(n::Int) -> iₙ(r)   # return type: T
source
NESSie.TestModel.spherical_besselkFunction
spherical_besselk(
    maxn::Int,
    r   ::T
)

Precomputes the modified spherical Bessel function of the second kind $kₙ(r)$ for $n=-1, 0, ..., \texttt{maxn}$ and returns a generic function to access the values. $kₙ(r)$ is defined as

\[kₙ(r) = \sqrt{\frac{π}{2r}} K_{n+0.5}(r),\]

where $K_ν$ is the modified Bessel function of the second kind [Xie16].

Return type

(generic function)

(n::Int) -> kₙ(r)   # return type: T
source