| 1 | /* |
| 2 | * Definition of Lorene class Star_rot_Dirac |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * Copyright (c) 2005 Lap-Ming Lin & Jerome Novak |
| 8 | * |
| 9 | * This file is part of LORENE. |
| 10 | * |
| 11 | * LORENE is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 |
| 13 | * as published by the Free Software Foundation. |
| 14 | * |
| 15 | * LORENE is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with LORENE; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #ifndef __STAR_ROT_DIRAC_H_ |
| 27 | #define __STAR_ROT_DIRAC_H_ |
| 28 | |
| 29 | /* |
| 30 | * |
| 31 | * $Header: /cvsroot/Lorene/C++/Include/star_rot_dirac.h,v 1.8 2014/10/13 08:52:36 j_novak Exp $ |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | |
| 36 | // Headers Lorene |
| 37 | #include "star.h" |
| 38 | |
| 39 | |
| 40 | namespace Lorene { |
| 41 | /** |
| 42 | * Class for relativistic rotating stars in Dirac gauge and maximal slicing. |
| 43 | * (*** Under development ***) \ingroup (star) |
| 44 | * |
| 45 | */ |
| 46 | class Star_rot_Dirac : public Star { |
| 47 | |
| 48 | // Data : |
| 49 | // ----- |
| 50 | protected: |
| 51 | /** |
| 52 | * Spectral exponential filtering order. |
| 53 | * If 0, no filtering is done (see also \c Scalar::exponential_filter_r). |
| 54 | * Filtering is performed only in shells containing matter, i.e. for |
| 55 | * domain numbers \e l such that \f$0 < l <\f$ \c nzet . |
| 56 | */ |
| 57 | int spectral_filter ; |
| 58 | |
| 59 | double omega ; ///< Rotation angular velocity (\c [f_unit] ) |
| 60 | |
| 61 | // Quantities related to the conformal factor and lapse |
| 62 | //---------------------------------- |
| 63 | |
| 64 | Scalar psi4 ; ///< Conformal factor \f$\Psi^4\f$ |
| 65 | Scalar psi2 ; ///< \f$\Psi^2\f$ |
| 66 | Scalar qqq ; ///< \f$Q = \Psi^2 N\f$ |
| 67 | Scalar ln_psi ; ///< \f$ln(\Psi)\f$ |
| 68 | |
| 69 | |
| 70 | // Fluid quantities |
| 71 | //----------------------------------------- |
| 72 | |
| 73 | /** |
| 74 | * Momentum density 3-vector with respect to the |
| 75 | * Eulerian observer |
| 76 | */ |
| 77 | Vector j_euler ; |
| 78 | Scalar v2 ; ///< \f$\gamma_{ij}v^i v^j\f$ |
| 79 | |
| 80 | // Metric stuff |
| 81 | //------------------------------------- |
| 82 | |
| 83 | /// flat metric \f$f_{ij}\f$ (spherical components) |
| 84 | const Metric_flat& flat ; |
| 85 | |
| 86 | Metric tgamma ; ///< \f$\tilde{\gamma}_{ij}\f$ |
| 87 | Sym_tensor aa ; ///< \f$A^{ij}\f$ |
| 88 | Sym_tensor taa ; ///< \f$\tilde{A}_{ij}\f$ |
| 89 | Scalar aa_quad ; ///< \f$\tilde{A}_{ij} A^{ij}\f$ |
| 90 | |
| 91 | /** |
| 92 | * \f$h^{ij}\f$ is defined by \f$\tilde{\gamma}^{ij}=f^{ij}+h^{ij}\f$. |
| 93 | * We impose the Dirac gauge \f$D_j h^{ij}\f$ explicitly by |
| 94 | * defining \f$h^{ij}\f$ to be a symmetric transverse tensor. |
| 95 | */ |
| 96 | Sym_tensor_trans hh ; |
| 97 | |
| 98 | |
| 99 | // Derived data : |
| 100 | // ------------ |
| 101 | protected: |
| 102 | |
| 103 | // More to come later..... |
| 104 | //---------------------------- |
| 105 | |
| 106 | mutable double* p_angu_mom ; ///< Angular momentum. |
| 107 | mutable double* p_grv2 ; ///< Error on the virial identity GRV2. |
| 108 | mutable double* p_grv3 ; ///< Error on the virial identity GRV3. |
| 109 | mutable double* p_tsw ; ///< Ratio T/W. |
| 110 | mutable double* p_r_circ ; ///<Circumferential equatorial radius. |
| 111 | mutable double* p_rp_circ ; ///<Circumferential polar radius. |
| 112 | |
| 113 | |
| 114 | // Constructors - Destructor |
| 115 | // ------------------------- |
| 116 | public: |
| 117 | |
| 118 | /** |
| 119 | * |
| 120 | * Standard constructor. |
| 121 | * |
| 122 | * @param mp_i Mapping on which the star will be defined |
| 123 | * @param nzet_i Number of domains occupied by the star |
| 124 | * @param eos_i Equation of state of the stellar matter |
| 125 | * @param filter order for spectral exponential filtering |
| 126 | */ |
| 127 | Star_rot_Dirac(Map& mp_i, int nzet_i, const Eos& eos_i, int filter=0) ; |
| 128 | |
| 129 | Star_rot_Dirac(const Star_rot_Dirac& ) ; ///< Copy constructor |
| 130 | |
| 131 | |
| 132 | /** Constructor from a file (see \c sauve(FILE*) ). |
| 133 | * |
| 134 | * @param mp_i Mapping on which the star will be defined |
| 135 | * @param eos_i Equation of state of the stellar matter |
| 136 | * @param fich input file (must have been created by the function |
| 137 | * \c sauve ) |
| 138 | */ |
| 139 | Star_rot_Dirac(Map& mp_i, const Eos& eos_i, FILE* fich) ; |
| 140 | |
| 141 | |
| 142 | virtual ~Star_rot_Dirac() ; ///< Destructor |
| 143 | |
| 144 | |
| 145 | // Memory management |
| 146 | // ----------------- |
| 147 | protected: |
| 148 | |
| 149 | /// Deletes all the derived quantities |
| 150 | virtual void del_deriv() const ; |
| 151 | |
| 152 | /// Sets to \c 0x0 all the pointers on derived quantities |
| 153 | void set_der_0x0() const ; |
| 154 | |
| 155 | /** Sets to \c ETATNONDEF (undefined state) the hydrodynamical |
| 156 | * quantities relative to the Eulerian observer. |
| 157 | */ |
| 158 | virtual void del_hydro_euler() ; |
| 159 | |
| 160 | |
| 161 | // Mutators / assignment |
| 162 | // --------------------- |
| 163 | public: |
| 164 | |
| 165 | /// Assignment to another \c Star_rot_Dirac |
| 166 | void operator=(const Star_rot_Dirac& ) ; |
| 167 | |
| 168 | // Accessors |
| 169 | // --------- |
| 170 | public: |
| 171 | |
| 172 | /// Returns the filtering order |
| 173 | int spectral_filter_order() const {return spectral_filter;}; |
| 174 | |
| 175 | /** |
| 176 | * Returns the rotation angular velocity \f$\Omega\f$ |
| 177 | */ |
| 178 | double get_omega() const {return omega;} ; |
| 179 | |
| 180 | |
| 181 | /** |
| 182 | * Returns the conformal factor \f$\Psi^4\f$ |
| 183 | */ |
| 184 | const Scalar& get_psi4() const {return psi4;} ; |
| 185 | |
| 186 | /** |
| 187 | * Returns \f$\Psi^2\f$ |
| 188 | */ |
| 189 | const Scalar& get_psi2() const {return psi2;} ; |
| 190 | |
| 191 | /** |
| 192 | * Returns \f$Q=\Psi^2 N\f$ |
| 193 | */ |
| 194 | const Scalar& get_qqq() const {return qqq;} ; |
| 195 | |
| 196 | /** |
| 197 | * Returns \f$ln(\Psi)\f$ |
| 198 | */ |
| 199 | const Scalar& get_ln_psi() const {return ln_psi;} ; |
| 200 | |
| 201 | |
| 202 | // Fluid stuff |
| 203 | //------------------ |
| 204 | |
| 205 | /** |
| 206 | * Returns the momentum density 3-vector with respect to the |
| 207 | * Eulerian observer |
| 208 | */ |
| 209 | const Vector& get_j_euler() const {return j_euler;} ; |
| 210 | |
| 211 | /** |
| 212 | * Reutrns \f$\gamma_{ij}v^i v^j\f$ |
| 213 | */ |
| 214 | const Scalar& get_v2() const {return v2;} ; |
| 215 | |
| 216 | |
| 217 | //Metric stuff |
| 218 | //------------------- |
| 219 | /** |
| 220 | * Returns the conformal metric \f$\tilde{\gamma}_{ij}\f$ |
| 221 | */ |
| 222 | const Metric get_tgamma() const {return tgamma;} ; |
| 223 | |
| 224 | // documentation comes later...... |
| 225 | |
| 226 | /** |
| 227 | * Returns \f$A^{ij}\f$ |
| 228 | */ |
| 229 | const Sym_tensor get_aa() const {return aa;} ; |
| 230 | |
| 231 | /** |
| 232 | * Returns \f$\tilde{A}_{ij}\f$ |
| 233 | */ |
| 234 | const Sym_tensor get_taa() const {return taa;} ; |
| 235 | |
| 236 | /** |
| 237 | * Returns \f$\tilde{A}_{ij} A^{ij}\f$ |
| 238 | */ |
| 239 | const Scalar get_aa_quad() const {return aa_quad;} ; |
| 240 | |
| 241 | /** |
| 242 | * Returns \f$h^{ij}\f$ |
| 243 | */ |
| 244 | const Sym_tensor_trans get_hh() const {return hh;} ; |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | // Outputs |
| 250 | // ------- |
| 251 | public: |
| 252 | |
| 253 | virtual void sauve(FILE* ) const ; ///< Save in a file |
| 254 | |
| 255 | protected: |
| 256 | |
| 257 | virtual ostream& operator>>(ostream& ) const ; |
| 258 | |
| 259 | |
| 260 | // Global quantities |
| 261 | //------------------------- |
| 262 | public: |
| 263 | |
| 264 | virtual double mass_b() const ; ///< Baryonic mass |
| 265 | virtual double mass_g() const ; ///< Gravitational mass |
| 266 | virtual double angu_mom() const ; ///< Angular momentum |
| 267 | virtual double grv2() const ; ///< Error on the virial identity GRV2 |
| 268 | virtual double grv3() const ; ///< Error on the virial identity GRV3 |
| 269 | virtual double tsw() const ; ///< Ratio T/W |
| 270 | virtual double aplat() const ; ///< Flattening r_pole/r_eq |
| 271 | virtual double r_circ() const ; ///< Circumferential equatorial radius. |
| 272 | virtual double rp_circ() const ; ///< Circumferential polar radius. |
| 273 | /** |
| 274 | * Ellipticity \e e. |
| 275 | * Defined as \f$ e = \sqrt{1 - \left( \frac{R^c_e}{R^c_p} \right)^2} \f$, |
| 276 | * where \f$R^c_e\f$ and \f$R^c_p\f$ are, respectively, the equatorial |
| 277 | * and polar circumferential radius, given by \c r_circ() and \c rp_circ(). |
| 278 | */ |
| 279 | virtual double ellipt() const ; |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | // Computational routines |
| 285 | //-------------------------- |
| 286 | public: |
| 287 | |
| 288 | /** |
| 289 | * Computes the hydrodynamical quantities relative to the Eulerian |
| 290 | * observer from those in the fluid frame. |
| 291 | * |
| 292 | * More later...... |
| 293 | */ |
| 294 | virtual void hydro_euler() ; |
| 295 | |
| 296 | |
| 297 | /** |
| 298 | * Computes metric quantities from known potentials. |
| 299 | * |
| 300 | * The calculation is performed starting from \c qqq, \c logn, |
| 301 | * \c shift, \c hh, which are supposed to be up to date. |
| 302 | * From these, the following fields are updated: \c nnn, |
| 303 | * \c psi4, \c psi2, \c ln_psi, \c tgamma, \c aa, \c taa, and |
| 304 | * \c aa_quad. |
| 305 | */ |
| 306 | void update_metric() ; |
| 307 | |
| 308 | |
| 309 | /** |
| 310 | * Computes an equilibrium configuration |
| 311 | */ |
| 312 | void equilibrium(double ent_c, double omega0, double fact_omega, |
| 313 | int nzadapt, const Tbl& ent_limit, |
| 314 | const Itbl& icontrol, const Tbl& control, |
| 315 | double mbar_wanted, double aexp_mass, |
| 316 | Tbl& diff) ; |
| 317 | |
| 318 | /** |
| 319 | * Solution of the two scalar Poisson equations for rotating |
| 320 | * stars in Dirac gauge |
| 321 | */ |
| 322 | void solve_logn_f(Scalar& ln_f_new) const ; |
| 323 | |
| 324 | /** |
| 325 | * Solution of the two scalar Poisson equations for rotating |
| 326 | * stars in Dirac gauge |
| 327 | */ |
| 328 | void solve_logn_q(Scalar& ln_q_new) const ; |
| 329 | |
| 330 | /** |
| 331 | * Solution of the two scalar Poisson equations for rotating |
| 332 | * stars in Dirac gauge |
| 333 | */ |
| 334 | void solve_qqq(Scalar& q_new) const ; |
| 335 | |
| 336 | /** |
| 337 | * Solution of the shift equation for rotating stars |
| 338 | * in Dirac gauge |
| 339 | */ |
| 340 | void solve_shift(Vector& shift_new) const ; |
| 341 | |
| 342 | /** |
| 343 | * Solution of the tensor Poisson equation for rotating stars |
| 344 | * in Dirac gauge |
| 345 | */ |
| 346 | void solve_hij(Sym_tensor_trans& hij_new) const ; |
| 347 | |
| 348 | }; |
| 349 | |
| 350 | } |
| 351 | #endif |