Debian Codegraph @

Codes/HiggsMonopole/higgs.C

raw
1 /*
2 * Code for reading Higgs monopole spacetime from a file
3 */
4
5 /*
6 * Copyright (c) 2014 Marie Leroy, Eric Gourgoulhon
7 *
8 * This file is part of LORENE.
9 *
10 * LORENE is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * LORENE is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with LORENE; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25 char higgs_C[] = "$Header: /cvsroot/Lorene/Codes/HiggsMonopole/higgs.C,v 1.3 2014/10/13 08:53:56 j_novak Exp $" ;
26
27 /*
28 * $Id: higgs.C,v 1.3 2014/10/13 08:53:56 j_novak Exp $
29 * $Log: higgs.C,v $
30 * Revision 1.3 2014/10/13 08:53:56 j_novak
31 * Lorene classes and functions now belong to the namespace Lorene.
32 *
33 * Revision 1.2 2014/01/31 15:36:06 e_gourgoulhon
34 * Added drawings
35 *
36 * Revision 1.1 2014/01/29 16:34:36 e_gourgoulhon
37 * New main code for reading Higgs monopoles
38 *
39 *
40 * $Header: /cvsroot/Lorene/Codes/HiggsMonopole/higgs.C,v 1.3 2014/10/13 08:53:56 j_novak Exp $
41 *
42 */
43
44 // C++ headers
45 #include "headcpp.h"
46
47 // C headers
48 #include <cstdlib>
49 #include <cmath>
50
51 // Lorene headers
52 #include "compobj.h"
53 #include "nbr_spx.h"
54 #include "utilitaires.h"
55 #include "graphique.h"
56
57 using namespace Lorene ;
58
59 int main() {
60
61 // Parameters of the computation
62 // -----------------------------
63
64 ifstream fpar("par_higgs.d") ;
65 if ( !fpar.good() ) {
66 cerr << "Problem in opening the file par_higgs.d ! " << endl ;
67 abort() ;
68 }
69
70 char file_name[256] ;
71 fpar.getline(file_name, 256) ;
72 cout << "File to be read: " << file_name << endl ;
73
74 int graphic_out ; // flag for graphical outputs
75 fpar >> graphic_out ; fpar.ignore(1000,'\n') ;
76
77 int nr ; // Number of collocation points in r in each domain
78 fpar >> nr; fpar.ignore(1000,'\n') ;
79
80 int nt ; // Number of collocation points in theta in each domain
81 fpar >> nt; fpar.ignore(1000,'\n') ;
82
83 int np ; // Number of collocation points in phi in each domain
84 fpar >> np; fpar.ignore(1000,'\n') ;
85
86 int nz ; // Number of domains
87 fpar >> nz ; fpar.ignore(1000,'\n') ;
88 int nzm1 = nz - 1 ; // Index of outermost domain
89
90 fpar.ignore(1000,'\n') ; // skip title
91 double* r_limits = new double[nz+1]; // inner boundaries of each domain in units of M
92 for (int l=0; l<nz+1; l++) {
93 fpar >> r_limits[l];
94 }
95 //r_limits[nz] = __infinity ;
96
97 fpar.close();
98
99 cout << "r_limits : " ;
100 for (int l=0; l<nz+1; l++) {
101 cout << r_limits[l] << " " ;
102 }
103 cout << endl ;
104 //arrete() ;
105
106 // Setup of a multi-domain grid (Lorene class Mg3d)
107 // ------------------------------------------------
108
109 int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane
110 int symmetry_phi = SYM ; // symmetry with respect to phi --> phi + pi
111 bool compact = false ; // external domain is compactified
112
113 Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ;
114
115 cout << mgrid << endl ;
116
117 // Setup of an affine mapping : grid --> physical space (Lorene class Map_af)
118 // --------------------------------------------------------------------------
119
120 Map_af map(mgrid, r_limits) ;
121
122 Mtbl r_grid(map.r) ;
123 ofstream grid_file("grid_file.d") ;
124 grid_file.precision(16) ;
125 for (int l = 0; l<nz; l++) {
126 for (int i = 0; i<nr; i++) {
127 grid_file << r_grid(l, 0, 0, i) << endl ;
128 }
129 }
130 grid_file.close() ;
131
132
133 // Construction of the AltBH_QI object:
134 // ----------------------------------
135
136 HiggsMonopole hmonop(map, file_name) ;
137
138 cout << hmonop << endl ;
139
140 // Drawings
141 if (graphic_out == 1) {
142 double r_max = map.val_r(nzm1, 1.,0.,0.) ;
143
144 des_meridian(hmonop.get_nn(), 0, r_max, "N", 1) ;
145 des_meridian(hmonop.get_grr() , 0, r_max, "g_rr", 2) ;
146 des_meridian(hmonop.get_higgs() , 0, r_max, "h", 3) ;
147 des_meridian(hmonop.get_press() , 0, r_max, "P", 4) ;
148
149 arrete() ;
150 }
151
152
153
154 return EXIT_SUCCESS ;
155
156 }