| 1 | /* |
| 2 | * Definition of Lorene class Time_slice |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * Copyright (c) 2004 Eric Gourgoulhon, Jose Luis Jaramillo & 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 __TIME_SLICE_H_ |
| 27 | #define __TIME_SLICE_H_ |
| 28 | |
| 29 | /* |
| 30 | * $Id: time_slice.h,v 1.32 2014/10/13 08:52:37 j_novak Exp $ |
| 31 | * $Log: time_slice.h,v $ |
| 32 | * Revision 1.32 2014/10/13 08:52:37 j_novak |
| 33 | * Lorene classes and functions now belong to the namespace Lorene. |
| 34 | * |
| 35 | * Revision 1.31 2012/02/06 12:59:07 j_novak |
| 36 | * Correction of some errors. |
| 37 | * |
| 38 | * Revision 1.30 2010/10/20 07:58:09 j_novak |
| 39 | * Better implementation of the explicit time-integration. Not fully-tested yet. |
| 40 | * |
| 41 | * Revision 1.29 2008/12/04 18:22:49 j_novak |
| 42 | * Enhancement of the dzpuis treatment + various bug fixes. |
| 43 | * |
| 44 | * Revision 1.28 2008/12/02 15:02:21 j_novak |
| 45 | * Implementation of the new constrained formalism, following Cordero et al. 2009 |
| 46 | * paper. The evolution eqs. are solved as a first-order system. Not tested yet! |
| 47 | * |
| 48 | * Revision 1.27 2008/08/19 06:41:59 j_novak |
| 49 | * Minor modifications to avoid warnings with gcc 4.3. Most of them concern |
| 50 | * cast-type operations, and constant strings that must be defined as const char* |
| 51 | * |
| 52 | * Revision 1.26 2007/11/06 14:47:06 j_novak |
| 53 | * New constructor from a rotating star in Dirac gauge (class Star_rot_Dirac). |
| 54 | * Evolution can take into account matter terms. |
| 55 | * |
| 56 | * Revision 1.25 2007/04/25 15:20:59 j_novak |
| 57 | * Corrected an error in the initialization of tildeB in |
| 58 | * Tslice_dirac_max::initial_dat_cts. + New method for solve_hij_AB. |
| 59 | * |
| 60 | * Revision 1.24 2007/03/21 14:51:48 j_novak |
| 61 | * Introduction of potentials A and tilde(B) of h^{ij} into Tslice_dirac_max. |
| 62 | * |
| 63 | * Revision 1.23 2005/03/28 19:44:00 f_limousin |
| 64 | * Function tgam() is now virtual. |
| 65 | * |
| 66 | * Revision 1.22 2004/06/24 20:36:07 e_gourgoulhon |
| 67 | * Class Time_slice_conf: added method check_psi_dot. |
| 68 | * |
| 69 | * Revision 1.21 2004/06/14 20:46:35 e_gourgoulhon |
| 70 | * Added argument method_poisson to Tslice_dirac_max::solve_hij. |
| 71 | * |
| 72 | * Revision 1.20 2004/05/31 20:28:20 e_gourgoulhon |
| 73 | * -- Class Time_slice : added inline functions get_latest_j() and |
| 74 | * get_time() |
| 75 | * -- Class Tslice_dirac_max: method hh_det_one takes now a time step |
| 76 | * as argument, to compute h^{ij} from khi and mu at an arbitrary |
| 77 | * time step and not only the latest one. |
| 78 | * |
| 79 | * Revision 1.19 2004/05/27 15:22:28 e_gourgoulhon |
| 80 | * Added functions save and sauve, as well as constructors from file. |
| 81 | * |
| 82 | * Revision 1.18 2004/05/20 20:30:37 e_gourgoulhon |
| 83 | * Added arguments check_mod and save_mod to method Tsclice_dirac_max::evolve. |
| 84 | * |
| 85 | * Revision 1.17 2004/05/17 19:52:16 e_gourgoulhon |
| 86 | * -- Method initial_data_cts: added arguments graph_device and |
| 87 | * method_poisson_vect. |
| 88 | * -- Method Tslice_dirac_max::solve_beta : added argument method |
| 89 | * -- Method Tslice_dirac_max::solve_hij : added argument graph_device |
| 90 | * -- Method Tslice_dirac_max::evolve : added arguments |
| 91 | * method_poisson_vect, nopause and graph_device. |
| 92 | * |
| 93 | * Revision 1.16 2004/05/12 15:16:25 e_gourgoulhon |
| 94 | * Added #include "metric.h" before #include "evolution.h". |
| 95 | * |
| 96 | * Revision 1.15 2004/05/09 20:56:09 e_gourgoulhon |
| 97 | * Added member adm_mass_evol and corresponding virtual method adm_mass(). |
| 98 | * |
| 99 | * Revision 1.14 2004/05/06 15:23:10 e_gourgoulhon |
| 100 | * initial_data_cts is know a virtual function of class Time_slice_conf |
| 101 | * and is implemented also for class Tslice_dirac_max. |
| 102 | * |
| 103 | * Revision 1.13 2004/05/03 14:46:11 e_gourgoulhon |
| 104 | * Class Tslice_dirac_max: -- changed prototype of method solve_hij |
| 105 | * -- added new method evolve |
| 106 | * |
| 107 | * Revision 1.12 2004/04/30 14:36:15 j_novak |
| 108 | * Added the method Tslice_dirac_max::solve_hij(...) |
| 109 | * NOT READY YET!!! |
| 110 | * |
| 111 | * Revision 1.11 2004/04/30 10:51:38 e_gourgoulhon |
| 112 | * Class Tslice_dirac_max: added methods solve_n, solve_q and solve_beta |
| 113 | * for resolution of the elliptic part of Einstein equations. |
| 114 | * |
| 115 | * Revision 1.10 2004/04/29 17:07:27 e_gourgoulhon |
| 116 | * Added argument pdt to Time_slice_conf::initial_data_cts. |
| 117 | * |
| 118 | * Revision 1.9 2004/04/08 16:42:11 e_gourgoulhon |
| 119 | * Many changes: |
| 120 | * -- class Time_slice_conf: added methods set_*, changed argument list of |
| 121 | * method initial_data_cts. |
| 122 | * -- class Tslice_dirac_max: added methods set_* and hh_det_one(). |
| 123 | * |
| 124 | * Revision 1.8 2004/04/05 21:21:51 e_gourgoulhon |
| 125 | * class Time_slice_conf: added method initial_data_cts (computation of |
| 126 | * initial data from conformally thin sandwich method). |
| 127 | * classes Time_slice_conf and Tslice_dirac_max: added constructor as |
| 128 | * standard time slice of Minkowski spacetime. |
| 129 | * |
| 130 | * Revision 1.7 2004/04/01 16:09:01 j_novak |
| 131 | * Trace of K_ij is now member of Time_slice (it was member of Time_slice_conf). |
| 132 | * Added new methods for checking 3+1 Einstein equations (preliminary). |
| 133 | * |
| 134 | * Revision 1.6 2004/03/30 14:00:30 j_novak |
| 135 | * New class Tslide_dirac_max (first version). |
| 136 | * |
| 137 | * Revision 1.5 2004/03/29 11:58:53 e_gourgoulhon |
| 138 | * Many modif. to class Time_slice_conf. |
| 139 | * Minor modif. to class Time_slice. |
| 140 | * |
| 141 | * Revision 1.4 2004/03/28 21:33:14 e_gourgoulhon |
| 142 | * Constructor Time_slice::Time_slice(int depth_in) declared "explicit". |
| 143 | * |
| 144 | * Revision 1.3 2004/03/28 21:27:57 e_gourgoulhon |
| 145 | * Class Time_slice: - renamed the Evolution_std with suffix "_evol". |
| 146 | * - added protected constructor for derived classes |
| 147 | * Added class Time_slice_conf. |
| 148 | * |
| 149 | * Revision 1.2 2004/03/26 13:33:02 j_novak |
| 150 | * New methods for accessing/updating members (nn(), beta(), gam_uu(), k_uu(), ...) |
| 151 | * |
| 152 | * Revision 1.1 2004/03/24 14:56:18 e_gourgoulhon |
| 153 | * First version |
| 154 | * |
| 155 | * |
| 156 | * $Header: /cvsroot/Lorene/C++/Include/time_slice.h,v 1.32 2014/10/13 08:52:37 j_novak Exp $ |
| 157 | * |
| 158 | */ |
| 159 | |
| 160 | #include "star_rot_dirac.h" |
| 161 | #include "evolution.h" |
| 162 | |
| 163 | //---------------------------// |
| 164 | // class Time_slice // |
| 165 | //---------------------------// |
| 166 | |
| 167 | namespace Lorene { |
| 168 | /** |
| 169 | * Spacelike time slice of a 3+1 spacetime. |
| 170 | * \ingroup (evol) |
| 171 | * |
| 172 | */ |
| 173 | class Time_slice { |
| 174 | |
| 175 | // Data : |
| 176 | // ----- |
| 177 | protected: |
| 178 | /// Number of stored time slices |
| 179 | int depth ; |
| 180 | |
| 181 | /** Order of the finite-differences scheme for |
| 182 | * the computation of time derivatives. |
| 183 | * |
| 184 | * This order is not constant and can be adjusted \e via |
| 185 | * \c set_scheme_order() . |
| 186 | */ |
| 187 | int scheme_order ; |
| 188 | |
| 189 | /// Time step index of the latest slice |
| 190 | int jtime ; |
| 191 | |
| 192 | /// Time label of each slice |
| 193 | Evolution_std<double> the_time ; |
| 194 | |
| 195 | /** Values at successive time steps of the covariant components of |
| 196 | * the induced metric \f$ \gamma_{ij} \f$ |
| 197 | */ |
| 198 | mutable Evolution_std<Sym_tensor> gam_dd_evol ; |
| 199 | |
| 200 | /** Values at successive time steps of the contravariant components |
| 201 | * of the induced metric \f$ \gamma^{ij} \f$ |
| 202 | */ |
| 203 | mutable Evolution_std<Sym_tensor> gam_uu_evol ; |
| 204 | |
| 205 | /** Values at successive time steps of the covariant components |
| 206 | * of the extrinsic curvature tensor \f$ K_{ij} \f$ |
| 207 | */ |
| 208 | mutable Evolution_std<Sym_tensor> k_dd_evol ; |
| 209 | |
| 210 | /** Values at successive time steps of the contravariant components |
| 211 | * of the extrinsic curvature tensor \f$ K^{ij} \f$ |
| 212 | */ |
| 213 | mutable Evolution_std<Sym_tensor> k_uu_evol ; |
| 214 | |
| 215 | /// Values at successive time steps of the lapse function \e N |
| 216 | mutable Evolution_std<Scalar> n_evol ; |
| 217 | |
| 218 | /// Values at successive time steps of the shift vector \f$ \beta^i \f$ |
| 219 | mutable Evolution_std<Vector> beta_evol ; |
| 220 | |
| 221 | /** Values at successive time steps of the trace \e K of the |
| 222 | * extrinsic curvature |
| 223 | */ |
| 224 | mutable Evolution_std<Scalar> trk_evol ; |
| 225 | |
| 226 | /** ADM mass at each time step, since the creation of the slice. |
| 227 | * At a given time step \c j, \c adm_mass_evol[j] is a 1-D \c Tbl |
| 228 | * of size the number \c nz of domains, containing the "ADM mass" |
| 229 | * evaluated at the outer boundary of each domain. The true ADM |
| 230 | * mass is thus the last value, i.e. \c adm_mass_evol[j](nz-1). |
| 231 | * |
| 232 | */ |
| 233 | mutable Evolution_full<Tbl> adm_mass_evol ; |
| 234 | |
| 235 | // Derived data : |
| 236 | // ------------ |
| 237 | protected: |
| 238 | /// Pointer on the induced metric at the current time step (\c jtime) |
| 239 | mutable Metric* p_gamma ; |
| 240 | |
| 241 | // Constructors - Destructor |
| 242 | // ------------------------- |
| 243 | public: |
| 244 | |
| 245 | /** General constructor (Hamiltonian-like). |
| 246 | * |
| 247 | * @param lapse_in lapse function \e N |
| 248 | * @param shift_in shift vector |
| 249 | * @param gamma_in induced metric (covariant or contravariant components) |
| 250 | * @param kk_in extrinsic curvature (covariant or contravariant components) |
| 251 | * @param depth_in number of stored time slices; this parameter is used |
| 252 | * to set the \c scheme_order member with \c scheme_order |
| 253 | * = \c depth_in - 1. \c scheme_order can be changed |
| 254 | * afterwards by the method \c set_scheme_order(int). |
| 255 | */ |
| 256 | Time_slice(const Scalar& lapse_in, const Vector& shift_in, |
| 257 | const Sym_tensor& gamma_in, const Sym_tensor& kk_in, |
| 258 | int depth_in = 3) ; |
| 259 | |
| 260 | /** General constructor (Lagrangian-like). |
| 261 | * |
| 262 | * @param lapse_in lapse function \e N |
| 263 | * @param shift_in shift vector |
| 264 | * @param gamma_in induced metric (covariant or contravariant components) |
| 265 | * at various time steps; note that the \c scheme_order member |
| 266 | * is set to \c gamma_in.size - 1. \c scheme_order can be changed |
| 267 | * afterwards by the method \c set_scheme_order(int). |
| 268 | */ |
| 269 | Time_slice(const Scalar& lapse_in, const Vector& shift_in, |
| 270 | const Evolution_std<Sym_tensor>& gamma_in) ; |
| 271 | |
| 272 | /** Constructor as standard time slice of flat spacetime (Minkowski). |
| 273 | * |
| 274 | * @param mp Mapping on which the various Lorene fields will be constructed |
| 275 | * @param triad vector basis with respect to which the various tensor |
| 276 | * components will be defined |
| 277 | * @param depth_in number of stored time slices; this parameter is used |
| 278 | * to set the \c scheme_order member with \c scheme_order |
| 279 | * = \c depth_in - 1. \c scheme_order can be changed |
| 280 | * afterwards by the method \c set_scheme_order(int). |
| 281 | */ |
| 282 | Time_slice(const Map& mp, const Base_vect& triad, int depth_in = 3) ; |
| 283 | |
| 284 | /** Constructor from binary file. |
| 285 | * |
| 286 | * The binary file must have been created by method \c save. |
| 287 | * |
| 288 | * @param mp Mapping on which the various Lorene fields will be constructed |
| 289 | * @param triad vector basis with respect to which the various tensor |
| 290 | * components will be defined |
| 291 | * @param fich file containing the saved \c Time_slice |
| 292 | * @param partial_read indicates whether the full object must |
| 293 | * be read in file or whether the final construction is |
| 294 | * devoted to a constructor of a derived class |
| 295 | * @param depth_in number of stored time slices; the given value must |
| 296 | * coincide with that stored in the file. |
| 297 | */ |
| 298 | Time_slice(const Map& mp, const Base_vect& triad, FILE* fich, |
| 299 | bool partial_read, int depth_in = 3) ; |
| 300 | |
| 301 | Time_slice(const Time_slice& ) ; ///< Copy constructor |
| 302 | |
| 303 | protected: |
| 304 | /** Special constructor for derived classes. |
| 305 | * |
| 306 | */ |
| 307 | explicit Time_slice(int depth_in) ; |
| 308 | |
| 309 | public: |
| 310 | virtual ~Time_slice() ; ///< Destructor |
| 311 | |
| 312 | |
| 313 | // Memory management |
| 314 | // ----------------- |
| 315 | protected: |
| 316 | |
| 317 | /// Deletes all the derived quantities |
| 318 | virtual void del_deriv() const ; |
| 319 | |
| 320 | /// Sets to \c 0x0 all the pointers on derived quantities |
| 321 | void set_der_0x0() const ; |
| 322 | |
| 323 | |
| 324 | // Mutators / assignment |
| 325 | // --------------------- |
| 326 | public: |
| 327 | /// Assignment to another \c Time_slice |
| 328 | void operator=(const Time_slice&) ; |
| 329 | |
| 330 | /// Sets the order of the finite-differences scheme. |
| 331 | void set_scheme_order(int ord) { |
| 332 | assert ((0<= ord)&&(ord < 4)) ; |
| 333 | scheme_order = ord ; } ; |
| 334 | |
| 335 | // Accessors |
| 336 | // --------- |
| 337 | public: |
| 338 | |
| 339 | /// Gets the order of the finite-differences scheme. |
| 340 | int get_scheme_order() const { return scheme_order ; } ; |
| 341 | |
| 342 | /// Gets the latest value of time step index |
| 343 | int get_latest_j() const {return jtime; } ; |
| 344 | |
| 345 | /// Gets the time coordinate \e t at successive time steps |
| 346 | const Evolution_std<double>& get_time() const {return the_time; } ; |
| 347 | |
| 348 | /// Lapse function \e N at the current time step (\c jtime ) |
| 349 | virtual const Scalar& nn() const ; |
| 350 | |
| 351 | /// shift vector \f$ \beta^i \f$ at the current time step (\c jtime ) |
| 352 | virtual const Vector& beta() const ; |
| 353 | |
| 354 | /// Induced metric \f$ \mathbf{\gamma} \f$ at the current time step (\c jtime ) |
| 355 | const Metric& gam() const ; |
| 356 | |
| 357 | /** Induced metric (covariant components \f$ \gamma_{ij} \f$) |
| 358 | * at the current time step (\c jtime ) |
| 359 | */ |
| 360 | virtual const Sym_tensor& gam_dd() const ; |
| 361 | |
| 362 | /** Induced metric (contravariant components \f$ \gamma^{ij} \f$) |
| 363 | * at the current time step (\c jtime ) |
| 364 | */ |
| 365 | virtual const Sym_tensor& gam_uu() const ; |
| 366 | |
| 367 | /** Extrinsic curvature tensor (covariant components \f$ K_{ij} \f$) |
| 368 | * at the current time step (\c jtime ) |
| 369 | */ |
| 370 | virtual const Sym_tensor& k_dd() const ; |
| 371 | |
| 372 | /** Extrinsic curvature tensor (contravariant components \f$ K^{ij} \f$) |
| 373 | * at the current time step (\c jtime ) |
| 374 | */ |
| 375 | virtual const Sym_tensor& k_uu() const ; |
| 376 | |
| 377 | /** Trace \e K of the extrinsic curvature |
| 378 | * at the current time step (\c jtime ) |
| 379 | */ |
| 380 | virtual const Scalar& trk() const ; |
| 381 | |
| 382 | |
| 383 | // Computational functions |
| 384 | // ----------------------- |
| 385 | public: |
| 386 | /** |
| 387 | * Checks the level at which the hamiltonian constraint is verified. |
| 388 | * |
| 389 | * \f[ |
| 390 | * R + K^2 - K_{ij}K^{ij} = 16\pi E |
| 391 | * \f] |
| 392 | * @param energy_density : a pointer on the energy density \e E |
| 393 | * measured by the Eulerian observer of 4-velocity |
| 394 | * \f$\mbox{\boldmath{$n $}}\f$ ; if this |
| 395 | * is the null pointer, it is assumed that \e E = 0 (vacuum). |
| 396 | * @param ost : output stream for a formatted output of the result |
| 397 | * @return Tbl of size the number of domains containing the |
| 398 | * absolute ( if \e E = 0 ) or the relative (in presence of matter) |
| 399 | * error in max version. |
| 400 | */ |
| 401 | Tbl check_hamiltonian_constraint(const Scalar* energy_density = 0x0, |
| 402 | ostream& ost = cout, bool verb=true) const ; |
| 403 | |
| 404 | /** |
| 405 | * Checks the level at which the momentum constraints are verified. |
| 406 | * |
| 407 | * \f[ |
| 408 | * D_j K_i^{\ j} - D_i K = 8 \pi J_i |
| 409 | * \f] |
| 410 | * @param momentum_density : a pointer on the momentum density |
| 411 | * \f$ J_i \f$ measured by the Eulerian observer of 4-velocity |
| 412 | * \f$\mbox{\boldmath{$n $}}\f$ ; if this is the null pointer, |
| 413 | * it is assumed that\f$ J_i \f$ = 0 (vacuum). |
| 414 | * @param ost : output stream for a formatted output of the result |
| 415 | * @return Tbl 2D of size the number of domains times 3 |
| 416 | * (components)containing the absolute ( if \f$ J_i \f$ = 0 ) |
| 417 | * or the relative (in presence of matter) error in max version. |
| 418 | */ |
| 419 | Tbl check_momentum_constraint(const Vector* momentum_density = 0x0, |
| 420 | ostream& ost = cout, bool verb=true) const ; |
| 421 | |
| 422 | /** |
| 423 | * Checks the level at which the dynamical equations are verified. |
| 424 | * |
| 425 | * \f[ |
| 426 | * \frac{\partial K_{ij}}{\partial t} - |
| 427 | * \pounds_{\mbox{\boldmath{$\beta $}}} K_{ij} = - D_i D_j N |
| 428 | * + N \left[ R_{ij} - 2 K_{ik} K^k_{\ j} + K K_{ij} |
| 429 | * + 4\pi \left( (S-E)\gamma_{ij} - 2 S_{ij} \right) |
| 430 | * \right] |
| 431 | * \f] |
| 432 | * @param strain_tensor : a pointer on the strain_tensor |
| 433 | * \f$ S_{ij} \f$ measured by the Eulerian observer of 4-velocity |
| 434 | * \f$\mbox{\boldmath{$n $}}\f$ ; if this is the null pointer, |
| 435 | * it is assumed that \f$ S_{ij} \f$ = 0 (vacuum). |
| 436 | * @param energy_density : a pointer on the energy density \e E |
| 437 | * (see \c check_hamiltonian_constraint) |
| 438 | * @param ost : output stream for a formatted output of the result |
| 439 | * @return Tbl 3D of size the number of domains times 3 times 3 |
| 440 | * (corresponding to the rank-2 tensor, with the symmetry in the |
| 441 | * components) containing the absolute ( if \f$ J_i \f$ = 0 ) or |
| 442 | * the relative (in presence of matter) error in max version. |
| 443 | */ |
| 444 | Tbl check_dynamical_equations(const Sym_tensor* strain_tensor = 0x0, |
| 445 | const Scalar* energy_density = 0x0, |
| 446 | ostream& ost = cout, bool verb=true) const ; |
| 447 | |
| 448 | /** Returns the ADM mass (geometrical units) at the current step. |
| 449 | * Moreover this method updates \c adm_mass_evol if |
| 450 | * necessary. |
| 451 | */ |
| 452 | virtual double adm_mass() const ; |
| 453 | |
| 454 | // Outputs |
| 455 | // ------- |
| 456 | protected: |
| 457 | /// Operator >> (virtual function called by the operator<<). |
| 458 | virtual ostream& operator>>(ostream& ) const ; |
| 459 | |
| 460 | /// Display |
| 461 | friend ostream& operator<<(ostream& , const Time_slice& ) ; |
| 462 | |
| 463 | public: |
| 464 | /** Saves in a binary file. |
| 465 | * The saved data is sufficient to restore the whole time slice |
| 466 | * via the constructor from file. |
| 467 | * @param rootname root for the file name; the current time step index |
| 468 | * will be appended to it. |
| 469 | */ |
| 470 | void save(const char* rootname) const ; |
| 471 | |
| 472 | protected: |
| 473 | /** Total or partial saves in a binary file. |
| 474 | * This protected method is to be called either from public method |
| 475 | * \c save or from method \c sauve of a derived class. |
| 476 | * |
| 477 | * @param fich binary file |
| 478 | * @param partial_save indicates whether the whole object must be |
| 479 | * saved. |
| 480 | */ |
| 481 | virtual void sauve(FILE* fich, bool partial_save) const ; |
| 482 | |
| 483 | }; |
| 484 | |
| 485 | ostream& operator<<(ostream& , const Time_slice& ) ; |
| 486 | |
| 487 | |
| 488 | |
| 489 | //---------------------------// |
| 490 | // class Time_slice_conf // |
| 491 | //---------------------------// |
| 492 | |
| 493 | /** |
| 494 | * Spacelike time slice of a 3+1 spacetime with conformal decomposition. |
| 495 | * \ingroup (evol) |
| 496 | * |
| 497 | */ |
| 498 | class Time_slice_conf : public Time_slice { |
| 499 | |
| 500 | // Data : |
| 501 | // ----- |
| 502 | protected: |
| 503 | |
| 504 | /** Pointer on the flat metric \f$ f_{ij} \f$ with respect to |
| 505 | * which the conformal decomposition is performed |
| 506 | */ |
| 507 | const Metric_flat& ff ; |
| 508 | |
| 509 | /** Values at successive time steps of the conformal factor |
| 510 | * \f$ \Psi \f$ relating the |
| 511 | * physical metric \f$ \gamma_{ij} \f$ to the conformal one: |
| 512 | * \f$ \gamma_{ij} = \Psi^4 \tilde\gamma_{ij} \f$. |
| 513 | * \f$ \Psi \f$ is defined by |
| 514 | * \f[ \Psi := \left( \frac{\det\gamma_{ij}}{\det f_{ij}} |
| 515 | * \right) ^{1/12} \f] |
| 516 | */ |
| 517 | mutable Evolution_std<Scalar> psi_evol ; |
| 518 | |
| 519 | /** Values at successive time steps of the factor |
| 520 | * \f$ N\Psi \f$. |
| 521 | */ |
| 522 | mutable Evolution_std<Scalar> npsi_evol ; |
| 523 | |
| 524 | |
| 525 | /** Values at successive time steps of the components \f$ h^{ij} \f$. |
| 526 | * It is the deviation of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 527 | * the flat metric \f$ f^{ij} \f$: |
| 528 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 529 | */ |
| 530 | mutable Evolution_std<Sym_tensor> hh_evol ; |
| 531 | |
| 532 | /** Values at successive time steps of the components \f$ \hat{A}^{ij} \f$. |
| 533 | * It is the conformal representation of the traceless part |
| 534 | * of the extrinsic curvature: |
| 535 | * \f$ \hat{A}^{ij} = \Psi^{10} \left( K^{ij} - \frac{1}{3} K \gamma^{ij} \right) \f$. |
| 536 | * One can uniquely (up to the boundary conditions) define the decomposition: |
| 537 | * \f$ \hat{A}^{ij} = {\cal D}^i X^j + {\cal D}^j X^i - \frac{2}{3} |
| 538 | * {\cal D}_k X^k f^{ij} + \hat{A}^{ij}_{TT} \f$, where \f$ X^i \f$ |
| 539 | * represents the longitudinal part and \f$ \hat{A}^{ij}_{TT} \f$ is |
| 540 | * the transverse-traceless part. |
| 541 | */ |
| 542 | mutable Evolution_std<Sym_tensor> hata_evol ; |
| 543 | |
| 544 | /** Potential \e A associated with the symmetric tensor |
| 545 | * \f$ \hat{A}^{ij}_{TT} \f$. (see documentation of \c Sym_tensor::p_aaa). |
| 546 | */ |
| 547 | mutable Evolution_std<Scalar> A_hata_evol ; |
| 548 | |
| 549 | /** Potential \f$ \tilde{B} \f$ associated with the symmetric tensor |
| 550 | * \f$ \hat{A}^{ij}_{TT} \f$. (see documentation of \c Sym_tensor::p_tilde_b). |
| 551 | */ |
| 552 | mutable Evolution_std<Scalar> B_hata_evol ; |
| 553 | |
| 554 | // Derived data : |
| 555 | // ------------ |
| 556 | protected: |
| 557 | /** Pointer on the conformal metric \f$ \tilde\gamma_{ij} \f$ |
| 558 | * at the current time step (\c jtime) |
| 559 | */ |
| 560 | mutable Metric* p_tgamma ; |
| 561 | |
| 562 | /// Pointer on the factor \f$ \Psi^4 \f$ at the current time step (\c jtime) |
| 563 | mutable Scalar* p_psi4 ; |
| 564 | |
| 565 | /// Pointer on the logarithm of \f$ \Psi \f$ at the current time step (\c jtime) |
| 566 | mutable Scalar* p_ln_psi ; |
| 567 | |
| 568 | /** Pointer on the vector \f$ H^i = {\cal D}_j \tilde\gamma^{ij} \f$ |
| 569 | * (which vanishes in Dirac gauge), at the current time step (\c jtime). |
| 570 | */ |
| 571 | mutable Vector* p_hdirac ; |
| 572 | |
| 573 | /** Pointer on the vector \f$ X^i \f$ representing the longitudinal |
| 574 | * part of \f$ \hat{A}^{ij} \f$. |
| 575 | * (see the documentation of \c hata_evol) |
| 576 | */ |
| 577 | mutable Vector* p_vec_X ; |
| 578 | |
| 579 | // Constructors - Destructor |
| 580 | // ------------------------- |
| 581 | public: |
| 582 | |
| 583 | /** Constructor from conformal decomposition. |
| 584 | * |
| 585 | * @param lapse_in lapse function \e N |
| 586 | * @param shift_in shift vector |
| 587 | * @param ff_in reference flat metric with respect to which the |
| 588 | * conformal decomposition is performed |
| 589 | * @param psi_in conformal factor \f$\Psi\f$ relating the |
| 590 | * physical metric \f$ \gamma_{ij} \f$ to the conformal one: |
| 591 | * \f$ \gamma_{ij} = \Psi^4 \tilde\gamma_{ij} \f$ |
| 592 | * @param hh_in deviation \f$ h^{ij} \f$ |
| 593 | * of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 594 | * the flat metric \f$ f^{ij} \f$: |
| 595 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 596 | * \f$ h^{ij} \f$ must be such that |
| 597 | * \f$\det\tilde\gamma^{ij} = f^{-1} \f$. |
| 598 | * @param hata_in conformal representation \f$ A^{ij} \f$ |
| 599 | * of the traceless part of the extrinsic curvature: |
| 600 | * \f$ \hat{A}^{ij} = \Psi^{10} \left( K^{ij} - \frac{1}{3} K \gamma^{ij} \right) \f$ |
| 601 | * @param trk_in trace \e K of the extrinsic curvature |
| 602 | * @param depth_in number of stored time slices; this parameter is used |
| 603 | * to set the \c scheme_order member with \c scheme_order |
| 604 | * = \c depth_in - 1. \c scheme_order can be changed |
| 605 | * afterwards by the method \c set_scheme_order(int). |
| 606 | */ |
| 607 | Time_slice_conf(const Scalar& lapse_in, const Vector& shift_in, |
| 608 | const Metric_flat& ff_in, const Scalar& psi_in, |
| 609 | const Sym_tensor& hh_in, const Sym_tensor& hata_in, |
| 610 | const Scalar& trk_in, int depth_in = 3) ; |
| 611 | |
| 612 | |
| 613 | /** Constructor from physical metric. |
| 614 | * The conformal decomposition is performed by the constructor. |
| 615 | * |
| 616 | * @param lapse_in lapse function \e N |
| 617 | * @param shift_in shift vector |
| 618 | * @param gamma_in induced metric (covariant or contravariant components) |
| 619 | * @param kk_in extrinsic curvature (covariant or contravariant components) |
| 620 | * @param ff_in reference flat metric with respect to which the |
| 621 | * conformal decomposition is performed |
| 622 | * @param depth_in number of stored time slices; this parameter is used |
| 623 | * to set the \c scheme_order member with \c scheme_order |
| 624 | * = \c depth_in - 1. \c scheme_order can be changed |
| 625 | * afterwards by the method \c set_scheme_order(int). |
| 626 | */ |
| 627 | Time_slice_conf(const Scalar& lapse_in, const Vector& shift_in, |
| 628 | const Sym_tensor& gamma_in, const Sym_tensor& kk_in, |
| 629 | const Metric_flat& ff_in, int depth_in = 3) ; |
| 630 | |
| 631 | /** Constructor as standard time slice of flat spacetime (Minkowski). |
| 632 | * |
| 633 | * @param mp Mapping on which the various Lorene fields will be constructed |
| 634 | * @param triad vector basis with respect to which the various tensor |
| 635 | * components will be defined |
| 636 | * @param ff_in reference flat metric with respect to which the |
| 637 | * conformal decomposition is performed |
| 638 | * @param depth_in number of stored time slices; this parameter is used |
| 639 | * to set the \c scheme_order member with \c scheme_order |
| 640 | * = \c depth_in - 1. \c scheme_order can be changed |
| 641 | * afterwards by the method \c set_scheme_order(int). |
| 642 | */ |
| 643 | Time_slice_conf(const Map& mp, const Base_vect& triad, |
| 644 | const Metric_flat& ff_in, int depth_in = 3) ; |
| 645 | |
| 646 | /** Constructor from binary file. |
| 647 | * |
| 648 | * The binary file must have been created by method \c save. |
| 649 | * |
| 650 | * @param mp Mapping on which the various Lorene fields will be constructed |
| 651 | * @param triad vector basis with respect to which the various tensor |
| 652 | * components will be defined |
| 653 | * @param ff_in reference flat metric with respect to which the |
| 654 | * conformal decomposition is performed |
| 655 | * @param fich file containing the saved \c Time_slice_conf |
| 656 | * @param partial_read indicates whether the full object must |
| 657 | * be read in file or whether the final construction is |
| 658 | * devoted to a constructor of a derived class |
| 659 | * @param depth_in number of stored time slices; the given must |
| 660 | * coincide with that stored in the file. |
| 661 | */ |
| 662 | Time_slice_conf(const Map& mp, const Base_vect& triad, |
| 663 | const Metric_flat& ff_in, FILE* fich, |
| 664 | bool partial_read, int depth_in = 3) ; |
| 665 | |
| 666 | Time_slice_conf(const Time_slice_conf& ) ; ///< Copy constructor |
| 667 | |
| 668 | virtual ~Time_slice_conf() ; ///< Destructor |
| 669 | |
| 670 | |
| 671 | // Memory management |
| 672 | // ----------------- |
| 673 | protected: |
| 674 | |
| 675 | /// Deletes all the derived quantities |
| 676 | virtual void del_deriv() const ; |
| 677 | |
| 678 | /// Sets to \c 0x0 all the pointers on derived quantities |
| 679 | void set_der_0x0() const ; |
| 680 | |
| 681 | |
| 682 | // Mutators / assignment |
| 683 | // --------------------- |
| 684 | public: |
| 685 | /// Assignment to another \c Time_slice_conf |
| 686 | void operator=(const Time_slice_conf&) ; |
| 687 | |
| 688 | /// Assignment to a \c Time_slice |
| 689 | void operator=(const Time_slice&) ; |
| 690 | |
| 691 | /** Sets the conformal factor \f$ \Psi \f$ relating the |
| 692 | * physical metric \f$ \gamma_{ij} \f$ to the conformal one: |
| 693 | * \f$ \gamma_{ij} = \Psi^4 \tilde\gamma_{ij} \f$. |
| 694 | * \f$ \Psi \f$ is defined by |
| 695 | * \f[ \Psi := \left( \frac{\det\gamma_{ij}}{\det f_{ij}} |
| 696 | * \right) ^{1/12} \f] |
| 697 | * Sets the value at the current time step (\c jtime ) and |
| 698 | * deletes the value of \f$N\Psi\f$. |
| 699 | * |
| 700 | */ |
| 701 | virtual void set_psi_del_npsi(const Scalar& psi_in) ; |
| 702 | |
| 703 | /** Sets the conformal factor \f$ \Psi \f$ relating the |
| 704 | * physical metric \f$ \gamma_{ij} \f$ to the conformal one: |
| 705 | * \f$ \gamma_{ij} = \Psi^4 \tilde\gamma_{ij} \f$. |
| 706 | * \f$ \Psi \f$ is defined by |
| 707 | * \f[ \Psi := \left( \frac{\det\gamma_{ij}}{\det f_{ij}} |
| 708 | * \right) ^{1/12} \f] |
| 709 | * Sets the value at the current time step (\c jtime ) and |
| 710 | * deletes the value of \e N. |
| 711 | * |
| 712 | */ |
| 713 | virtual void set_psi_del_n(const Scalar& psi_in) ; |
| 714 | |
| 715 | /** Sets the factor \f$ N\Psi \f$ at the |
| 716 | * current time step (\c jtime ) and deletes the value |
| 717 | * of \f$\Psi\f$. |
| 718 | */ |
| 719 | virtual void set_npsi_del_psi(const Scalar& npsi_in) ; |
| 720 | |
| 721 | /** Sets the factor \f$ N\Psi \f$ at the |
| 722 | * current time step (\c jtime ) and deletes the value |
| 723 | * of \e N. |
| 724 | */ |
| 725 | virtual void set_npsi_del_n(const Scalar& npsi_in) ; |
| 726 | |
| 727 | /** Sets the deviation \f$ h^{ij} \f$ |
| 728 | * of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 729 | * the flat metric \f$ f^{ij} \f$: |
| 730 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 731 | * \f$ h^{ij} \f$ must be such that |
| 732 | * \f$\det\tilde\gamma^{ij} = f^{-1} \f$. |
| 733 | * Sets the value at the current time step (\c jtime ). |
| 734 | */ |
| 735 | virtual void set_hh(const Sym_tensor& hh_in) ; |
| 736 | |
| 737 | /** Sets the conformal representation \f$ \hat{A}{ij} \f$ of the traceless part |
| 738 | * of the extrinsic curvature: |
| 739 | * \f$ \hat{A}^{ij} = \Psi^{10} \left( K^{ij} - \frac{1}{3} K \gamma^{ij} \right) \f$. |
| 740 | * Sets the value at the current time step (\c jtime ), and updates the |
| 741 | * potentials \c A_hata_evol, \c B_hata_evol and \c p_vec_X accordingly. |
| 742 | */ |
| 743 | virtual void set_hata(const Sym_tensor& hata_in) ; |
| 744 | |
| 745 | /** Sets the TT part of \f$ \hat{A}^{ij} \f$ (see member \c hata_evol ). |
| 746 | * Sets the value at current time-step (\c jtime ) and updates the potentials |
| 747 | * \e A and \f$ \tilde{B} \f$. */ |
| 748 | virtual void set_hata_TT(const Sym_tensor_tt& hata_tt) ; |
| 749 | |
| 750 | /** Sets the conformal representation \f$ \hat{A}{ij} \f$ of the traceless part |
| 751 | * of the extrinsic curvature from its potentials \e A, \f$ \tilde{B} \f$ |
| 752 | * and \f$ X^i \f$. |
| 753 | * These potentials must be up-to-date. It sets the value at the current |
| 754 | * time step (\c jtime ). |
| 755 | */ |
| 756 | virtual void set_hata_from_XAB(Param* par_bc=0x0, Param* par_mat=0x0) ; |
| 757 | |
| 758 | // Accessors |
| 759 | // --------- |
| 760 | public: |
| 761 | |
| 762 | // Virtual functions from base class Time_slice: |
| 763 | // --------------------------------------------- |
| 764 | |
| 765 | /// Lapse function \e N at the current time step (\c jtime ) |
| 766 | virtual const Scalar& nn() const ; |
| 767 | |
| 768 | /** Induced metric (covariant components \f$ \gamma_{ij} \f$) |
| 769 | * at the current time step (\c jtime ) |
| 770 | */ |
| 771 | virtual const Sym_tensor& gam_dd() const ; |
| 772 | |
| 773 | /** Induced metric (contravariant components \f$ \gamma^{ij} \f$) |
| 774 | * at the current time step (\c jtime ) |
| 775 | */ |
| 776 | virtual const Sym_tensor& gam_uu() const ; |
| 777 | |
| 778 | /** Extrinsic curvature tensor (covariant components \f$ K_{ij} \f$) |
| 779 | * at the current time step (\c jtime ) |
| 780 | */ |
| 781 | virtual const Sym_tensor& k_dd() const ; |
| 782 | |
| 783 | /** Extrinsic curvature tensor (contravariant components \f$ K^{ij} \f$) |
| 784 | * at the current time step (\c jtime ) |
| 785 | */ |
| 786 | virtual const Sym_tensor& k_uu() const ; |
| 787 | |
| 788 | // Virtual functions from this class: |
| 789 | // ---------------------------------- |
| 790 | |
| 791 | /** Returns the potential \e A of \f$ \hat{A}^{ij} \f$. |
| 792 | * See the documentation of \c Sym_tensor for details. |
| 793 | * Returns the value at the current time step (\c jtime ). |
| 794 | */ |
| 795 | virtual const Scalar& A_hata() const ; |
| 796 | |
| 797 | /** Returns the potential \f$\tilde{B}\f$ of \f$ \hat{A}^{ij} \f$. |
| 798 | * See the documentation of \c Sym_tensor_tt for details. |
| 799 | * Returns the value at the current time step (\c jtime ). |
| 800 | */ |
| 801 | virtual const Scalar& B_hata() const ; |
| 802 | |
| 803 | /** Conformal factor \f$ \Psi \f$ relating the |
| 804 | * physical metric \f$ \gamma_{ij} \f$ to the conformal one: |
| 805 | * \f$ \gamma_{ij} = \Psi^4 \tilde\gamma_{ij} \f$. |
| 806 | * \f$ \Psi \f$ is defined by |
| 807 | * \f[ \Psi := \left( \frac{\det\gamma_{ij}}{\det f_{ij}} \right) ^{1/12} \f] |
| 808 | * Returns the value at the current time step (\c jtime ). |
| 809 | */ |
| 810 | virtual const Scalar& psi() const ; |
| 811 | |
| 812 | /// Factor \f$ \Psi^4 \f$ at the current time step (\c jtime ). |
| 813 | const Scalar& psi4() const ; |
| 814 | |
| 815 | /// Logarithm of \f$ \Psi \f$ at the current time step (\c jtime ). |
| 816 | const Scalar& ln_psi() const ; |
| 817 | |
| 818 | /** Factor \f$ N\Psi \f$ at the current time step (\c jtime ). |
| 819 | */ |
| 820 | virtual const Scalar& npsi() const ; |
| 821 | |
| 822 | /** Conformal metric |
| 823 | * \f$ \tilde\gamma_{ij} = \Psi^{-4} \gamma_{ij} \f$ |
| 824 | * Returns the value at the current time step (\c jtime ). |
| 825 | */ |
| 826 | virtual const Metric& tgam() const ; |
| 827 | |
| 828 | /** Deviation \f$ h^{ij} \f$ |
| 829 | * of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 830 | * the flat metric \f$ f^{ij} \f$: |
| 831 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 832 | * Returns the value at the current time step (\c jtime ). |
| 833 | */ |
| 834 | virtual const Sym_tensor& hh(Param* = 0x0, Param* = 0x0) const ; |
| 835 | |
| 836 | /** Conformal representation \f$ \hat{A}^{ij} \f$ of the traceless part |
| 837 | * of the extrinsic curvature: |
| 838 | * \f$ \hat{A}^{ij} = \Psi^{10} \left( K^{ij} - \frac{1}{3} K \gamma^{ij} \right) \f$. |
| 839 | * Returns the value at the current time step (\c jtime ). |
| 840 | */ |
| 841 | virtual const Sym_tensor& hata() const ; |
| 842 | |
| 843 | /** Conformal representation \f$ A^{ij} \f$ of the traceless part |
| 844 | * of the extrinsic curvature: |
| 845 | * \f$ A^{ij} = \Psi^4 \left( K^{ij} - \frac{1}{3} K \gamma^{ij} \right) \f$. |
| 846 | * Returns the value at the current time step (\c jtime ). |
| 847 | */ |
| 848 | virtual Sym_tensor aa() const ; |
| 849 | |
| 850 | /** Trace \e K of the extrinsic curvature |
| 851 | * at the current time step (\c jtime ) |
| 852 | */ |
| 853 | virtual const Scalar& trk() const ; |
| 854 | |
| 855 | /** Vector \f$ H^i = {\cal D}_j \tilde\gamma^{ij} \f$ |
| 856 | * which vanishes in Dirac gauge. |
| 857 | */ |
| 858 | virtual const Vector& hdirac() const ; |
| 859 | |
| 860 | /** Vector \f$ X^i \f$ representing the longitudinal part of |
| 861 | * \f$ \hat{A}^{ij} \f$.(see the documentation of \c hata_evol) |
| 862 | */ |
| 863 | virtual const Vector& vec_X(int method_poisson=6) const ; |
| 864 | |
| 865 | // Computational methods |
| 866 | // --------------------- |
| 867 | public: |
| 868 | /** Computes the vector \f$ X^i \f$ from the conformally-rescaled |
| 869 | * momentum \f$ \hat{S}^i = \Psi^6 S^i \f$, using the momentum constraint. |
| 870 | */ |
| 871 | void compute_X_from_momentum_constraint |
| 872 | (const Vector& hat_S, const Sym_tensor_tt& hata_tt, |
| 873 | int iter_max = 200, double precis = 1.e-12, |
| 874 | double relax = 0.8, int methode_poisson = 6) ; |
| 875 | |
| 876 | /** Sets the potentials \e A and \f$\tilde{B}\f$ |
| 877 | * of the TT part \f$ \hat{A}^{ij} |
| 878 | * (see the documentation of \c Sym_tensor for details). |
| 879 | * Sets the value at the current time step (\c jtime ). |
| 880 | */ |
| 881 | virtual void set_AB_hata(const Scalar& A_in, const Scalar& B_in) ; |
| 882 | |
| 883 | /** Computes valid initial data by solving the constraint |
| 884 | * equations in the conformal thin-sandwich approach. |
| 885 | * |
| 886 | * @param uu value of |
| 887 | * \f$ {\tilde u}^{ij} = \partial h^{ij} /\partial t \f$ |
| 888 | * (freely specifiable data). |
| 889 | * This quantity must be trace-free with respect to the conformal |
| 890 | * metric \f$\tilde\gamma_{ij}\f$, reflecting the unimodular |
| 891 | * character of \f$\tilde\gamma_{ij}\f$. |
| 892 | * @param trk_in value of \f$ K = K_i^{\ i} \f$ |
| 893 | * (freely specifiable data) |
| 894 | * @param trk_point value of \f$ \partial K / \partial t \f$ |
| 895 | * (freely specifiable data) |
| 896 | * @param pdt time step, to be used in order to fill \c depth |
| 897 | * slices |
| 898 | * @param precis convergence threshold required to stop the |
| 899 | * iteration |
| 900 | * @param method_poisson_vect method to be used for solving |
| 901 | * vector Poisson equation (for the shift), see |
| 902 | * \c Vector::poisson(double, const Metric_flat&, int) const. |
| 903 | * @param graph_device name of type of graphical device: 0x0 |
| 904 | * (default value) will result in interactive choice; |
| 905 | * "/xwin" in X-Window display and "/n" in no output. |
| 906 | * @param ener_dens matter energy density \e E as measured by the |
| 907 | * Eulerian observer; this quantity is passed as a pointer, |
| 908 | * the null value of which (default) meaning \e E=0. |
| 909 | * @param mom_dens matter momentum density \e J as measured by the |
| 910 | * Eulerian observer; this quantity is passed as a pointer, |
| 911 | * the null value of which (default) meaning \e J=0. |
| 912 | * @param trace_stress trace of the matter stress \e S as measured |
| 913 | * by the Eulerian observer; this quantity is passed as a pointer, |
| 914 | * the null value of which (default) meaning \e S=0. |
| 915 | */ |
| 916 | virtual void initial_data_cts(const Sym_tensor& uu, const Scalar& trk_in, |
| 917 | const Scalar& trk_point, double pdt, double precis = 1.e-12, |
| 918 | int method_poisson_vect = 6, const char* graph_device = 0x0, |
| 919 | const Scalar* ener_dens = 0x0, const Vector* mom_dens = 0x0, |
| 920 | const Scalar* trace_stress = 0x0 ) ; |
| 921 | |
| 922 | /** Returns the ADM mass (geometrical units) at the current step. |
| 923 | * Moreover this method updates \c adm_mass_evol if |
| 924 | * necessary. |
| 925 | */ |
| 926 | virtual double adm_mass() const ; |
| 927 | |
| 928 | /** Checks the \f$\frac{\partial}{\partial t} \ln\Psi \f$ relation. |
| 929 | * @param tlnpsi_dot [output] maximun value in each domain of |
| 930 | * \f$ \left| \frac{\partial}{\partial t} \ln\Psi \right| \f$ |
| 931 | * @param tdiff [output] maximum value in each domain of \f$ \left| |
| 932 | * \frac{\partial}{\partial t} \ln\Psi - |
| 933 | * \beta^i {\cal D}_i \ln \Psi - \frac{1}{6} ( |
| 934 | * {\cal D}_i \beta^i - N K) \right| \f$ |
| 935 | * @param tdiff_rel [output] relative error on the above relation |
| 936 | * in each domain. |
| 937 | * |
| 938 | */ |
| 939 | void check_psi_dot(Tbl& tlnpsi_dot, Tbl& tdiff, Tbl& tdiff_rel) const ; |
| 940 | |
| 941 | // Outputs |
| 942 | // ------- |
| 943 | protected: |
| 944 | /// Operator >> (virtual function called by the operator<<). |
| 945 | virtual ostream& operator>>(ostream& ) const ; |
| 946 | |
| 947 | /** Total or partial saves in a binary file. |
| 948 | * This protected method is to be called either from public method |
| 949 | * \c save or from method \c sauve of a derived class. |
| 950 | * |
| 951 | * @param fich binary file |
| 952 | * @param partial_save indicates whether the whole object must be |
| 953 | * saved. |
| 954 | */ |
| 955 | virtual void sauve(FILE* fich, bool partial_save) const ; |
| 956 | |
| 957 | } ; |
| 958 | //----------------------------// |
| 959 | // class Tslice_dirac_max // |
| 960 | //----------------------------// |
| 961 | |
| 962 | /** |
| 963 | * Spacelike time slice of a 3+1 spacetime with conformal decomposition |
| 964 | * in the maximal slicing and Dirac gauge. |
| 965 | * \ingroup (evol) |
| 966 | * |
| 967 | */ |
| 968 | class Tslice_dirac_max : public Time_slice_conf { |
| 969 | |
| 970 | // Data : |
| 971 | // ----- |
| 972 | protected: |
| 973 | /** The \e A potential of \f$ \bar{h}^{ij} \f$. |
| 974 | * |
| 975 | * (see the documentation of \c Sym_tensor::p_aaa for details). |
| 976 | */ |
| 977 | mutable Evolution_std<Scalar> A_hh_evol ; |
| 978 | |
| 979 | /** The \f$\tilde{B} \f$ potential of \f$ \bar{h}^{ij} \f$. |
| 980 | * |
| 981 | * (see the documentation of \c Sym_tensor::p_tilde_b for details). |
| 982 | */ |
| 983 | mutable Evolution_std<Scalar> B_hh_evol ; |
| 984 | |
| 985 | /** The \e A potential of the source of equation for \f$ \bar{h}^{ij} \f$. |
| 986 | * |
| 987 | * (see the documentation of \c Sym_tensor::p_aaa for details). |
| 988 | */ |
| 989 | mutable Evolution_std<Scalar> source_A_hh_evol ; |
| 990 | |
| 991 | /** The \f$\tilde{B} \f$ potential of the source of equation for \f$ \bar{h}^{ij} \f$. |
| 992 | * |
| 993 | * (see the documentation of \c Sym_tensor::p_tilde_b for details). |
| 994 | */ |
| 995 | mutable Evolution_std<Scalar> source_B_hh_evol ; |
| 996 | |
| 997 | /** The potential \e A of the source of equation for \f$ \hat{A}^{ij} \f$. |
| 998 | * |
| 999 | * (see the documentation of \c Sym_tensor::p_aaa for details). |
| 1000 | */ |
| 1001 | mutable Evolution_std<Scalar> source_A_hata_evol ; |
| 1002 | |
| 1003 | /** The potential \f$\tilde{B}\f$ of the source of equation for \f$ \hat{A}^{ij} \f$. |
| 1004 | * |
| 1005 | * (see the documentation of \c Sym_tensor::p_tilde_b for details). |
| 1006 | */ |
| 1007 | mutable Evolution_std<Scalar> source_B_hata_evol ; |
| 1008 | |
| 1009 | /// The trace, with respect to the flat metric \c ff , of \f$ h^{ij} \f$. |
| 1010 | mutable Evolution_std<Scalar> trh_evol ; |
| 1011 | |
| 1012 | |
| 1013 | // Constructors - Destructor |
| 1014 | // ------------------------- |
| 1015 | public: |
| 1016 | /** Constructor from conformal decomposition. |
| 1017 | * |
| 1018 | * @param lapse_in lapse function \e N |
| 1019 | * @param shift_in shift vector |
| 1020 | * @param ff_in reference flat metric with respect to which the |
| 1021 | * conformal decomposition is performed |
| 1022 | * @param psi_in conformal factor \f$\Psi\f$ relating the |
| 1023 | * physical metric \f$ \gamma_{ij} \f$ to the conformal one: |
| 1024 | * \f$ \gamma_{ij} = \Psi^4 \tilde\gamma_{ij} \f$ |
| 1025 | * @param hh_in deviation \f$ h^{ij} \f$ |
| 1026 | * of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 1027 | * the flat metric \f$ f^{ij} \f$: |
| 1028 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 1029 | * \f$ h^{ij} \f$ must be such that |
| 1030 | * \f$\det\tilde\gamma^{ij} = f^{-1} \f$. |
| 1031 | * @param hata_in conformal representation \f$ \hat{A}^{ij} \f$ |
| 1032 | * of the traceless part of the extrinsic curvature: |
| 1033 | * \f$ \hat{A}^{ij} = \Psi^{10} \left( K^{ij} - \frac{1}{3} K \gamma^{ij} \right) \f$, |
| 1034 | * with \e K = 0 in the present case |
| 1035 | * @param depth_in number of stored time slices; this parameter is used |
| 1036 | * to set the \c scheme_order member with \c scheme_order |
| 1037 | * = \c depth_in - 1. \c scheme_order can be changed |
| 1038 | * afterwards by the method \c set_scheme_order(int). |
| 1039 | */ |
| 1040 | Tslice_dirac_max(const Scalar& lapse_in, const Vector& shift_in, |
| 1041 | const Metric_flat& ff_in, const Scalar& psi_in, |
| 1042 | const Sym_tensor_trans& hh_in, const Sym_tensor& hata_in, |
| 1043 | int depth_in = 3) ; |
| 1044 | |
| 1045 | /** Constructor as standard time slice of flat spacetime (Minkowski). |
| 1046 | * |
| 1047 | * @param mp Mapping on which the various Lorene fields will be constructed |
| 1048 | * @param triad vector basis with respect to which the various tensor |
| 1049 | * components will be defined |
| 1050 | * @param ff_in reference flat metric with respect to which the |
| 1051 | * conformal decomposition is performed |
| 1052 | * @param depth_in number of stored time slices; this parameter is used |
| 1053 | * to set the \c scheme_order member with \c scheme_order |
| 1054 | * = \c depth_in - 1. \c scheme_order can be changed |
| 1055 | * afterwards by the method \c set_scheme_order(int). |
| 1056 | */ |
| 1057 | Tslice_dirac_max(const Map& mp, const Base_vect& triad, |
| 1058 | const Metric_flat& ff_in, int depth_in = 3) ; |
| 1059 | |
| 1060 | /** Constructor from binary file. |
| 1061 | * |
| 1062 | * The binary file must have been created by method \c save. |
| 1063 | * |
| 1064 | * @param mp Mapping on which the various Lorene fields will be constructed |
| 1065 | * @param triad vector basis with respect to which the various tensor |
| 1066 | * components will be defined |
| 1067 | * @param ff_in reference flat metric with respect to which the |
| 1068 | * conformal decomposition is performed |
| 1069 | * @param fich file containing the saved \c Tslice_dirac_max |
| 1070 | * @param partial_read indicates whether the full object must |
| 1071 | * be read in file or whether the final construction is |
| 1072 | * devoted to a constructor of a derived class |
| 1073 | * @param depth_in number of stored time slices; the given must |
| 1074 | * coincide with that stored in the file. |
| 1075 | */ |
| 1076 | Tslice_dirac_max(const Map& mp, const Base_vect& triad, |
| 1077 | const Metric_flat& ff_in, FILE* fich, |
| 1078 | bool partial_read, int depth_in = 3) ; |
| 1079 | |
| 1080 | /// Construnction of a stationary slice from a rotating star |
| 1081 | Tslice_dirac_max(const Star_rot_Dirac& star, double pdt, int depth_in = 3) ; |
| 1082 | |
| 1083 | Tslice_dirac_max(const Tslice_dirac_max& ) ; ///< Copy constructor |
| 1084 | |
| 1085 | virtual ~Tslice_dirac_max() ; ///< Destructor |
| 1086 | |
| 1087 | |
| 1088 | // Mutators / assignment |
| 1089 | // --------------------- |
| 1090 | public: |
| 1091 | /// Assignment to another Tslice_dirac_max |
| 1092 | void operator=(const Tslice_dirac_max&) ; |
| 1093 | |
| 1094 | // Virtual functions from base class Time_slice_conf: |
| 1095 | // ------------------------------------------------- |
| 1096 | |
| 1097 | /** Sets the deviation \f$ h^{ij} \f$ |
| 1098 | * of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 1099 | * the flat metric \f$ f^{ij} \f$: |
| 1100 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 1101 | * \f$ h^{ij} \f$ must be such that |
| 1102 | * \f$\det\tilde\gamma^{ij} = f^{-1} \f$. |
| 1103 | * Sets the value at the current time step (\c jtime ). |
| 1104 | */ |
| 1105 | virtual void set_hh(const Sym_tensor& hh_in) ; |
| 1106 | |
| 1107 | /** Computes valid initial data by solving the constraint |
| 1108 | * equations in the conformal thin-sandwich approach. |
| 1109 | * |
| 1110 | * @param uu value of |
| 1111 | * \f$ {\tilde u}^{ij} = \partial h^{ij} /\partial t \f$ |
| 1112 | * (freely specifiable data). |
| 1113 | * This quantity must be trace-free with respect to the conformal |
| 1114 | * metric \f$\tilde\gamma_{ij}\f$, reflecting the unimodular |
| 1115 | * character of \f$\tilde\gamma_{ij}\f$. |
| 1116 | * @param trk_in value of \f$ K = K_i^{\ i} \f$ |
| 1117 | * (freely specifiable data) |
| 1118 | * @param trk_point value of \f$ \partial K / \partial t \f$ |
| 1119 | * (freely specifiable data) |
| 1120 | * @param pdt time step, to be used in order to fill \c depth |
| 1121 | * slices |
| 1122 | * @param precis convergence threshold required to stop the |
| 1123 | * iteration |
| 1124 | * @param method_poisson_vect method to be used for solving |
| 1125 | * vector Poisson equation (for the shift), see |
| 1126 | * \c Vector::poisson(double, const Metric_flat&, int) const. |
| 1127 | * @param graph_device name of type of graphical device: 0x0 |
| 1128 | * (default value) will result in interactive choice; |
| 1129 | * "/xwin" in X-Window display and "/n" in no output. |
| 1130 | * @param ener_dens matter energy density \e E as measured by the |
| 1131 | * Eulerian observer; this quantity is passed as a pointer, |
| 1132 | * the null value of which (default) meaning \e E=0. |
| 1133 | * @param mom_dens matter momentum density \e J as measured by the |
| 1134 | * Eulerian observer; this quantity is passed as a pointer, |
| 1135 | * the null value of which (default) meaning \e J=0. |
| 1136 | * @param trace_stress trace of the matter stress \e S as measured |
| 1137 | * by the Eulerian observer; this quantity is passed as a pointer, |
| 1138 | * the null value of which (default) meaning \e S=0. |
| 1139 | */ |
| 1140 | virtual void initial_data_cts(const Sym_tensor& uu, const Scalar& trk_in, |
| 1141 | const Scalar& trk_point, double pdt, double precis = 1.e-12, |
| 1142 | int method_poisson_vect = 6, const char* graph_device = 0x0, |
| 1143 | const Scalar* ener_dens = 0x0, const Vector* mom_dens = 0x0, |
| 1144 | const Scalar* trace_stress = 0x0 ) ; |
| 1145 | |
| 1146 | // Virtual functions from this class: |
| 1147 | // ---------------------------------- |
| 1148 | |
| 1149 | /** Sets the potentials \f$\chi \f$ and \f$\mu\f$ |
| 1150 | * of the TT part \f$ \bar{h}^{ij} \f$ of \f$ h^{ij} \f$ |
| 1151 | * (see the documentation of \c Sym_tensor_tt for details). |
| 1152 | * The value of \f$ h^{ij} \f$ is then deduced from the |
| 1153 | * unimodularity condition on the conformal metric. |
| 1154 | * Sets the value at the current time step (\c jtime ). |
| 1155 | */ |
| 1156 | virtual void set_khi_mu(const Scalar& khi_in, const Scalar& mu_in) ; |
| 1157 | |
| 1158 | /** Sets the potentials \e A and \f$\tilde{B}\f$ |
| 1159 | * of the TT part \f$ \bar{h}^{ij} \f$ of \f$ h^{ij} \f$ |
| 1160 | * (see the documentation of \c Sym_tensor for details). |
| 1161 | * \f$ h^{ij} \f$ is not modified. |
| 1162 | * Sets the value at the current time step (\c jtime ). |
| 1163 | */ |
| 1164 | virtual void set_AB_hh(const Scalar& A_in, const Scalar& B_in) ; |
| 1165 | |
| 1166 | /** Sets the trace, with respect to the flat metric |
| 1167 | * \c ff , of \f$ h^{ij} \f$. |
| 1168 | * Sets the value at the current time step (\c jtime ). |
| 1169 | * Note that this method does not ensure that the conformal |
| 1170 | * metric is unimodular. |
| 1171 | */ |
| 1172 | virtual void set_trh(const Scalar& trh_in) ; |
| 1173 | |
| 1174 | /** Solves the elliptic equation for the conformal factor $\Psi$ |
| 1175 | * (Hamiltonian constraint). |
| 1176 | * @param ener_dens conformal matter energy density \f$ \hat{E} = \Psi^6 E \f$, |
| 1177 | * where \e E is measured by the Eulerian observer; this quantity is |
| 1178 | * passed as a pointer, the null value of which (default) meaning \e E=0. |
| 1179 | * @return solution \f$\Psi_{\rm new}\f$ of the elliptic equation |
| 1180 | * (flat Laplacian) for the lapse with the source computed from the |
| 1181 | * quantities at the current time step. |
| 1182 | * |
| 1183 | */ |
| 1184 | virtual Scalar solve_psi(const Scalar* ener_dens=0x0) const ; |
| 1185 | |
| 1186 | /** Solves the elliptic equation for \f$ N\Psi \f$ (maximal |
| 1187 | * slicing condition + Hamiltonian constraint) |
| 1188 | * @param ener_dens conformal matter energy density \f$ \hat{E} = \Psi^6 E \f$, |
| 1189 | * where \e E is measured by the Eulerian observer; this quantity is |
| 1190 | * passed as a pointer, the null value of which (default) meaning \e E=0. |
| 1191 | * @param trace_stress trace of the conformal matter stress |
| 1192 | * \f$ S^* = \Psi^6 S \f$, |
| 1193 | * where \e S is measured by the Eulerian observer; |
| 1194 | * this quantity is passed as a pointer, |
| 1195 | * the null value of which (default) meaning \e S=0. |
| 1196 | * @return solution \f$(N\Psi)_{\rm new}\f$ of the elliptic equation |
| 1197 | * (flat Laplacian) for \f$ N\Psi \f$ with the source computed from the |
| 1198 | * quantities at the current time step. |
| 1199 | * |
| 1200 | */ |
| 1201 | virtual Scalar solve_npsi(const Scalar* ener_dens=0x0, |
| 1202 | const Scalar* trace_stress=0x0) const ; |
| 1203 | |
| 1204 | /** Solves the elliptic equation for the shift vector \f$\beta^i\f$ |
| 1205 | * from \f$ A^{ij} \f$ (Eq. (73) of Bonazzola et al. 2004). |
| 1206 | * @param method method to be used for solving |
| 1207 | * vector Poisson equation (for the shift), see |
| 1208 | * \c Vector::poisson(double, const Metric_flat&, int) const. |
| 1209 | * @return solution \f$\beta^i_{\rm new}\f$ of the elliptic equation |
| 1210 | * (flat vector Laplacian) for the shift with the source computed from the |
| 1211 | * quantities at the current time step. |
| 1212 | * |
| 1213 | */ |
| 1214 | virtual Vector solve_beta(int method = 6) const ; |
| 1215 | |
| 1216 | /** Time evolution by resolution of Einstein equations. |
| 1217 | * |
| 1218 | * @param pdt time step \e dt. |
| 1219 | * @param nb_time_steps number of time steps for the evolution |
| 1220 | * @param niter_elliptic number of iterations if the resolution |
| 1221 | * of elliptic equations |
| 1222 | * @param relax_elliptic relaxation factor for the elliptic |
| 1223 | * equations |
| 1224 | * @param check_mod determines the frequency of check of the |
| 1225 | * constraint equations: they are checked every \c check_mod time step |
| 1226 | * @param save_mod determines the frequency of writing to file |
| 1227 | * the monotoring quantities: they are written to file every |
| 1228 | * \c save_mod time step |
| 1229 | * @param method method_poisson_vect to be used for solving |
| 1230 | * vector Poisson equation (for the shift), see |
| 1231 | * \c Vector::poisson(double, const Metric_flat&, int) const. |
| 1232 | * @param nopause = 1 if no pause between each time step, 0 otherwise |
| 1233 | * @param graph_device name of type of graphical device: 0x0 |
| 1234 | * (default value) will result in interactive choice; |
| 1235 | * "/xwin" in X-Window display and "/n" in no output. |
| 1236 | */ |
| 1237 | void evolve(double pdt, int nb_time_steps, int niter_elliptic, |
| 1238 | double relax_elliptic, int check_mod, int save_mod, |
| 1239 | int method_poisson_vect = 6, int nopause = 1, |
| 1240 | const char* graph_device = 0x0, bool verbose=true, |
| 1241 | const Scalar* ener_euler = 0x0, |
| 1242 | const Vector* mom_euler = 0x0, const Scalar* s_euler = 0x0, |
| 1243 | const Sym_tensor* strain_euler = 0x0) ; |
| 1244 | |
| 1245 | /** Returns the ADM mass at (geometrical units) the current step. |
| 1246 | * Moreover this method updates \c adm_mass_evol if |
| 1247 | * necessary. |
| 1248 | */ |
| 1249 | virtual double adm_mass() const ; |
| 1250 | |
| 1251 | protected: |
| 1252 | /** Computes the sources \c source_A_XXX_evol and \c source_B_XXX_evol , |
| 1253 | * for the solution of the evolution equation for \f$ h^{ij} \f$ and |
| 1254 | * \f$ \hat{A}^{ij} \f$. |
| 1255 | * @param strain_tensor [input] : a pointer on the strain_tensor |
| 1256 | * \f$ S^{ij} \f$ measured by the Eulerian observer of 4-velocity |
| 1257 | * \f$\mbox{\boldmath{$n $}}\f$ ; if this is the null pointer |
| 1258 | * (default value), it is assumed that \f$ S_{ij} \f$ = 0 (vacuum). |
| 1259 | */ |
| 1260 | void compute_sources(const Sym_tensor* strain_tensor = 0x0) const ; |
| 1261 | |
| 1262 | /// Copy the sources \c source_A_XXX_evol and \c source_B_XXX_evol to all time-steps. |
| 1263 | void initialize_sources_copy() const ; |
| 1264 | |
| 1265 | /** Computes \f$ h^{ij} \f$ from the values of \e A and |
| 1266 | * \f$\tilde{B}\f$ and using the condition |
| 1267 | * \f$\det\tilde\gamma^{ij} = \det f^{ij} \f$, which fixes the |
| 1268 | * trace of \f$ h^{ij} \f$. |
| 1269 | * @param j time step at which the computation of \f$ h^{ij} \f$ |
| 1270 | * is required. |
| 1271 | */ |
| 1272 | void hh_det_one(int j, Param* par_bc = 0x0, Param* par_mat = 0x0) const ; |
| 1273 | |
| 1274 | /** Computes \f$ h^{ij} \f$ from the TT part using the condition |
| 1275 | * \f$\det\tilde\gamma^{ij} = \det f^{ij} \f$, which fixes the |
| 1276 | * trace of \f$ h^{ij} \f$. |
| 1277 | * @param hijtt : the TT part. |
| 1278 | */ |
| 1279 | void hh_det_one(const Sym_tensor_tt& hijtt, Param* par_mat = 0x0) const ; |
| 1280 | |
| 1281 | // Accessors |
| 1282 | // --------- |
| 1283 | public: |
| 1284 | // Virtual functions from base class Time_slice_conf: |
| 1285 | // ------------------------------------------------- |
| 1286 | |
| 1287 | /** Deviation \f$ h^{ij} \f$ |
| 1288 | * of the conformal metric \f$ \tilde\gamma^{ij} \f$ from |
| 1289 | * the flat metric \f$ f^{ij} \f$: |
| 1290 | * \f$\tilde\gamma^{ij} = f^{ij} + h^{ij} \f$. |
| 1291 | * Returns the value at the current time step (\c jtime ). |
| 1292 | */ |
| 1293 | virtual const Sym_tensor& hh(Param* par_bc = 0x0, Param* par_mat = 0x0) const ; |
| 1294 | |
| 1295 | /** Trace \e K of the extrinsic curvature |
| 1296 | * at the current time step (\c jtime ). |
| 1297 | * It is null in the present case (maximal slicing) |
| 1298 | */ |
| 1299 | virtual const Scalar& trk() const ; |
| 1300 | |
| 1301 | /** Vector \f$ H^i = {\cal D}_j \tilde\gamma^{ij} \f$ |
| 1302 | * which vanishes in Dirac gauge. |
| 1303 | * It is null in the present case... |
| 1304 | */ |
| 1305 | virtual const Vector& hdirac() const ; |
| 1306 | |
| 1307 | // Virtual functions from this class: |
| 1308 | // ---------------------------------- |
| 1309 | |
| 1310 | /** Returns the potential \e A of \f$ \bar{h}^{ij} \f$. |
| 1311 | * See the documentation of \c Sym_tensor for details. |
| 1312 | * Returns the value at the current time step (\c jtime ). |
| 1313 | */ |
| 1314 | virtual const Scalar& A_hh() const ; |
| 1315 | |
| 1316 | /** Returns the potential \f$\tilde{B}\f$ of \f$ \bar{h}^{ij} \f$. |
| 1317 | * See the documentation of \c Sym_tensor_tt for details. |
| 1318 | * Returns the value at the current time step (\c jtime ). |
| 1319 | */ |
| 1320 | virtual const Scalar& B_hh() const ; |
| 1321 | |
| 1322 | /** Computes the trace \c h, with respect to the flat metric |
| 1323 | * \c ff , of \f$ h^{ij} \f$. |
| 1324 | * Returns the value at the current time step (\c jtime ). |
| 1325 | */ |
| 1326 | virtual const Scalar& trh() const ; |
| 1327 | |
| 1328 | |
| 1329 | // Outputs |
| 1330 | // ------- |
| 1331 | protected: |
| 1332 | /// Operator >> (virtual function called by the operator<<). |
| 1333 | virtual ostream& operator>>(ostream& ) const ; |
| 1334 | |
| 1335 | /** Total or partial saves in a binary file. |
| 1336 | * This protected method is to be called either from public method |
| 1337 | * \c save or from method \c sauve of a derived class. |
| 1338 | * |
| 1339 | * @param fich binary file |
| 1340 | * @param partial_save indicates whether the whole object must be |
| 1341 | * saved. |
| 1342 | */ |
| 1343 | virtual void sauve(FILE* fich, bool partial_save) const ; |
| 1344 | |
| 1345 | }; |
| 1346 | } |
| 1347 | #endif |