/* * Main code for computing stationary axisymmetric gravastar. * */ /* * Copyright (c) 2010 Frederic Vincent * * 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 as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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 gravastar_C[] = "$Header: /cvsroot/Lorene/Codes/GraVaStar/GraVaStar.C,v 1.2 2014/10/13 08:53:56 j_novak Exp $" ; /* * * * "$Header: /cvsroot/Lorene/Codes/GraVaStar/GraVaStar.C,v 1.2 2014/10/13 08:53:56 j_novak Exp $" * */ // C headers #include #include #include // Lorene headers #include "gravastar.h" #include "eos.h" #include "utilitaires.h" #include "graphique.h" #include "nbr_spx.h" #include "unites.h" namespace Lorene { // Local prototype (for drawings only) Scalar raccord_c1(const Scalar& uu, int l1) ; /* ***Comment: SERT A QUOI?? */ } //****************************************************************************** using namespace Lorene ; int main(){ using namespace Unites ; // Identification of all the subroutines called by the code : //system("ident nrotstar > identif.d") ; /* ***Comment: SERT A QUOI?? */ // For the display : char display_bold[]="x[1m" ; display_bold[0] = 27 ; //------------------------------------------------------------------ // Parameters of the computation //------------------------------------------------------------------ int mer_max, mer_rot, mer_change_omega, mer_fix_omega, delta_mer_kep, mermax_poisson, graph, nz, nzet, nzadapt, nt, np; double freq_si, fact_omega, precis, freq_ini_si, thres_adapt, relax, relax_poisson, precis_adapt, rho_core ; ifstream fpar("par_grav.d") ; if ( !fpar.good() ) { cerr << "Problem in opening the file par_grav.d ! " << endl ; abort() ; } fpar.ignore(1000,'\n') ; // skip title fpar >> freq_si ; fpar.ignore(1000,'\n') ; fpar >> fact_omega ; fpar.ignore(1000,'\n') ; fpar >> rho_core ; fpar.ignore(1000,'\n') ; fpar.ignore(1000,'\n') ; // skip title fpar >> mer_max ; fpar.ignore(1000,'\n') ; fpar >> precis ; fpar.ignore(1000,'\n') ; fpar >> mer_rot ; fpar.ignore(1000,'\n') ; fpar >> freq_ini_si ; fpar.ignore(1000,'\n') ; fpar >> mer_change_omega ; fpar.ignore(1000,'\n') ; fpar >> mer_fix_omega ; fpar.ignore(1000,'\n') ; fpar >> delta_mer_kep ; fpar.ignore(1000,'\n') ; fpar >> thres_adapt ; fpar.ignore(1000,'\n') ; fpar >> relax ; fpar.ignore(1000,'\n') ; fpar >> mermax_poisson ; fpar.ignore(1000,'\n') ; fpar >> relax_poisson ; fpar.ignore(1000,'\n') ; fpar >> precis_adapt ; fpar.ignore(1000,'\n') ; fpar >> graph ; fpar.ignore(1000,'\n') ; fpar.ignore(1000,'\n') ; // skip title fpar >> nz ; fpar.ignore(1000,'\n') ; fpar >> nzet; fpar.ignore(1000,'\n') ; fpar >> nzadapt; fpar.ignore(1000,'\n') ; fpar >> nt; fpar.ignore(1000,'\n') ; fpar >> np; fpar.ignore(1000,'\n') ; int* nr = new int[nz]; int* nt_tab = new int[nz]; int* np_tab = new int[nz]; double* bornes = new double[nz+1]; fpar.ignore(1000,'\n'); // skip title for (int l=0; l> nr[l]; fpar >> bornes[l]; fpar.ignore(1000,'\n') ; np_tab[l] = np ; nt_tab[l] = nt ; } bornes[nz] = __infinity ; fpar.ignore(1000,'\n'); // skip title Tbl ent_limit(nzet) ; ent_limit.set_etat_qcq() ; ent_limit.set(nzet-1) = 0 ; // enthalpy at the gravastar surface = 0 for (int l=0; l> ent_limit.set(l) ; fpar.ignore(1000,'\n') ; } fpar.close(); // Particular cases // ---------------- // Initial frequency = final frequency if ( freq_ini_si < 0 ) { freq_ini_si = freq_si ; mer_change_omega = mer_rot ; mer_fix_omega = mer_rot + 1 ; } //----------------------------------------------------------------------- // Equation of state of the gravastar crust //----------------------------------------------------------------------- fpar.open("par_grav_eos.d") ; if ( !fpar.good() ) { cerr << "Problem in opening the file par_grav_eos.d ! " << endl ; abort() ; } Eos* peos = Eos::eos_from_file(fpar) ; Eos& eos = *peos ; fpar.close() ; //----------------------------------------------------------------------- // Construction of the multi-grid and the mapping //----------------------------------------------------------------------- /* Remark: 1st domain inside gravastar = vacuum core from bornes[0] to bornes[1] 2nd domain = first domain inside the crust from bornes[1] to bornes[2] ... nth domain = last domain inside the crust from bornes[nzet-1] to bornes[nzet] (n+1)th domain = first domain outside the gravastar (n+2)th domain = last domain (compactified) outside the gravastar If there are more than one domain inside the crust, there is a need to rescale bornes[2,...,nzet-1] inside the crust, in order to allow enthalpy(r) to be linear there from H(inner crust boundary) to H(outer crust boundry)=0 */ for (int l=1; l> result.txt") ; fichfinal.open("result.txt", ios::app) ; fichfinal << endl << "================================================================" << endl ; fichfinal << " EOS PARAMETERS (file par_grav_eos.d) : " << endl ; fichfinal << "================================================================" << endl ; fichfinal.close() ; system("cat par_grav_eos.d >> result.txt") ; // Identification du code et de ses sous-routines (no. de version RCS) : fichfinal.open("result.txt", ios::app) ; fichfinal << endl << "================================================================" << endl ; fichfinal << " IDENTIFICATION OF THE CODE : " << endl ; fichfinal << "================================================================" << endl ; fichfinal.close() ; // system("ident nrotstar >> result.txt") ; /* ***Comment: SERT A QUOI?? */ // Saveguard of the whole configuration // ------------------------------------ FILE* fresu = fopen("resu.d", "w") ; gravastar.get_mp().get_mg()->sauve(fresu) ; // writing of the grid gravastar.get_mp().sauve(fresu) ; // writing of the mapping gravastar.get_eos().sauve(fresu) ; // writing of the EOS gravastar.sauve(fresu) ; // writing of the gravastar fclose(fresu) ; // Drawings // -------- ofstream fichdes("prof_n.d") ; fichdes.precision(10) ; fichdes << "# r [km] N(theta=0) N(theta=pi/2)" << endl ; int npd = 300 ; double r_max = 3 ; double h = r_max/double(npd-1) ; for (int i=0; i