sym_ttt_poisson.C

00001 /*
00002  *  Resolution of the TT tensor Poisson equation
00003  *
00004  *    (see file sym_tensor.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2003 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 version 2
00015  *   as published by the Free Software Foundation.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 char sym_ttt_poisson_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/sym_ttt_poisson.C,v 1.4 2004/12/28 10:37:24 j_novak Exp $" ;
00029 
00030 /*
00031  * $Id: sym_ttt_poisson.C,v 1.4 2004/12/28 10:37:24 j_novak Exp $
00032  * $Log: sym_ttt_poisson.C,v $
00033  * Revision 1.4  2004/12/28 10:37:24  j_novak
00034  * Better way of enforcing zero divergence.
00035  *
00036  * Revision 1.3  2004/12/27 14:33:12  j_novak
00037  * New algorithm for the tensor Poisson eq.
00038  *
00039  * Revision 1.2  2004/03/04 09:50:41  e_gourgoulhon
00040  * Method poisson: use of new methods khi() and set_khi_mu.
00041  *
00042  * Revision 1.1  2003/11/07 16:53:52  e_gourgoulhon
00043  * First version
00044  *
00045  *
00046  * $Header: /cvsroot/Lorene/C++/Source/Tensor/sym_ttt_poisson.C,v 1.4 2004/12/28 10:37:24 j_novak Exp $
00047  *
00048  */
00049 
00050 // C headers
00051 //#include <>
00052 
00053 // Lorene headers
00054 #include "tensor.h"
00055 #include "param_elliptic.h"
00056 
00057 
00058 Sym_tensor_tt Sym_tensor_tt::poisson(int dzfin) const {
00059 
00060     // All this has a meaning only for spherical components...
00061     assert(dynamic_cast<const Base_vect_spher*>(triad) != 0x0) ; 
00062     //## ... and affine mapping, for the moment!
00063     assert(dynamic_cast<const Map_af*>(mp) != 0x0) ;
00064     assert( (dzfin == 0) || (dzfin == 2) ) ;
00065     Sym_tensor_tt resu(*mp, *triad, *met_div) ; 
00066 
00067     // Solution for the rr-component
00068     // ----------------------------
00069 
00070     const Scalar& source_rr = operator()(1,1) ;
00071     Scalar h_rr(*mp) ;
00072     int nz = mp->get_mg()->get_nzone() ;
00073    
00074     if (source_rr.get_etat() != ETATZERO) {
00075 
00076     //------------------------
00077     // The elliptic operator
00078     //------------------------
00079       
00080     Param_elliptic param_hr(source_rr) ;
00081     for (int lz=0; lz<nz; lz++) 
00082         param_hr.set_poisson_tens_rr(lz) ;
00083       
00084     h_rr = source_rr.sol_elliptic(param_hr) ;
00085     }
00086     else
00087     h_rr.set_etat_zero() ;
00088 
00089     h_rr.inc_dzpuis(dzfin) ; //## can we improve here?
00090     resu.set(1,1) = h_rr ;
00091 
00092     // Solution for (eta / r) 
00093     //-----------------------
00094 //     Scalar source_eta = - source_rr ;
00095 //     source_eta.mult_r_dzpuis(3) ;
00096 //     source_eta.mult_r_dzpuis(2) ;
00097 //     h_rr.set_spectral_va().ylm() ;
00098 //     Scalar tmp = 2*h_rr + h_rr.lapang() ;
00099 //     if (dzfin == 0) 
00100 //  tmp.inc_dzpuis(2) ;
00101 //     source_eta += tmp ;
00102 //     source_eta = source_eta.primr() ;
00103 
00104 //     source_eta.div_r_dzpuis(dzfin) ;
00105 
00106 //     Scalar etasurr = (h_rr+source_eta).poisson_angu() ;
00107 
00108     Scalar source_eta = -resu(1,1).dsdr() ;
00109     source_eta.mult_r_dzpuis(dzfin) ;
00110     source_eta -= 3.*resu(1,1) ;
00111     Scalar etasurr = source_eta.poisson_angu() ;
00112         
00113     // Solution for mu
00114     // ---------------
00115     
00116     Scalar musurr = mu().poisson() ;
00117     musurr.div_r_dzpuis(dzfin) ;
00118 
00119     resu.set(1,1).set_spectral_va().ylm_i() ;
00120     
00121     Scalar** rcmp = resu.cmp ;
00122 
00123     Itbl idx(2) ;
00124     idx.set(0) = 1 ;    // r index
00125     
00126     // h^{r theta} : 
00127     // ------------
00128     idx.set(1) = 2 ;    // theta index
00129     *rcmp[position(idx)] = etasurr.dsdt() - musurr.stdsdp() ; 
00130     
00131     // h^{r phi} :
00132     // ------------
00133     idx.set(1) = 3 ;    // phi index
00134     *rcmp[position(idx)] = etasurr.stdsdp() + musurr.dsdt() ; 
00135 
00136     // h^{theta phi} and h^{phi phi}
00137     // -----------------------------
00138     
00139     //--------------  Computation of T^theta   --> taut : 
00140     
00141     Scalar tautst = resu(1,2).dsdr() ; 
00142 
00143     // dhrr contains  dh^{rt}/dr in all domains but the CED,    
00144     // in the CED:    r^2 dh^{rt}/dr        if dzfin = 0          (1)
00145     //                r^3 dh^{rt}/dr        if dzfin = 2          (2)
00146                                                     
00147     // Multiplication by r of dh^{rt}/dr (with the same dzpuis than h^{rt})
00148     tautst.mult_r_dzpuis(dzfin) ;   
00149     
00150     // Addition of the remaining parts :    
00151     tautst += 3 * resu(1,2) - resu(1,1).dsdt() ; 
00152     tautst.mult_sint() ; 
00153     
00154     Scalar tmp = resu(1,1) ;
00155     tmp.mult_cost() ;       // h^{rr} cos(th)
00156     
00157     tautst -= tmp ;     // T^th / sin(th)
00158     
00159     Scalar taut = tautst ; 
00160     taut.mult_sint() ;  // T^th
00161     
00162 
00163     //----------- Computation of T^phi   --> taup : 
00164     
00165     Scalar taupst = - resu(1,3).dsdr() ; 
00166 
00167     // dhrr contains  - dh^{rp}/dr in all domains but the CED,  
00168     // in the CED:    - r^2 dh^{rp}/dr        if dzfin = 0          (3)
00169     //                - r^3 dh^{rp}/dr        if dzfin = 2          (4)
00170                                                                 
00171     // Multiplication by r of -dh^{rp}/dr  (with the same dzpuis than h^{rp})
00172     taupst.mult_r_dzpuis(dzfin) ;   
00173                           
00174     // Addition of the remaining part : 
00175     
00176     taupst -= 3 * resu(1,3) ; 
00177     taupst.mult_sint() ;    // T^ph / sin(th)
00178     
00179     Scalar taup = taupst ; 
00180     taup.mult_sint() ;      // T^ph 
00181     
00182     //------------------- Computation of F and h^[ph ph}
00183     
00184     tmp = tautst ; 
00185     tmp.mult_cost() ;   // T^th / tan(th)
00186     
00187     // dT^th/dth + T^th / tan(th) + 1/sin(th) dT^ph/dph :
00188     tmp = taut.dsdt() + tmp + taup.stdsdp() ;
00189 
00190     Scalar tmp2 (*mp) ;     
00191     tmp2 = tmp.poisson_angu() ;  // F
00192     tmp2.div_sint() ; 
00193     tmp2.div_sint() ; // h^{ph ph}
00194     
00195     idx.set(0) = 3 ;    // phi index
00196     idx.set(1) = 3 ;    // phi index
00197     *rcmp[position(idx)] = tmp2 ;       // h^{ph ph} is updated
00198     
00199     
00200     //------------------- Computation of G and h^[th ph}
00201     
00202     tmp = taupst ; 
00203     tmp.mult_cost() ; // T^ph / tan(th)
00204     
00205     // - 1/sin(th) dT^th/dph + dT^ph/dth + T^ph / tan(th) :
00206     tmp = - taut.stdsdp() + taup.dsdt() + tmp ; 
00207     
00208     tmp2 = tmp.poisson_angu() ;  // G
00209     tmp2.div_sint() ; 
00210     tmp2.div_sint() ; // h^{th ph}
00211     
00212     idx.set(0) = 2 ;    // theta index
00213     idx.set(1) = 3 ;    // phi index
00214     *rcmp[position(idx)] = tmp2 ;       // h^{th ph} is updated
00215     
00216     // h^{th th}  (from the trace-free condition)
00217     // ---------
00218     idx.set(1) = 2 ;    // theta index
00219     *rcmp[position(idx)] = - resu(1,1) - resu(3,3) ; 
00220     
00221      return resu ;   
00222 }

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