charm_integ#

Module to compute the following integrals:

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

θ1θ2P¯n1,m1(cosθ)P¯n2,m2(cosθ)sin(θ)dθ,θ1θ2,

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

θ1θ2λ1λ2Y¯n1,m1(θ,λ)Y¯n2,m2(θ,λ)dλsin(θ)dθ,θ1θ2,λ1λ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

ip=θminθmaxP¯n1,m1(cosθ)P¯n2,m2(cosθ)sinθdθ,θminθ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

iy=θminθmaxλminλmaxY¯i1,n1,m1(θ,λ)Y¯i2,n2,m2(θ,λ)dλsin(θ)dθ,θminθmax,λminλmax,

where

Y¯i,n,m(θ,λ)={P¯nm(cosθ)cos(mλ)ifi=0,P¯nm(cosθ)sin(mλ)ifi=1.

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.