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 char HiggsMonopole_C[] = "$Header: /cvsroot/Lorene/C++/Source/Compobj/higgs_monopole.C,v 1.3 2014/10/13 08:52:49 j_novak Exp $" ;
29 
30 /*
31  * $Id: higgs_monopole.C,v 1.3 2014/10/13 08:52:49 j_novak Exp $
32  * $Log: higgs_monopole.C,v $
33  * Revision 1.3 2014/10/13 08:52:49 j_novak
34  * Lorene classes and functions now belong to the namespace Lorene.
35  *
36  * Revision 1.2 2014/01/31 15:35:27 e_gourgoulhon
37  * Reading file in constructor
38  *
39  * Revision 1.1 2014/01/29 16:31:42 e_gourgoulhon
40  * New class HiggsMonopole
41  *
42  *
43  * $Header: /cvsroot/Lorene/C++/Source/Compobj/higgs_monopole.C,v 1.3 2014/10/13 08:52:49 j_novak Exp $
44  *
45  */
46 
47 
48 // C headers
49 #include <cassert>
50 
51 // Lorene headers
52 #include "compobj.h"
53 #include "unites.h"
54 
55  //--------------//
56  // Constructors //
57  //--------------//
58 
59 // Standard constructor
60 // --------------------
61 namespace Lorene {
62 HiggsMonopole::HiggsMonopole(Map& mpi, const char* file_name) :
63  Compobj(mpi) ,
64  hh(mpi) ,
65  grr(mpi) ,
66  press(mpi)
67 {
68 
69  ifstream file(file_name) ;
70  if ( !file.good() ) {
71  cerr << "Problem in opening the file " << file_name << endl ;
72  abort() ;
73  }
74 
75  file.getline(description1, 256) ;
76  file.getline(description2, 256) ;
77  cout << "description1 : " << description1 << endl ;
78  cout << "description2 : " << description2 << endl ;
79 // description1[0] = " " ;
80 // description2[0] = " " ;
81 
82  file.ignore(1000,'\n') ;
83 
84  const Mg3d* mg = mp.get_mg() ;
85  double tmp ;
86  int nz = mg->get_nzone() ;
87  cout << "nz : " << nz << endl ;
88  nn.set_etat_qcq() ; // Memory allocation for N
89  grr.allocate_all() ; // Memory allocation for g_rr
90  hh.allocate_all() ; // Memory allocation for h
91  press.allocate_all() ; // Memory allocation for press
92  double explamb_last, nn_last, hh_last, press_last ;
93  for (int l=0; l<nz; l++) {
94  cout << "l = " << l << endl ;
95  int nr = mg->get_nr(l) ;
96  int nt = mg->get_nt(l) ;
97  int np = mg->get_np(l) ;
98  double u_r ; // u = r m_p
99  double* explamb_tab = new double[nr] ;
100  double* nn_tab = new double[nr] ;
101  double* hh_tab = new double[nr] ;
102  double* press_tab = new double[nr] ;
103  int i_min = 0 ;
104  if (l>0) {
105  i_min = 1 ;
106  explamb_tab[0] = explamb_last ;
107  nn_tab[0] = nn_last ;
108  hh_tab[0] = hh_last ;
109  press_tab[0] = press_last ;
110  }
111  for (int i=i_min; i<nr; i++) {
112  file >> u_r ;
113  file >> explamb_tab[i] ;
114  file >> nn_tab[i] ;
115  file >> hh_tab[i] ;
116  file >> press_tab[i] ;
117  }
118  explamb_last = explamb_tab[nr-1] ;
119  nn_last = nn_tab[nr-1] ;
120  hh_last = hh_tab[nr-1] ;
121  press_last = press_tab[nr-1] ;
122 
123  for (int i=0; i<nr; i++) {
124  cout << " explamb, nn, hh : " << explamb_tab[i] << " "
125  << nn_tab[i] << " " << hh_tab[i] << endl ;
126  }
127 
128  for (int k=0; k<np; k++) {
129  for (int j=0; j<nt; j++) {
130  for (int i=0; i<nr; i++) {
131  grr.set_grid_point(l,k,j,i) = explamb_tab[i]*explamb_tab[i] ;
132  nn.set_grid_point(l,k,j,i) = nn_tab[i] ;
133  hh.set_grid_point(l,k,j,i) = hh_tab[i] ;
134  press.set_grid_point(l,k,j,i) = press_tab[i] ;
135  }
136  }
137  }
138 
139  delete[] explamb_tab ;
140  delete[] nn_tab ;
141  delete[] hh_tab ;
142  delete[] press_tab ;
143 
144  }
145  file.close() ;
146 
147  nn.std_spectral_base() ; // Sets bases for spectral expansions
149  hh.std_spectral_base() ;
151 
152  // Pointers of derived quantities initialized to zero :
153  // set_der_0x0() ;
154 }
155 
156 // Copy constructor
157 // --------------------
159  Compobj(other),
160  hh(other.hh) ,
161  grr(other.grr) ,
162  press(other.press)
163 {
164  // Pointers of derived quantities initialized to zero :
165  // set_der_0x0() ;
166 }
167 
168  //------------//
169  // Destructor //
170  //------------//
171 
173 
174  // del_deriv() ;
175 
176 }
177 
178 // Printing
179 // --------
180 
181 ostream& HiggsMonopole::operator>>(ostream& ost) const {
182 
183  using namespace Unites ;
184 
185  ost << endl << "Higgs monopole" << endl ;
186 
187  ost << description1 << endl ;
188  ost << description2 << endl ;
189 
190  Compobj::operator>>(ost) ;
191 
192  return ost ;
193 
194 }
195 
196 
197 
198 }
Lorene::Mg3d::get_np
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:462
Lorene::Compobj::mp
Map & mp
Mapping describing the coordinate system (r,theta,phi)
Definition: compobj.h:132
Lorene::Mg3d
Multi-domain grid.
Definition: grilles.h:273
Lorene::Mg3d::get_nt
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:457
Lorene
Lorene prototypes.
Definition: app_hor.h:64
Lorene::Map::get_mg
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
Lorene::Scalar::set_grid_point
double & set_grid_point(int l, int k, int j, int i)
Setting the value of the field at a given grid point.
Definition: scalar.h:684
Lorene::HiggsMonopole
Higgs monopole (under development).
Definition: compobj.h:1116
Unites
Standard units of space, time and mass.
Lorene::Compobj::operator>>
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: compobj.C:239
Lorene::HiggsMonopole::hh
Scalar hh
Higgs scalar field.
Definition: compobj.h:1125
Lorene::HiggsMonopole::operator>>
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: higgs_monopole.C:181
Lorene::Scalar::allocate_all
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Definition: scalar.C:365
Lorene::Mg3d::get_nzone
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:448
Lorene::Mg3d::get_nr
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:452
Lorene::HiggsMonopole::grr
Scalar grr
Metric coefficient g_rr.
Definition: compobj.h:1127
Lorene::Scalar::set_etat_qcq
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: scalar.C:353
Lorene::HiggsMonopole::HiggsMonopole
HiggsMonopole(Map &mp_i, const char *file_name)
Standard constructor.
Definition: higgs_monopole.C:62
Lorene::Scalar::std_spectral_base
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
Definition: scalar.C:784
Lorene::HiggsMonopole::description1
char description1[256]
String describing the model.
Definition: compobj.h:1122
Lorene::HiggsMonopole::description2
char description2[256]
String describing the model.
Definition: compobj.h:1123
Lorene::HiggsMonopole::press
Scalar press
Fluid pressure.
Definition: compobj.h:1129
Lorene::Compobj
Base class for stationary compact objects (under development).
Definition: compobj.h:126
Lorene::HiggsMonopole::~HiggsMonopole
virtual ~HiggsMonopole()
Destructor.
Definition: higgs_monopole.C:172
Lorene::Map
Base class for coordinate mappings.
Definition: map.h:670
Lorene::Compobj::nn
Scalar nn
Lapse function N .
Definition: compobj.h:135