Debian Codegraph @

C++/Include/star.h

raw symbols SCIP
1 /*
2 * Definition of Lorene classes Star, Star_bin and Star_bin_xcts
3 *
4 */
5
6 /*
7 * Copyright (c) 2010 Michal Bejger
8 * Copyright (c) 2004 Francois Limousin
9 *
10 * Copyright (c) 2000-2001 Eric Gourgoulhon (for preceding class Etoile)
11 * Copyright (c) 2000-2001 Keisuke Taniguchi (for preceding class Etoile)
12 *
13 * This file is part of LORENE.
14 *
15 * LORENE is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * LORENE is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with LORENE; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30
31
32 #ifndef __STAR_H_
33 #define __STAR_H_
34
35 /*
36 * $Id: star.h,v 1.32 2014/10/13 08:52:36 j_novak Exp $
37 * $Log: star.h,v $
38 * Revision 1.32 2014/10/13 08:52:36 j_novak
39 * Lorene classes and functions now belong to the namespace Lorene.
40 *
41 * Revision 1.31 2010/12/09 10:36:42 m_bejger
42 * Decouple method removed from declaration in Star_bin_xcts
43 *
44 * Revision 1.30 2010/10/26 18:47:36 m_bejger
45 * Modification of Star_bin_xcts::equilibrium, added table fact_resize
46 *
47 * Revision 1.29 2010/10/18 19:11:53 m_bejger
48 * Changes to Star::equilibrium_spher and Star_bin_xcts::equilibrium to allow for calculations with more than one domain in the star
49 *
50 * Revision 1.28 2010/06/15 08:17:43 m_bejger
51 * Method Star_bin_xcts::set_chi_comp() declared
52 *
53 * Revision 1.27 2010/05/04 07:53:32 m_bejger
54 * Class Star_bin_xcts added (initial version)
55 *
56 * Revision 1.26 2010/03/29 12:00:25 e_gourgoulhon
57 * Removed lnq from documentation
58 * (lnq has to be removed from base class Star; it is meaningfull only
59 * for Star_bin).
60 *
61 * Revision 1.25 2010/01/24 16:07:45 e_gourgoulhon
62 * New class Star_rot.
63 *
64 * Revision 1.24 2007/11/06 16:22:03 j_novak
65 * The data member stress_euler is now a Sym_tensor instead of a Tensor.
66 *
67 * Revision 1.23 2007/06/21 19:48:25 k_taniguchi
68 * Introduction of a method to compute ray_eq_3pis2.
69 *
70 * Revision 1.22 2006/05/31 09:25:47 f_limousin
71 * Modif. of the size of the different domains
72 *
73 * Revision 1.21 2006/04/11 14:26:12 f_limousin
74 * New version of the code : improvement of the computation of some
75 * critical sources, estimation of the dirac gauge, helical symmetry...
76 *
77 * Revision 1.20 2005/09/15 15:56:28 e_gourgoulhon
78 * Made the documentation compliant with Doxygen.
79 *
80 * Revision 1.19 2005/09/13 19:38:32 f_limousin
81 * Reintroduction of the resolution of the equations in cartesian coordinates.
82 *
83 * Revision 1.18 2005/08/13 16:14:11 m_saijo
84 * Corrected the document of the total shift vector
85 *
86 * Revision 1.17 2005/04/08 12:36:45 f_limousin
87 * Just to avoid warnings...
88 *
89 * Revision 1.16 2005/02/24 16:09:29 f_limousin
90 * Change the name of some variables (for instance dcov_logn --> dlogn).
91 * Add also member dlnq but delete dlnpsi_auto and dlogn_auto.
92 *
93 * Revision 1.15 2005/02/17 17:28:18 f_limousin
94 * Change the name of some quantities to be consistent with other classes
95 * (for instance nnn is changed to nn, shift to beta, beta to lnq...)
96 *
97 * Revision 1.14 2005/02/11 18:11:16 f_limousin
98 * Introduction of a member Map_af in derived class Star_bin.
99 *
100 * Revision 1.13 2004/11/11 16:29:48 j_novak
101 * set_der_0x0 is no longer virtual (to be coherent with Tensor/Scalar classes).
102 *
103 * Revision 1.12 2004/11/10 16:31:53 j_novak
104 * Star is no longer an abstract class (mass_b and mass_g are no longer
105 * pure virtual). Modified comments to be readable by doxygen.
106 *
107 * Revision 1.11 2004/07/21 11:48:30 f_limousin
108 * Remove function sprod.
109 *
110 * Revision 1.10 2004/06/22 12:47:01 f_limousin
111 * Change qq, qq_auto and qq_comp to beta, beta_auto and beta_comp.
112 *
113 * Revision 1.9 2004/05/25 14:48:57 f_limousin
114 * Add a parameter for the function equilibrium.
115 *
116 * Revision 1.8 2004/03/23 09:53:50 f_limousin
117 * Minor changes
118 *
119 * Revision 1.7 2004/02/27 09:41:52 f_limousin
120 * Scalars ssjm1_logn, ssjm1_qq ... for all metric coefficients have been
121 * in class Star_bin for the resolution of Poisson equations.
122 * The class Star is now abstract : the computational routines mass_b()
123 * and mass_g() = 0.
124 *
125 * Revision 1.6 2004/01/22 10:06:33 f_limousin
126 * Add methods set_logn_comp() and set_shift_auto().
127 *
128 * Revision 1.5 2004/01/20 15:26:00 f_limousin
129 * New class star and star_bin.
130 *
131 *
132 * $Header: /cvsroot/Lorene/C++/Include/star.h,v 1.32 2014/10/13 08:52:36 j_novak Exp $
133 *
134 */
135
136 // Headers Lorene
137 #include "tensor.h"
138 #include "metric.h"
139
140 namespace Lorene {
141 class Eos ;
142
143 //---------------------------//
144 // base class Star //
145 //---------------------------//
146
147 /**
148 * Base class for stars. \ingroup (star)
149 *
150 * A \c Star is constructed upon (i) a mapping
151 * (derived class of \c Map), the center of which defines the center of the
152 * star, and (ii) an equation of state (derived class of \c Eos).
153 * It contains tensor fields (class \c Tensor) which describe the
154 * hydrodynamical quantities as well as the gravitational field (spacetime
155 * metric).
156 *
157 * According to the 3+1 formalism, the spacetime metric is written
158 * \f[
159 * ds^2 = - N^2 dt^2 + \gamma_{ij} ( dx^i + \beta^i dt )
160 * (dx^j + \beta^j dt )
161 * \f]
162 * where \f$\gamma_{ij}\f$ is the 3-metric, described by a Lorene object of class \c Metric.
163 *
164 * The 3+1 formalism introduces two kinds of privileged observers: the
165 * fluid comoving observer and the Eulerian observer, whose 4-velocity
166 * is the unit future directed normal to the \e t = const hypersurfaces.
167 * The hydrodynamical quantities measured by the fluid observer correspond
168 * to the members \c ent, \c nbar, \c ener, and \c press.
169 * The hydrodynamical quantities measured by the Eulerian observer correspond
170 * to the members \c ener_euler, \c s_euler, \c gam_euler, and
171 * \c u_euler.
172 *
173 * \version $Id: star.h,v 1.32 2014/10/13 08:52:36 j_novak Exp $
174 */
175 class Star {
176
177 // Data :
178 // -----
179 protected:
180 Map& mp ; ///< Mapping associated with the star
181
182 /// Number of domains of \c *mp occupied by the star
183 int nzet ;
184
185 const Eos& eos ; ///< Equation of state of the stellar matter
186
187 // Fluid quantities with respect to the fluid frame
188 // ------------------------------------------------
189
190 Scalar ent ; ///< Log-enthalpy
191
192 Scalar nbar ; ///< Baryon density in the fluid frame
193 Scalar ener ; ///< Total energy density in the fluid frame
194 Scalar press ; ///< Fluid pressure
195
196 // Fluid quantities with respect to the Eulerian frame
197 // ---------------------------------------------------
198 Scalar ener_euler ; ///< Total energy density in the Eulerian frame
199
200 /// Trace of the stress scalar in the Eulerian frame
201 Scalar s_euler ;
202
203 /// Lorentz factor between the fluid and Eulerian observers
204 Scalar gam_euler ;
205
206 /// Fluid 3-velocity with respect to the Eulerian observer
207 Vector u_euler ;
208
209 /** Spatial part of the stress-energy tensor with respect
210 * to the Eulerian observer.
211 */
212 Sym_tensor stress_euler ;
213
214 // Metric potentials
215 // -----------------
216
217 /** Logarithm of the lapse \e N .
218 * In the Newtonian case,
219 * this is the Newtonian gravitational potential
220 * (in units of \f$c^2\f$).
221 */
222 Scalar logn ;
223
224 /// Lapse function \e N .
225 Scalar nn ;
226
227 /// Shift vector.
228 Vector beta ;
229
230 // Scalar field \f$\ln Q = \ln(\psi^2 N)\f$
231 //## to be removed from base class Star
232 Scalar lnq ;
233
234 /// 3-metric
235 Metric gamma ;
236
237
238 // Derived data :
239 // ------------
240 protected:
241 /// Coordinate radius at \f$\phi=0\f$, \f$\theta=\pi/2\f$.
242 mutable double* p_ray_eq ;
243
244 /// Coordinate radius at \f$\phi=\pi/2\f$, \f$\theta=\pi/2\f$.
245 mutable double* p_ray_eq_pis2 ;
246
247 /// Coordinate radius at \f$\phi=\pi\f$, \f$\theta=\pi/2\f$.
248 mutable double* p_ray_eq_pi ;
249
250 /// Coordinate radius at \f$\phi=3\pi/2\f$, \f$\theta=\pi/2\f$.
251 mutable double* p_ray_eq_3pis2 ;
252
253 /// Coordinate radius at \f$\theta=0\f$.
254 mutable double* p_ray_pole ;
255
256 /** Description of the stellar surface: 2-D \c Itbl containing the
257 * values of the domain index \e l on the surface at the
258 * collocation points in \f$(\theta', \phi')\f$
259 */
260 mutable Itbl* p_l_surf ;
261
262 /** Description of the stellar surface: 2-D \c Tbl containing the
263 * values of the radial coordinate \f$\xi\f$ on the surface at the
264 * collocation points in \f$(\theta', \phi')\f$
265 */
266 mutable Tbl* p_xi_surf ;
267
268 mutable double* p_mass_b ; ///< Baryon mass
269 mutable double* p_mass_g ; ///< Gravitational mass
270
271
272 // Constructors - Destructor
273 // -------------------------
274 public:
275
276 /** Standard constructor.
277 *
278 * @param mp_i Mapping on which the star will be defined
279 * @param nzet_i Number of domains occupied by the star
280 * @param eos_i Equation of state of the stellar matter
281 *
282 */
283 Star(Map& mp_i, int nzet_i, const Eos& eos_i) ;
284
285
286 Star(const Star& ) ; ///< Copy constructor
287
288 /** Constructor from a file (see \c sauve(FILE* )).
289 *
290 * @param mp_i Mapping on which the star will be defined
291 * @param eos_i Equation of state of the stellar matter
292 * @param fich input file (must have been created by the function
293 * \c sauve)
294 */
295 Star(Map& mp_i, const Eos& eos_i, FILE* fich) ;
296
297 virtual ~Star() ; ///< Destructor
298
299
300 // Memory management
301 // -----------------
302 protected:
303 /// Deletes all the derived quantities
304 virtual void del_deriv() const ;
305
306 /// Sets to \c 0x0 all the pointers on derived quantities
307 virtual void set_der_0x0() const ;
308
309 /** Sets to \c ETATNONDEF (undefined state) the hydrodynamical
310 * quantities relative to the Eulerian observer.
311 */
312 virtual void del_hydro_euler() ;
313
314
315 // Mutators / assignment
316 // ---------------------
317 public:
318 /// Assignment to another \c Star
319 void operator=(const Star&) ;
320
321 /// Read/write of the mapping
322 Map& set_mp() {return mp; } ;
323
324 /// Assignment of the enthalpy field.
325 void set_enthalpy(const Scalar& ) ;
326
327 /** Computes the proper baryon and energy density, as well as
328 * pressure from the enthalpy.
329 */
330 void equation_of_state() ;
331
332 /** Computes the hydrodynamical quantities relative to the Eulerian
333 * observer from those in the fluid frame (\c nbar, \c ener
334 * and \c press).
335 */
336 virtual void hydro_euler() ;
337
338 /** Computes a spherical static configuration.
339 *
340 * @param ent_c [input] central value of the enthalpy
341 * @param precis [input] threshold in the relative difference between
342 * the enthalpy fields of two consecutive steps
343 * to stop the iterative procedure (default value: 1.e-14)
344 * @param ent_limit [input] : array of enthalpy values to be set
345 * at the boundaries between the domains; if set to 0x0 (default),
346 * the initial values will be kept.
347 */
348 virtual void equilibrium_spher(double ent_c, double precis = 1.e-14,
349 const Tbl* pent_limit = 0x0 ) ;
350
351 // Accessors
352 // ---------
353 public:
354 /// Returns the mapping
355 const Map& get_mp() const {return mp; } ;
356
357 /// Returns the number of domains occupied by the star
358 int get_nzet() const {return nzet; } ;
359
360 /// Returns the equation of state
361 const Eos& get_eos() const {return eos; } ;
362
363 /// Returns the enthalpy field
364 const Scalar& get_ent() const {return ent;} ;
365
366 /// Returns the proper baryon density
367 const Scalar& get_nbar() const {return nbar;} ;
368
369 /// Returns the proper total energy density
370 const Scalar& get_ener() const {return ener;} ;
371
372 /// Returns the fluid pressure
373 const Scalar& get_press() const {return press;} ;
374
375 /// Returns the total energy density with respect to the Eulerian observer
376 const Scalar& get_ener_euler() const {return ener_euler;} ;
377
378 /// Returns the trace of the stress tensor in the Eulerian frame
379 const Scalar& get_s_euler() const {return s_euler;} ;
380
381 /// Returns the Lorentz factor between the fluid and Eulerian observers
382 const Scalar& get_gam_euler() const {return gam_euler;} ;
383
384 /// Returns the fluid 3-velocity with respect to the Eulerian observer
385 const Vector& get_u_euler() const {return u_euler;} ;
386
387 /** Returns the spatial part of the stress-energy tensor
388 * with respect to the Eulerian observer
389 */
390 const Tensor& get_stress_euler() const {return stress_euler;} ;
391
392 /** Returns the logarithm of the lapse \e N.
393 * In the Newtonian case, this is the Newtonian
394 * gravitational potential (in units of \f$c^2\f$).
395 */
396 const Scalar& get_logn() const {return logn;} ;
397
398 /// Returns the lapse function \e N
399 const Scalar& get_nn() const {return nn;} ;
400
401 /// Returns the shift vector \f$\beta^i\f$.
402 const Vector& get_beta() const {return beta;} ;
403
404 // Returns the scalar field \f$\ln Q\f$.
405 //## to be removed from base class Star
406 const Scalar& get_lnq() const {return lnq;} ;
407
408 /// Returns the 3-metric \f$\gamma\f$.
409 const Metric& get_gamma() const {return gamma;} ;
410
411 // Outputs
412 // -------
413 public:
414 virtual void sauve(FILE* ) const ; ///< Save in a file
415
416 /// Display
417 friend ostream& operator<<(ostream& , const Star& ) ;
418
419 protected:
420 /// Operator >> (virtual function called by the operator <<).
421 virtual ostream& operator>>(ostream& ) const ;
422
423 // Global quantities
424 // -----------------
425 public:
426 /// Coordinate radius at \f$\phi=0\f$, \f$\theta=\pi/2\f$ [r_unit].
427 double ray_eq() const ;
428
429 /// Coordinate radius at \f$\phi=\pi/2\f$, \f$\theta=\pi/2\f$ [r_unit].
430 double ray_eq_pis2() const ;
431
432 /// Coordinate radius at \f$\phi=\pi\f$, \f$\theta=\pi/2\f$ [r_unit].
433 double ray_eq_pi() const ;
434
435 /// Coordinate radius at \f$\phi=3\pi/2\f$, \f$\theta=\pi/2\f$ [r_unit].
436 double ray_eq_3pis2() const ;
437
438 /// Coordinate radius at \f$\theta=0\f$ [r_unit].
439 double ray_pole() const ;
440
441 /** Description of the stellar surface: returns a 2-D \c Itbl
442 * containing the
443 * values of the domain index \e l on the surface at the
444 * collocation points in \f$(\theta', \phi')\f$.
445 * The stellar surface is defined as the location where
446 * the enthalpy (member \c ent) vanishes.
447 */
448 virtual const Itbl& l_surf() const ;
449
450 /** Description of the stellar surface: returns a 2-D \c Tbl
451 * containing the values of the radial coordinate \f$\xi\f$
452 * on the surface at the
453 * collocation points in \f$(\theta', \phi')\f$.
454 * The stellar surface is defined as the location where
455 * the enthalpy (member \c ent) vanishes.
456 */
457 const Tbl& xi_surf() const ;
458
459 /// Baryon mass
460 virtual double mass_b() const = 0 ;
461
462 /// Gravitational mass
463 virtual double mass_g() const = 0 ;
464
465 };
466 ostream& operator<<(ostream& , const Star& ) ;
467
468
469 //---------------------------//
470 // class Star_bin //
471 //---------------------------//
472
473 /**
474 * Class for stars in binary system. *** UNDER DEEVELOPMENT *** \ingroup (star)
475 *
476 * A \c Star_bin can be construted in two states, represented by
477 * the \c bool member \c irrotational: (i) irrotational
478 * (i.e. the fluid motion is irrotational) or (ii) rigidly corotating
479 * with respect to the orbital motion (synchronized binary).
480 *
481 * @version #$Id: star.h,v 1.32 2014/10/13 08:52:36 j_novak Exp $#
482 */
483 class Star_bin : public Star {
484
485 // Data :
486 // -----
487 protected:
488 /** \c true for an irrotational star, \c false for a
489 * corotating one
490 */
491 bool irrotational ;
492
493 /** Scalar potential \f$\Psi_0\f$ of the non-translational part of
494 * fluid 4-velocity (in the irrotational case)
495 */
496 Scalar psi0 ;
497
498 /** Gradient of \f$\Psi\f$ (in the irrotational case)
499 * (Spherical components with respect to the mapping of the star)
500 */
501 Vector d_psi ;
502
503 /** Spatial projection of the fluid 3-velocity with respect to
504 * the co-orbiting observer.
505 * (Spherical components with respect to the mapping of the star)
506 */
507 Vector wit_w ;
508
509 /** Logarithm of the Lorentz factor between the fluid and
510 * the co-orbiting observer.
511 */
512 Scalar loggam ;
513
514 /** 3-vector shift, divided by \e N, of the rotating coordinates,
515 * \f$\beta^i/N\f$.
516 * (Spherical components with respect to the mapping of the star)
517 */
518 Vector bsn ;
519
520 /// Centrifugal potential
521 Scalar pot_centri ;
522
523
524 /** Part of the lapse logarithm (gravitational potential at the
525 * Newtonian limit) generated principally by the star.
526 */
527 Scalar logn_auto ;
528
529 /** Part of the lapse logarithm (gravitational potential at the
530 * Newtonian limit) generated principally by the companion star.
531 */
532 Scalar logn_comp ;
533
534 /// Covariant derivative of the total logarithm of the lapse.
535 Vector dcov_logn ;
536
537 /// Contravariant derivative of the total logarithm of the lapse.
538 Vector dcon_logn ;
539
540 /** Scalar field \f$ Q = \psi^2 N \f$ generated principally by the
541 * star.
542 */
543 Scalar lnq_auto ;
544
545 /** Scalar field \f$ Q = \psi^2 N \f$ generated principally by the
546 * companion star.
547 */
548 Scalar lnq_comp ;
549
550
551 /// Conformal factor \f$\psi^4\f$
552 Scalar psi4 ;
553
554 /// Covariant derivative of the logarithm of the conformal factor
555 Vector dcov_phi ;
556 /// Contravariant derivative of the logarithm of the conformal factor
557 Vector dcon_phi ;
558
559 /** Flat metric defined on the mapping (Spherical components
560 * with respect to the mapping of the star) .
561 */
562 Metric_flat flat ;
563
564 /// Conformal metric \f$\tilde \gamma_{ij}\f$
565 Metric gtilde ;
566
567 /** Part of the shift vector generated principally by the star
568 * (Spherical components with respect to the mapping of the star)
569 */
570 Vector beta_auto ;
571
572 /** Part of the shift vector generated principally by the star
573 * (Spherical components with respect to the mapping of the star)
574 */
575 Vector beta_comp ;
576
577
578 /** Total deviation of the inverse conformal metric
579 * \f$\tilde \gamma^{ij}\f$ from the inverse flat metric.
580 */
581 Sym_tensor hij ;
582
583
584 /** Deviation of the inverse conformal metric
585 * \f$\tilde \gamma^{ij}\f$ from the inverse flat metric generated
586 * principally by the star.
587 */
588 Sym_tensor hij_auto ;
589
590 /** Deviation of the inverse conformal metric
591 * \f$\tilde \gamma^{ij}\f$ from the inverse flat metric generated
592 * principally by the companion star.
593 */
594 Sym_tensor hij_comp ;
595
596 /** Part of the extrinsic curvature tensor \f$\tilde K^{ij}\f$
597 * generated by \c beta_auto.
598 * (Spherical components with respect to the mapping of the star)
599 */
600 Sym_tensor tkij_auto ;
601
602 /** Part of the extrinsic curvature tensor \f$\tilde K^{ij}\f$
603 * generated by \c beta_comp.
604 * (Spherical components with respect to the mapping of the star)
605 */
606 Sym_tensor tkij_comp ;
607
608 /** Part of the scalar \f$K_{ij} K^{ij}\f$
609 * generated by \c beta_auto, i.e.
610 * \f$K_{ij}^{\rm auto} K^{ij}_{\rm auto}\f$
611 */
612 Scalar kcar_auto ;
613
614 /** Part of the scalar \f$K_{ij} K^{ij}\f$
615 * generated by \c beta_auto and \c beta_comp, i.e.
616 * \f$K_{ij}^{\rm auto} K^{ij}_{\rm comp}\f$
617 */
618 Scalar kcar_comp ;
619
620 /** Effective source at the previous step for the resolution of
621 * the Poisson equation for \c logn_auto.
622 */
623 Scalar ssjm1_logn ;
624
625 /** Effective source at the previous step for the resolution of
626 * the Poisson equation for \c lnq_auto.
627 */
628 Scalar ssjm1_lnq ;
629
630 /** Effective source at the previous step for the resolution of
631 * the Poisson equation for \c khi. (second scalar equation
632 * for the resolution of the vectorial poisson equation for the shift)
633 */
634 Scalar ssjm1_khi ;
635
636 Vector ssjm1_wbeta ;
637
638 /** Effective source at the previous step for the resolution of
639 * the Poisson equation for \c h00_auto.
640 */
641 Scalar ssjm1_h11 ;
642
643 /** Effective source at the previous step for the resolution of
644 * the Poisson equation for \c h10_auto.
645 */
646 Scalar ssjm1_h21 ;
647
648 /** Effective source at the previous step for the resolution of
649 * the Poisson equation for \c h20_auto.
650 */
651 Scalar ssjm1_h31 ;
652
653 /** Effective source at the previous step for the resolution of
654 * the Poisson equation for \c h11_auto.
655 */
656 Scalar ssjm1_h22 ;
657
658 /** Effective source at the previous step for the resolution of
659 * the Poisson equation for \c h21_auto.
660 */
661 Scalar ssjm1_h32 ;
662
663 /** Effective source at the previous step for the resolution of
664 * the Poisson equation for \c h22_auto.
665 */
666 Scalar ssjm1_h33 ;
667
668 /**
669 * Function used to construct the part \f$lnq_auto\f$ generated by
670 * the star from the total \f$lnq\f$.
671 * Mainly this \c Scalar is 1 around the star and 0 around
672 * the companion
673 * and the sum of \c decouple for the star and his companion is 1
674 * everywhere.
675 */
676 Scalar decouple ;
677
678 /** \c true if the 3-metric is conformally flat, \c false
679 * for a more general metric.
680 */
681 bool conf_flat ;
682
683 // Derived data :
684 // ------------
685 protected:
686 /// Absolute coordinate X of the barycenter of the baryon density
687 mutable double* p_xa_barycenter ;
688
689
690 // Constructors - Destructor
691 // -------------------------
692 public:
693 /** Standard constructor.
694 *
695 * @param mp_i Mapping on which the star will be defined
696 * @param nzet_i Number of domains occupied by the star
697 * @param eos_i Equation of state of the stellar matter
698 * @param irrot should be \c true for an irrotational star,
699 * \c false for a corotating one
700 * @param conf_flat should be \c true for a conformally flat metric
701 * \c false for a general one
702 */
703 Star_bin(Map& mp_i, int nzet_i, const Eos& eos_i,
704 bool irrot, bool conf_flat) ;
705
706
707 Star_bin(const Star_bin& ) ; ///< Copy constructor
708
709 /** Constructor from a file (see \c sauve(FILE* )).
710 *
711 * @param mp_i Mapping on which the star will be defined
712 * @param eos_i Equation of state of the stellar matter
713 * @param fich input file (must have been created by the function
714 * \c sauve)
715 */
716 Star_bin(Map& mp_i, const Eos& eos_i, FILE* fich) ;
717
718 virtual ~Star_bin() ; ///< Destructor
719
720
721 // Memory management
722 // -----------------
723 protected:
724 /// Deletes all the derived quantities
725 virtual void del_deriv() const ;
726
727 /// Sets to \c 0x0 all the pointers on derived quantities
728 virtual void set_der_0x0() const ;
729
730 /** Sets to \c ETATNONDEF (undefined state) the hydrodynamical
731 * quantities relative to the Eulerian observer.
732 */
733 virtual void del_hydro_euler() ;
734
735
736 // Mutators / assignment
737 // ---------------------
738 public:
739 /// Assignment to another \c Star_bin
740 void operator=(const Star_bin& ) ;
741
742 /// Read/write the centrifugal potential
743 Scalar& set_pot_centri() ;
744
745 /** Read/write of the logarithm of the lapse generated
746 * principally by the companion.
747 */
748 Scalar& set_logn_comp() ;
749
750 /// Assignment of a new logn_auto
751 void set_logn_auto(const Scalar& logn_auto_new) {logn_auto = logn_auto_new ;
752 return ;}
753
754 /// Assignment of a new lnq_auto
755 void set_lnq_auto(const Scalar& lnq_auto_new) {lnq_auto = lnq_auto_new ;
756 return ;}
757
758 /// Read/write of \f$beta_auto\f$
759 Vector& set_beta_auto() ;
760
761 /// Read/write of \f$beta\f$
762 Vector& set_beta() ;
763
764 /// Write if conformally flat
765 void set_conf_flat(bool confflat) {conf_flat = confflat ; return ;}
766
767 // Accessors
768 // ---------
769 public:
770 /** Returns \c true for an irrotational motion, \c false for
771 * a corotating one.
772 */
773 bool is_irrotational() const {return irrotational; } ;
774
775 /// Returns the non-translational part of the velocity potential
776 const Scalar& get_psi0() const {return psi0;} ;
777
778 /** Returns the covariant derivative of the velocity potential
779 * (Spherical components with respect to the mapping of the star)
780 */
781 const Vector& get_d_psi() const {return d_psi;} ;
782
783 /** Returns the spatial projection of the fluid 3-velocity with
784 * respect to the co-orbiting observer.
785 * (Spherical components with respect to the mapping of the star)
786 */
787 const Vector& get_wit_w() const {return wit_w;} ;
788
789 /** Returns the logarithm of the Lorentz factor between the fluid and
790 * the co-orbiting observer.
791 */
792 const Scalar& get_loggam() const {return loggam;} ;
793
794 /** Returns the shift vector, divided by \e N, of the rotating
795 * coordinates, \f$\beta^i/N\f$.
796 * (Spherical components with respect to the mapping of the star)
797 */
798 const Vector& get_bsn() const {return bsn;} ;
799
800 /// Returns the centrifugal potential
801 const Scalar& get_pot_centri() const {return pot_centri;} ;
802
803 /** Returns the part of the lapse logarithm (gravitational potential
804 * at the Newtonian limit) generated principally by the star.
805 */
806 const Scalar& get_logn_auto() const {return logn_auto;} ;
807
808 /** Returns the part of the lapse logarithm (gravitational potential
809 * at the Newtonian limit) generated principally by the companion star.
810 */
811 const Scalar& get_logn_comp() const {return logn_comp;} ;
812
813 /** Returns the part of the shift vector \f$\beta^i\f$ generated
814 * principally by the star.
815 * (Spherical components with respect to the mapping of the star)
816 */
817 const Vector& get_beta_auto() const {return beta_auto;} ;
818
819 /** Returns the part of the shift vector \f$\beta^i\f$ generated
820 * principally by the star.
821 * (Spherical components with respect to the mapping of the star)
822 */
823 const Vector& get_beta_comp() const {return beta_comp;} ;
824
825 /** Returns the part of the vector field \f$Q\f$ generated principally
826 * by the star.
827 */
828 const Scalar& get_lnq_auto() const {return lnq_auto;} ;
829
830 /** Returns the part of the vector field \f$Q\f$ generated principally
831 * by the companion star.
832 */
833 const Scalar& get_lnq_comp() const {return lnq_comp;} ;
834
835 /** Returns the covariant derivative of \f$logn\f$.
836 */
837 const Vector& get_dcov_logn() const {return dcov_logn;} ;
838
839 /** Returns the contravariant derivative of \f$logn\f$.
840 */
841 const Vector& get_dcon_logn() const {return dcon_logn;} ;
842
843 /** Returns the covariant derivative of \f$\Phi\f$
844 * (logarithm of the conformal factor).
845 */
846 const Vector& get_dcov_phi() const {return dcov_phi;} ;
847
848 /** Returns the contravariant derivative of \f$\Phi\f$
849 * (logarithm of the conformal factor).
850 */
851 const Vector& get_dcon_phi() const {return dcon_phi;} ;
852
853 /// Return the conformal factor \f$\psi^4\f$
854 const Scalar& get_psi4() const {return psi4;} ;
855
856 /** Return the flat metric defined on the mapping (Spherical
857 * components with respect to the mapping of the star)
858 */
859 const Metric& get_flat() const {return flat;} ;
860
861 /// Return the conformal 3-metric \f$\tilde \gamma\f$
862 const Metric& get_gtilde() const {return gtilde;} ;
863
864 /** Return the total deviation of the inverse conformal metric
865 * \f$\tilde \gamma^{ij}\f$ from the inverse flat metric.
866 */
867 const Sym_tensor& get_hij() const {return hij;} ;
868
869 /** Return the deviation of the inverse conformal metric
870 * \f$\tilde \gamma^{ij}\f$ from the inverse flat metric principally
871 * generated by the star.
872 */
873 const Sym_tensor& get_hij_auto() const {return hij_auto;} ;
874
875 /** Return the deviation of the inverse conformal metric
876 * \f$\tilde \gamma^{ij}\f$ from the inverse flat metric generated
877 * principally by the companion star.
878 */
879 const Sym_tensor& get_hij_comp() const {return hij_comp;} ;
880
881
882 /** Returns the part of the extrinsic curvature tensor
883 * \f$\tilde K^{ij}\f$ generated by \c beta_auto.
884 * (Spherical components with respect to the mapping of the star)
885 */
886 const Sym_tensor& get_tkij_auto() const {return tkij_auto;} ;
887
888 /** Returns the part of the extrinsic curvature tensor
889 * \f$\tilde K^{ij}\f$ generated by \c beta_comp.
890 * (Spherical components with respect to the mapping of the star)
891 */
892 const Sym_tensor& get_tkij_comp() const {return tkij_comp;} ;
893
894 /** Returns the part of
895 * \f$\tilde K^{ij} \tilde K_{ij}\f$ generated by \c beta_auto.
896 */
897 const Scalar& get_kcar_auto() const {return kcar_auto;} ;
898
899 /** Returns the part of
900 * \f$\tilde K^{ij} \tilde K_{ij}\f$ generated by \c beta_comp.
901 */
902 const Scalar& get_kcar_comp() const {return kcar_comp;} ;
903
904 /**
905 * Returns the function used to construct \c beta_auto
906 from \c beta.
907 */
908 const Scalar get_decouple() const {return decouple ;}
909
910 bool is_conf_flat() const {return conf_flat; } ;
911
912 // Outputs
913 // -------
914 public:
915 virtual void sauve(FILE* ) const ; ///< Save in a file
916
917 protected:
918 /// Operator >> (virtual function called by the operator <<).
919 virtual ostream& operator>>(ostream& ) const ;
920
921 // Global quantities
922 // -----------------
923 public:
924 /// Baryon mass
925 virtual double mass_b() const ;
926
927 /// Gravitational mass
928 virtual double mass_g() const ;
929
930 /// Absolute coordinate X of the barycenter of the baryon density,
931 virtual double xa_barycenter() const ;
932
933
934 // Computational routines
935 // ----------------------
936 public:
937
938 /** Computes the hydrodynamical quantities relative to the Eulerian
939 * observer from those in the fluid frame, as well as
940 * \c wit_w and \c loggam.
941 *
942 * The calculation is performed starting from the quantities
943 * \c ent, \c ener, \c press and \c bsn,
944 * which are supposed to be up to date.
945 * From these, the following fields are updated:
946 * \c gam_euler, \c u_euler, \c ener_euler,
947 * \c s_euler, \c stress_euler,
948 * \c wit_w and \c loggam.
949 *
950 */
951 virtual void hydro_euler() ;
952
953 /** Computes metric coefficients from known potentials,
954 * when the companion is another star.
955 *
956 * The calculation is performed starting from the quantities
957 * \c logn_auto, \c lnq_auto, \c beta_auto,
958 * \c hij_auto, \c comp.logn_auto, \c comp.lnq_auto,
959 * \c comp.beta_auto, \c comp.hij_auto
960 * which are supposed to be up to date.
961 * From these, the following fields are updated:
962 * \c logn_comp, \c lnq_comp, \c beta_comp,
963 * \c hij_comp, \c nn, \c psi4, \c beta,
964 *
965 * @param comp companion star.
966 * @param omega angular velocity with respect to an asymptotically
967 * inertial observer
968 */
969 void update_metric(const Star_bin& comp, double omega) ;
970
971 /** Same as \c update_metric(const Star_bin\& ) but with
972 * relaxation.
973 *
974 * @param comp companion star.
975 * @param star_prev previous value of the star.
976 * @param relax relaxation parameter.
977 * @param omega angular velocity with respect to an asymptotically
978 * inertial observer
979 */
980 void update_metric(const Star_bin& comp, const Star_bin& star_prev,
981 double relax, double omega) ;
982
983 /** Computes the derivative of metric functions related to the
984 * companion star.
985 * @param omega angular velocity with respect to an asymptotically
986 * inertial observer
987 */
988 void update_metric_der_comp(const Star_bin& comp, double omega) ;
989
990 /** Computes the quantities \c bsn and \c pot_centri.
991 *
992 * The calculation is performed starting from the quantities
993 * \c nn, \c beta, \c Q,
994 * which are supposed to be up to date.
995 *
996 * @param omega angular velocity with respect to an asymptotically
997 * inertial observer
998 * @param x_axe absolute X coordinate of the rotation axis
999 */
1000 void kinematics(double omega, double x_axe) ;
1001
1002 /** Computes the gradient of the total velocity potential \f$\psi\f$.
1003 *
1004 */
1005 void fait_d_psi() ;
1006
1007 /** Computes \c tkij_auto and \c akcar_auto from
1008 * \c beta_auto, \c nn and \c Q.
1009 * @param omega angular velocity with respect to an asymptotically
1010 * inertial observer
1011 */
1012 void extrinsic_curvature(double omega) ;
1013
1014
1015 /** Computes an equilibrium configuration.
1016 *
1017 * @param ent_c [input] Central enthalpy
1018 * @param mermax [input] Maximum number of steps
1019 * @param mermax_poisson [input] Maximum number of steps in
1020 * poisson scalar
1021 * @param relax_poisson [input] Relaxation factor in poisson scalar
1022 * @param mermax_potvit [input] Maximum number of steps in
1023 * Map_radial::poisson_compact
1024 * @param relax_potvit [input] Relaxation factor in
1025 * Map_radial::poisson_compact
1026 * @param thres_adapt [input] Threshold on dH/dr for the adaptation
1027 * of the mapping
1028 * @param diff [output] 1-D \c Tbl for the storage of some
1029 * error indicators
1030 */
1031 void equilibrium(double ent_c, int mermax, int mermax_potvit,
1032 int mermax_poisson, double relax_poisson,
1033 double relax_potvit, double thres_adapt, Tbl& diff,
1034 double om) ;
1035
1036
1037 /** Computes the non-translational part of the velocity scalar potential
1038 * \f$\psi0\f$ by solving the continuity equation.
1039 *
1040 * @param mermax [input] Maximum number of steps in the iteration
1041 * @param precis [input] Required precision: the iteration will
1042 * be stopped when the relative difference
1043 * on \f$\psi0\f$ between two successive steps
1044 * is lower than \c precis.
1045 * @param relax [input] Relaxation factor.
1046 *
1047 * @return Relative error of the resolution obtained by comparing
1048 * the operator acting on the solution with the source.
1049 */
1050 double velocity_potential(int mermax, double precis, double relax) ;
1051
1052 /** Performs a relaxation on \c ent, \c logn_auto,
1053 * \c lnq_auto, \c beta_auto and \c hij_auto.
1054 *
1055 * @param star_prev [input] star at the previous step.
1056 * @param relax_ent [input] Relaxation factor for \c ent
1057 * @param relax_met [input] Relaxation factor for \c logn_auto,
1058 * \c lnq_auto, \c beta_auto,
1059 * only if \c (mer \% fmer_met == 0).
1060 * @param mer [input] Step number
1061 * @param fmer_met [input] Step interval between metric updates
1062 */
1063 void relaxation(const Star_bin& star_prev, double relax_ent,
1064 double relax_met, int mer, int fmer_met) ;
1065
1066
1067 /// Test if the gauge conditions we impose are well satisfied
1068 void test_K_Hi() const ;
1069
1070 /// Test of the helical symmetry
1071 void helical(double omega) const ;
1072
1073 friend class Binary ;
1074
1075 };
1076
1077 //---------------------------//
1078 // class Star_bin_xcts //
1079 //---------------------------//
1080
1081 /**
1082 * Class for stars in binary system in eXtended Conformal Thin Sandwich
1083 * formulation. *** UNDER DEEVELOPMENT *** \ingroup (star)
1084 *
1085 * A \c Star_bin_xcts can be construted in two states, represented by
1086 * the \c bool member \c irrotational: (i) irrotational
1087 * (i.e. the fluid motion is irrotational) or (ii) rigidly corotating
1088 * with respect to the orbital motion (synchronized binary).
1089 *
1090 */
1091 class Star_bin_xcts : public Star {
1092
1093 // Data :
1094 // -----
1095 protected:
1096 /** \c true for an irrotational star, \c false for a
1097 * corotating one
1098 */
1099 bool irrotational ;
1100
1101 /** Scalar potential \f$\Psi_0\f$ of the non-translational part of
1102 * fluid 4-velocity (in the irrotational case)
1103 */
1104 Scalar psi0 ;
1105
1106 /** Gradient of \f$\Psi\f$ (in the irrotational case)
1107 * (Spherical components with respect to the mapping of the star)
1108 */
1109 Vector d_psi ;
1110
1111 /** Spatial projection of the fluid 3-velocity with respect to
1112 * the co-orbiting observer.
1113 * (Spherical components with respect to the mapping of the star)
1114 */
1115 Vector wit_w ;
1116
1117 /** Logarithm of the Lorentz factor between the fluid and
1118 * the co-orbiting observer.
1119 */
1120 Scalar loggam ;
1121
1122 /** 3-vector shift, divided by \e N, of the rotating coordinates,
1123 * \f$\beta^i/N\f$.
1124 * (Spherical components with respect to the mapping of the star)
1125 */
1126 Vector bsn ;
1127
1128 /// Centrifugal potential
1129 Scalar pot_centri ;
1130
1131 /** Scalar field \f$ \chi_{auto} = (N\Psi)_{auto} \f$ generated
1132 * principally by the star.
1133 */
1134 Scalar chi_auto ;
1135
1136 /** Scalar field \f$ \chi_{comp} = (N\Psi)_{comp} \f$ generated
1137 * principally by the companion star.
1138 */
1139 Scalar chi_comp ;
1140
1141 /** Scalar field \f$\Psi_{auto}\f$ generated principally by the
1142 * star.
1143 */
1144 Scalar Psi_auto ;
1145
1146 /** Scalar field \f$\Psi_{comp}\f$ generated principally by the
1147 * companion star.
1148 */
1149 Scalar Psi_comp ;
1150
1151 /// Total conformal factor \f$\Psi\f$
1152 Scalar Psi ;
1153
1154 /// Total function \f$\chi\f$
1155 Scalar chi ;
1156
1157 /// Conformal factor \f$\psi^4\f$
1158 Scalar psi4 ;
1159
1160 /** Solution for the vector part of the vector Poisson equation
1161 * for \f$\beta^i\f$
1162 */
1163 Vector w_beta ;
1164
1165 /** Solution for the scalar part of the vector Poisson equation
1166 * for \f$\beta^i\f$
1167 */
1168 Scalar khi ;
1169
1170 /// Covariant derivative of the conformal factor \f$\Psi\f$
1171 Vector dcov_Psi ;
1172
1173 /// Covariant derivative of the function \f$\chi\f$
1174 Vector dcov_chi ;
1175
1176 ///Flat metric defined on the mapping (Spherical components with respect to the mapping of the star) .
1177 Metric_flat flat ;
1178
1179 /** Part of the shift vector generated principally by the star
1180 * (Spherical components with respect to the mapping of the star)
1181 */
1182 Vector beta_auto ;
1183
1184 /** Part of the shift vector generated principally by the star
1185 * (Spherical components with respect to the mapping of the star)
1186 */
1187 Vector beta_comp ;
1188
1189 /** Part of the extrinsic curvature tensor \f$\hat{A}^{ij}\f$
1190 * generated by \c beta_auto.
1191 * (Spherical components with respect to the mapping of the star)
1192 */
1193 Sym_tensor haij_auto ;
1194
1195 /** Part of the extrinsic curvature tensor \f$\hat{A}^{ij}\f$
1196 * generated by \c beta_comp.
1197 * (Spherical components with respect to the mapping of the star)
1198 */
1199 Sym_tensor haij_comp ;
1200
1201 /** Part of the scalar \f$\hat{A}_{ij}\hat{A}^{ij}\f$
1202 * generated by \c beta_auto, i.e.
1203 * \f$\hat{A}_{ij}^{\rm auto}\hat{A}^{ij}_{\rm auto}\f$
1204 */
1205 Scalar hacar_auto ;
1206
1207 /** Part of the scalar \f$\hat{A}_{ij}\hat{A}^{ij}\f$
1208 * generated by \c beta_auto and \c beta_comp, i.e.
1209 * \f$\hat{A}_{ij}^{\rm auto}\hat{A}^{ij}_{\rm comp}\f$
1210 */
1211 Scalar hacar_comp ;
1212
1213 /** Effective source at the previous step for the resolution of
1214 * the Poisson equation for \c \chi_auto.
1215 */
1216 Scalar ssjm1_chi ;
1217
1218 /** Effective source at the previous step for the resolution of
1219 * the Poisson equation for \c \Psi_auto.
1220 */
1221 Scalar ssjm1_psi ;
1222
1223 /** Effective source at the previous step for the resolution of
1224 * the Poisson equation for \c khi. (second scalar equation
1225 * for the resolution of the vectorial poisson equation for the shift)
1226 */
1227 Scalar ssjm1_khi ;
1228
1229 /** Effective source at the previous step for wbeta of
1230 * the vector Poisson equation for \c wbeta (needed for the
1231 * solution of the vector Poisson equation for the shift
1232 * \f$\beta^i\f$)
1233 */
1234 Vector ssjm1_wbeta ;
1235
1236 // Derived data :
1237 // ------------
1238 protected:
1239 /// Absolute coordinate X of the barycenter of the baryon density
1240 mutable double* p_xa_barycenter ;
1241
1242 // Constructors - Destructor
1243 // -------------------------
1244 public:
1245 /** Standard constructor.
1246 *
1247 * @param mp_i Mapping on which the star will be defined
1248 * @param nzet_i Number of domains occupied by the star
1249 * @param eos_i Equation of state of the stellar matter
1250 * @param irrot should be \c true for an irrotational star,
1251 * \c false for a corotating one
1252 */
1253 Star_bin_xcts(Map& mp_i, int nzet_i, const Eos& eos_i, bool irrot) ;
1254
1255 Star_bin_xcts(const Star_bin_xcts& ) ; ///< Copy constructor
1256
1257 /** Constructor from a file (see \c sauve(FILE* )).
1258 *
1259 * @param mp_i Mapping on which the star will be defined
1260 * @param eos_i Equation of state of the stellar matter
1261 * @param fich input file (must have been created by the function
1262 * \c sauve)
1263 */
1264 Star_bin_xcts(Map& mp_i, const Eos& eos_i, FILE* fich) ;
1265
1266 virtual ~Star_bin_xcts() ; ///< Destructor
1267
1268
1269 // Memory management
1270 // -----------------
1271 protected:
1272 /// Deletes all the derived quantities
1273 virtual void del_deriv() const ;
1274
1275 /// Sets to \c 0x0 all the pointers on derived quantities
1276 virtual void set_der_0x0() const ;
1277
1278 /** Sets to \c ETATNONDEF (undefined state) the hydrodynamical
1279 * quantities relative to the Eulerian observer.
1280 */
1281 virtual void del_hydro_euler() ;
1282
1283
1284 // Mutators / assignment
1285 // ---------------------
1286 public:
1287 /// Assignment to another \c Star_bin_xcts
1288 void operator=(const Star_bin_xcts& ) ;
1289
1290 /// Read/write the centrifugal potential
1291 Scalar& set_pot_centri() ;
1292
1293 /// Read/write the conformal factor \f$\Psi_{auto}\f$
1294 Scalar& set_Psi_auto() ;
1295
1296 /// Read/write the conformal factor \f$\Psi_{comp}\f$
1297 Scalar& set_Psi_comp() ;
1298
1299 /// Read/write the conformal factor \f$\chi_{auto}\f$
1300 Scalar& set_chi_auto() ;
1301
1302 /// Read/write the conformal factor \f$\chi_{comp}\f$
1303 Scalar& set_chi_comp() ;
1304
1305 /// Read/write of \f$\beta_{auto}\f$
1306 Vector& set_beta_auto() ;
1307
1308 /// Read/write of \f$\beta\f$
1309 Vector& set_beta() ;
1310
1311 // Accessors
1312 // ---------
1313 public:
1314 /** Returns \c true for an irrotational motion, \c false for
1315 * a corotating one.
1316 */
1317 bool is_irrotational() const { return irrotational; } ;
1318
1319 /// Returns the non-translational part of the velocity potential
1320 const Scalar& get_psi0() const {return psi0 ; } ;
1321
1322 /** Returns the covariant derivative of the velocity potential
1323 * (Spherical components with respect to the mapping of the star)
1324 */
1325 const Vector& get_d_psi() const {return d_psi ; } ;
1326
1327 /** Returns the spatial projection of the fluid 3-velocity with
1328 * respect to the co-orbiting observer.
1329 * (Spherical components with respect to the mapping of the star)
1330 */
1331 const Vector& get_wit_w() const {return wit_w ; } ;
1332
1333 /** Returns the logarithm of the Lorentz factor between the fluid and
1334 * the co-orbiting observer.
1335 */
1336 const Scalar& get_loggam() const {return loggam ; } ;
1337
1338 /** Returns the shift vector, divided by \e N, of the rotating
1339 * coordinates, \f$\beta^i/N\f$.
1340 * (Spherical components with respect to the mapping of the star)
1341 */
1342 const Vector& get_bsn() const {return bsn ; } ;
1343
1344 /// Returns the centrifugal potential
1345 const Scalar& get_pot_centri() const {return pot_centri ; } ;
1346
1347 /** Returns the part of the shift vector \f$\beta^i\f$ generated
1348 * principally by the star (\f$\beta^i_{auto}\f$).
1349 * (Spherical components with respect to the mapping of the star)
1350 */
1351 const Vector& get_beta_auto() const {return beta_auto ; } ;
1352
1353 /** Returns the part of the shift vector \f$\beta^i\f$ generated
1354 * principally by the companion (\f$\beta^i_{comp}\f$).
1355 * (Spherical components with respect to the mapping of the star)
1356 */
1357 const Vector& get_beta_comp() const {return beta_comp ; } ;
1358
1359 /** Returns the scalar field \f$\Psi_{auto}\f$ generated principally
1360 * by the star.
1361 */
1362 const Scalar& get_Psi_auto() const {return Psi_auto ; } ;
1363
1364 /** Returns the scalar field \f$\Psi_{comp}\f$ generated principally
1365 * by the companion star.
1366 */
1367 const Scalar& get_Psi_comp() const {return Psi_comp ; } ;
1368
1369 /** Returns the scalar field \f$\chi_{auto} = (N\Psi)_{auto}\f$
1370 * generated principally by the star.
1371 */
1372 const Scalar& get_chi_auto() const {return chi_auto ; } ;
1373
1374 /** Returns the scalar field \f$\chi_{comp} = (N\Psi)_{comp}\f$
1375 * generated principally by the companion star.
1376 */
1377 const Scalar& get_chi_comp() const {return chi_comp ; } ;
1378
1379 /** Returns the covariant derivative of \f$\chi\f$.
1380 */
1381 const Vector& get_dcov_chi() const {return dcov_chi ; } ;
1382
1383 /** Returns the covariant derivative of
1384 * the conformal factor \f$\Psi\f$
1385 */
1386 const Vector& get_dcov_Psi() const {return dcov_Psi ; } ;
1387
1388 /// Return the conformal factor \f$\Psi\f$
1389 const Scalar& get_Psi() const {return Psi ; } ;
1390
1391 /// Return the function \f$\chi\f$
1392 const Scalar& get_chi() const {return chi ; } ;
1393
1394 /// Return the conformal factor \f$\Psi^4\f$
1395 const Scalar& get_psi4() const {return psi4 ; } ;
1396
1397 /** Return the flat metric defined on the mapping (Spherical
1398 * components with respect to the mapping of the star)
1399 */
1400 const Metric& get_flat() const {return flat ; } ;
1401
1402 /** Returns the part of the extrinsic curvature tensor
1403 * \f$\hat{A}^{ij}\f$ generated by \c beta_auto.
1404 * (Spherical components with respect to the mapping of the star)
1405 */
1406 const Sym_tensor& get_haij_auto() const {return haij_auto ; } ;
1407
1408 /** Returns the part of the extrinsic curvature tensor
1409 * \f$\hat{A}^{ij}\f$ generated by \c beta_comp.
1410 * (Spherical components with respect to the mapping of the star)
1411 */
1412 const Sym_tensor& get_haij_comp() const {return haij_comp ; } ;
1413
1414 /** Returns the part of
1415 * \f$\hat{A}^{ij}\hat{A}_{ij}\f$ generated by \c beta_auto.
1416 */
1417 const Scalar& get_hacar_auto() const {return hacar_auto ; } ;
1418
1419 /** Returns the part of
1420 * \f$\hat{A}^{ij}\hat{A}_{ij}\f$ generated by \c beta_comp.
1421 */
1422 const Scalar& get_hacar_comp() const {return hacar_comp ; } ;
1423
1424 // Outputs
1425 // -------
1426 public:
1427 virtual void sauve(FILE* ) const ; ///< Save in a file
1428
1429 protected:
1430 /// Operator >> (virtual function called by the operator <<).
1431 virtual ostream& operator>>(ostream& ) const ;
1432
1433 // Global quantities
1434 // -----------------
1435 public:
1436 /// Baryon mass
1437 virtual double mass_b() const ;
1438
1439 /// Gravitational mass
1440 virtual double mass_g() const ;
1441
1442 /// Absolute coordinate X of the barycenter of the baryon density,
1443 virtual double xa_barycenter() const ;
1444
1445
1446 // Computational routines
1447 // ----------------------
1448 public:
1449
1450 /** Computes the hydrodynamical quantities relative to the Eulerian
1451 * observer from those in the fluid frame, as well as
1452 * \c wit_w and \c loggam.
1453 *
1454 * The calculation is performed starting from the quantities
1455 * \c ent, \c ener, \c press and \c bsn,
1456 * which are supposed to be up to date.
1457 * From these, the following fields are updated:
1458 * \c gam_euler, \c u_euler, \c ener_euler,
1459 * \c s_euler, \c stress_euler,
1460 * \c wit_w and \c loggam.
1461 *
1462 */
1463 virtual void hydro_euler() ;
1464
1465 /** Computes metric coefficients from known potentials,
1466 * when the companion is another star.
1467 *
1468 * The calculation is performed starting from the quantities
1469 * \c Psi_auto, \c chi_auto, \c beta_auto,
1470 * \c comp.Psi_auto, \c comp.chi_auto,
1471 * \c comp.beta_auto
1472 * which are supposed to be up to date.
1473 * From these, the following fields are updated:
1474 * \c Psi_comp, \c chi_comp, \c beta_comp,
1475 * \c nn, \c psi4, \c beta.
1476 *
1477 * @param comp companion star.
1478 * @param omega angular velocity with respect to an asymptotically
1479 * inertial observer
1480 */
1481 void update_metric(const Star_bin_xcts& comp) ;
1482
1483 /** Same as \c update_metric(const Star_bin_xcts\& ) but with
1484 * relaxation.
1485 *
1486 * @param comp companion star.
1487 * @param star_prev previous value of the star.
1488 * @param relax relaxation parameter.
1489 * @param omega angular velocity with respect to an asymptotically
1490 * inertial observer
1491 */
1492 void update_metric(const Star_bin_xcts& comp,
1493 const Star_bin_xcts& star_prev,
1494 double relax) ;
1495
1496 /** Computes the derivative of metric functions related to the
1497 * companion star
1498 */
1499 void update_metric_der_comp(const Star_bin_xcts& comp) ;
1500
1501 /** Computes the quantities \c bsn and \c pot_centri.
1502 *
1503 * The calculation is performed starting from the quantities
1504 * \c nn, \c beta, \c Psi,
1505 * which are supposed to be up to date.
1506 *
1507 * @param omega angular velocity with respect to an asymptotically
1508 * inertial observer
1509 * @param x_axe absolute X coordinate of the rotation axis
1510 */
1511 void kinematics(double omega, double x_axe) ;
1512
1513 /** Computes the gradient of the total velocity potential \f$\psi\f$.
1514 *
1515 */
1516 void fait_d_psi() ;
1517
1518 /** Computes \c haij_auto and \c hacar_auto from
1519 * \c beta_auto, \c nn and \c Psi .
1520 */
1521 void extrinsic_curvature() ;
1522
1523 /** Computes an equilibrium configuration.
1524 *
1525 * @param ent_c [input] Central enthalpy
1526 * @param mermax [input] Maximum number of steps
1527 * @param mermax_poisson [input] Maximum number of steps in
1528 * poisson scalar
1529 * @param relax_poisson [input] Relaxation factor in poisson scalar
1530 * @param mermax_potvit [input] Maximum number of steps in
1531 * Map_radial::poisson_compact
1532 * @param relax_potvit [input] Relaxation factor in
1533 * Map_radial::poisson_compact
1534 * @param thres_adapt [input] Threshold on dH/dr for the adaptation
1535 * of the mapping
1536 * @param fact [input] 1-D \c Tbl for the input of some factors:
1537 * \li \c fact(0) : A resizing factor for the first shell
1538 * @param ent_limit [input] array of enthalpy values to be set at
1539 * the boundaries between the domains; if set to 0x0 (default),
1540 * the initial values will be kept.
1541 * @param diff [output] 1-D \c Tbl for the storage of some
1542 * error indicators
1543 */
1544 void equilibrium(double ent_c, int mermax, int mermax_potvit,
1545 int mermax_poisson, double relax_poisson,
1546 double relax_potvit, double thres_adapt,
1547 const Tbl& fact, const Tbl* pent_limit,
1548 Tbl& diff) ;
1549
1550 /** Computes the non-translational part of the velocity scalar potential
1551 * \f$\psi0\f$ by solving the continuity equation.
1552 *
1553 * @param mermax [input] Maximum number of steps in the iteration
1554 * @param precis [input] Required precision: the iteration will
1555 * be stopped when the relative difference
1556 * on \f$\psi0\f$ between two successive steps
1557 * is lower than \c precis.
1558 * @param relax [input] Relaxation factor.
1559 *
1560 * @return Relative error of the resolution obtained by comparing
1561 * the operator acting on the solution with the source.
1562 */
1563 double velocity_potential(int mermax, double precis, double relax) ;
1564
1565 /** Performs a relaxation on \c ent, \c Psi_auto,
1566 * \c chi_auto and \c beta_auto.
1567 *
1568 * @param star_prev [input] star at the previous step.
1569 * @param relax_ent [input] Relaxation factor for \c ent
1570 * @param relax_met [input] Relaxation factor for \c logn_auto,
1571 * \c lnq_auto, \c beta_auto,
1572 * only if \c (mer \% fmer_met == 0).
1573 * @param mer [input] Step number
1574 * @param fmer_met [input] Step interval between metric updates
1575 */
1576 void relaxation(const Star_bin_xcts& star_prev, double relax_ent,
1577 double relax_met, int mer, int fmer_met) ;
1578
1579 friend class Binary_xcts ;
1580
1581 };
1582
1583 }
1584 #endif