LORENE
boson_star.C
1/*
2 * Methods of the class Boson_star
3 *
4 * (see file boson_star.h for documentation).
5 */
6
7/*
8 * Copyright (c) 2012 Claire Some, 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
27char boson_star_C[] = "$Header: /cvsroot/Lorene/C++/Source/Compobj/boson_star.C,v 1.4 2014/10/13 08:52:49 j_novak Exp $" ;
28
29/*
30 * $Id: boson_star.C,v 1.4 2014/10/13 08:52:49 j_novak Exp $
31 * $Log: boson_star.C,v $
32 * Revision 1.4 2014/10/13 08:52:49 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.3 2012/12/03 15:27:30 c_some
36 * Small changes
37 *
38 * Revision 1.2 2012/11/23 15:44:10 c_some
39 * Small changes + method update_ener_mom
40 *
41 * Revision 1.1 2012/11/22 16:04:12 c_some
42 * New class Boson_star
43 *
44 *
45 * $Header: /cvsroot/Lorene/C++/Source/Compobj/boson_star.C,v 1.4 2014/10/13 08:52:49 j_novak Exp $
46 *
47 */
48
49
50// C headers
51#include <cassert>
52
53// Lorene headers
54#include "boson_star.h"
55#include "utilitaires.h"
56
57 //--------------//
58 // Constructors //
59 //--------------//
60
61// Standard constructor
62// --------------------
63namespace Lorene {
64Boson_star::Boson_star(Map& mpi, double m, int k) :
65 Star_QI(mpi) ,
66 rphi(mpi),
67 iphi(mpi),
68 omega(0),
69 kkk(k),
70 mmm(m),
71 m2(m*m)
72{
73 // Pointers of derived quantities initialized to zero :
74 set_der_0x0() ;
75
76 // Initialization of the scalar field to zero
77 rphi = 0 ;
78 iphi = 0 ;
79
80}
81
82// Copy constructor
83// --------------------
85 Star_QI(st),
86 rphi(st.rphi),
87 iphi(st.iphi),
88 omega(st.omega),
89 kkk(st.kkk),
90 mmm(st.mmm),
91 m2(st.m2)
92{
93 // Pointers of derived quantities initialized to zero :
94 set_der_0x0() ;
95}
96
97
98// Constructor from a file
99// -----------------------
100Boson_star::Boson_star(Map& mpi, FILE* fich) :
101 Star_QI(mpi, fich) ,
102 rphi(mpi, *(mpi.get_mg()), fich) ,
103 iphi(mpi, *(mpi.get_mg()), fich)
104{
105 // Pointers of derived quantities initialized to zero :
106 set_der_0x0() ;
107
108 fread_be(&omega, sizeof(double), 1, fich) ;
109 fread_be(&kkk, sizeof(int), 1, fich) ;
110 fread_be(&mmm, sizeof(double), 1, fich) ;
111 m2 = mmm*mmm ;
112
113}
114
115 //------------//
116 // Destructor //
117 //------------//
118
120
121 del_deriv() ;
122
123}
124
125
126 //----------------------------------//
127 // Management of derived quantities //
128 //----------------------------------//
129
131
133
135}
136
137
139
140}
141
142 //--------------//
143 // Assignment //
144 //--------------//
145
146// Assignment to another Boson_star
147// --------------------------------
149
150 // Assignment of quantities common to all the derived classes of Star_QI
151 Star_QI::operator=(st) ;
152
153 rphi = st.rphi ;
154 iphi = st.iphi ;
155 omega = st.omega ;
156 kkk = st.kkk ;
157 mmm = st.mmm ;
158 m2 = st.m2 ;
159
160 del_deriv() ; // Deletes all derived quantities
161}
162
163 //--------------//
164 // Outputs //
165 //--------------//
166
167// Save in a file
168// --------------
169void Boson_star::sauve(FILE* fich) const {
170
171 Star_QI::sauve(fich) ;
172 rphi.sauve(fich) ;
173 iphi.sauve(fich) ;
174 fwrite_be(&omega, sizeof(double), 1, fich) ;
175 fwrite_be(&kkk, sizeof(int), 1, fich) ;
176 fwrite_be(&mmm, sizeof(double), 1, fich) ;
177
178}
179
180// Printing
181// --------
182
183ostream& Boson_star::operator>>(ostream& ost) const {
184
185 Star_QI::operator>>(ost) ;
186
187 ost << endl << "Axisymmetric stationary boson star in quasi-isotropic coordinates (class Boson_star) " << endl ;
188
189 ost << "Boson mass : " << mmm << endl ; //## which units ?
190
191 ost << "omega = " << omega << " , k = " << kkk << endl ;
192
193 ost << "Central value of the scalar field : " << rphi.val_grid_point(0,0,0,0) << " + i " << iphi.val_grid_point(0,0,0,0)<< endl ;
194
195 // ost << "Real part of the scalar field : " << rphi << endl ;
196 // ost << "Imaginary part of the scalar field : " << iphi << endl ;
197
198 //## ost << "ADM mass : " << adm_mass() << endl ;
199 ost << "Gravitational mass : " << mass_g() << endl ;
200 return ost ;
201
202}
203
204//------------------------
205// Computational routines
206//------------------------
207
208 /* Computes the 3+1 components of the energy-momentum tensor (E, P_i and S_{ij})
209 * from the values of the scalar field and the metric
210 */
212
213 const Metric_flat& ff = mp.flat_met_spher() ;
214
215 Scalar mod_phi2 = rphi*rphi + iphi*iphi ;
216 mod_phi2.inc_dzpuis(4) ; // mod_phi2 multiplied by r^4 in the last domain
217
218 Sym_tensor dphidphi = rphi.derive_cov(ff) * rphi.derive_cov(ff)
219 + iphi.derive_cov(ff) * iphi.derive_cov(ff) ;
220
221 Scalar tmp = (omega - kkk*nphi)/nn ;
222 Scalar tmp2 = tmp*tmp ;
223 Scalar dphi2 = dphidphi.trace(gamma) ;
224
225 ener_euler = 0.5*( (tmp2 + m2)*mod_phi2 + dphi2 ) ;
226
227 mom_euler.set(1) = 0 ; // p^(r) = 0
228 mom_euler.set(2) = 0 ; // p^(theta) = 0
229 mom_euler.set(3) = -kkk*tmp * mod_phi2 ;
230
231 stress_euler = dphidphi - 0.5*( (m2-tmp2)*mod_phi2 + dphi2 )*gamma.cov() ;
232}
233
234
235}
Class for stationary axisymmetric boson stars (under development).
Definition boson_star.h:64
double omega
Coefficient omega in the time dependence of Phi.
Definition boson_star.h:80
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition boson_star.C:138
double m2
Boson mass squared.
Definition boson_star.h:92
virtual void del_deriv() const
Deletes all the derived quantities.
Definition boson_star.C:130
double mmm
Boson mass.
Definition boson_star.h:88
Scalar rphi
Real part of the scalar field Phi.
Definition boson_star.h:72
int kkk
Coefficient kkk in the azimuthal dependence of Phi.
Definition boson_star.h:84
virtual ~Boson_star()
Destructor.
Definition boson_star.C:119
void operator=(const Boson_star &)
Assignment to another Boson_star.
Definition boson_star.C:148
void update_ener_mom()
Computes the 3+1 components of the energy-momentum tensor (E, P_i and S_{ij}) from the values of the ...
Definition boson_star.C:211
Boson_star(Map &mp_i, double m, int k)
Standard constructor.
Definition boson_star.C:64
Scalar iphi
Imaginary part of the scalar field Phi.
Definition boson_star.h:76
virtual void sauve(FILE *) const
Save in a file.
Definition boson_star.C:169
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition boson_star.C:183
Scalar nphi
Metric coefficient .
Definition compobj.h:296
Vector mom_euler
Total 3-momentum density in the Eulerian frame.
Definition compobj.h:147
Sym_tensor stress_euler
Stress tensor with respect to the Eulerian observer.
Definition compobj.h:150
Scalar ener_euler
Total energy density E in the Eulerian frame.
Definition compobj.h:144
Metric gamma
3-metric
Definition compobj.h:141
Scalar nn
Lapse function N .
Definition compobj.h:135
Map & mp
Mapping describing the coordinate system (r,theta,phi)
Definition compobj.h:132
Base class for coordinate mappings.
Definition map.h:670
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
Definition map.C:321
Flat metric for tensor calculation.
Definition metric.h:261
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition metric.C:280
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
virtual void sauve(FILE *) const
Save in a file.
Definition scalar.C:686
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Definition scalar.h:637
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values of the Scalar in the co...
Base class for axisymmetric stationary compact stars in Quasi-Isotropic coordinates (under developmen...
Definition compobj.h:487
virtual void sauve(FILE *) const
Save in a file.
Definition star_QI.C:279
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition star_QI.C:300
virtual void del_deriv() const
Deletes all the derived quantities.
Definition star_QI.C:222
virtual double mass_g() const
Gravitational mass.
void operator=(const Star_QI &)
Assignment to another Star_QI.
Definition star_QI.C:250
Class intended to describe valence-2 symmetric tensors.
Definition sym_tensor.h:223
Scalar & set(int)
Read/write access to a component.
Definition vector.C:296
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Definition fread_be.C:69
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Definition fwrite_be.C:70
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Lorene prototypes.
Definition app_hor.h:64