/* * Method of class Et_bin_bhns_extr to compute an equilibrium configuration * of a BH-NS binary system with an extreme mass ratio * * (see file et_bin_bhns_extr.h for documentation). * */ /* * Copyright (c) 2004-2005 Keisuke Taniguchi * 2004 Joshua A. Faber * * This file is part of LORENE. * * LORENE is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * LORENE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char et_bin_bhns_extr_eq_ylm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_bhns_extr_eq_ylm.C,v 1.7 2014/10/13 08:52:54 j_novak Exp $" ; /* * $Id: et_bin_bhns_extr_eq_ylm.C,v 1.7 2014/10/13 08:52:54 j_novak Exp $ * $Log: et_bin_bhns_extr_eq_ylm.C,v $ * Revision 1.7 2014/10/13 08:52:54 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.6 2014/10/06 15:13:07 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.5 2005/02/28 23:12:28 k_taniguchi * Modification to include the case of the conformally flat background metric * * Revision 1.4 2005/01/31 20:28:14 k_taniguchi * Addition of a number of coefficients which are deleted in the filtre_phi * in the argument. * * Revision 1.3 2005/01/25 17:42:02 k_taniguchi * Suppression of the filter for the source term of the shift vector. * * Revision 1.2 2005/01/03 18:03:39 k_taniguchi * Addition of the method to fix the position of the neutron star * in the coordinate system. * * Revision 1.1 2004/12/29 16:31:24 k_taniguchi * *** empty log message *** * * * * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_bhns_extr_eq_ylm.C,v 1.7 2014/10/13 08:52:54 j_novak Exp $ * */ // C headers #include // Lorene headers #include "et_bin_bhns_extr.h" #include "etoile.h" #include "map.h" #include "coord.h" #include "param.h" #include "eos.h" #include "graphique.h" #include "utilitaires.h" #include "unites.h" namespace Lorene { void Et_bin_bhns_extr::equil_bhns_extr_ylm_ks(double ent_c, const double& mass, const double& sepa, double* nu_int, double* beta_int, double* shift_int, int mermax, int mermax_poisson, double relax_poisson, double relax_ylm, int mermax_potvit, double relax_potvit, int np_filter, double thres_adapt, Tbl& diff) { // Fundamental constants and units // ------------------------------- using namespace Unites ; assert( kerrschild == true ) ; // Initializations // --------------- const Mg3d* mg = mp.get_mg() ; int nz = mg->get_nzone() ; // total number of domains // The following is required to initialize mp_prev as a Map_et: Map_et& mp_et = dynamic_cast(mp) ; // Domain and radial indices of points at the surface of the star: int l_b = nzet - 1 ; int i_b = mg->get_nr(l_b) - 1 ; int k_b ; int j_b ; // Value of the enthalpy defining the surface of the star double ent_b = 0 ; // Error indicators // ---------------- double& diff_ent = diff.set(0) ; double& diff_vel_pot = diff.set(1) ; double& diff_logn = diff.set(2) ; double& diff_beta = diff.set(3) ; double& diff_shift_x = diff.set(4) ; double& diff_shift_y = diff.set(5) ; double& diff_shift_z = diff.set(6) ; // Parameters for the function Map_et::adapt // ----------------------------------------- Param par_adapt ; int nitermax = 100 ; int niter ; int adapt_flag = 1 ; // 1 = performs the full computation, // 0 = performs only the rescaling by // the factor alpha_r int nz_search = nzet ; // Number of domains for searching // the enthalpy isosurfaces double precis_secant = 1.e-14 ; double alpha_r ; double reg_map = 1. ; // 1 = regular mapping, 0 = contracting mapping Tbl ent_limit(nz) ; par_adapt.add_int(nitermax, 0) ; // maximum number of iterations to // locate zeros by the secant method par_adapt.add_int(nzet, 1) ; // number of domains where the adjustment // to the isosurfaces of ent is to be // performed par_adapt.add_int(nz_search, 2) ; // number of domains to search for // the enthalpy isosurface par_adapt.add_int(adapt_flag, 3) ; // 1 = performs the full computation, // 0 = performs only the rescaling by // the factor alpha_r par_adapt.add_int(j_b, 4) ; // theta index of the collocation point // (theta_*, phi_*) par_adapt.add_int(k_b, 5) ; // theta index of the collocation point // (theta_*, phi_*) par_adapt.add_int_mod(niter, 0) ; // number of iterations actually // used in the secant method par_adapt.add_double(precis_secant, 0) ; // required absolute precision in // the determination of zeros by // the secant method par_adapt.add_double(reg_map, 1) ; // 1 = regular mapping, // 0 = contracting mapping par_adapt.add_double(alpha_r, 2) ; // factor by which all the radial // distances will be multiplied par_adapt.add_tbl(ent_limit, 0) ; // array of values of the field ent // to define the isosurfaces // Parameters for the function Map_et::poisson for logn_auto // --------------------------------------------------------- double precis_poisson = 1.e-16 ; Param par_poisson1 ; par_poisson1.add_int(mermax_poisson, 0) ; // maximum number of iterations par_poisson1.add_double(relax_poisson, 0) ; // relaxation parameter par_poisson1.add_double(precis_poisson, 1) ; // required precision par_poisson1.add_int_mod(niter, 0) ; // number of iterations actually // used par_poisson1.add_cmp_mod( ssjm1_logn ) ; // Parameters for the function Map_et::poisson for beta_auto // --------------------------------------------------------- Param par_poisson2 ; par_poisson2.add_int(mermax_poisson, 0) ; // maximum number of iterations par_poisson2.add_double(relax_poisson, 0) ; // relaxation parameter par_poisson2.add_double(precis_poisson, 1) ; // required precision par_poisson2.add_int_mod(niter, 0) ; // number of iterations actually // used par_poisson2.add_cmp_mod( ssjm1_beta ) ; // Parameters for the function Tenseur::poisson_vect // ------------------------------------------------- Param par_poisson_vect ; par_poisson_vect.add_int(mermax_poisson, 0) ; // maximum number of // iterations par_poisson_vect.add_double(relax_poisson, 0) ; // relaxation parameter par_poisson_vect.add_double(precis_poisson, 1) ; // required precision par_poisson_vect.add_cmp_mod( ssjm1_khi ) ; par_poisson_vect.add_tenseur_mod( ssjm1_wshift ) ; par_poisson_vect.add_int_mod(niter, 0) ; // External potential // See Eq (99) from Gourgoulhon et al. (2001) // ----------------------------------------- Tenseur pot_ext = logn_comp + pot_centri + loggam ; Tenseur ent_jm1 = ent ; // Enthalpy at previous step Tenseur source(mp) ; // source term in the equation for logn_auto // and beta_auto Tenseur source_shift(mp, 1, CON, ref_triad) ; // source term in the // equation for shift_auto // maximum l to evaluate multipole moments y_lm int l_max = 4 ; if (l_max > 6) { cout << "We don't have those ylm programmed yet!!!!" << endl ; abort() ; } int nylm = (l_max+1) * (l_max+1) ; Cmp** ylmvec = new Cmp* [nylm] ; //==========================================================// // Start of iteration // //==========================================================// for(int mer=0 ; mer enthalpy in all space // See Eq (98) from Gourgoulhon et al. (2001) //-------------------------------------------- ent = (ent_c + logn_auto_c + pot_ext_c) - logn_auto - pot_ext ; //---------------------------------------------------------- // Change the enthalpy field to be set its maximum position // at the coordinate center //---------------------------------------------------------- double dentdx = ent().dsdx()(0, 0, 0, 0) ; double dentdy = ent().dsdy()(0, 0, 0, 0) ; cout << "dH/dx|_center = " << dentdx << endl ; cout << "dH/dy|_center = " << dentdy << endl ; double dec_fact = 1. ; Tenseur func_in(mp) ; func_in.set_etat_qcq() ; func_in.set() = 1. - dec_fact * (dentdx/ent_c) * mp.x - dec_fact * (dentdy/ent_c) * mp.y ; func_in.set().annule(nzet, nz-1) ; func_in.set_std_base() ; Tenseur func_ex(mp) ; func_ex.set_etat_qcq() ; func_ex.set() = 1. ; func_ex.set().annule(0, nzet-1) ; func_ex.set_std_base() ; // New enthalpy field // ------------------ ent.set() = ent() * (func_in() + func_ex()) ; (ent().va).smooth(nzet, (ent.set()).va) ; double dentdx_new = ent().dsdx()(0, 0, 0, 0) ; double dentdy_new = ent().dsdy()(0, 0, 0, 0) ; cout << "dH/dx|_new = " << dentdx_new << endl ; cout << "dH/dy|_new = " << dentdy_new << endl ; //----------------------------------------------------- // Adaptation of the mapping to the new enthalpy field //---------------------------------------------------- // Shall the adaptation be performed (cusp) ? // ------------------------------------------ double dent_eq = ent().dsdr().val_point(ray_eq_pi(),M_PI/2.,M_PI) ; double dent_pole = ent().dsdr().val_point(ray_pole(),0.,0.) ; double rap_dent = fabs( dent_eq / dent_pole ) ; cout << "| dH/dr_eq / dH/dr_pole | = " << rap_dent << endl ; if ( rap_dent < thres_adapt ) { adapt_flag = 0 ; // No adaptation of the mapping cout << "******* FROZEN MAPPING *********" << endl ; } else{ adapt_flag = 1 ; // The adaptation of the mapping is to be // performed } ent_limit.set_etat_qcq() ; for (int l=0; lget_np(l_b); k++) { for (int j=0; jget_nt(l_b); j++) { double xx = fabs( ent()(l_b, k, j, i_b) ) ; if (xx > ent_s_max) { ent_s_max = xx ; k_s_max = k ; j_s_max = j ; } } } cout << "Max. abs(enthalpy) at the boundary between domains nzet-1" << " and nzet : " << endl ; cout << " " << ent_s_max << " reached for k = " << k_s_max << " and j = " << j_s_max << endl ; //****************************************** // Call this each time the mapping changes, // but no more often than that //****************************************** int oldindex = -1 ; for (int l=0; l<=l_max; l++) { for (int m=0; m<= l; m++) { int index = l*l + 2*m ; if(m > 0) index -= 1 ; if(index != oldindex+1) { cout << "error!! " << l << " " << m << " " << index << " " << oldindex << endl ; abort() ; } // set up Cmp's in ylmvec with proper parity if ((l+m) % 2 == 0) { ylmvec[index] = new Cmp (logn_auto()) ; } else { ylmvec[index] = new Cmp (shift_auto(2)) ; } oldindex = index ; if (m > 0) { index += 1 ; if((l+m) % 2 == 0) { ylmvec[index] = new Cmp (logn_auto()) ; } else { ylmvec[index] = new Cmp (shift_auto(2)) ; } oldindex = index ; } } } if(oldindex+1 != nylm) { cout << "ERROR!!! " << oldindex << " "<< nylm << endl ; abort() ; } // This may need to be in some class definition, // it references the relevant map_et get_ylm(nylm, ylmvec); //------------------- // Equation of state //------------------- equation_of_state() ; // computes new values for nbar (n), ener (e) // and press (p) from the new ent (H) //---------------------------------------------------------- // Matter source terms in the gravitational field equations //--------------------------------------------------------- hydro_euler_extr(mass, sepa) ; // computes new values for // ener_euler (E), s_euler (S) // and u_euler (U^i) //---------------------------------------------------- // Auxiliary terms for the source of Poisson equation //---------------------------------------------------- const Coord& xx = mp.x ; const Coord& yy = mp.y ; const Coord& zz = mp.z ; Tenseur r_bh(mp) ; r_bh.set_etat_qcq() ; r_bh.set() = pow( (xx+sepa)*(xx+sepa) + yy*yy + zz*zz, 0.5) ; r_bh.set_std_base() ; Tenseur xx_cov(mp, 1, COV, ref_triad) ; xx_cov.set_etat_qcq() ; xx_cov.set(0) = xx + sepa ; xx_cov.set(1) = yy ; xx_cov.set(2) = zz ; xx_cov.set_std_base() ; Tenseur xsr_cov(mp, 1, COV, ref_triad) ; xsr_cov = xx_cov / r_bh ; xsr_cov.set_std_base() ; Tenseur msr(mp) ; msr = ggrav * mass / r_bh ; msr.set_std_base() ; Tenseur lapse_bh(mp) ; lapse_bh = 1. / sqrt( 1.+2.*msr ) ; lapse_bh.set_std_base() ; Tenseur lapse_bh2(mp) ; // lapse_bh * lapse_bh lapse_bh2 = 1. / (1.+2.*msr) ; lapse_bh2.set_std_base() ; Tenseur ldnu(mp) ; ldnu = flat_scalar_prod_desal(xsr_cov, d_logn_auto) ; ldnu.set_std_base() ; Tenseur ldbeta(mp) ; ldbeta = flat_scalar_prod_desal(xsr_cov, d_beta_auto) ; ldbeta.set_std_base() ; Tenseur lltkij(mp) ; lltkij.set_etat_qcq() ; lltkij.set() = 0 ; lltkij.set_std_base() ; for (int i=0; i<3; i++) for (int j=0; j<3; j++) lltkij.set() += xsr_cov(i) * xsr_cov(j) * tkij_auto(i, j) ; Tenseur lshift(mp) ; lshift = flat_scalar_prod_desal(xsr_cov, shift_auto) ; lshift.set_std_base() ; Tenseur d_ldnu(mp, 1, COV, ref_triad) ; d_ldnu = ldnu.gradient() ; // (d/dx, d/dy, d/dz) d_ldnu.change_triad(ref_triad) ; // --> (d/dX, d/dY, d/dZ) Tenseur ldldnu(mp) ; ldldnu = flat_scalar_prod_desal(xsr_cov, d_ldnu) ; ldldnu.set_std_base() ; Tenseur d_ldbeta(mp, 1, COV, ref_triad) ; d_ldbeta = ldbeta.gradient() ; // (d/dx, d/dy, d/dz) d_ldbeta.change_triad(ref_triad) ; // --> (d/dX, d/dY, d/dZ) Tenseur ldldbeta(mp) ; ldldbeta = flat_scalar_prod_desal(xsr_cov, d_ldbeta) ; ldldbeta.set_std_base() ; //------------------------------------------ // Poisson equation for logn_auto (nu_auto) //------------------------------------------ // Source // ------ if (relativistic) { source = qpig * a_car % (ener_euler + s_euler) + akcar_auto - flat_scalar_prod_desal(d_logn_auto, d_beta_auto) + 2.*lapse_bh2 % msr % (ldnu % ldbeta + ldldnu) + lapse_bh2 % lapse_bh2 % msr % (2.*(ldnu + 4.*msr % ldnu) - ldbeta) / r_bh - (4.*a_car % lapse_bh2 % lapse_bh2 % msr / 3. / nnn / r_bh) * (2.+3.*msr) * (3.+4.*msr) * lltkij + (2.*a_car % lapse_bh2 % lapse_bh2 % lapse_bh % msr / nnn / r_bh / r_bh) * (2.+10.*msr+9.*msr%msr) * lshift + (4.*pow(lapse_bh2, 3.) % msr % msr / 3. / r_bh / r_bh) % (2.*(a_car%lapse_bh2/nnn/nnn - 1.) * pow(2.+3.*msr, 2.) + (a_car - 1.) % pow(1.+3.*msr, 2.) - 3.*(a_car%lapse_bh/nnn - 1.)*(2.+10.*msr+9.*msr%msr)) ; } else { cout << "The computation of BH-NS binary systems" << " should be relativistic !!!" << endl ; abort() ; } source.set_std_base() ; // Resolution of the Poisson equation // ---------------------------------- double* intvec_logn = new double[nylm] ; // get_integrals needs access to map_et get_integrals(nylm, intvec_logn, ylmvec, source()) ; // relax if you have a previously calculated set of moments if(nu_int[0] != -1.0) { for (int i=0; i 2 */ double lambda_shift = double(1) / double(3) ; double* intvec_shift = new double[4*nylm] ; for (int i=0; i<3; i++) { double* intvec = new double[nylm]; get_integrals(nylm, intvec, ylmvec, source_shift(i)); for (int j=0; j 0 // Grad(div) : Tenseur graddivn = divna.gradient() ; // graddivn.inc2_dzpuis() ; // dzpuis 2 -> 4 // Full operator : Tenseur lap_shift(mp, 1, CON, mp.get_bvect_cart() ) ; lap_shift.set_etat_qcq() ; for (int i=0; i<3; i++) { lap_shift.set(i) = shift_auto(i).laplacien() + lambda_shift * graddivn(i) ; } Tbl tdiff_shift_x = diffrel(lap_shift(0), source_shift(0)) ; Tbl tdiff_shift_y = diffrel(lap_shift(1), source_shift(1)) ; Tbl tdiff_shift_z = diffrel(lap_shift(2), source_shift(2)) ; cout << "Relative error in the resolution of the equation for " << "shift_auto : " << endl ; cout << "x component : " ; for (int l=0; lget_nzone() ; // total number of domains // The following is required to initialize mp_prev as a Map_et: Map_et& mp_et = dynamic_cast(mp) ; // Domain and radial indices of points at the surface of the star: int l_b = nzet - 1 ; int i_b = mg->get_nr(l_b) - 1 ; int k_b ; int j_b ; // Value of the enthalpy defining the surface of the star double ent_b = 0 ; // Error indicators // ---------------- double& diff_ent = diff.set(0) ; double& diff_vel_pot = diff.set(1) ; double& diff_logn = diff.set(2) ; double& diff_beta = diff.set(3) ; double& diff_shift_x = diff.set(4) ; double& diff_shift_y = diff.set(5) ; double& diff_shift_z = diff.set(6) ; // Parameters for the function Map_et::adapt // ----------------------------------------- Param par_adapt ; int nitermax = 100 ; int niter ; int adapt_flag = 1 ; // 1 = performs the full computation, // 0 = performs only the rescaling by // the factor alpha_r int nz_search = nzet ; // Number of domains for searching // the enthalpy isosurfaces double precis_secant = 1.e-14 ; double alpha_r ; double reg_map = 1. ; // 1 = regular mapping, 0 = contracting mapping Tbl ent_limit(nz) ; par_adapt.add_int(nitermax, 0) ; // maximum number of iterations to // locate zeros by the secant method par_adapt.add_int(nzet, 1) ; // number of domains where the adjustment // to the isosurfaces of ent is to be // performed par_adapt.add_int(nz_search, 2) ; // number of domains to search for // the enthalpy isosurface par_adapt.add_int(adapt_flag, 3) ; // 1 = performs the full computation, // 0 = performs only the rescaling by // the factor alpha_r par_adapt.add_int(j_b, 4) ; // theta index of the collocation point // (theta_*, phi_*) par_adapt.add_int(k_b, 5) ; // theta index of the collocation point // (theta_*, phi_*) par_adapt.add_int_mod(niter, 0) ; // number of iterations actually // used in the secant method par_adapt.add_double(precis_secant, 0) ; // required absolute precision in // the determination of zeros by // the secant method par_adapt.add_double(reg_map, 1) ; // 1 = regular mapping, // 0 = contracting mapping par_adapt.add_double(alpha_r, 2) ; // factor by which all the radial // distances will be multiplied par_adapt.add_tbl(ent_limit, 0) ; // array of values of the field ent // to define the isosurfaces // Parameters for the function Map_et::poisson for logn_auto // --------------------------------------------------------- double precis_poisson = 1.e-16 ; Param par_poisson1 ; par_poisson1.add_int(mermax_poisson, 0) ; // maximum number of iterations par_poisson1.add_double(relax_poisson, 0) ; // relaxation parameter par_poisson1.add_double(precis_poisson, 1) ; // required precision par_poisson1.add_int_mod(niter, 0) ; // number of iterations actually // used par_poisson1.add_cmp_mod( ssjm1_logn ) ; // Parameters for the function Map_et::poisson for beta_auto // --------------------------------------------------------- Param par_poisson2 ; par_poisson2.add_int(mermax_poisson, 0) ; // maximum number of iterations par_poisson2.add_double(relax_poisson, 0) ; // relaxation parameter par_poisson2.add_double(precis_poisson, 1) ; // required precision par_poisson2.add_int_mod(niter, 0) ; // number of iterations actually // used par_poisson2.add_cmp_mod( ssjm1_beta ) ; // Parameters for the function Tenseur::poisson_vect // ------------------------------------------------- Param par_poisson_vect ; par_poisson_vect.add_int(mermax_poisson, 0) ; // maximum number of // iterations par_poisson_vect.add_double(relax_poisson, 0) ; // relaxation parameter par_poisson_vect.add_double(precis_poisson, 1) ; // required precision par_poisson_vect.add_cmp_mod( ssjm1_khi ) ; par_poisson_vect.add_tenseur_mod( ssjm1_wshift ) ; par_poisson_vect.add_int_mod(niter, 0) ; // External potential // See Eq (99) from Gourgoulhon et al. (2001) // ----------------------------------------- Tenseur pot_ext = logn_comp + pot_centri + loggam ; Tenseur ent_jm1 = ent ; // Enthalpy at previous step Tenseur source(mp) ; // source term in the equation for logn_auto // and beta_auto Tenseur source_shift(mp, 1, CON, ref_triad) ; // source term in the // equation for shift_auto // maximum l to evaluate multipole moments y_lm int l_max = 4 ; if (l_max > 6) { cout << "We don't have those ylm programmed yet!!!!" << endl ; abort() ; } int nylm = (l_max+1) * (l_max+1) ; Cmp** ylmvec = new Cmp* [nylm] ; //==========================================================// // Start of iteration // //==========================================================// for(int mer=0 ; mer enthalpy in all space // See Eq (98) from Gourgoulhon et al. (2001) //-------------------------------------------- ent = (ent_c + logn_auto_c + pot_ext_c) - logn_auto - pot_ext ; //--------------------------------------------------------- // Change the enthalpy field to accelerate the convergence //--------------------------------------------------------- double dentdx = ent().dsdx()(0, 0, 0, 0) ; double dentdy = ent().dsdy()(0, 0, 0, 0) ; cout << "dH/dx|_center = " << dentdx << endl ; cout << "dH/dy|_center = " << dentdy << endl ; double dec_fact = 1. ; Tenseur func_in(mp) ; func_in.set_etat_qcq() ; func_in.set() = 1. - dec_fact * (dentdx/ent_c) * mp.x ; func_in.set().annule(nzet, nz-1) ; func_in.set_std_base() ; Tenseur func_ex(mp) ; func_ex.set_etat_qcq() ; func_ex.set() = 1. ; func_ex.set().annule(0, nzet-1) ; func_ex.set_std_base() ; // New enthalpy field // ------------------ ent.set() = ent() * (func_in() + func_ex()) ; (ent().va).smooth(nzet, (ent.set()).va) ; double dentdx_new = ent().dsdx()(0, 0, 0, 0) ; cout << "dH/dx|_new = " << dentdx_new << endl ; //----------------------------------------------------- // Adaptation of the mapping to the new enthalpy field //---------------------------------------------------- // Shall the adaptation be performed (cusp) ? // ------------------------------------------ double dent_eq = ent().dsdr().val_point(ray_eq_pi(),M_PI/2.,M_PI) ; double dent_pole = ent().dsdr().val_point(ray_pole(),0.,0.) ; double rap_dent = fabs( dent_eq / dent_pole ) ; cout << "| dH/dr_eq / dH/dr_pole | = " << rap_dent << endl ; if ( rap_dent < thres_adapt ) { adapt_flag = 0 ; // No adaptation of the mapping cout << "******* FROZEN MAPPING *********" << endl ; } else{ adapt_flag = 1 ; // The adaptation of the mapping is to be // performed } ent_limit.set_etat_qcq() ; for (int l=0; lget_np(l_b); k++) { for (int j=0; jget_nt(l_b); j++) { double xx = fabs( ent()(l_b, k, j, i_b) ) ; if (xx > ent_s_max) { ent_s_max = xx ; k_s_max = k ; j_s_max = j ; } } } cout << "Max. abs(enthalpy) at the boundary between domains nzet-1" << " and nzet : " << endl ; cout << " " << ent_s_max << " reached for k = " << k_s_max << " and j = " << j_s_max << endl ; //****************************************** // Call this each time the mapping changes, // but no more often than that //****************************************** int oldindex = -1 ; for (int l=0; l<=l_max; l++) { for (int m=0; m<= l; m++) { int index = l*l + 2*m ; if(m > 0) index -= 1 ; if(index != oldindex+1) { cout << "error!! " << l << " " << m << " " << index << " " << oldindex << endl ; abort() ; } // set up Cmp's in ylmvec with proper parity if ((l+m) % 2 == 0) { ylmvec[index] = new Cmp (logn_auto()) ; } else { ylmvec[index] = new Cmp (shift_auto(2)) ; } oldindex = index ; if (m > 0) { index += 1 ; if((l+m) % 2 == 0) { ylmvec[index] = new Cmp (logn_auto()) ; } else { ylmvec[index] = new Cmp (shift_auto(2)) ; } oldindex = index ; } } } if(oldindex+1 != nylm) { cout << "ERROR!!! " << oldindex << " "<< nylm << endl ; abort() ; } // This may need to be in some class definition, // it references the relevant map_et get_ylm(nylm, ylmvec); //------------------- // Equation of state //------------------- equation_of_state() ; // computes new values for nbar (n), ener (e) // and press (p) from the new ent (H) //---------------------------------------------------------- // Matter source terms in the gravitational field equations //--------------------------------------------------------- hydro_euler_extr(mass, sepa) ; // computes new values for // ener_euler (E), s_euler (S) // and u_euler (U^i) //---------------------------------------------------- // Auxiliary terms for the source of Poisson equation //---------------------------------------------------- const Coord& xx = mp.x ; const Coord& yy = mp.y ; const Coord& zz = mp.z ; Tenseur r_bh(mp) ; r_bh.set_etat_qcq() ; r_bh.set() = pow( (xx+sepa)*(xx+sepa) + yy*yy + zz*zz, 0.5) ; r_bh.set_std_base() ; Tenseur xx_cov(mp, 1, COV, ref_triad) ; xx_cov.set_etat_qcq() ; xx_cov.set(0) = xx + sepa ; xx_cov.set(1) = yy ; xx_cov.set(2) = zz ; xx_cov.set_std_base() ; Tenseur msr(mp) ; msr = ggrav * mass / r_bh ; msr.set_std_base() ; Tenseur tmp(mp) ; tmp = 1. / ( 1. - 0.25*msr*msr ) ; tmp.set_std_base() ; Tenseur xdnu(mp) ; xdnu = flat_scalar_prod_desal(xx_cov, d_logn_auto) ; xdnu.set_std_base() ; Tenseur xdbeta(mp) ; xdbeta = flat_scalar_prod_desal(xx_cov, d_beta_auto) ; xdbeta.set_std_base() ; //------------------------------------------ // Poisson equation for logn_auto (nu_auto) //------------------------------------------ // Source // ------ if (relativistic) { source = qpig * a_car % (ener_euler + s_euler) + akcar_auto - flat_scalar_prod_desal(d_logn_auto, d_beta_auto) - 0.5 * tmp % msr % msr % xdnu / r_bh / r_bh - tmp % msr % xdbeta / r_bh / r_bh ; } else { cout << "The computation of BH-NS binary systems" << " should be relativistic !!!" << endl ; abort() ; } source.set_std_base() ; // Resolution of the Poisson equation // ---------------------------------- double* intvec_logn = new double[nylm] ; // get_integrals needs access to map_et get_integrals(nylm, intvec_logn, ylmvec, source()) ; // relax if you have a previously calculated set of moments if(nu_int[0] != -1.0) { for (int i=0; i 2 */ double lambda_shift = double(1) / double(3) ; double* intvec_shift = new double[4*nylm] ; for (int i=0; i<3; i++) { double* intvec = new double[nylm]; get_integrals(nylm, intvec, ylmvec, source_shift(i)); for (int j=0; j 0 // Grad(div) : Tenseur graddivn = divna.gradient() ; // graddivn.inc2_dzpuis() ; // dzpuis 2 -> 4 // Full operator : Tenseur lap_shift(mp, 1, CON, mp.get_bvect_cart() ) ; lap_shift.set_etat_qcq() ; for (int i=0; i<3; i++) { lap_shift.set(i) = shift_auto(i).laplacien() + lambda_shift * graddivn(i) ; } Tbl tdiff_shift_x = diffrel(lap_shift(0), source_shift(0)) ; Tbl tdiff_shift_y = diffrel(lap_shift(1), source_shift(1)) ; Tbl tdiff_shift_z = diffrel(lap_shift(2), source_shift(2)) ; cout << "Relative error in the resolution of the equation for " << "shift_auto : " << endl ; cout << "x component : " ; for (int l=0; l