LORENE
higgs_monopole.C
1/*
2 * Methods of the class HiggsMonopole
3 *
4 * (see file compobj.h for documentation).
5 *
6 */
7
8/*
9 * Copyright (c) 2014 Marie Leroy, Eric Gourgoulhon
10 *
11 * This file is part of LORENE.
12 *
13 * LORENE is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2
15 * as published by the Free Software Foundation.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29
30/*
31 * $Id: higgs_monopole.C,v 1.5 2018/11/16 14:34:35 j_novak Exp $
32 * $Log: higgs_monopole.C,v $
33 * Revision 1.5 2018/11/16 14:34:35 j_novak
34 * Changed minor points to avoid some compilation warnings.
35 *
36 * Revision 1.4 2016/12/05 16:17:49 j_novak
37 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
38 *
39 * Revision 1.3 2014/10/13 08:52:49 j_novak
40 * Lorene classes and functions now belong to the namespace Lorene.
41 *
42 * Revision 1.2 2014/01/31 15:35:27 e_gourgoulhon
43 * Reading file in constructor
44 *
45 * Revision 1.1 2014/01/29 16:31:42 e_gourgoulhon
46 * New class HiggsMonopole
47 *
48 *
49 * $Header: /cvsroot/Lorene/C++/Source/Compobj/higgs_monopole.C,v 1.5 2018/11/16 14:34:35 j_novak Exp $
50 *
51 */
52
53
54// C headers
55#include <cassert>
56
57// Lorene headers
58#include "compobj.h"
59#include "unites.h"
60
61 //--------------//
62 // Constructors //
63 //--------------//
64
65// Standard constructor
66// --------------------
67namespace Lorene {
68HiggsMonopole::HiggsMonopole(Map& mpi, const char* file_name) :
69 Compobj(mpi) ,
70 hh(mpi) ,
71 grr(mpi) ,
72 press(mpi)
73{
74
75 ifstream file(file_name) ;
76 if ( !file.good() ) {
77 cerr << "Problem in opening the file " << file_name << endl ;
78 abort() ;
79 }
80
81 file.getline(description1, 256) ;
82 file.getline(description2, 256) ;
83 cout << "description1 : " << description1 << endl ;
84 cout << "description2 : " << description2 << endl ;
85// description1[0] = " " ;
86// description2[0] = " " ;
87
88 file.ignore(1000,'\n') ;
89
90 const Mg3d* mg = mp.get_mg() ;
91 int nz = mg->get_nzone() ;
92 cout << "nz : " << nz << endl ;
93 nn.set_etat_qcq() ; // Memory allocation for N
94 grr.allocate_all() ; // Memory allocation for g_rr
95 hh.allocate_all() ; // Memory allocation for h
96 press.allocate_all() ; // Memory allocation for press
97 double explamb_last, nn_last, hh_last, press_last ;
98 for (int l=0; l<nz; l++) {
99 cout << "l = " << l << endl ;
100 int nr = mg->get_nr(l) ;
101 int nt = mg->get_nt(l) ;
102 int np = mg->get_np(l) ;
103 double u_r ; // u = r m_p
104 double* explamb_tab = new double[nr] ;
105 double* nn_tab = new double[nr] ;
106 double* hh_tab = new double[nr] ;
107 double* press_tab = new double[nr] ;
108 int i_min = 0 ;
109 if (l>0) {
110 i_min = 1 ;
111 explamb_tab[0] = explamb_last ;
112 nn_tab[0] = nn_last ;
113 hh_tab[0] = hh_last ;
114 press_tab[0] = press_last ;
115 }
116 for (int i=i_min; i<nr; i++) {
117 file >> u_r ;
118 file >> explamb_tab[i] ;
119 file >> nn_tab[i] ;
120 file >> hh_tab[i] ;
121 file >> press_tab[i] ;
122 }
123 explamb_last = explamb_tab[nr-1] ;
124 nn_last = nn_tab[nr-1] ;
125 hh_last = hh_tab[nr-1] ;
126 press_last = press_tab[nr-1] ;
127
128 for (int i=0; i<nr; i++) {
129 cout << " explamb, nn, hh : " << explamb_tab[i] << " "
130 << nn_tab[i] << " " << hh_tab[i] << endl ;
131 }
132
133 for (int k=0; k<np; k++) {
134 for (int j=0; j<nt; j++) {
135 for (int i=0; i<nr; i++) {
136 grr.set_grid_point(l,k,j,i) = explamb_tab[i]*explamb_tab[i] ;
137 nn.set_grid_point(l,k,j,i) = nn_tab[i] ;
138 hh.set_grid_point(l,k,j,i) = hh_tab[i] ;
139 press.set_grid_point(l,k,j,i) = press_tab[i] ;
140 }
141 }
142 }
143
144 delete[] explamb_tab ;
145 delete[] nn_tab ;
146 delete[] hh_tab ;
147 delete[] press_tab ;
148
149 }
150 file.close() ;
151
152 nn.std_spectral_base() ; // Sets bases for spectral expansions
153 grr.std_spectral_base() ;
154 hh.std_spectral_base() ;
155 press.std_spectral_base() ;
156
157 // Pointers of derived quantities initialized to zero :
158 // set_der_0x0() ;
159}
160
161// Copy constructor
162// --------------------
164 Compobj(other),
165 hh(other.hh) ,
166 grr(other.grr) ,
167 press(other.press)
168{
169 // Pointers of derived quantities initialized to zero :
170 // set_der_0x0() ;
171}
172
173 //------------//
174 // Destructor //
175 //------------//
176
178
179 // del_deriv() ;
180
181}
182
183// Printing
184// --------
185
186ostream& HiggsMonopole::operator>>(ostream& ost) const {
187
188 using namespace Unites ;
189
190 ost << endl << "Higgs monopole" << endl ;
191
192 ost << description1 << endl ;
193 ost << description2 << endl ;
194
195 Compobj::operator>>(ost) ;
196
197 return ost ;
198
199}
200
201
202
203}
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition compobj.C:242
Compobj(Map &map_i)
Standard constructor.
Definition compobj.C:85
Scalar nn
Lapse function N .
Definition compobj.h:138
Map & mp
Mapping describing the coordinate system (r,theta,phi).
Definition compobj.h:135
HiggsMonopole(Map &mp_i, const char *file_name)
Standard constructor.
Scalar hh
Higgs scalar field.
Definition compobj.h:1128
virtual ~HiggsMonopole()
Destructor.
Scalar press
Fluid pressure.
Definition compobj.h:1132
char description2[256]
String describing the model.
Definition compobj.h:1126
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
char description1[256]
String describing the model.
Definition compobj.h:1125
Scalar grr
Metric coefficient g_rr.
Definition compobj.h:1130
Multi-domain grid.
Definition grilles.h:279
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition grilles.h:479
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition grilles.h:474
int get_nzone() const
Returns the number of domains.
Definition grilles.h:465
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition grilles.h:469
Lorene prototypes.
Definition app_hor.h:67
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Definition map.C:142
Standard units of space, time and mass.