| 1 |
/* |
| 2 |
* Test code for class Bin_ns_bh |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 2002 Philippe Grandclement, Keisuke Taniguchi, |
| 8 |
* Eric Gourgoulhon |
| 9 |
* |
| 10 |
* This file is part of LORENE. |
| 11 |
* |
| 12 |
* LORENE is free software; you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License version 2 |
| 14 |
* as published by the Free Software Foundation. |
| 15 |
* |
| 16 |
* LORENE is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with LORENE; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
char test_bin_ns_bh_C[] = "$Header: /cvsroot/Lorene/Codes/Test/Bin_ns_bh/test_bin_ns_bh.C,v 1.3 2014/10/13 08:54:00 j_novak Exp $" ; |
| 28 |
|
| 29 |
/* |
| 30 |
* $Id: test_bin_ns_bh.C,v 1.3 2014/10/13 08:54:00 j_novak Exp $ |
| 31 |
* $Log: test_bin_ns_bh.C,v $ |
| 32 |
* Revision 1.3 2014/10/13 08:54:00 j_novak |
| 33 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 34 |
* |
| 35 |
* Revision 1.2 2014/10/06 15:12:51 j_novak |
| 36 |
* Modified #include directives to use c++ syntax. |
| 37 |
* |
| 38 |
* Revision 1.1 2002/12/17 13:09:21 e_gourgoulhon |
| 39 |
* Test code for class Bin_ns_bh |
| 40 |
* |
| 41 |
* |
| 42 |
* |
| 43 |
* |
| 44 |
* $Header: /cvsroot/Lorene/Codes/Test/Bin_ns_bh/test_bin_ns_bh.C,v 1.3 2014/10/13 08:54:00 j_novak Exp $ |
| 45 |
* |
| 46 |
*/ |
| 47 |
|
| 48 |
// C++ headers |
| 49 |
#include "headcpp.h" |
| 50 |
|
| 51 |
// C headers |
| 52 |
#include <cstdlib> |
| 53 |
|
| 54 |
// Lorene headers |
| 55 |
#include "bin_ns_bh.h" |
| 56 |
#include "nbr_spx.h" |
| 57 |
#include "eos.h" |
| 58 |
|
| 59 |
using namespace Lorene ; |
| 60 |
|
| 61 |
int main() { |
| 62 |
|
| 63 |
{ // Main block |
| 64 |
|
| 65 |
// Identification of all the subroutines called by the code : |
| 66 |
|
| 67 |
// system("ident test_etoile > identification.d") ; |
| 68 |
|
| 69 |
//----------------------------------------------------------------------- |
| 70 |
// Input data : number of points, types of sampling, etc... |
| 71 |
//----------------------------------------------------------------------- |
| 72 |
|
| 73 |
int nz = 3 ; // Number of domains |
| 74 |
int nr = 17 ; // Number of points in theta |
| 75 |
int nt = 7 ; // Number of points in theta |
| 76 |
int np = 4 ; // Number of points in phi |
| 77 |
|
| 78 |
double* bornes = new double[nz+1]; |
| 79 |
|
| 80 |
bornes[0] = 0. ; |
| 81 |
bornes[1] = 2. ; |
| 82 |
bornes[2] = 3. ; |
| 83 |
bornes[3] = __infinity ; |
| 84 |
|
| 85 |
int typ_t = SYM ; |
| 86 |
|
| 87 |
int typ_p = NONSYM ; |
| 88 |
|
| 89 |
|
| 90 |
//----------------------------------------------------------------------- |
| 91 |
// Construction of a multi-grid |
| 92 |
//----------------------------------------------------------------------- |
| 93 |
|
| 94 |
Mg3d mg(nz, nr, nt, np, typ_t, typ_p, true) ; |
| 95 |
|
| 96 |
cout << endl << "Grid mg : " << mg << endl ; |
| 97 |
|
| 98 |
//------------------------------------------- |
| 99 |
// Construction of a mapping of class Map_et for the NS |
| 100 |
//------------------------------------------- |
| 101 |
|
| 102 |
Map_et mp_ns(mg, bornes) ; |
| 103 |
|
| 104 |
mp_ns.set_ori(-10.,0.,0.) ; |
| 105 |
|
| 106 |
//------------------------------------------- |
| 107 |
// Construction of a mapping of class Map_af for the BH |
| 108 |
//------------------------------------------- |
| 109 |
|
| 110 |
Map_af mp_bh(mg, bornes) ; |
| 111 |
|
| 112 |
mp_bh.set_ori(10.,0.,0.) ; |
| 113 |
mp_bh.set_rot_phi(M_PI) ; |
| 114 |
|
| 115 |
// Cleaning |
| 116 |
// -------- |
| 117 |
|
| 118 |
delete [] bornes ; |
| 119 |
|
| 120 |
cout << "NS mapping : " << mp_ns << endl ; |
| 121 |
cout << "BH mapping : " << mp_bh << endl ; |
| 122 |
|
| 123 |
//----------------------------------------------------------------------- |
| 124 |
// Construction of an EOS |
| 125 |
//----------------------------------------------------------------------- |
| 126 |
|
| 127 |
double gamma = 2. ; |
| 128 |
double kappa = 0.0332 ; |
| 129 |
|
| 130 |
Eos_poly eos(gamma, kappa) ; |
| 131 |
|
| 132 |
|
| 133 |
//----------------------------------------------------------------------- |
| 134 |
// Construction of a NS-BH binary system |
| 135 |
//----------------------------------------------------------------------- |
| 136 |
|
| 137 |
int nzet = nz - 2 ; // Number of domains occupied by the star |
| 138 |
bool irrot_ns = true ; |
| 139 |
|
| 140 |
Bin_ns_bh bibi(mp_ns, nzet, eos, irrot_ns, mp_bh) ; |
| 141 |
|
| 142 |
|
| 143 |
//----------------------------------------------------------------------- |
| 144 |
// Initialization of the stellar enthalpy field |
| 145 |
//----------------------------------------------------------------------- |
| 146 |
|
| 147 |
Cmp ent0(mp_ns) ; |
| 148 |
|
| 149 |
double ray = mp_ns.val_r(nzet-1, 1, M_PI/2., 0.) ; |
| 150 |
|
| 151 |
const Coord& r = mp_ns.r ; |
| 152 |
|
| 153 |
ent0 = 1 - r*r/(ray*ray) ; |
| 154 |
|
| 155 |
ent0.annule(nz-1) ; |
| 156 |
ent0.std_base_scal() ; |
| 157 |
|
| 158 |
(bibi.set_ns()).set_enthalpy(ent0) ; |
| 159 |
|
| 160 |
cout << bibi << endl ; |
| 161 |
|
| 162 |
|
| 163 |
} |
| 164 |
|
| 165 |
return EXIT_SUCCESS ; |
| 166 |
|
| 167 |
} |
| 168 |
|