/* * Main code for computing stationary axisymmetric rotating stars in Dirac * gauge and maximal slicing. * */ /* * Copyright (c) 2005 Lap-Ming Lin & Jerome Novak * * 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 rotstar_dirac_C[] = "$Header: /cvsroot/Lorene/Codes/Rot_star/rotstar_dirac.C,v 1.11 2015/01/27 14:22:39 j_novak Exp $" ; /* * $Id: rotstar_dirac.C,v 1.11 2015/01/27 14:22:39 j_novak Exp $ * $Log: rotstar_dirac.C,v $ * Revision 1.11 2015/01/27 14:22:39 j_novak * New methods in Eos_tabul to correct for EoS themro consistency (optional). * * Revision 1.10 2014/10/13 08:53:59 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.9 2014/05/09 14:44:25 j_novak * Tests are now done for the opening of parameter files. * * Revision 1.8 2012/05/10 09:05:30 j_novak * New code examrot_dirac for reading the results of * rotstar_dirac. Simplification of the parrot.d parameter file for * rotstar_dirac. * * Revision 1.7 2009/10/26 10:42:30 j_novak * Changed dzpuis handling in final test. * * Revision 1.6 2008/08/22 06:34:13 j_novak * Now displaying \hat{A}^{ij} and \hat{A}^{ij}_{TT} (see paper by Cordero, * Cerda, Dimmelmeier et al.). * * Revision 1.5 2008/02/25 10:40:54 j_novak * Added the flag mer_hij to control the step from which the equation for h^{ij} * is being solved. * * Revision 1.4 2007/11/06 16:24:00 j_novak * Added the flag spectral_filter giving the order of possible spectral filtering * of the hydro sources of metric equations (some members *_euler). The filtering * is done in strot_dirac_hydro, if this flag is non-zero. * * Revision 1.3 2005/03/25 13:53:34 j_novak * Added drawings of various fields. * * Revision 1.2 2005/03/10 09:38:35 j_novak * *** empty log message *** * * Revision 1.1 2005/01/31 09:10:06 j_novak * Main code for rotating stars in Dirac gauge. * * * $Header: /cvsroot/Lorene/Codes/Rot_star/rotstar_dirac.C,v 1.11 2015/01/27 14:22:39 j_novak Exp $ * */ // headers C #include // headers Lorene #include "star_rot_dirac.h" #include "cmp.h" #include "eos.h" #include "graphique.h" #include "nbr_spx.h" #include "unites.h" namespace Lorene { // Local prototype (for drawings only) Cmp raccord_c1(const Cmp& uu, int l1) ; } //****************************************************************************** using namespace Lorene ; int main(){ using namespace Unites ; //------------------------------------------------------------------ // Parameters of the computation //------------------------------------------------------------------ char blabla[120] ; int mer_max, mer_rot, mer_change_omega, mer_fix_omega, delta_mer_kep, mer_mass, graph, nz, nzet, nzadapt, nt, np, filter_order, mer_hij ; double ent_c, freq_si, fact_omega, mbar_wanted, precis, freq_ini_si, aexp_mass, relax ; ifstream fich("parrot.d") ; if ( !fich.good() ) { cerr << "Problem in opening the file parrot.d ! " << endl ; abort() ; } fich.getline(blabla, 120) ; fich.getline(blabla, 120) ; fich >> ent_c ; fich.getline(blabla, 120) ; fich >> freq_si ; fich.getline(blabla, 120) ; fich >> fact_omega ; fich.getline(blabla, 120) ; fich >> mbar_wanted ; fich.getline(blabla, 120) ; mbar_wanted *= msol ; fich.getline(blabla, 120) ; fich >> mer_max ; fich.getline(blabla, 120) ; fich >> precis ; fich.getline(blabla, 120) ; fich >> mer_rot ; fich.getline(blabla, 120) ; fich >> freq_ini_si ; fich.getline(blabla, 120) ; fich >> mer_change_omega ; fich.getline(blabla, 120) ; fich >> mer_fix_omega ; fich.getline(blabla, 200) ; fich >> delta_mer_kep ; fich.getline(blabla, 120) ; fich >> mer_mass ; fich.getline(blabla, 120) ; fich >> aexp_mass ; fich.getline(blabla, 120) ; fich >> relax ; fich.getline(blabla, 120) ; fich >> graph ; fich.getline(blabla, 120) ; fich.getline(blabla, 120) ; fich >> nz ; fich.getline(blabla, 120) ; fich >> nzet; fich.getline(blabla, 120) ; fich >> nzadapt; fich.getline(blabla, 120) ; fich >> nt; fich.getline(blabla, 120) ; fich >> np; fich.getline(blabla, 120) ; int* nr = new int[nz]; int* nt_tab = new int[nz]; int* np_tab = new int[nz]; double* bornes = new double[nz+1]; fich.getline(blabla, 120); for (int l=0; l> nr[l]; fich >> bornes[l]; fich.getline(blabla, 120) ; np_tab[l] = np ; nt_tab[l] = nt ; } bornes[nz] = __infinity ; Tbl ent_limit(nzet) ; ent_limit.set_etat_qcq() ; ent_limit.set(nzet-1) = 0 ; // enthalpy at the stellar surface for (int l=0; l> ent_limit.set(l) ; fich.getline(blabla, 120) ; } fich >> filter_order ; fich.getline(blabla, 120) ; fich >> mer_hij ;fich.getline(blabla, 120) ; fich.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 //----------------------------------------------------------------------- fich.open("par_eos.d") ; if ( !fich.good() ) { cerr << "Problem in opening the file par_eos.d ! " << endl ; abort() ; } Eos* peos = Eos::eos_from_file(fich) ; Eos& eos = *peos ; fich.close() ; //----------------------------------------------------------------------- // Construction of the multi-grid and the mapping //----------------------------------------------------------------------- // Rescale of bornes in the case where there more than 1 domain inside // the star for (int l=0; l> calcul.d") ; fichfinal.open("calcul.d", ios::app) ; fichfinal << endl << "================================================================" << endl ; fichfinal << " EOS PARAMETERS (file par_eos.d) : " << endl ; fichfinal << "================================================================" << endl ; fichfinal.close() ; ret = system("cat par_eos.d >> calcul.d") ; if (ret == -1) cout << "Warning: problems in identification of the parameters!" << endl ; // Saveguard of the whole configuration // ------------------------------------ FILE* fresu = fopen("resu.d", "w") ; star.get_mp().get_mg()->sauve(fresu) ; // writing of the grid star.get_mp().sauve(fresu) ; // writing of the mapping star.get_eos().sauve(fresu) ; // writing of the EOS star.sauve(fresu) ; // writing of the star fclose(fresu) ; Sym_tensor hat_aij = star.get_psi4()*star.get_psi2()*star.get_aa() ; const Metric_flat& mets = mp.flat_met_spher() ; cout << "Looking at \\hat{A}^{ij} and \\hat{A}^{ij}_{TT}: " << endl ; Vector wwws = hat_aij.divergence(mets) ; wwws.inc_dzpuis() ; Vector www = wwws.poisson(1./3., 6) ; Sym_tensor prueba = hat_aij - www.ope_killing_conf(mets) ; Tbl maxa = maxabs(hat_aij, "Max \\hat{A}^ij") ; Tbl maxb = maxabs(prueba, "Max. \\hat{A}^{ij}_{TT}: ") ; Tbl maxh = maxabs(star.get_hh(), "Max. h^ij: ") ; cout << "Max(A_TT)/Max(A): " << max(maxb)/max(maxa) <