LORENE
ope_helmholtz_minus_pseudo_1d_solh.C
1/*
2 * Copyright (c) 2004 Philippe Grandclement
3 *
4 * This file is part of LORENE.
5 *
6 * LORENE is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * LORENE is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with LORENE; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21char ope_helmholtz_minus_pseudo_1d_solh_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_solh.C,v 1.4 2014/10/13 08:53:34 j_novak Exp $" ;
22
23/*
24 * $Id: ope_helmholtz_minus_pseudo_1d_solh.C,v 1.4 2014/10/13 08:53:34 j_novak Exp $
25 * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_solh.C,v 1.4 2014/10/13 08:53:34 j_novak Exp $
26 *
27 */
28#include <cmath>
29#include <cstdlib>
30#include <gsl/gsl_sf_bessel.h>
31
32#include "proto.h"
33#include "ope_elementary.h"
34
35 //------------------------------------
36 // Routine pour les cas non prevus --
37 //------------------------------------
38namespace Lorene {
39Tbl _solh_helmholtz_minus_pseudo_1d_pas_prevu (int, int,
40 double, double, double) {
41
42 cout << " Solution homogene pas prevue ..... : "<< endl ;
43 exit(-1) ;
44 Tbl res(1) ;
45 return res;
46}
47
48
49 //-------------------
50 //-- R_CHEBU -----
51 //-------------------
52
53Tbl _solh_helmholtz_minus_pseudo_1d_r_chebu (int n, int l,
54 double masse,
55 double alpha, double) {
56
57
58 Tbl res(n) ;
59 res.set_etat_qcq() ;
60 double* coloc = new double[n] ;
61
62 int * deg = new int[3] ;
63 deg[0] = 1 ;
64 deg[1] = 1 ;
65 deg[2] = n ;
66
67 for (int i=0 ; i<n-1 ; i++) {
68 double air = 1./(alpha*(-1-cos(M_PI*i/(n-1)))) ;
69 if ((l !=0) && (l!=1))
70 coloc[i] = gsl_sf_bessel_kl_scaled (l-1, masse*air) / exp(masse*air) * air;
71 else
72 coloc[i] = exp(-masse*air) ;
73 }
74 coloc[n-1] = 0 ;
75
76 cfrcheb(deg, deg, coloc, deg, coloc) ;
77 for (int i=0 ; i<n ;i++)
78 res.set(i) = coloc[i] ;
79
80 delete [] coloc ;
81 delete [] deg ;
82
83 return res ;
84}
85
86
88
89 // Routines de derivation
91 static int nap = 0 ;
92
93 // Premier appel
94 if (nap==0) {
95 nap = 1 ;
96 for (int i=0 ; i<MAX_BASE ; i++) {
97 solh_helmholtz_minus_pseudo_1d[i] = _solh_helmholtz_minus_pseudo_1d_pas_prevu ;
98 }
99 // Les routines existantes
100 solh_helmholtz_minus_pseudo_1d[R_CHEBU >> TRA_R] = _solh_helmholtz_minus_pseudo_1d_r_chebu ;
101 }
102
104
105 // Un peu tricky...
106
107 if (res.get_ndim() == 1) {
108 Tbl val_lim (val_solp (res, alpha, base_r)) ;
109 val_lim *= sqrt (double(2)) ;
110
111 s_one_plus = val_lim(0) ;
112 s_one_minus = val_lim(1) ;
113 ds_one_plus = val_lim(2) ;
114 ds_one_minus = val_lim(3) ;
115
116 }
117 else {
118 Tbl auxi (nr) ;
119 auxi.set_etat_qcq() ;
120 for (int i=0 ; i<nr ; i++)
121 auxi.set(i) = res(0,i) ;
122
123 Tbl val_one (val_solp (auxi, alpha, base_r)) ;
124 val_one *= sqrt (double(2)) ;
125
126 s_one_plus = val_one(0) ;
127 s_one_minus = val_one(1) ;
128 ds_one_plus = val_one(2) ;
129 ds_one_minus = val_one(3) ;
130
131 for (int i=0 ; i<nr ; i++)
132 auxi.set(i) = res(1,i) ;
133
134 Tbl val_two (val_solp (auxi, alpha, base_r)) ;
135 val_two *= sqrt(double(2)) ;
136
137 s_two_plus = val_two(0) ;
138 s_two_minus = val_two(1) ;
139 ds_two_plus = val_two(2) ;
140 ds_two_minus = val_two(3) ;
141
142 }
143
144 return res ;
145}
146}
Time evolution with partial storage (*** under development ***).
Definition evolution.h:371
double ds_two_minus
Value of the derivative of the second homogeneous solution at the inner boundary.
double s_two_plus
Value of the second homogeneous solution at the outer boundary.
double s_one_minus
Value of the first homogeneous solution at the inner boundary.
double beta
Parameter of the associated mapping.
double ds_one_plus
Value of the derivative of the first homogeneous solution at the outer boundary.
double ds_one_minus
Value of the derivative of the first homogeneous solution at the inner boundary.
double alpha
Parameter of the associated mapping.
double s_two_minus
Value of the second homogeneous solution at the inner boundary.
int base_r
Radial basis of decomposition.
double s_one_plus
Value of the first homogeneous solution at the outer boundary.
double ds_two_plus
Value of the derivative of the second homogeneous solution at the outer boundary.
int nr
Number of radial points.
virtual Tbl get_solh() const
Computes the homogeneous solutions(s).
Basic array class.
Definition tbl.h:161
Cmp sqrt(const Cmp &)
Square root.
Definition cmp_math.C:220
Cmp exp(const Cmp &)
Exponential.
Definition cmp_math.C:270
Cmp cos(const Cmp &)
Cosine.
Definition cmp_math.C:94
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
Lorene prototypes.
Definition app_hor.h:64