tenseur_pde_falloff.C

00001 /*
00002  *  Methods of the class tenseur for solving vectorial Poisson equations
00003  *   with a falloff condition at the outer boundary
00004  *
00005  *    (see file tenseur.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2004 Joshua A. Faber
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License version 2
00016  *   as published by the Free Software Foundation.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 char tenseur_pde_falloff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_falloff.C,v 1.2 2004/12/22 18:25:59 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: tenseur_pde_falloff.C,v 1.2 2004/12/22 18:25:59 k_taniguchi Exp $
00033  * $Log: tenseur_pde_falloff.C,v $
00034  * Revision 1.2  2004/12/22 18:25:59  k_taniguchi
00035  * Cahnge an argument of poisson_vect_falloff.
00036  *
00037  * Revision 1.1  2004/11/30 20:55:33  k_taniguchi
00038  * *** empty log message ***
00039  *
00040  *
00041  * $Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_falloff.C,v 1.2 2004/12/22 18:25:59 k_taniguchi Exp $
00042  *
00043  */
00044 
00045 // Header Lorene:
00046 #include "map.h"
00047 #include "cmp.h"
00048 #include "param.h"
00049 #include "tenseur.h"
00050 
00051             //-----------------------------------//
00052             //      Vectorial Poisson equation   //
00053             //-----------------------------------//
00054 
00055 // Version avec parametres
00056 // -----------------------
00057 void Tenseur::poisson_vect_falloff(double lambda, Param& para, Tenseur& shift,
00058                    Tenseur& vecteur, Tenseur& scalaire,
00059                    int* k_falloff) const {
00060     assert (lambda != -1) ;
00061     
00062     // Verifications d'usage ...
00063     assert (valence == 1) ;
00064     assert (shift.get_valence() == 1) ;
00065     assert (shift.get_type_indice(0) == type_indice(0)) ;
00066     assert (vecteur.get_valence() == 1) ;
00067     assert (vecteur.get_type_indice(0) == type_indice(0)) ;
00068     assert (scalaire.get_valence() == 0) ;
00069     assert (etat != ETATNONDEF) ;
00070 
00071     // define int k_falloff[4] ;
00072     // k_falloff[0,1,2] = falloff for vecteur_x,y,z
00073     // k_falloff[3] = falloff for scalaire
00074 
00075     // Nothing to do if the source is zero
00076     if (etat == ETATZERO) {
00077 
00078     shift.set_etat_zero() ; 
00079 
00080     vecteur.set_etat_qcq() ;
00081     for (int i=0; i<3; i++) {
00082         vecteur.set(i) = 0 ; 
00083     }
00084 
00085     scalaire.set_etat_qcq() ;
00086     scalaire.set() = 0 ;  
00087 
00088     return ; 
00089     }
00090 
00091     // On construit le tableau contenant le terme P_i ...
00092     for (int i=0 ; i<3 ; i++) {
00093     Param* par = mp->donne_para_poisson_vect(para, i) ; 
00094 
00095     (*this)(i).poisson_falloff(*par, vecteur.set(i),k_falloff[i]) ;
00096 
00097     if (par != 0x0)
00098       delete par ; 
00099     }
00100     vecteur.set_triad( *triad ) ; 
00101     
00102     // Equation de Poisson scalaire :
00103     Tenseur source_scal (-skxk(*this)) ;
00104       
00105     Param* par = mp->donne_para_poisson_vect(para, 3) ; 
00106 
00107     source_scal().poisson_falloff(*par, scalaire.set(), k_falloff[3]) ;
00108     
00109     if (par !=0x0)
00110       delete par ; 
00111 
00112     // On construit le tableau contenant le terme d xsi / d x_i ...
00113     Tenseur auxiliaire(scalaire) ;
00114     Tenseur dxsi (auxiliaire.gradient()) ;
00115  
00116     // On construit le tableau contenant le terme x_k d P_k / d x_i
00117     Tenseur dp (skxk(vecteur.gradient())) ;
00118     
00119     // Il ne reste plus qu'a tout ranger dans P :
00120     // The final computation is done component by component because
00121     // d_khi and x_d_w are covariant comp. whereas w_shift is
00122     // contravariant
00123 
00124     shift.set_etat_qcq() ; 
00125 
00126     for (int i=0 ; i<3 ; i++)
00127     shift.set(i) = (lambda+2)/2/(lambda+1) * vecteur(i) 
00128                 - (lambda/2/(lambda+1)) * (dxsi(i) + dp(i)) ;   
00129                 
00130     shift.set_triad( *(vecteur.triad) ) ; 
00131 
00132 }
00133 
00134 
00135 // Version sans parametres
00136 // -----------------------
00137 Tenseur Tenseur::poisson_vect_falloff(double lambda, Tenseur& vecteur, 
00138                     Tenseur& scalaire, int* k_falloff) const {
00139       
00140     Param bidon ;
00141     Tenseur resu(*mp, valence, type_indice, triad, metric, poids) ;
00142     resu.set_etat_qcq() ;
00143     poisson_vect_falloff(lambda, bidon, resu, vecteur, scalaire, k_falloff) ;
00144     return resu ;
00145 }
00146 

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