sym_tensor_tt_etamu.C

00001 /*
00002  *  Methods of class Sym_tensor_tt related to eta and mu
00003  *
00004  *   (see file sym_tensor.h for documentation)
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2003-2004 Eric Gourgoulhon & Jerome Novak
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License as published by
00015  *   the Free Software Foundation; either version 2 of the License, or
00016  *   (at your option) any later version.
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 
00030 char sym_tensor_tt_etamu_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_tt_etamu.C,v 1.16 2006/10/24 13:03:19 j_novak Exp $" ;
00031 
00032 /*
00033  * $Id: sym_tensor_tt_etamu.C,v 1.16 2006/10/24 13:03:19 j_novak Exp $
00034  * $Log: sym_tensor_tt_etamu.C,v $
00035  * Revision 1.16  2006/10/24 13:03:19  j_novak
00036  * New methods for the solution of the tensor wave equation. Perhaps, first
00037  * operational version...
00038  *
00039  * Revision 1.15  2005/04/01 14:28:32  j_novak
00040  * Members p_eta and p_mu are now defined in class Sym_tensor.
00041  *
00042  * Revision 1.14  2004/06/04 09:25:58  e_gourgoulhon
00043  * Method eta(): eta is no longer computed from h^rr but from khi (in the
00044  *   case where khi is known).
00045  *
00046  * Revision 1.13  2004/05/25 15:08:44  f_limousin
00047  * Add parameters in argument of the functions update, eta and mu for
00048  * the case of a Map_et.
00049  *
00050  * Revision 1.12  2004/05/24 13:45:29  e_gourgoulhon
00051  * Added parameter dzp to method Sym_tensor_tt::update.
00052  *
00053  * Revision 1.11  2004/05/05 14:24:54  e_gourgoulhon
00054  * Corrected a bug in method set_khi_mu: the division of khi by r^2
00055  * was ommitted in the case dzp=2 !!!
00056  *
00057  * Revision 1.10  2004/04/08 16:38:43  e_gourgoulhon
00058  * Sym_tensor_tt::set_khi_mu: added argument dzp (dzpuis of resulting h^{ij}).
00059  *
00060  * Revision 1.9  2004/03/04 09:53:04  e_gourgoulhon
00061  * Methods eta(), mu() and upate(): use of Scalar::mult_r_dzpuis and
00062  * change of dzpuis behavior of eta and mu.
00063  *
00064  * Revision 1.8  2004/03/03 13:16:21  j_novak
00065  * New potential khi (p_khi) and the functions manipulating it.
00066  *
00067  * Revision 1.7  2004/02/05 13:44:50  e_gourgoulhon
00068  * Major modif. of methods eta(), mu() and update() to treat
00069  * any value of dzpuis, thanks to the new definitions of
00070  * Scalar::mult_r(), Scalar::dsdr(), etc...
00071  *
00072  * Revision 1.6  2004/01/28 13:25:41  j_novak
00073  * The ced_mult_r arguments have been suppressed from the Scalar::*dsd* methods.
00074  * In the div/mult _r_dzpuis, there is no more default value.
00075  *
00076  * Revision 1.5  2003/11/05 15:28:31  e_gourgoulhon
00077  * Corrected error in update.
00078  *
00079  * Revision 1.4  2003/11/04 23:03:34  e_gourgoulhon
00080  * First full version of method update().
00081  * Add method set_rr_mu.
00082  * Method set_eta_mu ---> set_rr_eta_mu.
00083  *
00084  * Revision 1.3  2003/11/04 09:35:27  e_gourgoulhon
00085  * First operational version of update_tp().
00086  *
00087  * Revision 1.2  2003/11/03 22:33:36  e_gourgoulhon
00088  * Added methods update_tp and set_eta_mu.
00089  *
00090  * Revision 1.1  2003/11/03 17:08:37  e_gourgoulhon
00091  * First version
00092  *
00093  *
00094  * $Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_tt_etamu.C,v 1.16 2006/10/24 13:03:19 j_novak Exp $
00095  *
00096  */
00097 
00098 // Headers C
00099 #include <stdlib.h>
00100 #include <assert.h>
00101 
00102 // Headers Lorene
00103 #include "tensor.h"
00104 
00105             //--------------//
00106             //     khi      //
00107             //--------------//
00108 
00109 const Scalar& Sym_tensor_tt::khi() const {
00110 
00111   if (p_khi == 0x0) {   // a new computation is necessary
00112         
00113     // All this has a meaning only for spherical components:
00114     assert(dynamic_cast<const Base_vect_spher*>(triad) != 0x0) ; 
00115 
00116     // khi is computed from $h^{rr}$ component
00117 
00118     p_khi = new Scalar(operator()(1,1)) ;
00119     p_khi->mult_r() ;
00120     p_khi->mult_r() ;
00121   }
00122 
00123   return *p_khi ; 
00124 
00125 }
00126 
00127 
00128             //--------------//
00129             //     eta      //
00130             //--------------//
00131             
00132             
00133 const Scalar& Sym_tensor_tt::eta(Param* par) const {
00134 
00135 
00136     if (p_eta == 0x0) {   // a new computation is necessary
00137     
00138 
00139         // All this has a meaning only for spherical components:
00140         assert(dynamic_cast<const Base_vect_spher*>(triad) != 0x0) ; 
00141 
00142         // eta is computed from the divergence-free condition:
00143 
00144         int dzp = operator()(1,1).get_dzpuis() ; 
00145         int dzp_resu = ((dzp == 0) ? 0 : dzp-1) ;
00146 
00147         Scalar source_eta(*mp) ; 
00148         
00149         if (p_khi == 0x0) { //  eta is computed from h^rr
00150                             //  -------------------------
00151         
00152             source_eta = - operator()(1,1).dsdr() ;     
00153         
00154         // dhrr contains - dh^{rr}/dr in all domains but the CED,                                           
00155         // in the CED:   - r^2 dh^{rr}/dr        if dzp = 0          (1)
00156         //               - r^(dzp+1) dh^{rr}/dr  if dzp > 0          (2)
00157                                                     
00158                 
00159             // Multiplication by r of (-d h^{rr}/dr) (with the same dzpuis as h^{rr})
00160             source_eta.mult_r_dzpuis( dzp ) ;                           
00161 
00162             // Substraction of the h^rr part and multiplication by r :
00163             source_eta -= 3. * operator()(1,1) ;                          
00164 
00165             source_eta.mult_r_dzpuis(dzp_resu) ;
00166         }
00167         else {      // eta is computed from khi
00168                     // ------------------------
00169 
00170             source_eta = - p_khi->dsdr() ;
00171             int diff_dzp = source_eta.get_dzpuis() - dzp_resu ; 
00172             assert( diff_dzp >= 0 ) ;
00173             source_eta.dec_dzpuis(diff_dzp) ;
00174             
00175             Scalar tmp(*p_khi) ; 
00176             tmp.div_r_dzpuis(dzp_resu) ; 
00177             
00178             source_eta -= tmp ;  
00179             
00180         }
00181 
00182         
00183         // Resolution of the angular Poisson equation for eta
00184         // --------------------------------------------------
00185         if (dynamic_cast<const Map_af*>(mp) != 0x0) {
00186             p_eta = new Scalar( source_eta.poisson_angu() ) ; 
00187         }
00188         else {
00189             Scalar resu (*mp) ;
00190             resu = 0. ;
00191             mp->poisson_angu(source_eta, *par, resu) ;
00192             p_eta = new Scalar( resu ) ;        
00193         }
00194     
00195     }
00196 
00197     return *p_eta ; 
00198 
00199 }
00200 
00201             
00202 
00203             //-------------------//
00204             //  set_rr_eta_mu    //
00205             //-------------------//
00206             
00207 
00208 void Sym_tensor_tt::set_rr_eta_mu(const Scalar& hrr, const Scalar& eta_i, 
00209         const Scalar& mu_i) {
00210 
00211         // All this has a meaning only for spherical components:
00212         assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ; 
00213                         
00214         set(1,1) = hrr ;    // h^{rr}
00215                             // calls del_deriv() and therefore delete previous
00216                             // p_eta and p_mu
00217         
00218         p_eta = new Scalar( eta_i ) ;   // eta
00219 
00220         p_mu = new Scalar( mu_i ) ;     // mu 
00221         
00222         update( hrr.get_dzpuis() ) ; // all h^{ij}, except for h^{rr}
00223         
00224 }
00225             
00226             //---------------//
00227             //  set_rr_mu    //
00228             //---------------//
00229             
00230 
00231 void Sym_tensor_tt::set_rr_mu(const Scalar& hrr, const Scalar& mu_i) {
00232 
00233         // All this has a meaning only for spherical components:
00234         assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ; 
00235                         
00236         set(1,1) = hrr ;    // h^{rr}
00237                             // calls del_deriv() and therefore delete previous
00238                             // p_eta and p_mu
00239         
00240         p_mu = new Scalar( mu_i ) ;     // mu 
00241         
00242         eta() ; // computes eta form the divergence-free condition
00243         
00244         update( hrr.get_dzpuis() ) ; // all h^{ij}, except for h^{rr}
00245         
00246 }
00247             
00248             //-------------------//
00249             //  set_khi_eta_mu    //
00250             //-------------------//
00251             
00252 
00253 void Sym_tensor_tt::set_khi_eta_mu(const Scalar& khi_i, const Scalar& eta_i, 
00254         const Scalar& mu_i) {
00255 
00256   // All this has a meaning only for spherical components:
00257   assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ; 
00258             
00259   set(1,1) = khi_i ;
00260   set(1,1).div_r() ;
00261   set(1,1).div_r() ;     // h^{rr}
00262 
00263   // calls del_deriv() and therefore delete previous
00264   // p_khi, p_eta and p_mu
00265         
00266   p_khi = new Scalar( khi_i ) ;        // khi
00267 
00268   p_eta = new Scalar( eta_i ) ;     // eta
00269   
00270   p_mu = new Scalar( mu_i ) ;   // mu 
00271   
00272   update( khi_i.get_dzpuis() ) ; // all h^{ij}, except for h^{rr}
00273         
00274 }
00275             
00276             //---------------//
00277             //  set_khi_mu    //
00278             //---------------//
00279             
00280 
00281 void Sym_tensor_tt::set_khi_mu(const Scalar& khi_i, const Scalar& mu_i, 
00282                               int dzp, Param* par1, Param* par2, Param* par3) {
00283 
00284   // All this has a meaning only for spherical components:
00285   assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ; 
00286                         
00287   set(1,1) = khi_i ; 
00288                         // calls del_deriv() and therefore delete previous
00289                         // p_eta and p_mu
00290 
00291   assert( khi_i.check_dzpuis(0) ) ; 
00292   if (dzp == 0) {
00293     set(1,1).div_r() ;
00294     set(1,1).div_r() ;  // h^{rr}
00295   }
00296   else {
00297     assert(dzp == 2) ; //## temporary: the other cases are not treated yet
00298     set(1,1).div_r_dzpuis(1) ;
00299     set(1,1).div_r_dzpuis(2) ;
00300   }     
00301   
00302   p_khi = new Scalar ( khi_i ) ;  // khi
00303 
00304   p_mu = new Scalar( mu_i ) ;   // mu 
00305 
00306   if (dynamic_cast<const Map_af*>(mp) != 0x0) {     
00307       eta() ; // computes eta form the divergence-free condition
00308       // dzp = 0 ==> eta.dzpuis = 0
00309       // dzp = 2 ==> eta.dzpuis = 1
00310       
00311       update(dzp) ; // all h^{ij}, except for h^{rr}
00312   }
00313   else {
00314       eta(par1) ; // computes eta form the divergence-free condition
00315       // dzp = 0 ==> eta.dzpuis = 0
00316       // dzp = 2 ==> eta.dzpuis = 1
00317       
00318       update(dzp, par2, par3) ; // all h^{ij}, except for h^{rr}
00319   }
00320 
00321 }
00322 
00323             
00324 
00325             //-------------//
00326             //   update    //
00327             //-------------//
00328             
00329 
00330 
00331 void Sym_tensor_tt::update(int dzp, Param* par1, Param* par2) {
00332 
00333     // All this has a meaning only for spherical components:
00334     assert(dynamic_cast<const Base_vect_spher*>(triad) != 0x0) ; 
00335 
00336     assert( (p_eta != 0x0) && (p_mu != 0x0) ) ; 
00337             
00338     Itbl idx(2) ;
00339     idx.set(0) = 1 ;    // r index
00340     
00341     // h^{r theta} : 
00342     // ------------
00343     idx.set(1) = 2 ;    // theta index
00344     *cmp[position(idx)] = p_eta->srdsdt() - p_mu->srstdsdp() ; 
00345     
00346     if (dzp == 0) {
00347         assert( cmp[position(idx)]->check_dzpuis(2) ) ; 
00348         cmp[position(idx)]->dec_dzpuis(2) ;
00349     }
00350     
00351     assert( cmp[position(idx)]->check_dzpuis(dzp) ) ; 
00352     
00353     // h^{r phi} :
00354     // ------------
00355     idx.set(1) = 3 ;    // phi index
00356     *cmp[position(idx)] = p_eta->srstdsdp() + p_mu->srdsdt() ; 
00357 
00358     if (dzp == 0) {
00359         assert( cmp[position(idx)]->check_dzpuis(2) ) ; 
00360         cmp[position(idx)]->dec_dzpuis(2) ;
00361     }
00362     
00363     assert( cmp[position(idx)]->check_dzpuis(dzp) ) ; 
00364     
00365     // h^{theta phi} and h^{phi phi}
00366     // -----------------------------
00367     
00368     //--------------  Computation of T^theta   --> taut : 
00369     
00370     Scalar tautst = operator()(1,2).dsdr() ; 
00371 
00372     // dhrr contains  dh^{rt}/dr in all domains but the CED,                                           
00373     // in the CED:    r^2 dh^{rt}/dr        if dzp = 0          (1)
00374     //                r^(dzp+1) dh^{rt}/dr  if dzp > 0          (2)
00375                                                     
00376     // Multiplication by r of dh^{rt}/dr (with the same dzpuis than h^{rt})
00377     tautst.mult_r_dzpuis( operator()(1,2).get_dzpuis() ) ;  
00378     
00379                 
00380     // Addition of the remaining parts :    
00381     tautst += 3 * operator()(1,2) - operator()(1,1).dsdt() ; 
00382     tautst.mult_sint() ; 
00383     
00384     Scalar tmp = operator()(1,1) ;
00385     tmp.mult_cost() ;       // h^{rr} cos(th)
00386     
00387     tautst -= tmp ;     // T^th / sin(th)
00388     
00389     Scalar taut = tautst ; 
00390     taut.mult_sint() ;  // T^th
00391     
00392 
00393     //----------- Computation of T^phi   --> taup : 
00394     
00395     Scalar taupst = - operator()(1,3).dsdr() ; 
00396 
00397     // dhrr contains  - dh^{rp}/dr in all domains but the CED,                                           
00398     // in the CED:    - r^2 dh^{rp}/dr        if dzp = 0          (3)
00399     //                - r^(dzp+1) dh^{rp}/dr  if dzp > 0          (4)
00400                                                                 
00401     // Multiplication by r of -dh^{rp}/dr  (with the same dzpuis than h^{rp})
00402     taupst.mult_r_dzpuis( operator()(1,3).get_dzpuis() ) ;  
00403 
00404                           
00405     // Addition of the remaining part : 
00406     
00407     taupst -= 3 * operator()(1,3) ; 
00408     taupst.mult_sint() ;    // T^ph / sin(th)
00409     
00410     Scalar taup = taupst ; 
00411     taup.mult_sint() ;      // T^ph 
00412     
00413     
00414     //------------------- Computation of F and h^[ph ph}
00415     
00416     tmp = tautst ; 
00417     tmp.mult_cost() ;   // T^th / tan(th)
00418     
00419     // dT^th/dth + T^th / tan(th) + 1/sin(th) dT^ph/dph :
00420     tmp = taut.dsdt() + tmp + taup.stdsdp() ;
00421 
00422     Scalar tmp2 (*mp) ;     
00423     if (dynamic_cast<const Map_af*>(mp) != 0x0) {       
00424         tmp2 = tmp.poisson_angu() ;  // F
00425     }
00426     else {
00427         tmp2 = 0. ;
00428         mp->poisson_angu(tmp, *par1, tmp2) ; // F
00429     }
00430         
00431 
00432     tmp2.div_sint() ; 
00433     tmp2.div_sint() ; // h^{ph ph}
00434     
00435     idx.set(0) = 3 ;    // phi index
00436     idx.set(1) = 3 ;    // phi index
00437     *cmp[position(idx)] = tmp2 ;        // h^{ph ph} is updated
00438     
00439     
00440     //------------------- Computation of G and h^[th ph}
00441     
00442     tmp = taupst ; 
00443     tmp.mult_cost() ; // T^ph / tan(th)
00444     
00445     // - 1/sin(th) dT^th/dph + dT^ph/dth + T^ph / tan(th) :
00446     tmp = - taut.stdsdp() + taup.dsdt() + tmp ; 
00447     
00448     if (dynamic_cast<const Map_af*>(mp) != 0x0) {       
00449         tmp2 = tmp.poisson_angu() ;  // G
00450     }
00451     else {
00452         tmp2 = 0. ;
00453         mp->poisson_angu(tmp, *par2, tmp2) ;  // G
00454     }
00455     
00456     tmp2.div_sint() ; 
00457     tmp2.div_sint() ; // h^{th ph}
00458     
00459     idx.set(0) = 2 ;    // theta index
00460     idx.set(1) = 3 ;    // phi index
00461     *cmp[position(idx)] = tmp2 ;        // h^{th ph} is updated
00462     
00463     // h^{th th}  (from the trace-free condition)
00464     // ---------
00465     idx.set(1) = 2 ;    // theta index
00466     *cmp[position(idx)] = - operator()(1,1) - operator()(3,3) ; 
00467     
00468 
00469     Sym_tensor_trans::del_deriv() ; //## in order not to delete p_eta and p_mu
00470     
00471 
00472 
00473 }           
00474 
00475 
00476             //-----------------//
00477             //  set_A_tilde_B  //
00478             //-----------------//
00479 
00480 void Sym_tensor_tt::set_A_tildeB(const Scalar& a_in, const Scalar& tb_in, 
00481                  Param* par_bc, Param* par_mat) {
00482 
00483     Scalar zero(*mp) ;
00484     zero.set_etat_zero() ;
00485     set_AtB_trace(a_in, tb_in, zero, par_bc, par_mat) ;
00486     return ;
00487 }
00488 
00489 
00490 
00491 
00492 
00493 

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