Práce na vswf ; jdu domů
Former-commit-id: 112c65dcb0de85908b43cd488c63ac14072dc97e
This commit is contained in:
parent
f6118d6ed9
commit
3312bc61e2
|
@ -915,7 +915,69 @@ reference "eq:2d long range regularisation problem statement"
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
might lead to satisfactory results; see below.
|
might lead to satisfactory results; see below.
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Standard
|
||||||
|
\begin_inset Note Note
|
||||||
|
status open
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
In natural/dimensionless units;
|
||||||
|
\begin_inset Formula $x=k_{0}r$
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
,
|
||||||
|
\begin_inset Formula $\tilde{k}=k/k_{0}$
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
,
|
||||||
|
\begin_inset Formula $č=c/k_{0}$
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\begin_inset Formula
|
||||||
|
\[
|
||||||
|
s_{q}(x)\equiv e^{ix}x^{-q}
|
||||||
|
\]
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\begin_inset Formula
|
||||||
|
\[
|
||||||
|
\tilde{\rho}_{\kappa,č}(x)\equiv\left(1-e^{-čx}\right)^{\text{\kappa}}=\left(1-e^{-\frac{c}{k_{0}}k_{0}r}\right)^{\kappa}=\left(1-e^{-cr}\right)^{\kappa}=\rho_{\kappa,c}(r)
|
||||||
|
\]
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\begin_inset Formula
|
||||||
|
\[
|
||||||
|
s_{q}^{\textup{L}}\left(x\right)\equiv s_{q}(x)\tilde{\rho}_{\kappa,č}(x)=e^{ix}x^{-q}\left(1-e^{-čx}\right)^{\text{\kappa}}
|
||||||
|
\]
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\begin_inset Formula
|
||||||
|
\begin{eqnarray*}
|
||||||
|
\pht n{s_{q}^{\textup{L}}}\left(\tilde{k}\right) & = & \int_{0}^{\infty}s_{q}^{\textup{L}}\left(x\right)xJ_{n}\left(\tilde{k}x\right)\ud x=\int_{0}^{\infty}s_{q}\left(x\right)\tilde{\rho}_{\kappa,č}(x)xJ_{n}\left(\tilde{k}x\right)\ud x\\
|
||||||
|
& = & \int_{0}^{\infty}s_{k_{0},q}\left(r\right)\rho_{\kappa,c}(r)\left(k_{0}r\right)J_{n}\left(kr\right)\ud\left(k_{0}r\right)\\
|
||||||
|
& = & k_{0}^{2}\int_{0}^{\infty}s_{k_{0},q}\left(r\right)\rho_{\kappa,c}(r)rJ_{n}\left(kr\right)\ud r\\
|
||||||
|
& = & k_{0}^{2}\pht n{s_{k_{0},q}^{\textup{L}}}\left(k\right)
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Standard
|
||||||
\begin_inset Note Note
|
\begin_inset Note Note
|
||||||
status open
|
status open
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ typedef enum {
|
||||||
|
|
||||||
// Normalisations
|
// Normalisations
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
// As in TODO
|
||||||
QPMS_NORMALIZATION_XU = 3, // NI!
|
QPMS_NORMALIZATION_XU = 3, // NI!
|
||||||
|
// As in http://www.eit.lth.se/fileadmin/eit/courses/eit080f/Literature/book.pdf, power-normalised
|
||||||
QPMS_NORMALIZATION_KRISTENSSON = 2, // NI!
|
QPMS_NORMALIZATION_KRISTENSSON = 2, // NI!
|
||||||
QPMS_NORMALIZATION_POWER = QPMS_NORMALIZATION_KRISTENSSON, // NI!
|
QPMS_NORMALIZATION_POWER = QPMS_NORMALIZATION_KRISTENSSON, // NI!
|
||||||
QPMS_NORMALIZATION_TAYLOR = 1,
|
QPMS_NORMALIZATION_TAYLOR = 1,
|
||||||
|
|
18
qpms/vswf.c
18
qpms/vswf.c
|
@ -2,7 +2,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
// Legendre functions also for negative m, see DLMF 14.9.3
|
// Legendre functions also for negative m, see DLMF 14.9.3
|
||||||
qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, double x, qpms_l_t lMax,
|
int qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, double x, qpms_l_t lMax,
|
||||||
gsl_sf_legendre_t lnorm, double csphase)
|
gsl_sf_legendre_t lnorm, double csphase)
|
||||||
{
|
{
|
||||||
size_t n = gsl_sf_legenre_array_n(lMax);
|
size_t n = gsl_sf_legenre_array_n(lMax);
|
||||||
|
@ -12,7 +12,7 @@ qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, do
|
||||||
lnorm, (size_t)lMax, x, csphase, legendre_tmp,legendre_tmp_deriv);
|
lnorm, (size_t)lMax, x, csphase, legendre_tmp,legendre_tmp_deriv);
|
||||||
for (qpms_l_t l = 0; l <= lMax; ++l)
|
for (qpms_l_t l = 0; l <= lMax; ++l)
|
||||||
for (qpms_m_t m = 0; m <= l; ++m) {
|
for (qpms_m_t m = 0; m <= l; ++m) {
|
||||||
qpms_y_t y = gpms_mn2y(m,l);
|
qpms_y_t y = qpms_mn2y(m,l);
|
||||||
size_t i = gsl_sf_legenre_array_index(l,m);
|
size_t i = gsl_sf_legenre_array_index(l,m);
|
||||||
target[y] = legendre_tmp[i];
|
target[y] = legendre_tmp[i];
|
||||||
target_deriv[y] = legendre_deriv_tmp[i];
|
target_deriv[y] = legendre_deriv_tmp[i];
|
||||||
|
@ -21,7 +21,7 @@ qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, do
|
||||||
case GSL_SF_LEGEDRE_NONE:
|
case GSL_SF_LEGEDRE_NONE:
|
||||||
for (qpms_l_t l = 0; l <= lMax; ++l)
|
for (qpms_l_t l = 0; l <= lMax; ++l)
|
||||||
for (qpms_m_t m = 1; m <= l; ++m) {
|
for (qpms_m_t m = 1; m <= l; ++m) {
|
||||||
qpms_y_t y = gpms_mn2y(-m,l);
|
qpms_y_t y = qpms_mn2y(-m,l);
|
||||||
size_t i = gsl_sf_legenre_array_index(l,m);
|
size_t i = gsl_sf_legenre_array_index(l,m);
|
||||||
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
||||||
double factor = exp(lgamma(l-m+1)-lgamma(n+m+1))*((m%2)?-1:1);
|
double factor = exp(lgamma(l-m+1)-lgamma(n+m+1))*((m%2)?-1:1);
|
||||||
|
@ -34,7 +34,7 @@ qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, do
|
||||||
case GSL_SF_LEGENDRE_FULL:
|
case GSL_SF_LEGENDRE_FULL:
|
||||||
for (qpms_l_t l = 0; l <= lMax; ++l)
|
for (qpms_l_t l = 0; l <= lMax; ++l)
|
||||||
for (qpms_m_t m = 1; m <= l; ++m) {
|
for (qpms_m_t m = 1; m <= l; ++m) {
|
||||||
qpms_y_t y = gpms_mn2y(-m,l);
|
qpms_y_t y = qpms_mn2y(-m,l);
|
||||||
size_t i = gsl_sf_legenre_array_index(l,m);
|
size_t i = gsl_sf_legenre_array_index(l,m);
|
||||||
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
||||||
double factor = ((m%2)?-1:1); // this is the difference from the unnormalised case
|
double factor = ((m%2)?-1:1); // this is the difference from the unnormalised case
|
||||||
|
@ -51,13 +51,13 @@ qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, do
|
||||||
return QPMS_SUCCESS;
|
return QPMS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME ZAPOMNĚL JSEM NA POLE DERIVACÍ (TÉŽ HLAVIČKOVÝ SOUBOR)
|
int qpms_legendre_deriv_y_get(double **target, double **dtarget, double x, qpms_l_t lMax, gsl_sf_legendre_t lnorm,
|
||||||
double *qpms_legendre_deriv_y_get(double x, qpms_l_t lMax, gsle_sf_legendre_t lnorm,
|
|
||||||
double csphase)
|
double csphase)
|
||||||
{
|
{
|
||||||
double *ar = malloc(sizeof(double)*qpms_lMaxnelem(lMax));
|
|
||||||
if (qpms_legendre_deriv_y_fill(ar, x, lMax, lnorm, csphase))
|
*target = malloc(sizeof(double)*qpms_lMax2nelem(lMax));
|
||||||
abort();
|
*dtarget = malloc(sizeof(double)*qpms_lMax2nelem(lMax));
|
||||||
|
return qpms_legendre_deriv_y_fill(ar, x, lMax, lnorm, csphase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
14
qpms/vswf.h
14
qpms/vswf.h
|
@ -4,10 +4,10 @@
|
||||||
#include <gsl/gsl_sf_legendre.h>
|
#include <gsl/gsl_sf_legendre.h>
|
||||||
|
|
||||||
// Electric wave N; NI
|
// Electric wave N; NI
|
||||||
complex double qpms_vswf_single_el(int m, int n, sph_t kdlj,
|
csphvec_t qpms_vswf_single_el(int m, int n, sph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalization_t norm);
|
qpms_bessel_t btyp, qpms_normalization_t norm);
|
||||||
// Magnetic wave M; NI
|
// Magnetic wave M; NI
|
||||||
complex double qpms_vswf_single_mg(int m, int n, sph_t kdlj,
|
csphvec_t qpms_vswf_single_mg(int m, int n, sph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalization_t norm);
|
qpms_bessel_t btyp, qpms_normalization_t norm);
|
||||||
|
|
||||||
// Set of electric and magnetic VSWF in spherical coordinate basis
|
// Set of electric and magnetic VSWF in spherical coordinate basis
|
||||||
|
@ -24,12 +24,12 @@ typedef struct {
|
||||||
* N.B. for the norm definitions, see
|
* N.B. for the norm definitions, see
|
||||||
* https://www.gnu.org/software/gsl/manual/html_node/Associated-Legendre-Polynomials-and-Spherical-Harmonics.html
|
* https://www.gnu.org/software/gsl/manual/html_node/Associated-Legendre-Polynomials-and-Spherical-Harmonics.html
|
||||||
* ( gsl/specfunc/legendre_source.c and 7.24.2 of gsl docs
|
* ( gsl/specfunc/legendre_source.c and 7.24.2 of gsl docs
|
||||||
*
|
*/
|
||||||
|
|
||||||
double *qpms_legendre_deriv_y_get(double x, qpms_l_t lMax,
|
int qpms_legendre_deriv_y_get(double **result, double **result_deriv, double x, qpms_l_t lMax,
|
||||||
gsle_sf_legendre_t lnorm, double csphase); //FIXME what about derivative?
|
gsle_sf_legendre_t lnorm, double csphase);
|
||||||
qpms_errno_t qpms_legendre_deriv_y_fill(double *where, double *where_deriv, double x,
|
int qpms_errno_t qpms_legendre_deriv_y_fill(double *where, double *where_deriv, double x,
|
||||||
qpms_l_t lMax, gsl_sf_legendre_t lnorm, double csphase); //NI
|
qpms_l_t lMax, gsl_sf_legendre_t lnorm, double csphase);
|
||||||
|
|
||||||
qpms_vswfset_sph_t *qpms_vswfset_make(qpms_l_t lMax, sph_t kdlj,
|
qpms_vswfset_sph_t *qpms_vswfset_make(qpms_l_t lMax, sph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalization_t norm);//NI
|
qpms_bessel_t btyp, qpms_normalization_t norm);//NI
|
||||||
|
|
Loading…
Reference in New Issue