boson_star.C
/*
* Methods of the class Boson_star
*
* (see file boson_star.h for documentation).
*/
/*
* Copyright (c) 2012 Claire Some, Eric Gourgoulhon
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char boson_star_C[] = "$Header: /cvsroot/Lorene/C++/Source/Compobj/boson_star.C,v 1.4 2014/10/13 08:52:49 j_novak Exp $" ;
/*
* $Id: boson_star.C,v 1.4 2014/10/13 08:52:49 j_novak Exp $
* $Log: boson_star.C,v $
* Revision 1.4 2014/10/13 08:52:49 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.3 2012/12/03 15:27:30 c_some
* Small changes
*
* Revision 1.2 2012/11/23 15:44:10 c_some
* Small changes + method update_ener_mom
*
* Revision 1.1 2012/11/22 16:04:12 c_some
* New class Boson_star
*
*
* $Header: /cvsroot/Lorene/C++/Source/Compobj/boson_star.C,v 1.4 2014/10/13 08:52:49 j_novak Exp $
*
*/
// C headers
#include <cassert>
// Lorene headers
#include "boson_star.h"
#include "utilitaires.h"
//--------------//
// Constructors //
//--------------//
// Standard constructor
// --------------------
namespace Lorene {
Boson_star::Boson_star(Map& mpi, double m, int k) :
Star_QI(mpi) ,
rphi(mpi),
iphi(mpi),
omega(0),
kkk(k),
mmm(m),
m2(m*m)
{
// Pointers of derived quantities initialized to zero :
set_der_0x0() ;
// Initialization of the scalar field to zero
rphi = 0 ;
iphi = 0 ;
}
// Copy constructor
// --------------------
Boson_star::Boson_star(const Boson_star& st) :
Star_QI(st),
rphi(st.rphi),
iphi(st.iphi),
omega(st.omega),
kkk(st.kkk),
mmm(st.mmm),
m2(st.m2)
{
// Pointers of derived quantities initialized to zero :
set_der_0x0() ;
}
// Constructor from a file
// -----------------------
Boson_star::Boson_star(Map& mpi, FILE* fich) :
Star_QI(mpi, fich) ,
rphi(mpi, *(mpi.get_mg()), fich) ,
iphi(mpi, *(mpi.get_mg()), fich)
{
// Pointers of derived quantities initialized to zero :
set_der_0x0() ;
fread_be(&omega, sizeof(double), 1, fich) ;
fread_be(&kkk, sizeof(int), 1, fich) ;
fread_be(&mmm, sizeof(double), 1, fich) ;
m2 = mmm*mmm ;
}
//------------//
// Destructor //
//------------//
Boson_star::~Boson_star(){
del_deriv() ;
}
//----------------------------------//
// Management of derived quantities //
//----------------------------------//
void Boson_star::del_deriv() const {
Star_QI::del_deriv() ;
Boson_star::set_der_0x0() ;
}
void Boson_star::set_der_0x0() const {
}
//--------------//
// Assignment //
//--------------//
// Assignment to another Boson_star
// --------------------------------
void Boson_star::operator=(const Boson_star& st) {
// Assignment of quantities common to all the derived classes of Star_QI
Star_QI::operator=(st) ;
rphi = st.rphi ;
iphi = st.iphi ;
omega = st.omega ;
kkk = st.kkk ;
mmm = st.mmm ;
m2 = st.m2 ;
del_deriv() ; // Deletes all derived quantities
}
//--------------//
// Outputs //
//--------------//
// Save in a file
// --------------
void Boson_star::sauve(FILE* fich) const {
Star_QI::sauve(fich) ;
rphi.sauve(fich) ;
iphi.sauve(fich) ;
fwrite_be(&omega, sizeof(double), 1, fich) ;
fwrite_be(&kkk, sizeof(int), 1, fich) ;
fwrite_be(&mmm, sizeof(double), 1, fich) ;
}
// Printing
// --------
ostream& Boson_star::operator>>(ostream& ost) const {
Star_QI::operator>>(ost) ;
ost << endl << "Axisymmetric stationary boson star in quasi-isotropic coordinates (class Boson_star) " << endl ;
ost << "Boson mass : " << mmm << endl ; //## which units ?
ost << "omega = " << omega << " , k = " << kkk << endl ;
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 ;
// ost << "Real part of the scalar field : " << rphi << endl ;
// ost << "Imaginary part of the scalar field : " << iphi << endl ;
//## ost << "ADM mass : " << adm_mass() << endl ;
ost << "Gravitational mass : " << mass_g() << endl ;
return ost ;
}
//------------------------
// Computational routines
//------------------------
/* Computes the 3+1 components of the energy-momentum tensor (E, P_i and S_{ij})
* from the values of the scalar field and the metric
*/
void Boson_star::update_ener_mom() {
const Metric_flat& ff = mp.flat_met_spher() ;
Scalar mod_phi2 = rphi*rphi + iphi*iphi ;
mod_phi2.inc_dzpuis(4) ; // mod_phi2 multiplied by r^4 in the last domain
Sym_tensor dphidphi = rphi.derive_cov(ff) * rphi.derive_cov(ff)
+ iphi.derive_cov(ff) * iphi.derive_cov(ff) ;
Scalar tmp = (omega - kkk*nphi)/nn ;
Scalar tmp2 = tmp*tmp ;
Scalar dphi2 = dphidphi.trace(gamma) ;
ener_euler = 0.5*( (tmp2 + m2)*mod_phi2 + dphi2 ) ;
mom_euler.set(1) = 0 ; // p^(r) = 0
mom_euler.set(2) = 0 ; // p^(theta) = 0
mom_euler.set(3) = -kkk*tmp * mod_phi2 ;
stress_euler = dphidphi - 0.5*( (m2-tmp2)*mod_phi2 + dphi2 )*gamma.cov() ;
}
}
Lorene::Boson_star::omega
double omega
Coefficient omega in the time dependence of Phi.
Definition boson_star.h:80
Lorene::Boson_star::set_der_0x0
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition boson_star.C:138
Lorene::Boson_star::m2
double m2
Boson mass squared.
Definition boson_star.h:92
Lorene::Boson_star::del_deriv
virtual void del_deriv() const
Deletes all the derived quantities.
Definition boson_star.C:130
Lorene::Boson_star::mmm
double mmm
Boson mass.
Definition boson_star.h:88
Lorene::Boson_star::rphi
Scalar rphi
Real part of the scalar field Phi.
Definition boson_star.h:72
Lorene::Boson_star::kkk
int kkk
Coefficient kkk in the azimuthal dependence of Phi.
Definition boson_star.h:84
Lorene::Boson_star::~Boson_star
virtual ~Boson_star()
Destructor.
Definition boson_star.C:119
Lorene::Boson_star::operator=
void operator=(const Boson_star &)
Assignment to another Boson_star.
Definition boson_star.C:148
Lorene::Boson_star::update_ener_mom
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
Lorene::Boson_star::Boson_star
Boson_star(Map &mp_i, double m, int k)
Standard constructor.
Definition boson_star.C:64
Lorene::Boson_star::iphi
Scalar iphi
Imaginary part of the scalar field Phi.
Definition boson_star.h:76
Lorene::Boson_star::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition boson_star.C:169
Lorene::Boson_star::operator>>
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition boson_star.C:183
Lorene::Compobj_QI::nphi
Scalar nphi
Metric coefficient .
Definition compobj.h:296
Lorene::Compobj::mom_euler
Vector mom_euler
Total 3-momentum density in the Eulerian frame.
Definition compobj.h:147
Lorene::Compobj::stress_euler
Sym_tensor stress_euler
Stress tensor with respect to the Eulerian observer.
Definition compobj.h:150
Lorene::Compobj::ener_euler
Scalar ener_euler
Total energy density E in the Eulerian frame.
Definition compobj.h:144
Lorene::Compobj::gamma
Metric gamma
3-metric
Definition compobj.h:141
Lorene::Compobj::nn
Scalar nn
Lapse function N .
Definition compobj.h:135
Lorene::Compobj::mp
Map & mp
Mapping describing the coordinate system (r,theta,phi).
Definition compobj.h:132
Lorene::Metric_flat
Flat metric for tensor calculation.
Definition metric.h:261
Lorene::Scalar
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
Lorene::Scalar::inc_dzpuis
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...
Definition scalar_r_manip.C:470
Lorene::Star_QI::Star_QI
Star_QI(Map &mp_i)
Standard constructor.
Definition star_QI.C:68
Lorene::Star_QI::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition star_QI.C:279
Lorene::Star_QI::operator>>
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition star_QI.C:300
Lorene::Star_QI::del_deriv
virtual void del_deriv() const
Deletes all the derived quantities.
Definition star_QI.C:222
Lorene::Star_QI::mass_g
virtual double mass_g() const
Gravitational mass.
Definition star_QI_global.C:64
Lorene::Star_QI::operator=
void operator=(const Star_QI &)
Assignment to another Star_QI.
Definition star_QI.C:250
Lorene::Sym_tensor
Class intended to describe valence-2 symmetric tensors.
Definition sym_tensor.h:223
Lorene::fread_be
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
Lorene::fwrite_be
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
Lorene::Tensor::trace
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Definition tensor_calculus.C:94
Lorene
Lorene prototypes.
Definition app_hor.h:64
Lorene::get_mg
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition map.h:765
Lorene::Map
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Definition map.C:139