Debian Codegraph @

Codes/Bin_BH/init_bh.C

raw
1 /*
2 * Main code for computing Misner-Lindquist solution
3 *
4 */
5
6 /*
7 * Copyright (c) 2002 Philippe Grandclement
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 char init_bh_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_BH/init_bh.C,v 1.5 2014/10/13 08:53:52 j_novak Exp $" ;
27
28 /*
29 * $Id: init_bh.C,v 1.5 2014/10/13 08:53:52 j_novak Exp $
30 * $Log: init_bh.C,v $
31 * Revision 1.5 2014/10/13 08:53:52 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.4 2014/10/06 15:09:41 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.3 2003/11/14 08:14:52 p_grandclement
38 * Correction of the codes for binary black holes in circular orbit
39 *
40 * Revision 1.2 2003/04/09 15:05:09 e_gourgoulhon
41 * Added copyright and log messages.
42 *
43 *
44 * Revision 1.1
45 * date: 2003/03/31 16:08:23; author: p_grandclement; state: Exp;
46 * Add codes for the binary black holes computation :
47 * - init_bh.C : computes the Misner-Lindquist solution (used as initial guess for the coal code)
48 * - param_statiques.d : example of parameter file for init_bh
49 * - coal_bh.C : computation of the binary
50 * - param_coal.d : example of the paramater file for coal_bh
51 * - lit_holes_bin.C : reads a configuration.
52 *
53 * $Header: /cvsroot/Lorene/Codes/Bin_BH/init_bh.C,v 1.5 2014/10/13 08:53:52 j_novak Exp $
54 *
55 */
56
57 //standard
58 #include <cstdlib>
59 #include <cmath>
60
61 // LORENE
62 #include "type_parite.h"
63 #include "nbr_spx.h"
64 #include "proto.h"
65 #include "coord.h"
66 #include "tenseur.h"
67 #include "bhole.h"
68 #include "utilitaires.h"
69 #include "graphique.h"
70
71
72 using namespace Lorene ;
73
74 int main(int argc, char** argv) {
75
76 // Lecture du fichier de parametres :
77 if (argc <2) {
78 cout <<" Passer nom du ficher en arguments SVP !" << endl ;
79 abort() ;
80 }
81 char blabla [120] ;
82 char* name_fich = argv[1] ;
83 ifstream param(name_fich) ;
84
85 double precis, relax, rayon, beta ;
86 int nz, nbrer, nbret, nbrep ;
87
88 param >> beta ; param.getline(blabla, 120) ;
89 param >> nz ; param.getline(blabla, 120) ;
90 param >> nbrer ; param >> nbret ; param >> nbrep ; param.getline(blabla, 120) ;
91
92 double* bornes = new double[nz+1] ;
93 for (int i=0 ; i<nz ; i++)
94 param >> bornes[i] ;
95 bornes[nz] = __infinity ;
96 rayon = bornes[1] ;
97 param.getline(blabla, 120) ;
98
99 param >> precis ; param.getline(blabla, 120) ;
100 param >> relax ; param.getline(blabla, 120) ;
101
102 double distance = rayon*beta ;
103
104 param.close() ;
105
106 int symetrie = NONSYM ;
107 // echantillonnage en phi :
108 int* np = new int [nz] ;
109 for (int l=0 ; l<nz ; l++)
110 np[l] = nbrep ;
111 int type_p = symetrie ;
112
113 // echantillonnage en theta :
114 int* nt = new int [nz] ;
115 for (int l=0 ; l<nz ; l++)
116 nt[l] = nbret ;
117 int type_t = SYM ;
118
119 // echantillonage en r :
120 int* nr = new int [nz] ;
121 for (int l=0 ; l<nz ; l++)
122 nr[l] = nbrer ;
123
124 int* type_r = new int[nz] ;
125 type_r[0] = RARE ;
126 for (int l=1 ; l<nz-1 ; l++)
127 type_r[l] = FIN ;
128 type_r[nz-1] = UNSURR ;
129
130 Mg3d grille (nz, nr, type_r, nt, type_t, np, type_p) ;
131
132 Map_af mapping_un (grille, bornes) ;
133 Map_af mapping_deux (grille, bornes) ;
134
135 mapping_un.set_ori (distance/2.,0, 0) ;
136 mapping_deux.set_ori (-distance/2., 0, 0) ;
137 mapping_deux.set_rot_phi (M_PI) ;
138
139 Bhole_binaire bin (mapping_un, mapping_deux) ;
140 bin.set_statiques(precis, relax) ;
141
142 FILE* fich = fopen("statiques.dat", "w") ;
143 grille.sauve(fich) ;
144 mapping_un.sauve(fich) ;
145 mapping_deux.sauve(fich) ;
146 bin(1).sauve(fich) ;
147 bin(2).sauve(fich) ;
148 fclose(fich) ;
149
150 delete [] nr ;
151 delete [] nt ;
152 delete [] np ;
153 delete [] type_r ;
154 delete [] bornes ;
155
156 return 1 ;
157 }