tenseur_pde_regu.C

00001 /*
00002  *  Method of class Tenseur to solve a vector Poisson equation
00003  *  by regularizing its source.
00004  *
00005  *  (see file tenseur.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2000-2001 Keisuke Taniguchi
00011  *   Copyright (c) 2001 Philippe Grandclement
00012  *
00013  *   This file is part of LORENE.
00014  *
00015  *   LORENE is free software; you can redistribute it and/or modify
00016  *   it under the terms of the GNU General Public License as published by
00017  *   the Free Software Foundation; either version 2 of the License, or
00018  *   (at your option) any later version.
00019  *
00020  *   LORENE is distributed in the hope that it will be useful,
00021  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *   GNU General Public License for more details.
00024  *
00025  *   You should have received a copy of the GNU General Public License
00026  *   along with LORENE; if not, write to the Free Software
00027  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  *
00029  */
00030 
00031 
00032 char tenseur_pde_regu_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_regu.C,v 1.3 2003/10/03 15:58:51 j_novak Exp $" ;
00033 
00034 /*
00035  * $Id: tenseur_pde_regu.C,v 1.3 2003/10/03 15:58:51 j_novak Exp $
00036  * $Log: tenseur_pde_regu.C,v $
00037  * Revision 1.3  2003/10/03 15:58:51  j_novak
00038  * Cleaning of some headers
00039  *
00040  * Revision 1.2  2002/08/07 16:14:11  j_novak
00041  * class Tenseur can now also handle tensor densities, this should be transparent to older codes
00042  *
00043  * Revision 1.1.1.1  2001/11/20 15:19:30  e_gourgoulhon
00044  * LORENE
00045  *
00046  * Revision 2.1  2001/01/15  11:01:34  phil
00047  * vire version sans parametres
00048  *
00049  * Revision 2.0  2000/10/06  15:34:03  keisuke
00050  * Initial revision.
00051  *
00052  *
00053  * $Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_regu.C,v 1.3 2003/10/03 15:58:51 j_novak Exp $
00054  *
00055  */
00056 
00057 // Header Lorene:
00058 #include "param.h"
00059 #include "tenseur.h"
00060 
00061             //-----------------------------------//
00062             //      Vectorial Poisson equation   //
00063             //-----------------------------------//
00064 
00065 // Version avec parametres
00066 // -----------------------
00067 void Tenseur::poisson_vect_regu(int k_div, int nzet, double unsgam1,
00068                 double lambda, Param& para, Tenseur& shift,
00069                 Tenseur& vecteur, Tenseur& scalaire) const {
00070     assert (lambda != -1) ;
00071     
00072     // Verifications d'usage ...
00073     assert (valence == 1) ;
00074     assert (shift.get_valence() == 1) ;
00075     assert (shift.get_type_indice(0) == type_indice(0)) ;
00076     assert (vecteur.get_valence() == 1) ;
00077     assert (vecteur.get_type_indice(0) == type_indice(0)) ;
00078     assert (scalaire.get_valence() == 0) ;
00079     assert (etat != ETATNONDEF) ;
00080 
00081     // Nothing to do if the source is zero
00082     if (etat == ETATZERO) {
00083 
00084     shift.set_etat_zero() ; 
00085 
00086     vecteur.set_etat_qcq() ;
00087     for (int i=0; i<3; i++) {
00088         vecteur.set(i) = 0 ; 
00089     }
00090 
00091     scalaire.set_etat_qcq() ;
00092     scalaire.set() = 0 ;  
00093 
00094     return ; 
00095     }
00096 
00097     for (int i=0 ; i<3 ; i++)
00098     assert ((*this)(i).check_dzpuis(4)) ;
00099 
00100     Tenseur vecteur_regu(*mp, 1, CON, mp->get_bvect_cart(), metric, poids) ;
00101     Tenseur vecteur_div(*mp, 1, CON, mp->get_bvect_cart(), metric, poids) ;
00102     Tenseur dvect_div(*mp, 1, CON, mp->get_bvect_cart(), metric, poids) ;
00103     Tenseur souvect_regu(*mp, 1, CON, mp->get_bvect_cart(), metric, poids) ;
00104     Tenseur souvect_div(*mp, 1, CON, mp->get_bvect_cart(), metric, poids) ;
00105 
00106     vecteur_regu.set_etat_qcq() ;
00107     vecteur_div.set_etat_qcq() ;
00108     dvect_div.set_etat_qcq() ;
00109     souvect_regu.set_etat_qcq() ;
00110     souvect_div.set_etat_qcq() ;
00111 
00112     // On construit le tableau contenant le terme P_i ...
00113 
00114     // Apply only to x and y components because poisson_regular does not
00115     // work for z component due to the symmetry.
00116     for (int i=0 ; i<2 ; i++) {
00117     Param* par = mp->donne_para_poisson_vect(para, i) ; 
00118 
00119     (*this)(i).poisson_regular(k_div, nzet, unsgam1, *par,
00120                    vecteur.set(i),
00121                    vecteur_regu.set(i), vecteur_div.set(i),
00122                    dvect_div,
00123                    souvect_regu.set(i), souvect_div.set(i)) ;
00124 
00125     delete par ; 
00126     }
00127 
00128     Param* par = mp->donne_para_poisson_vect(para, 2) ;
00129 
00130     (*this)(2).poisson(*par, vecteur.set(2)) ;
00131 
00132     delete par ;
00133 
00134     vecteur.set_triad( *triad ) ; 
00135     
00136     // Equation de Poisson scalaire :
00137     Tenseur source_scal (-skxk(*this)) ;
00138       
00139     assert (source_scal().check_dzpuis(3)) ; 
00140 
00141     par = mp->donne_para_poisson_vect(para, 3) ; 
00142 
00143     Tenseur scalaire_regu(*mp, metric, poids) ;
00144     Tenseur scalaire_div(*mp, metric, poids) ;
00145     Tenseur dscal_div(*mp, 1, CON, mp->get_bvect_cart(), metric, poids) ;
00146     Cmp souscal_regu(mp) ;
00147     Cmp souscal_div(mp) ;
00148 
00149     scalaire_regu.set_etat_qcq() ;
00150     scalaire_div.set_etat_qcq() ;
00151     dscal_div.set_etat_qcq() ;
00152 
00153     souscal_regu.std_base_scal() ;
00154     souscal_div.std_base_scal() ;
00155 
00156     source_scal().poisson_regular(k_div, nzet, unsgam1, *par,
00157                   scalaire.set(),
00158                   scalaire_regu.set(), scalaire_div.set(),
00159                   dscal_div, souscal_regu, souscal_div) ;
00160     
00161     delete par ; 
00162 
00163     // On construit le tableau contenant le terme d xsi / d x_i ...
00164     Tenseur auxiliaire(scalaire) ;
00165     Tenseur dxsi (auxiliaire.gradient()) ;
00166     dxsi.dec2_dzpuis() ;
00167  
00168     // On construit le tableau contenant le terme x_k d P_k / d x_i
00169     Tenseur dp (skxk(vecteur.gradient())) ;
00170     dp.dec_dzpuis() ;
00171     
00172     // Il ne reste plus qu'a tout ranger dans P :
00173     // The final computation is done component by component because
00174     // d_khi and x_d_w are covariant comp. whereas w_shift is
00175     // contravariant
00176 
00177     shift.set_etat_qcq() ; 
00178 
00179     for (int i=0 ; i<3 ; i++)
00180     shift.set(i) = (lambda+2)/2/(lambda+1) * vecteur(i) 
00181                 - (lambda/2/(lambda+1)) * (dxsi(i) + dp(i)) ;   
00182                 
00183     shift.set_triad( *(vecteur.triad) ) ; 
00184 
00185 }
00186 
00187 

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