charm_integ#

Module to compute the following integrals:

  • a product of two fully-normalized associated Legendre functions and a sine of a co-latitude,

\[\int\limits_{\theta_1}^{\theta_2} \bar{P}_{n_1,m_1}(\cos\theta) \, \bar{P}_{n_2,m_2}(\cos\theta) \, \sin(\theta) \, \mathrm{d}\theta{,} \quad \theta_1 \leq \theta_2{,}\]

  • a product of two \(4 \pi\) fully-normalized surface spherical harmonic functions over a rectangular cell on the unit sphere,

\[\int\limits_{\theta_1}^{\theta_2} \int\limits_{\lambda_1}^{\lambda_2} \bar{Y}_{n_1,m_1}(\theta, \lambda) \, \bar{Y}_{n_2,m_2}(\theta, \lambda) \, \mathrm{d}\lambda \, \sin(\theta) \, \mathrm{d}\theta{,} \quad \theta_1 \leq \theta_2{,} \quad \lambda_1 \leq \lambda_2{.}\]

Note

This documentation is written for double precision version of CHarm.

Functions

double charm_integ_pn1m1pn2m2(double cltmin, double cltmax, unsigned long n1, unsigned long m1, unsigned long n2, unsigned long m2, const charm_pnmj *pnmj, charm_err *err)#

Analytically computes the integral.

\[\mathrm{ip} = \int\limits_{\theta_{\mathrm{min}}}^{\theta_{\mathrm{max}}} \bar{P}_{n_1, m_1}(\cos\theta) \, \bar{P}_{n_2, m_2}(\cos\theta) \, \sin\theta \, \mathrm{d}\theta{,} \quad \theta_{\mathrm{min}} \leq \theta_{\mathrm{max}}{.}\]

The computation is based on the Fourier coefficients of the associated Legendre functions (see Eq. 33 of Pail and Plank, 2001).

References:

  • Pail, R., Plank, G., Schuh, W.-D. (2001) Spatially restricted data distributions on the sphere: the method of orthonormalized functions and applications. Journal of Geodesy 75:44—56

Parameters:
  • cltmin[in] Minimum co-latitude in radians.

  • cltmax[in] Maximum co-latitude in radians.

  • n1[in] Harmonic degree of the first Legendre function.

  • m1[in] Harmonic order of the first Legendre function.

  • n2[in] Harmonic degree of the second Legendre function.

  • m2[in] Harmonic order of the second Legendre function.

  • pnmj[in] The charm_pnmj structure with the Fourier coefficients of associated Legendre functions at least up to degree CHARM_MAX(n1, n2). It is assumed that the structure is prepared beforehand by calling charm_leg_pnmj_coeffs().

  • err[out] Error reported by the function (if any).

Returns:

The value ip of the integral. In case of an error, returned is the nan value and the error is written to err.

double charm_integ_yi1n1m1yi2n2m2(double cltmin, double cltmax, double lonmin, double lonmax, _Bool i1, unsigned long n1, unsigned long m1, _Bool i2, unsigned long n2, unsigned long m2, const charm_pnmj *pnmj, charm_err *err)#

Analytically computes the integral.

\[\mathrm{iy} = \int\limits_{\theta_{\mathrm{min}}}^{\theta_{\mathrm{max}}} \int\limits_{\lambda_{\mathrm{min}}}^{\lambda_{\mathrm{max}}} \bar{Y}_{i_1,n_1,m_1}(\theta, \lambda) \, \bar{Y}_{i_2,n_2,m_2}(\theta, \lambda) \, \mathrm{d} \lambda \, \sin(\theta) \, \mathrm{d}\theta{,} \quad \theta_{\mathrm{min}} \leq \theta_{\mathrm{max}}{,} \quad \lambda_{\mathrm{min}} \leq \lambda_{\mathrm{max}}{,}\]

where

\[\begin{split}\bar{Y}_{i,n,m}(\theta, \lambda) = \begin{cases} \bar{P}_{nm}(\cos\theta) \, \cos(m \, \lambda) \quad &\textrm{if} \quad i = 0{,}\\ \bar{P}_{nm}(\cos\theta) \, \sin(m \, \lambda) \quad &\textrm{if} \quad i = 1{.} \end{cases}\end{split}\]

Parameters:
  • cltmin[in] Minimum co-latitude in radians.

  • cltmax[in] Maximum co-latitude in radians.

  • lonmin[in] Minimum longitude in radians.

  • lonmax[in] Maximum longitude in radians.

  • i1[in] 0 if the first spherical harmonic function is of the cos type; 1 for the sin type.

  • n1[in] Harmonic degree of the first spherical harmonic function.

  • m1[in] Harmonic order of the first spherical harmonic function.

  • i2[in] 0 if the second spherical harmonic function is of the cos type; 1 for the sin type.

  • n2[in] Harmonic degree of the second spherical harmonic function.

  • m2[in] Harmonic order of the second spherical harmonic function.

  • pnmj[in] The charm_pnmj structure with the Fourier coefficients of associated Legendre functions at least up to degree CHARM_MAX(n1, n2). It is assumed that the structure is prepared beforehand by calling charm_leg_pnmj_coeffs().

  • err[out] Error reported by the function (if any).

Returns:

The value iy of the integral. In case of an error, returned is the nan value and the error is written to err.