00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char solp_helmholtz_minus_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/solp_helmholtz_minus.C,v 1.7 2008/07/10 11:20:33 p_grandclement Exp $" ;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #include <stdio.h>
00061 #include <stdlib.h>
00062 #include <math.h>
00063
00064 #include "matrice.h"
00065 #include "type_parite.h"
00066 #include "proto.h"
00067
00068
00069
00070
00071 Tbl _solp_helmholtz_minus_pas_prevu (const Matrice &, const Matrice &,
00072 const Tbl &, double, double, int) {
00073 cout << " Solution homogene pas prevue ..... : "<< endl ;
00074 abort() ;
00075 exit(-1) ;
00076 Tbl res(1) ;
00077 return res;
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087 Tbl _solp_helmholtz_minus_r_chebu (const Matrice &lap, const Matrice &nondege,
00088 const Tbl &source, double, double, int) {
00089
00090 int n = lap.get_dim(0)+2 ;
00091 int dege = n-nondege.get_dim(0) ;
00092 assert (dege==3) ;
00093
00094 Tbl source_cl (cl_helmholtz_minus(source, R_CHEBU)) ;
00095
00096 Tbl so(n-dege) ;
00097 so.set_etat_qcq() ;
00098 for (int i=0 ; i<n-dege ; i++)
00099 so.set(i) = source_cl(i);
00100
00101 Tbl sol (nondege.inverse(so)) ;
00102
00103 Tbl res(n) ;
00104 res.annule_hard() ;
00105 for (int i=1 ; i<n-2 ; i++) {
00106 res.set(i) += sol(i-1)*(2*i+3) ;
00107 res.set(i+1) += -sol(i-1)*(4*i+4) ;
00108 res.set(i+2) += sol(i-1)*(2*i+1) ;
00109 }
00110
00111 return res ;
00112 }
00113
00114
00115
00116
00117
00118 Tbl _solp_helmholtz_minus_r_cheb (const Matrice &lap, const Matrice &nondege,
00119 const Tbl &source, double alpha, double beta, int) {
00120
00121 int n = lap.get_dim(0) ;
00122 int dege = n-nondege.get_dim(0) ;
00123 assert (dege ==2) ;
00124
00125 Tbl source_aux(source*alpha*alpha) ;
00126 Tbl xso(source_aux) ;
00127 Tbl xxso(source_aux) ;
00128 multx_1d(n, &xso.t, R_CHEB) ;
00129 multx_1d(n, &xxso.t, R_CHEB) ;
00130 multx_1d(n, &xxso.t, R_CHEB) ;
00131 source_aux = beta*beta/alpha/alpha*source_aux+2*beta/alpha*xso+xxso ;
00132
00133 source_aux = cl_helmholtz_minus (source_aux, R_CHEB) ;
00134
00135 Tbl so(n-dege) ;
00136 so.set_etat_qcq() ;
00137 for (int i=0 ; i<n-dege ; i++)
00138 so.set(i) = source_aux(i) ;
00139
00140 Tbl auxi(nondege.inverse(so)) ;
00141
00142 Tbl res(n) ;
00143 res.set_etat_qcq() ;
00144 for (int i=dege ; i<n ; i++)
00145 res.set(i) = auxi(i-dege) ;
00146
00147 for (int i=0 ; i<dege ; i++)
00148 res.set(i) = 0 ;
00149 return res ;
00150 }
00151
00152
00153
00154
00155
00156 Tbl _solp_helmholtz_minus_r_chebp (const Matrice &, const Matrice &nondege,
00157 const Tbl &source, double alpha, double, int lq) {
00158
00159
00160 int dege = (lq==0) ? 1 : 2 ;
00161 int n = nondege.get_dim(0) + dege ;
00162 Tbl source_cl (cl_helmholtz_minus(source*alpha*alpha, R_CHEBP)) ;
00163
00164 Tbl so(n-dege) ;
00165 so.set_etat_qcq() ;
00166 for (int i=0 ; i<n-dege ; i++)
00167 so.set(i) = source_cl(i);
00168
00169 Tbl sol (nondege.inverse(so)) ;
00170
00171 Tbl res(n) ;
00172 res.annule_hard() ;
00173 if (dege==2) {
00174 for (int i=1 ; i<n-1 ; i++) {
00175 res.set(i) += sol(i-1) ;
00176 res.set(i+1) += sol(i-1) ;
00177 }
00178 }
00179 else {
00180 for (int i=1 ; i<n ; i++)
00181 res.set(i) = sol(i-1) ;
00182 }
00183 return res ;
00184 }
00185
00186
00187
00188
00189 Tbl _solp_helmholtz_minus_r_chebi (const Matrice &, const Matrice &nondege,
00190 const Tbl &source, double alpha, double, int lq) {
00191
00192 int dege = (lq==1) ? 1 : 2 ;
00193 int n = nondege.get_dim(0) + dege ;
00194 Tbl source_cl (cl_helmholtz_minus(source*alpha*alpha, R_CHEBI)) ;
00195
00196 Tbl so(n-dege) ;
00197 so.set_etat_qcq() ;
00198 for (int i=0 ; i<n-dege ; i++)
00199 so.set(i) = source_cl(i);
00200
00201 Tbl sol (nondege.inverse(so)) ;
00202
00203 Tbl res(n) ;
00204 res.annule_hard() ;
00205 if (dege==2) {
00206 for (int i=1 ; i<n-1 ; i++) {
00207 res.set(i) += (2*i+3)*sol(i-1) ;
00208 res.set(i+1) += (2*i+1)*sol(i-1) ;
00209 }
00210 }
00211 else {
00212 for (int i=1 ; i<n ; i++)
00213 res.set(i) = sol(i-1) ;
00214 }
00215
00216 return res ;
00217
00218 }
00219
00220
00221
00222
00223
00224
00225 Tbl solp_helmholtz_minus (const Matrice &lap, const Matrice &nondege,
00226 const Tbl &source, double alpha, double beta, int lq,
00227 int base_r) {
00228
00229
00230 static Tbl (*solp_helmholtz_minus[MAX_BASE]) (const Matrice&, const Matrice&,
00231 const Tbl&, double, double, int) ;
00232 static int nap = 0 ;
00233
00234
00235 if (nap==0) {
00236 nap = 1 ;
00237 for (int i=0 ; i<MAX_BASE ; i++) {
00238 solp_helmholtz_minus[i] = _solp_helmholtz_minus_pas_prevu ;
00239 }
00240
00241 solp_helmholtz_minus[R_CHEB >> TRA_R] = _solp_helmholtz_minus_r_cheb ;
00242 solp_helmholtz_minus[R_CHEBU >> TRA_R] = _solp_helmholtz_minus_r_chebu ;
00243 solp_helmholtz_minus[R_CHEBP >> TRA_R] = _solp_helmholtz_minus_r_chebp ;
00244 solp_helmholtz_minus[R_CHEBI >> TRA_R] = _solp_helmholtz_minus_r_chebi ;
00245 }
00246
00247 Tbl res(solp_helmholtz_minus[base_r] (lap, nondege, source, alpha, beta, lq)) ;
00248 return res ;
00249 }