pseudo_misner.C

00001 /*
00002  *   Copyright (c) 2003 Keisuke Taniguchi
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License version 2
00008  *   as published by the Free Software Foundation.
00009  *
00010  *   LORENE is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with LORENE; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  */
00020 
00021 char pseudo_misner_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_ns_bh/pseudo_misner.C,v 1.2 2007/04/24 20:13:53 f_limousin Exp $" ;
00022 
00023 /*
00024  * $Id: pseudo_misner.C,v 1.2 2007/04/24 20:13:53 f_limousin Exp $
00025  * $Log: pseudo_misner.C,v $
00026  * Revision 1.2  2007/04/24 20:13:53  f_limousin
00027  * Implementation of Dirichlet and Neumann BC for the lapse
00028  *
00029  * Revision 1.1  2005/09/09 09:00:02  p_grandclement
00030  * add pseudo_misner
00031  *
00032 
00033  * $Header: /cvsroot/Lorene/C++/Source/Bin_ns_bh/pseudo_misner.C,v 1.2 2007/04/24 20:13:53 f_limousin Exp $
00034  *
00035  */
00036 
00037 // Headers C
00038 #include <math.h>
00039 
00040 // Headers Lorene
00041 #include "bhole.h"
00042 #include "nbr_spx.h"
00043 #include "et_bin_nsbh.h"
00044 #include "etoile.h"
00045 #include "param.h"
00046 #include "bin_ns_bh.h"
00047 
00048 #include "graphique.h"
00049 #include "utilitaires.h"
00050 #include "unites.h"
00051 
00052 void Bin_ns_bh::pseudo_misner (int& ite, int itemax, double relax, 
00053                    double precis, int bound_nn, double lim_nn) {
00054                 
00055     using namespace Unites ;
00056  
00057     // Parameters for the function Map_et::poisson for n_auto
00058     // ------------------------------------------------------
00059     Cmp source_n_prev (star.get_mp()) ;
00060     source_n_prev.set_etat_zero() ;
00061     
00062     Param par_poisson1 ;
00063     par_poisson1.add_int(itemax,  0) ;  // maximum number of iterations
00064     par_poisson1.add_double(relax,  0) ; // relaxation parameter
00065     par_poisson1.add_double(precis, 1) ; // required precision
00066     par_poisson1.add_int_mod(ite, 0) ; // number of iterations actually used
00067     par_poisson1.add_cmp_mod(source_n_prev) ;
00068     
00069     // Parameters for the function Map_et::poisson for confpsi_auto
00070     // ------------------------------------------------------------
00071     Cmp source_psi_prev (star.get_mp()) ;
00072     source_psi_prev.set_etat_zero() ;
00073     
00074     Param par_poisson2 ;
00075     par_poisson2.add_int(itemax,  0) ;  // maximum number of iterations
00076     par_poisson2.add_double(relax,  0) ; // relaxation parameter
00077     par_poisson2.add_double(precis, 1) ; // required precision
00078     par_poisson2.add_int_mod(ite, 0) ; // number of iterations actually used
00079     par_poisson2.add_cmp_mod(source_psi_prev) ;
00080   
00081 
00082     bool loop = true ;
00083     
00084     //=========================================================================
00085     //          Start of iteration
00086     //=========================================================================
00087     double erreur ;
00088     int itere =  1 ;
00089     
00090     while (loop) {
00091 
00092         Tenseur n_auto_old (star.n_auto()) ;
00093     Tenseur psi_auto_old (star.confpsi_auto()) ;
00094     Tenseur n_auto_hole (hole.n_auto()) ;
00095     
00096     Tenseur confpsi_q = pow(star.confpsi, 4.) ;
00097     Tenseur confpsi_c = pow(star.confpsi, 5.) ;
00098         
00099     // Lapse star
00100     Tenseur source_n (qpig * star.nnn * confpsi_q * (star.ener_euler + star.s_euler)
00101         - 2.*flat_scalar_prod((star.d_confpsi_auto+star.d_confpsi_comp), star.d_n_auto) / star.confpsi) ;
00102     source_n.set_std_base() ;
00103     source_n().poisson(par_poisson1, star.n_auto.set()) ;
00104     star.n_auto.set() = star.n_auto() + 0.5 ; 
00105     star.n_auto.set() = relax * star.n_auto() + (1-relax)*n_auto_old() ;
00106         erreur = max(diffrelmax(star.n_auto(), n_auto_old())) ;
00107     
00108     // Psi star
00109     Tenseur source_psi (-0.5 * qpig * confpsi_c * star.ener_euler) ;
00110     source_psi.set_std_base() ;
00111     source_psi().poisson(par_poisson2, star.confpsi_auto.set()) ;
00112     star.confpsi_auto.set() = star.confpsi_auto() + 0.5 ;
00113     star.confpsi_auto.set() = relax*star.confpsi_auto() + (1-relax)*psi_auto_old() ;
00114     
00115     // Trou noir :
00116     hole.update_metric (star) ;
00117     hole.solve_lapse_with_ns (relax, bound_nn, lim_nn) ;
00118     //erreur = max(diffrelmax(hole.n_auto(), n_auto_hole())) ;
00119     
00120     hole.solve_psi_with_ns (relax) ;
00121         
00122     star.update_metric (hole) ;
00123     star.update_metric_der_comp(hole) ;
00124         
00125     star.equation_of_state() ;
00126         star.kinematics(get_omega(), get_x_axe()) ;
00127     star.fait_d_psi() ;
00128         star.hydro_euler() ;
00129      
00130     cout << "Step " << itere << " " << erreur << endl ;
00131     
00132     if ((itere==itemax) || (erreur<precis))
00133         loop = false ;
00134     itere ++ ;
00135     }
00136     
00137   ite = itere ;
00138 }

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