single_bound.C

00001 /*
00002  *  Method of class single_hor to compute boundary conditions
00003  *
00004  *    (see file isol_hor.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2004  Jose Luis Jaramillo
00010  *                       Francois Limousin
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 single_bound_C[] = "$Header: /cvsroot/Lorene/C++/Source/Isol_hor/single_bound.C,v 1.1 2007/04/13 15:28:35 f_limousin Exp $" ;
00030 
00031 /*
00032  * $Id: single_bound.C,v 1.1 2007/04/13 15:28:35 f_limousin Exp $
00033  * $Log: single_bound.C,v $
00034  * Revision 1.1  2007/04/13 15:28:35  f_limousin
00035  * Lots of improvements, generalisation to an arbitrary state of
00036  * rotation, implementation of the spatial metric given by Samaya.
00037  *
00038  *
00039  * $Header: /cvsroot/Lorene/C++/Source/Isol_hor/single_bound.C,v 1.1 2007/04/13 15:28:35 f_limousin Exp $
00040  *
00041  */
00042 
00043 // C++ headers
00044 #include "headcpp.h"
00045 
00046 // C headers
00047 #include <stdlib.h>
00048 #include <assert.h>
00049 
00050 // Lorene headers
00051 #include "time_slice.h"
00052 #include "isol_hor.h"
00053 #include "metric.h"
00054 #include "evolution.h"
00055 #include "unites.h"
00056 #include "graphique.h"
00057 #include "utilitaires.h"
00058 #include "param.h"
00059 
00060 
00061 
00062 const Valeur Single_hor::boundary_psi_app_hor()const {
00063 
00064   Metric flat (mp.flat_met_spher()) ;
00065   Vector temp (mp, CON, mp.get_bvect_spher()) ;
00066   temp.set(1) = 1.;
00067   temp.set(2) = 0.;
00068   temp.set(3) = 0.;
00069   temp.std_spectral_base() ;
00070 
00071   Scalar tmp = psi * psi * psi * trK 
00072     - contract(get_k_dd(),0, 1, tgam.radial_vect() * tgam.radial_vect(), 0, 1) 
00073     / psi
00074     - psi * tgam.radial_vect().divergence(ff) 
00075     - 4 * ( tgam.radial_vect()(2) * psi.derive_cov(ff)(2) 
00076         + tgam.radial_vect()(3) * psi.derive_cov(ff)(3) ) ;
00077   
00078   tmp = tmp / (4 * tgam.radial_vect()(1)) ;
00079 
00080   // in this case you don't have to substract any value
00081  
00082   Valeur psi_bound (mp.get_mg()->get_angu() )  ;
00083   
00084   int nnp = mp.get_mg()->get_np(1) ;
00085   int nnt = mp.get_mg()->get_nt(1) ;
00086             
00087   psi_bound = 1 ;
00088             
00089   for (int k=0 ; k<nnp ; k++)
00090     for (int j=0 ; j<nnt ; j++)
00091       psi_bound.set(0, k, j, 0) = tmp.val_grid_point(1, k, j, 0) ;
00092 
00093   psi_bound.std_base_scal() ;
00094   
00095   return psi_bound ;
00096 
00097 }
00098 
00099 const Valeur Single_hor::boundary_nn_Neu(double cc)const  {
00100   
00101   double rho = 1. ; // 1 is the standart case;
00102 
00103   Scalar tmp = - cc * nn ;
00104   //  Scalar tmp = - nn()/psi()*psi().dsdr() ;
00105 
00106   // in this case you don't have to substract any value
00107   tmp += (rho - 1) * tgam.radial_vect()(1)  * dn(1)  ;
00108   tmp = tmp / (rho * tgam.radial_vect()(1))  ;
00109 
00110   int nnp = mp.get_mg()->get_np(1) ;
00111   int nnt = mp.get_mg()->get_nt(1) ;
00112 
00113   Valeur nn_bound (mp.get_mg()->get_angu()) ;
00114     
00115   nn_bound = 1 ;   // Juste pour affecter dans espace des configs ;
00116   
00117   for (int k=0 ; k<nnp ; k++)
00118     for (int j=0 ; j<nnt ; j++)
00119       nn_bound.set(0, k, j, 0) = tmp.val_grid_point(1, k, j, 0) ;
00120   
00121   nn_bound.std_base_scal() ;
00122   
00123   return  nn_bound ;
00124 
00125 }
00126 
00127 
00128 const Valeur Single_hor::boundary_nn_Dir(double cc)const {
00129 
00130   Scalar rho(mp);
00131   rho = 0. ;  // 0 is the standard case
00132 
00133   Scalar tmp(mp) ;
00134   tmp = cc ; 
00135   
00136  
00137   //tmp = 1./(2*psi()) ;
00138   //  tmp = - psi() * nn().dsdr() / (psi().dsdr())  ;
00139 
00140   // We  have substracted 1, since we solve for zero condition at infinity 
00141   //and then we add 1 to the solution  
00142 
00143   tmp = (tmp + rho * nn)/(1 + rho) ;
00144 
00145   tmp = tmp - 1 ;
00146 
00147   int nnp = mp.get_mg()->get_np(1) ;
00148   int nnt = mp.get_mg()->get_nt(1) ;
00149 
00150   Valeur nn_bound (mp.get_mg()->get_angu()) ;
00151     
00152   nn_bound = 1 ;  // Juste pour affecter dans espace des configs ;
00153   
00154   for (int k=0 ; k<nnp ; k++)
00155     for (int j=0 ; j<nnt ; j++)
00156       nn_bound.set(0, k, j, 0) = tmp.val_grid_point(1, k, j, 0) ;
00157   
00158   nn_bound.std_base_scal() ;
00159   
00160   return  nn_bound ;
00161 
00162 }
00163 
00164 // Component x of boundary value of beta
00165 //--------------------------------------
00166 
00167 const Valeur Single_hor:: boundary_beta_x(double om_orb, 
00168                       double om_loc)const {
00169 
00170     // Les alignemenents pour le signe des CL.
00171     double orientation = mp.get_rot_phi() ;
00172     assert ((orientation == 0) || (orientation == M_PI)) ;
00173     int aligne = (orientation == 0) ? 1 : -1 ;
00174    
00175     int nnp = mp.get_mg()->get_np(1) ;
00176     int nnt = mp.get_mg()->get_nt(1) ;
00177 
00178     Vector tmp_vect = nn * get_gam().radial_vect() ;
00179     tmp_vect.change_triad(mp.get_bvect_cart() ) ;
00180 
00181     //Isol_hor boundary conditions
00182   
00183     Valeur lim_x (mp.get_mg()->get_angu()) ;
00184     
00185     lim_x = 1 ;  // Juste pour affecter dans espace des configs ;
00186   
00187     Mtbl ya_mtbl (mp.get_mg()) ;
00188     ya_mtbl.set_etat_qcq() ;
00189     ya_mtbl = mp.ya ;
00190 
00191     Mtbl yy_mtbl (mp.get_mg()) ;
00192     yy_mtbl.set_etat_qcq() ;
00193     yy_mtbl = mp.y ;
00194 
00195     for (int k=0 ; k<nnp ; k++)
00196     for (int j=0 ; j<nnt ; j++)
00197       lim_x.set(0, k, j, 0) = aligne * om_orb * ya_mtbl(1, k, j, 0)
00198         + (om_loc-om_orb)* yy_mtbl(1, k, j, 0)
00199         + tmp_vect(1).val_grid_point(1, k, j, 0) ;
00200     
00201   lim_x.set_base(*(mp.get_mg()->std_base_vect_cart()[0])) ;
00202 
00203   return  lim_x ;
00204 }
00205 
00206 
00207 // Component y of boundary value of beta 
00208 //--------------------------------------
00209 
00210 const Valeur Single_hor:: boundary_beta_y(double om_orb, 
00211                       double om_loc)const {
00212 
00213     // Les alignemenents pour le signe des CL.
00214     double orientation = mp.get_rot_phi() ;
00215     assert ((orientation == 0) || (orientation == M_PI)) ;
00216     int aligne = (orientation == 0) ? 1 : -1 ;
00217     
00218 
00219     int nnp = mp.get_mg()->get_np(1) ;
00220     int nnt = mp.get_mg()->get_nt(1) ;
00221 
00222     Vector tmp_vect = nn * get_gam().radial_vect() ;
00223     tmp_vect.change_triad(mp.get_bvect_cart() ) ;
00224 
00225     //Isol_hor boundary conditions
00226   
00227     Valeur lim_y (mp.get_mg()->get_angu()) ;
00228     
00229     lim_y = 1 ;  // Juste pour affecter dans espace des configs ;
00230   
00231     Mtbl xa_mtbl (mp.get_mg()) ;
00232     xa_mtbl.set_etat_qcq() ;
00233     xa_mtbl = mp.xa ;
00234 
00235     Mtbl xx_mtbl (mp.get_mg()) ;
00236     xx_mtbl.set_etat_qcq() ;
00237     xx_mtbl = mp.x ;
00238   
00239     for (int k=0 ; k<nnp ; k++)
00240     for (int j=0 ; j<nnt ; j++)
00241       lim_y.set(0, k, j, 0) = - aligne *om_orb * xa_mtbl(1, k, j, 0) -
00242         (om_loc-om_orb)*xx_mtbl(1, k, j, 0)
00243         + tmp_vect(2).val_grid_point(1, k, j, 0) ;
00244     
00245   lim_y.set_base(*(mp.get_mg()->std_base_vect_cart()[1])) ;
00246 
00247   return  lim_y ;
00248 }
00249 
00250 // Component z of boundary value of beta 
00251 //--------------------------------------
00252 
00253 const Valeur Single_hor:: boundary_beta_z()const {
00254     
00255     int nnp = mp.get_mg()->get_np(1) ;
00256     int nnt = mp.get_mg()->get_nt(1) ;
00257 
00258     Vector tmp_vect = nn * get_gam().radial_vect() ;
00259     tmp_vect.change_triad(mp.get_bvect_cart() ) ;
00260 
00261     //Isol_hor boundary conditions
00262   
00263     Valeur lim_z (mp.get_mg()->get_angu()) ;
00264     
00265     lim_z = 1 ;  // Juste pour affecter dans espace des configs ;
00266   
00267     for (int k=0 ; k<nnp ; k++)
00268     for (int j=0 ; j<nnt ; j++)
00269         lim_z.set(0, k, j, 0) = tmp_vect(3).val_grid_point(1, k, j, 0) ;
00270     
00271   lim_z.set_base(*(mp.get_mg()->std_base_vect_cart()[2])) ;
00272 
00273   return  lim_z ;
00274 }
00275 

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