/* * Simple code for solving the Ernst equation for Kerr * boundary data in rotating coordinates with Lorene. * The boundary data are given on a sphere, the focus is * on the treatement of the light cylinder * * 28.01.03 * */ /* * Copyright (c) 2002 E. Gourgoulhon, C. Klein * * 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 name_of_this_file_C[] = "$Header: /cvsroot/Lorene/Codes/Ernstbbh/ernstbbh.C,v 1.6 2014/10/13 08:53:56 j_novak Exp $" ; /* * * $Header: /cvsroot/Lorene/Codes/Ernst/ernstbbh.C */ // C++ headers #include "headcpp.h" // C headers #include // Lorene headers #include "cmp.h" #include "nbr_spx.h" #include "graphique.h" #include "utilitaires.h" //============================================================= using namespace Lorene ; int main() { // Read grid parameters from a file // -------------------------------- ifstream parfile("ernstpar.d") ; char blabla[80] ; int nz, nr, nt, np ; double mu, alpha, M, tol; int MaxIt; parfile >> nz ; parfile.getline(blabla, 80) ; parfile >> nr ; parfile.getline(blabla, 80) ; parfile >> nt ; parfile.getline(blabla, 80) ; parfile >> np ; parfile.getline(blabla, 80) ; parfile >> mu ; parfile.getline(blabla, 80) ; parfile >> MaxIt ; parfile.getline(blabla, 80) ; parfile >> tol ; parfile.getline(blabla, 80) ; parfile >> M ; parfile.getline(blabla, 80) ; parfile >> alpha ; parfile.getline(blabla, 80) ; parfile.close() ; const double c = cos(alpha); // const double c2 = cos(2*alpha); const double s = sin(alpha); const double cc = c*c; const double Mc = M*c; const double J = M*M*s; // angular momentum const double Om = 0.5*tan(0.5*alpha)/M; // angular velocity of the horizon cout << "mass: " << Mc <<"\t" << J <<"\t" << Om << endl; // Construction of a multi-grid (Mg3d) // ----------------------------------- Mg3d mgrid(nz, nr, nt, np, SYM, SYM, true) ; cout << "Mult_grid : " << mgrid << endl ; // Construction of an affine mapping (Map_af) // ------------------------------------------ double* r_limits = new double[nz+1] ; assert( nz == 3 ) ; r_limits[0] = 0 ; r_limits[1] = 1 ; r_limits[2] = 2 ; r_limits[3] = __infinity ; Map_af map(mgrid, r_limits) ; // Construction of a scalar field (Cmp) // ------------------------------------ const Coord& z = map.z ; const Coord& r = map.r ; // const Coord& cost = map.cost ; // const Coord& sint = map.sint ; Cmp U(map) ; Cmp V(map) ; Cmp Usource(map); // RHS for the real part of the Ernst equation Cmp Vsource(map); // RHS for the imaginary part of the Ernst equation // Auxiliary fields for the Kerr solution //------------------------ Cmp F(map); // real part of the Ernst potential Cmp B(map); // imaginary part of the Ernst potential Cmp A(map); // metric function -g_tphi Cmp Rp(map); Cmp Rm(map); Rp = sqrt(Mc*Mc + r*r + 2*Mc*z); Rm = sqrt(Mc*Mc + r*r - 2*Mc*z); Cmp X = 0.5*(Rp+Rm)/Mc;//parabolic coordinates Cmp Y = 0.5*(Rp-Rm)/Mc; Cmp N = (c*X+1)*(c*X+1)+s*s*Y*Y; F = (cc*X*X+s*s*Y*Y-1)/N; B = -2*s*Y/N; A = 2*M*s*(1-Y*Y)*(1+c*X)/N; for (int i=0;i