00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char solh_helmholtz_plusC[] = "$Header $" ;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include <stdio.h>
00048 #include <stdlib.h>
00049 #include <math.h>
00050 #include <gsl/gsl_sf_bessel.h>
00051
00052 #include "proto.h"
00053 #include "matrice.h"
00054 #include "type_parite.h"
00055
00056
00057
00058
00059 Tbl _solh_helmholtz_plus_pas_prevu (int, int, double, double, double) {
00060
00061 cout << "Homogeneous solution not implemented in hemlholtz_plus : "<< endl ;
00062 abort() ;
00063 exit(-1) ;
00064 Tbl res(1) ;
00065 return res;
00066 }
00067
00068
00069
00070
00071
00072
00073
00074 Tbl _solh_helmholtz_plus_r_cheb (int n, int lq, double alpha, double beta,
00075 double masse) {
00076
00077 assert (masse > 0) ;
00078
00079 Tbl res(2,n) ;
00080 res.set_etat_qcq() ;
00081 double* coloc = new double[n] ;
00082
00083 int * deg = new int[3] ;
00084 deg[0] = 1 ;
00085 deg[1] = 1 ;
00086 deg[2] = n ;
00087
00088
00089 for (int i=0 ; i<n ; i++){
00090 double air = alpha*(-cos(M_PI*i/(n-1))) + beta ;
00091 coloc[i] = -gsl_sf_bessel_jl(lq, masse*air) ;
00092 }
00093
00094 cfrcheb(deg, deg, coloc, deg, coloc) ;
00095 for (int i=0 ; i<n ;i++)
00096 res.set(0,i) = coloc[i] ;
00097
00098
00099 for (int i=0 ; i<n ; i++){
00100 double air = alpha*(-cos(M_PI*i/(n-1))) + beta ;
00101 coloc[i] = -gsl_sf_bessel_yl (lq, masse*air) ;
00102 }
00103
00104 cfrcheb(deg, deg, coloc, deg, coloc) ;
00105 for (int i=0 ; i<n ;i++)
00106 res.set(1,i) = coloc[i] ;
00107
00108 delete [] deg ;
00109 delete [] coloc ;
00110 return res ;
00111 }
00112
00113
00114
00115
00116
00117
00118 Tbl _solh_helmholtz_plus_r_chebp (int n, int lq, double alpha, double,
00119 double masse) {
00120
00121 assert (masse > 0) ;
00122
00123 Tbl res(n) ;
00124 res.set_etat_qcq() ;
00125 double* coloc = new double[n] ;
00126
00127 int * deg = new int[3] ;
00128 deg[0] = 1 ;
00129 deg[1] = 1 ;
00130 deg[2] = n ;
00131
00132
00133 for (int i=0 ; i<n ; i++){
00134 double air = alpha*sin(M_PI*i/2/(n-1)) ;
00135 coloc[i] = -gsl_sf_bessel_jl(lq, masse*air) ;
00136 }
00137
00138 cfrchebp(deg, deg, coloc, deg, coloc) ;
00139 for (int i=0 ; i<n ;i++)
00140 res.set(i) = coloc[i] ;
00141
00142 delete [] deg ;
00143 delete [] coloc ;
00144 return res ;
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 Tbl solh_helmholtz_plus (int n, int lq, double alpha, double beta,
00154 double masse, int base_r) {
00155
00156
00157 static Tbl (*solh_helmholtz_plus[MAX_BASE])(int, int, double, double, double) ;
00158 static int nap = 0 ;
00159
00160
00161 if (nap==0) {
00162 nap = 1 ;
00163 for (int i=0 ; i<MAX_BASE ; i++) {
00164 solh_helmholtz_plus[i] = _solh_helmholtz_plus_pas_prevu ;
00165 }
00166
00167 solh_helmholtz_plus[R_CHEB >> TRA_R] = _solh_helmholtz_plus_r_cheb ;
00168 solh_helmholtz_plus[R_CHEBP >> TRA_R] = _solh_helmholtz_plus_r_chebp ;
00169 }
00170
00171 Tbl res(solh_helmholtz_plus[base_r](n, lq, alpha, beta, masse)) ;
00172 return res ;
00173 }