/* * Constructor of class Bin_BH (binary black hole exportation) * which depends explicitely on Lorene objects. * * (see file bin_bh.h for documentation). */ /* * Copyright (c) 2001-2002 Eric Gourgoulhon * * 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 bin_bh_aux_C[] = "$Header: /cvsroot/Lorene/Export/C++/Source/bin_bh_aux.C,v 1.9 2014/10/13 08:54:05 j_novak Exp $" ; /* * $Id: bin_bh_aux.C,v 1.9 2014/10/13 08:54:05 j_novak Exp $ * $Log: bin_bh_aux.C,v $ * Revision 1.9 2014/10/13 08:54:05 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.8 2014/10/06 15:13:25 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.7 2009/09/22 00:01:18 p_grandclement * change for reading new bholes * * Revision 1.6 2009/09/10 10:05:36 p_grandclement * slight change to read different mass BH * * Revision 1.5 2006/09/12 08:04:06 j_novak * Removal of the include path Export/C++/Include, updating of the relevant * source files in Export/C++/Source. * * Revision 1.4 2006/04/27 09:12:35 p_grandclement * First try at irrotational black holes * * Revision 1.3 2002/03/20 08:24:56 e_gourgoulhon * Added the derivatives of Psi. * * Revision 1.2 2001/12/19 11:20:56 e_gourgoulhon * Initialisation of radius2 was missing ! * * Revision 1.1 2001/12/18 22:27:04 e_gourgoulhon * Exportation of Lorene structures * * * * $Header: /cvsroot/Lorene/Export/C++/Source/bin_bh_aux.C,v 1.9 2014/10/13 08:54:05 j_novak Exp $ * */ #include "../Include/bin_bh.h" // C headers #include // Lorene headers #include "tenseur.h" #include "bhole.h" // Local prototype: namespace Lorene { double lagrange_parabol(double x, const double* xp, const double* yp) ; //----------------------------------------// // Constructor from LORENE data // //----------------------------------------// Bin_BH::Bin_BH(int nbpoints, const double* xi, const double* yi, const double* zi, int fill, const char* filename, bool mdiff) : np(nbpoints) { // Reading of data // --------------- FILE* fich = fopen(filename, "r") ; Mg3d* grille_1 = new Mg3d (fich) ; Mg3d* grille_2 ; if (mdiff) grille_2 = new Mg3d(fich) ; else grille_2 = 0x0 ; Map_af* map_un ; map_un = new Map_af (*grille_1, fich) ; Map_af* map_deux ; if (mdiff) map_deux = new Map_af (*grille_2, fich) ; else map_deux = new Map_af (*grille_1, fich) ; Bhole hole_un (*map_un, fich) ; Bhole hole_deux (*map_deux, fich) ; fclose(fich) ; assert (hole_un.get_omega() == hole_deux.get_omega()) ; // Construction of the binary system // --------------------------------- Bhole_binaire systeme (*map_un, *map_deux) ; systeme.set(1) = hole_un ; systeme.set(2) = hole_deux ; systeme.set_omega(hole_un.get_omega()) ; // On initialise les grandeurs derivees : systeme.set(1).fait_n_comp (systeme(2)) ; systeme.set(1).fait_psi_comp (systeme(2)) ; systeme.set(2).fait_n_comp (systeme(1)) ; systeme.set(2).fait_psi_comp (systeme(1)) ; systeme.fait_decouple() ; systeme.fait_tkij() ; // Initialisation of member data // ----------------------------- // Unit of length: double aa = systeme(1).get_rayon() ; double aasq = aa * aa ; double aa2 = systeme(2).get_rayon() ; radius2 = aa2 ; omega = systeme.get_omega() * aa ; dist = ( map_un->get_ori_x() - map_deux->get_ori_x() ) / aa ; cout << endl << "Binary system read in file : " << endl ; cout << "---------------------------- " << endl ; cout << " Separation d/a : " << dist << endl ; cout << " Omega : " << omega << " / a" << endl ; cout << " Size of black hole 2 : " << aa2 / aa << " a" << endl ; cout << " ADM mass : " << systeme.adm_systeme() / aa << " a" << endl ; cout << " Komar-lile mass : " << systeme.komar_systeme() / aa << " a" << endl ; cout << " Angular momentum : " << systeme.moment_systeme_inf() / (aa*aa) << " a^2" << endl ; cout << " Proper distance between the two throats : " << systeme.distance_propre() / aa << " a" << endl ; cout << " Area of black hole 1 apparent horizon : " << systeme(1).area() / (aa*aa) << " a^2" << endl ; cout << " Area of black hole 2 apparent horizon : " << systeme(2).area() / (aa*aa) << " a^2" << endl ; // Creation of the various arrays on the Cartesian grid // ---------------------------------------------------- alloc_memory() ; // Initialisation of the Cartesian grid // ------------------------------------ for (int i=0; i= aa) && (r2 >= aa2) ) { // Lapse function // -------------- nnn[i] = vnn1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vnn2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; // Shift vector // ------------ beta_x[i] = vbetax1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) - vbetax2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) - omega * yy[i] ; beta_y[i] = vbetay1.c_cf->val_point_symy(l1, xi1, theta1, phi1) - vbetay2.c_cf->val_point_symy(l2, xi2, theta2, phi2) + omega * xx[i] ; beta_z[i] = vbetaz1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) + vbetaz2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ; // 3-metric // -------- double psi4 = pow( vpsi1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vpsi2.c_cf->val_point_symy(l2, xi2, theta2, phi2), 4) ; g_xx[i] = psi4 ; g_yy[i] = psi4 ; g_zz[i] = psi4 ; g_xy[i] = 0 ; g_xz[i] = 0 ; g_yz[i] = 0 ; // Extrinsic curvature // ------------------- double pre = aa * psi4 ; k_xx[i] = pre * ( vkxx1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) + vkxx2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ) ; k_xy[i] = pre * ( vkxy1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vkxy2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ) ; k_xz[i] = pre * ( vkxz1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) - vkxz2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ) ; k_yy[i] = pre * ( vkyy1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) + vkyy2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ) ; k_yz[i] = pre * ( vkyz1.c_cf->val_point_symy(l1, xi1, theta1, phi1) - vkyz2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ) ; k_zz[i] = pre * ( vkzz1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) + vkzz2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ) ; // First derviatives of psi // ----------------------- dpsi_x[i] = vdpsix1.c_cf->val_point_symy(l1, xi1, theta1, phi1) - vdpsix2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; dpsi_y[i] = vdpsiy1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) - vdpsiy2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ; dpsi_z[i] = vdpsiz1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vdpsiz2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; // Second derviatives of psi // ------------------------- d2psi_xx[i] = vd2psixx1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vd2psixx2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; d2psi_xy[i] = vd2psixy1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) + vd2psixy2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ; d2psi_xz[i] = vd2psixz1.c_cf->val_point_symy(l1, xi1, theta1, phi1) - vd2psixz2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; d2psi_yy[i] = vd2psiyy1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vd2psiyy2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; d2psi_yz[i] = vd2psiyz1.c_cf->val_point_asymy(l1, xi1, theta1, phi1) - vd2psiyz2.c_cf->val_point_asymy(l2, xi2, theta2, phi2) ; d2psi_zz[i] = vd2psizz1.c_cf->val_point_symy(l1, xi1, theta1, phi1) + vd2psizz2.c_cf->val_point_symy(l2, xi2, theta2, phi2) ; } } // End of loop on the points delete map_un ; delete map_deux ; delete grille_1 ; if (mdiff) delete grille_2 ; } //========================================================================= // Interpolation/extrapolation by means of a parabola connecting // three points //========================================================================= double lagrange_parabol(double x, const double* xp, const double* yp) { double a0 = yp[0] / (xp[0] - xp[1]) / (xp[0] - xp[2]) ; double a1 = yp[1] / (xp[1] - xp[0]) / (xp[1] - xp[2]) ; double a2 = yp[2] / (xp[2] - xp[0]) / (xp[2] - xp[1]) ; return (x - xp[1]) * (x - xp[2]) * a0 + (x - xp[0]) * (x - xp[2]) * a1 + (x - xp[0]) * (x - xp[1]) * a2 ; } }