solh_helmholtz_plus.C

00001 /*
00002  *   Copyright (c) 1999-2001 Philippe Grandclement
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char solh_helmholtz_plusC[] = "$Header $" ;
00024 
00025 
00026 /*
00027  * $Id: solh_helmholtz_plus.C,v 1.4 2008/02/18 13:53:43 j_novak Exp $
00028  * $Log: solh_helmholtz_plus.C,v $
00029  * Revision 1.4  2008/02/18 13:53:43  j_novak
00030  * Removal of special indentation instructions.
00031  *
00032  * Revision 1.3  2007/05/06 10:48:12  p_grandclement
00033  * Modification of a few operators for the vorton project
00034  *
00035  * Revision 1.2  2004/01/15 09:15:37  p_grandclement
00036  * Modification and addition of the Helmholtz operators
00037  *
00038  * Revision 1.1  2003/12/11 14:48:49  p_grandclement
00039  * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
00040  *
00041  * 
00042  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/solh_helmholtz_plus.C,v 1.4 2008/02/18 13:53:43 j_novak Exp $
00043  *
00044  */
00045 
00046 //fichiers includes
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         // Routine pour les cas non prevus --
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            //--  R_CHEB   ------
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   // First SH
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   // Second SH
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            //--  R_CHEBP   -----
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   // SH
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            //--  Fonction   ----
00150           //-------------------
00151           
00152           
00153 Tbl solh_helmholtz_plus (int n, int lq, double alpha, double beta, 
00154               double masse, int base_r) {
00155 
00156   // Routines de derivation
00157   static Tbl (*solh_helmholtz_plus[MAX_BASE])(int, int, double, double, double) ;
00158   static int nap = 0 ;
00159   
00160   // Premier appel
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     // Les routines existantes
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 }

Generated on Tue Feb 7 01:35:19 2012 for LORENE by  doxygen 1.4.6