LORENE
star_rot.C
1 /*
2  * Methods of class Star_rot
3  *
4  * (see file star_rot.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2010 Eric Gourgoulhon
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
16  *
17  * LORENE is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with LORENE; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 
29 
30 /*
31  * $Id: star_rot.C,v 1.15 2026/01/20 08:35:28 j_novak Exp $
32  * $Log: star_rot.C,v $
33  * Revision 1.15 2026/01/20 08:35:28 j_novak
34  * New method radius_Morsink() to compute the physical radius along the definition of Morsink et al. (2007) in the oblate Schwarschild approximation.
35  *
36  * Revision 1.14 2023/07/04 09:01:09 j_novak
37  * Changed the name r_pol_circ -> r_circ_merid to explicitly show the radius is a circumferential one, along a meridian.
38  *
39  * Revision 1.13 2023/07/03 14:32:31 j_novak
40  * Added method "r_pol_circ()", to compute polar circumferential radius, with a circumference along a meridian.
41  *
42  * Revision 1.12 2021/10/08 13:10:14 j_novak
43  * Corrected a bug in Star_rot::fait_shift) in the np=1 case
44  *
45  * Revision 1.11 2017/04/11 10:46:55 m_bejger
46  * Star_rot::surf_grav() - surface gravity values along the theta direction
47  *
48  * Revision 1.10 2016/12/05 16:18:15 j_novak
49  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
50  *
51  * Revision 1.9 2015/05/19 09:30:56 j_novak
52  * New methods for computing the area of the star and its mean radius.
53  *
54  * Revision 1.8 2014/10/13 08:53:39 j_novak
55  * Lorene classes and functions now belong to the namespace Lorene.
56  *
57  * Revision 1.7 2014/10/06 15:13:17 j_novak
58  * Modified #include directives to use c++ syntax.
59  *
60  * Revision 1.6 2010/02/08 11:45:58 j_novak
61  * Better computation of fait_shift()
62  *
63  * Revision 1.5 2010/02/08 10:56:30 j_novak
64  * Added a few things missing for the reading from resulting file.
65  *
66  * Revision 1.4 2010/02/02 12:45:16 e_gourgoulhon
67  * Improved the display (operator>>)
68  *
69  * Revision 1.3 2010/01/25 22:33:35 e_gourgoulhon
70  * Debugging...
71  *
72  * Revision 1.2 2010/01/25 18:15:32 e_gourgoulhon
73  * Added member unsurc2
74  *
75  * Revision 1.1 2010/01/24 16:09:39 e_gourgoulhon
76  * New class Star_rot.
77  *
78  *
79  * $Header: /cvsroot/Lorene/C++/Source/Star/star_rot.C,v 1.15 2026/01/20 08:35:28 j_novak Exp $
80  *
81  */
82 
83 
84 // Lorene headers
85 #include "star_rot.h"
86 #include "eos.h"
87 #include "unites.h"
88 #include "utilitaires.h"
89 #include "nbr_spx.h"
90 
91 
92 
93  //--------------//
94  // Constructors //
95  //--------------//
96 
97 // Standard constructor
98 // --------------------
99 namespace Lorene {
100 Star_rot::Star_rot(Map& mpi, int nzet_i, bool relat, const Eos& eos_i)
101  : Star(mpi, nzet_i, eos_i),
102  relativistic(relat),
103  a_car(mpi),
104  bbb(mpi),
105  b_car(mpi),
106  nphi(mpi),
107  tnphi(mpi),
108  uuu(mpi),
109  nuf(mpi),
110  nuq(mpi),
111  dzeta(mpi),
112  tggg(mpi),
113  w_shift(mpi, CON, mp.get_bvect_cart()),
114  khi_shift(mpi),
115  tkij(mpi, COV, mp.get_bvect_cart()),
116  ak_car(mpi),
117  ssjm1_nuf(mpi),
118  ssjm1_nuq(mpi),
119  ssjm1_dzeta(mpi),
120  ssjm1_tggg(mpi),
121  ssjm1_khi(mpi),
122  ssjm1_wshift(mpi, CON, mp.get_bvect_cart())
123 {
124 
125  // Parameter 1/c^2 is deduced from relativistic:
126  unsurc2 = relativistic ? double(1) : double(0) ;
127 
128  // Initialization to a static state :
129  omega = 0 ;
130  uuu = 0 ;
131 
132  // Initialization to a flat metric :
133  a_car = 1 ;
134  bbb = 1 ;
136  b_car = 1 ;
137  nphi = 0 ;
138  tnphi = 0 ;
139  nuf = 0 ;
140  nuq = 0 ;
141  dzeta = 0 ;
142  tggg = 0 ;
143 
145  khi_shift = 0 ;
146 
147  beta.set_etat_zero() ;
149 
150  tkij.set_etat_zero() ;
151 
152  ak_car = 0 ;
153 
154  ssjm1_nuf = 0 ;
155  ssjm1_nuq = 0 ;
156  ssjm1_dzeta = 0 ;
157  ssjm1_tggg = 0 ;
158  ssjm1_khi = 0 ;
159 
161 
162  // Pointers of derived quantities initialized to zero :
163  set_der_0x0() ;
164 
165 }
166 
167 // Copy constructor
168 // ----------------
169 
171  : Star(et),
172  relativistic(et.relativistic),
173  unsurc2(et.unsurc2),
174  omega(et.omega),
175  a_car(et.a_car),
176  bbb(et.bbb),
177  b_car(et.b_car),
178  nphi(et.nphi),
179  tnphi(et.tnphi),
180  uuu(et.uuu),
181  nuf(et.nuf),
182  nuq(et.nuq),
183  dzeta(et.dzeta),
184  tggg(et.tggg),
185  w_shift(et.w_shift),
186  khi_shift(et.khi_shift),
187  tkij(et.tkij),
188  ak_car(et.ak_car),
189  ssjm1_nuf(et.ssjm1_nuf),
190  ssjm1_nuq(et.ssjm1_nuq),
191  ssjm1_dzeta(et.ssjm1_dzeta),
192  ssjm1_tggg(et.ssjm1_tggg),
193  ssjm1_khi(et.ssjm1_khi),
194  ssjm1_wshift(et.ssjm1_wshift)
195 {
196  // Pointers of derived quantities initialized to zero :
197  set_der_0x0() ;
198 }
199 
200 
201 // Constructor from a file
202 // -----------------------
203 Star_rot::Star_rot(Map& mpi, const Eos& eos_i, FILE* fich)
204  : Star(mpi, eos_i, fich),
205  a_car(mpi),
206  bbb(mpi),
207  b_car(mpi),
208  nphi(mpi),
209  tnphi(mpi),
210  uuu(mpi),
211  nuf(mpi),
212  nuq(mpi),
213  dzeta(mpi),
214  tggg(mpi),
215  w_shift(mpi, CON, mp.get_bvect_cart()),
216  khi_shift(mpi),
217  tkij(mpi, COV, mp.get_bvect_cart()),
218  ak_car(mpi),
219  ssjm1_nuf(mpi),
220  ssjm1_nuq(mpi),
221  ssjm1_dzeta(mpi),
222  ssjm1_tggg(mpi),
223  ssjm1_khi(mpi),
224  ssjm1_wshift(mpi, CON, mp.get_bvect_cart())
225 {
226 
227  // Star parameters
228  // -----------------
229 
230  // relativistic is read in the file:
231  size_t nread = fread(&relativistic, sizeof(bool), 1, fich) ;
232  if (nread == 0)
233  cerr << "Star_rot::Star_rot(FILE*): Problem reading the data file." << endl ;
234 
235  // Parameter 1/c^2 is deduced from relativistic:
236  unsurc2 = relativistic ? double(1) : double(0) ;
237 
238  // omega is read in the file:
239  fread_be(&omega, sizeof(double), 1, fich) ;
240 
241 
242  // Read of the saved fields:
243  // ------------------------
244 
245  Scalar nuf_file(mp, *(mp.get_mg()), fich) ;
246  nuf = nuf_file ;
247 
248  Scalar nuq_file(mp, *(mp.get_mg()), fich) ;
249  nuq = nuq_file ;
250 
251  Scalar dzeta_file(mp, *(mp.get_mg()), fich) ;
252  dzeta = dzeta_file ;
253 
254  Scalar tggg_file(mp, *(mp.get_mg()), fich) ;
255  tggg = tggg_file ;
256 
257  Vector w_shift_file(mp, mp.get_bvect_cart(), fich) ;
258  w_shift = w_shift_file ;
259 
260  Scalar khi_shift_file(mp, *(mp.get_mg()), fich) ;
261  khi_shift = khi_shift_file ;
262 
263  fait_shift() ; // constructs shift from w_shift and khi_shift
264  fait_nphi() ; // constructs N^phi from (N^x,N^y,N^z)
265 
266  Scalar ssjm1_nuf_file(mp, *(mp.get_mg()), fich) ;
267  ssjm1_nuf = ssjm1_nuf_file ;
268 
269  Scalar ssjm1_nuq_file(mp, *(mp.get_mg()), fich) ;
270  ssjm1_nuq = ssjm1_nuq_file ;
271 
272  Scalar ssjm1_dzeta_file(mp, *(mp.get_mg()), fich) ;
273  ssjm1_dzeta = ssjm1_dzeta_file ;
274 
275  Scalar ssjm1_tggg_file(mp, *(mp.get_mg()), fich) ;
276  ssjm1_tggg = ssjm1_tggg_file ;
277 
278  Scalar ssjm1_khi_file(mp, *(mp.get_mg()), fich) ;
279  ssjm1_khi = ssjm1_khi_file ;
280 
281  Vector ssjm1_wshift_file(mp, mp.get_bvect_cart(), fich) ;
282  ssjm1_wshift = ssjm1_wshift_file ;
283 
284  // All other fields are initialized to zero :
285  // ----------------------------------------
286  a_car = 0 ;
287  bbb = 0 ;
288  b_car = 0 ;
289  uuu = 0 ;
290  tkij.set_etat_zero() ;
291  ak_car = 0 ;
292 
293  // Pointers of derived quantities initialized to zero
294  // --------------------------------------------------
295  set_der_0x0() ;
296 
297 }
298 
299  //------------//
300  // Destructor //
301  //------------//
302 
304 
305  del_deriv() ;
306 
307 }
308 
309  //----------------------------------//
310  // Management of derived quantities //
311  //----------------------------------//
312 
313 void Star_rot::del_deriv() const {
314 
315  Star::del_deriv() ;
316 
317  if (p_angu_mom != 0x0) delete p_angu_mom ;
318  if (p_tsw != 0x0) delete p_tsw ;
319  if (p_grv2 != 0x0) delete p_grv2 ;
320  if (p_grv3 != 0x0) delete p_grv3 ;
321  if (p_r_circ != 0x0) delete p_r_circ ;
322  if (p_r_circ_merid != 0x0) delete p_r_circ_merid ;
323  if (p_area != 0x0) delete p_area ;
324  if (p_aplat != 0x0) delete p_aplat ;
325  if (p_z_eqf != 0x0) delete p_z_eqf ;
326  if (p_z_eqb != 0x0) delete p_z_eqb ;
327  if (p_z_pole != 0x0) delete p_z_pole ;
328  if (p_mom_quad != 0x0) delete p_mom_quad ;
329  if (p_surf_grav != 0x0) delete p_surf_grav ;
330  if (p_radius_Morsink != 0x0) delete p_radius_Morsink ;
331  if (p_r_isco != 0x0) delete p_r_isco ;
332  if (p_f_isco != 0x0) delete p_f_isco ;
333  if (p_lspec_isco != 0x0) delete p_lspec_isco ;
334  if (p_espec_isco != 0x0) delete p_espec_isco ;
335  if (p_f_eq != 0x0) delete p_f_eq ;
336 
338 }
339 
340 
341 void Star_rot::set_der_0x0() const {
342 
344 
345  p_angu_mom = 0x0 ;
346  p_tsw = 0x0 ;
347  p_grv2 = 0x0 ;
348  p_grv3 = 0x0 ;
349  p_r_circ = 0x0 ;
350  p_r_circ_merid = 0x0 ;
351  p_area = 0x0 ;
352  p_aplat = 0x0 ;
353  p_z_eqf = 0x0 ;
354  p_z_eqb = 0x0 ;
355  p_z_pole = 0x0 ;
356  p_mom_quad = 0x0 ;
357  p_surf_grav = 0x0 ;
358  p_radius_Morsink = 0x0 ;
359  p_r_isco = 0x0 ;
360  p_f_isco = 0x0 ;
361  p_lspec_isco = 0x0 ;
362  p_espec_isco = 0x0 ;
363  p_f_eq = 0x0 ;
364 
365 }
366 
368 
370 
371  del_deriv() ;
372 
373 }
374 
375  //--------------//
376  // Assignment //
377  //--------------//
378 
379 // Assignment to another Star_rot
380 // --------------------------------
381 void Star_rot::operator=(const Star_rot& et) {
382 
383  // Assignment of quantities common to all the derived classes of Star
384  Star::operator=(et) ;
385 
386  // Assignement of proper quantities of class Star_rot
387  relativistic = et.relativistic ;
388  unsurc2 = et.unsurc2 ;
389  omega = et.omega ;
390 
391  a_car = et.a_car ;
392  bbb = et.bbb ;
393  b_car = et.b_car ;
394  nphi = et.nphi ;
395  tnphi = et.tnphi ;
396  uuu = et.uuu ;
397  nuf = et.nuf ;
398  nuq = et.nuq ;
399  dzeta = et.dzeta ;
400  tggg = et.tggg ;
401  w_shift = et.w_shift ;
402  khi_shift = et.khi_shift ;
403  tkij = et.tkij ;
404  ak_car = et.ak_car ;
405  ssjm1_nuf = et.ssjm1_nuf ;
406  ssjm1_nuq = et.ssjm1_nuq ;
407  ssjm1_dzeta = et.ssjm1_dzeta ;
408  ssjm1_tggg = et.ssjm1_tggg ;
409  ssjm1_khi = et.ssjm1_khi ;
410  ssjm1_wshift = et.ssjm1_wshift ;
411 
412  del_deriv() ; // Deletes all derived quantities
413 
414 }
415 
416 
417  //--------------//
418  // Outputs //
419  //--------------//
420 
421 // Save in a file
422 // --------------
423 void Star_rot::sauve(FILE* fich) const {
424 
425  Star::sauve(fich) ;
426 
427  fwrite(&relativistic, sizeof(bool), 1, fich) ;
428  fwrite_be(&omega, sizeof(double), 1, fich) ;
429 
430  nuf.sauve(fich) ;
431  nuq.sauve(fich) ;
432  dzeta.sauve(fich) ;
433  tggg.sauve(fich) ;
434  w_shift.sauve(fich) ;
435  khi_shift.sauve(fich) ;
436 
437  ssjm1_nuf.sauve(fich) ;
438  ssjm1_nuq.sauve(fich) ;
439  ssjm1_dzeta.sauve(fich) ;
440  ssjm1_tggg.sauve(fich) ;
441  ssjm1_khi.sauve(fich) ;
442  ssjm1_wshift.sauve(fich) ;
443 
444 
445 }
446 
447 // Printing
448 // --------
449 
450 ostream& Star_rot::operator>>(ostream& ost) const {
451 
452  using namespace Unites ;
453 
454  Star::operator>>(ost) ;
455 
456  double omega_c = get_omega_c() ;
457 
458  ost << endl ;
459 
460  if (omega != __infinity) {
461  ost << "Uniformly rotating star" << endl ;
462  ost << "-----------------------" << endl ;
463 
464  double freq = omega / (2.*M_PI) ;
465  ost << "Omega : " << omega * f_unit
466  << " rad/s f : " << freq * f_unit << " Hz" << endl ;
467  ost << "Rotation period : " << 1000. / (freq * f_unit) << " ms"
468  << endl ;
469 
470  }
471  else {
472  ost << "Differentially rotating star" << endl ;
473  ost << "----------------------------" << endl ;
474 
475  double freq = omega_c / (2.*M_PI) ;
476  ost << "Central value of Omega : " << omega_c * f_unit
477  << " rad/s f : " << freq * f_unit << " Hz" << endl ;
478  ost << "Central rotation period : " << 1000. / (freq * f_unit) << " ms"
479  << endl ;
480  }
481  if (relativistic) {
482  ost << "Relativistic star" << endl ;
483  }
484  else {
485  ost << "Newtonian star" << endl ;
486  }
487  double compact = qpig/(4.*M_PI) * mass_g() / r_circ() ;
488  ost << "Compactness G M_g /(c^2 R_circ) : " << compact << endl ;
489 
490  double nphi_c = nphi.val_grid_point(0, 0, 0, 0) ;
491  if ( (omega_c==0) && (nphi_c==0) ) {
492  ost << "Central N^phi : " << nphi_c << endl ;
493  }
494  else{
495  ost << "Central N^phi/Omega : " << nphi_c / omega_c << endl ;
496  }
497 
498  ost << "Error on the virial identity GRV2 : " << grv2() << endl ;
499  double xgrv3 = grv3(&ost) ;
500  ost << "Error on the virial identity GRV3 : " << xgrv3 << endl ;
501 
502  double mom_quad_38si = mom_quad() * rho_unit * (pow(r_unit, double(5.))
503  / double(1.e38) ) ;
504  ost << "Quadrupole moment Q : " << mom_quad_38si << " 10^38 kg m^2"
505  << endl ;
506  ost << "Q / (M R_circ^2) : "
507  << mom_quad() / ( mass_g() * pow( r_circ(), 2. ) ) << endl ;
508  ost << "c^4 Q / (G^2 M^3) : "
509  << mom_quad() / ( pow(qpig/(4*M_PI), 2.) * pow(mass_g(), 3.) )
510  << endl ;
511 
512  ost << "Angular momentum J : "
513  << angu_mom()/( qpig / (4* M_PI) * msol*msol) << " G M_sol^2 / c"
514  << endl ;
515  ost << "c J / (G M^2) : "
516  << angu_mom()/( qpig / (4* M_PI) * pow(mass_g(), 2.) ) << endl ;
517 
518  if (omega != __infinity) {
519  double mom_iner = angu_mom() / omega ;
520  double mom_iner_38si = mom_iner * rho_unit * (pow(r_unit, double(5.))
521  / double(1.e38) ) ;
522  ost << "Moment of inertia: " << mom_iner_38si << " 10^38 kg m^2"
523  << endl ;
524  }
525 
526  ost << "Ratio T/W : " << tsw() << endl ;
527  ost << "Circumferential equatorial radius R_circ : "
528  << r_circ()/km << " km" << endl ;
529  if (mp.get_mg()->get_np(0) == 1) {
530  ost << "Circumferential polar (meridional) radius R_circ_merid : "
531  << r_circ_merid()/km << " km" << endl ;
532  ost << "Flattening R_circ_merid / R_circ_eq : "
533  << r_circ_merid() / r_circ() << endl ;
534  ost << "Surface area : " << area()/(km*km) << " km^2" << endl ;
535  ost << "Mean radius : " << mean_radius()/km << " km" << endl ;
536  } else {
537  ost <<
538  "Skipping polar radius / surface statements due to number of points in phi direction np > 1"
539  << endl;
540  }
541  ost << "Coordinate equatorial radius r_eq : " << ray_eq()/km << " km"
542  << endl ;
543  ost << "Flattening r_pole/r_eq : " << aplat() << endl ;
544  int lsurf = nzet - 1;
545  int nt = mp.get_mg()->get_nt(lsurf) ;
546  int nr = mp.get_mg()->get_nr(lsurf) ;
547  ost << "Equatorial value of the velocity U: "
548  << uuu.val_grid_point(nzet-1, 0, nt-1, nr-1) << " c" << endl ;
549  ost << "Redshift at the equator (forward) : " << z_eqf() << endl ;
550  ost << "Redshift at the equator (backward): " << z_eqb() << endl ;
551  ost << "Redshift at the pole : " << z_pole() << endl ;
552 
553 
554  ost << "Central value of log(N) : "
555  << logn.val_grid_point(0, 0, 0, 0) << endl ;
556 
557  ost << "Central value of dzeta=log(AN) : "
558  << dzeta.val_grid_point(0, 0, 0, 0) << endl ;
559 
560  if ( (omega_c==0) && (nphi_c==0) ) {
561  ost << "Central N^phi : " << nphi_c << endl ;
562  }
563  else{
564  ost << "Central N^phi/Omega : " << nphi_c / omega_c << endl ;
565  }
566 
567  ost << " ... w_shift (NB: components in the star Cartesian frame) [c] : "
568  << endl
569  << w_shift(1).val_grid_point(0, 0, 0, 0) << " "
570  << w_shift(2).val_grid_point(0, 0, 0, 0) << " "
571  << w_shift(3).val_grid_point(0, 0, 0, 0) << endl ;
572 
573  ost << "Central value of khi_shift [km c] : "
574  << khi_shift.val_grid_point(0, 0, 0, 0) / km << endl ;
575 
576  ost << "Central value of B^2 : " << b_car.val_grid_point(0,0,0,0) << endl ;
577 
578  Tbl diff_a_b = diffrel( a_car, b_car ) ;
579  ost <<
580  "Relative discrepancy in each domain between the metric coef. A^2 and B^2 : "
581  << endl ;
582  for (int l=0; l<diff_a_b.get_taille(); l++) {
583  ost << diff_a_b(l) << " " ;
584  }
585  ost << endl ;
586 
587  // Approximate formula for R_isco = 6 R_g (1-(2/3)^1.5 j )
588  // up to the first order in j
589  double jdimless = angu_mom() / ( ggrav * pow(mass_g(), 2.) ) ;
590  double r_grav = ggrav * mass_g() ;
591  double r_isco_appr = 6. * r_grav * ( 1. - pow(2./3.,1.5) * jdimless ) ;
592 
593  // Approximate formula for the ISCO frequency
594  // freq_ms = 6^{-1.5}/2pi/R_g (1+11*6^(-1.5) j )
595  // up to the first order in j
596  double f_isco_appr = ( 1. + 11. /6. /sqrt(6.) * jdimless ) / r_grav /
597  (12. * M_PI ) / sqrt(6.) ;
598 
599  ost << endl << "Innermost stable circular orbit (ISCO) : " << endl ;
600  double xr_isco = r_isco(&ost) ;
601  ost <<" circumferential radius r_isco = "
602  << xr_isco / km << " km" << endl ;
603  ost <<" (approx. 6M + 1st order in j : "
604  << r_isco_appr / km << " km)" << endl ;
605  ost <<" (approx. 6M : "
606  << 6. * r_grav / km << " km)" << endl ;
607  ost <<" orbital frequency f_isco = "
608  << f_isco() * f_unit << " Hz" << endl ;
609  ost <<" (approx. 1st order in j : "
610  << f_isco_appr * f_unit << " Hz)" << endl ;
611 
612 
613  return ost ;
614 
615 }
616 
617 
618 void Star_rot::partial_display(ostream& ost) const {
619 
620  using namespace Unites ;
621 
622  double omega_c = get_omega_c() ;
623  double freq = omega_c / (2.*M_PI) ;
624  ost << "Central Omega : " << omega_c * f_unit
625  << " rad/s f : " << freq * f_unit << " Hz" << endl ;
626  ost << "Rotation period : " << 1000. / (freq * f_unit) << " ms"
627  << endl ;
628  ost << endl << "Central enthalpy : " << ent.val_grid_point(0,0,0,0) << " c^2" << endl ;
629  ost << "Central proper baryon density : " << nbar.val_grid_point(0,0,0,0)
630  << " x 0.1 fm^-3" << endl ;
631  ost << "Central proper energy density : " << ener.val_grid_point(0,0,0,0)
632  << " rho_nuc c^2" << endl ;
633  ost << "Central pressure : " << press.val_grid_point(0,0,0,0)
634  << " rho_nuc c^2" << endl ;
635 
636  ost << "Central value of log(N) : "
637  << logn.val_grid_point(0, 0, 0, 0) << endl ;
638  ost << "Central lapse N : " << nn.val_grid_point(0,0,0,0) << endl ;
639  ost << "Central value of dzeta=log(AN) : "
640  << dzeta.val_grid_point(0, 0, 0, 0) << endl ;
641  ost << "Central value of A^2 : " << a_car.val_grid_point(0,0,0,0) << endl ;
642  ost << "Central value of B^2 : " << b_car.val_grid_point(0,0,0,0) << endl ;
643 
644  double nphi_c = nphi.val_grid_point(0, 0, 0, 0) ;
645  if ( (omega_c==0) && (nphi_c==0) ) {
646  ost << "Central N^phi : " << nphi_c << endl ;
647  }
648  else{
649  ost << "Central N^phi/Omega : " << nphi_c / omega_c
650  << endl ;
651  }
652 
653 
654  int lsurf = nzet - 1;
655  int nt = mp.get_mg()->get_nt(lsurf) ;
656  int nr = mp.get_mg()->get_nr(lsurf) ;
657  ost << "Equatorial value of the velocity U: "
658  << uuu.val_grid_point(nzet-1, 0, nt-1, nr-1) << " c" << endl ;
659 
660  ost << endl
661  << "Coordinate equatorial radius r_eq = "
662  << ray_eq()/km << " km" << endl ;
663  ost << "Flattening r_pole/r_eq : " << aplat() << endl ;
664  if (mp.get_mg()->get_np(0) == 1)
665  ost << "Flattening r_circ_pole/r_circ_eq : "
666  << r_circ_merid() / r_circ() << endl ;
667 
668 }
669 
670 
671 double Star_rot::get_omega_c() const {
672 
673  return omega ;
674 
675 }
676 
677 // display_poly
678 // ------------
679 
680 void Star_rot::display_poly(ostream& ost) const {
681 
682  using namespace Unites ;
683 
684  const Eos_poly* p_eos_poly = dynamic_cast<const Eos_poly*>( &eos ) ;
685 
686  if (p_eos_poly != 0x0) {
687 
688  double kappa = p_eos_poly->get_kap() ;
689 
690  // kappa^{n/2}
691  double kap_ns2 = pow( kappa, 0.5 /(p_eos_poly->get_gam()-1) ) ;
692 
693  // Polytropic unit of length in terms of r_unit :
694  double r_poly = kap_ns2 / sqrt(ggrav) ;
695 
696  // Polytropic unit of time in terms of t_unit :
697  double t_poly = r_poly ;
698 
699  // Polytropic unit of mass in terms of m_unit :
700  double m_poly = r_poly / ggrav ;
701 
702  // Polytropic unit of angular momentum in terms of j_unit :
703  double j_poly = r_poly * r_poly / ggrav ;
704 
705  // Polytropic unit of density in terms of rho_unit :
706  double rho_poly = 1. / (ggrav * r_poly * r_poly) ;
707 
708  ost.precision(10) ;
709  ost << endl << "Quantities in polytropic units : " << endl ;
710  ost << "==============================" << endl ;
711  ost << " ( r_poly = " << r_poly / km << " km )" << endl ;
712  ost << " n_c : " << nbar.val_grid_point(0, 0, 0, 0) / rho_poly << endl ;
713  ost << " e_c : " << ener.val_grid_point(0, 0, 0, 0) / rho_poly << endl ;
714  ost << " Omega_c : " << get_omega_c() * t_poly << endl ;
715  ost << " P_c : " << 2.*M_PI / get_omega_c() / t_poly << endl ;
716  ost << " M_bar : " << mass_b() / m_poly << endl ;
717  ost << " M : " << mass_g() / m_poly << endl ;
718  ost << " J : " << angu_mom() / j_poly << endl ;
719  ost << " r_eq : " << ray_eq() / r_poly << endl ;
720  ost << " R_circ_eq : " << r_circ() / r_poly << endl ;
721  ost << " R_circ_merid : " << r_circ_merid() / r_poly << endl ;
722  ost << " R_mean : " << mean_radius() / r_poly << endl ;
723 
724  }
725 
726 
727 }
728 
729 
730 
731  //-------------------------//
732  // Computational methods //
733  //-------------------------//
734 
736 
737  Vector d_khi = khi_shift.derive_con( mp.flat_met_cart() ) ;
738 
739  d_khi.dec_dzpuis(2) ; // divide by r^2 in the external compactified domain
740 
741  // x_k dW^k/dx_i
742  Scalar xx(mp) ;
743  Scalar yy(mp) ;
744  Scalar zz(mp) ;
745  Scalar sintcosp(mp) ;
746  Scalar sintsinp(mp) ;
747  Scalar cost(mp) ;
748  xx = mp.x ;
749  yy = mp.y ;
750  zz = mp.z ;
751  sintcosp = mp.sint * mp.cosp ;
752  sintsinp = mp.sint * mp.sinp ;
753  cost = mp.cost ;
754 
755  int nz = mp.get_mg()->get_nzone() ;
756  Vector xk(mp, COV, mp.get_bvect_cart()) ;
757  xk.set(1) = xx ;
758  xk.set(1).set_domain(nz-1) = sintcosp.domain(nz-1) ;
759  xk.set(1).set_dzpuis(-1) ;
760  xk.set(2) = yy ;
761  xk.set(2).set_domain(nz-1) = sintsinp.domain(nz-1) ;
762  xk.set(2).set_dzpuis(-1) ;
763  xk.set(3) = zz ;
764  xk.set(3).set_domain(nz-1) = cost.domain(nz-1) ;
765  xk.set(3).set_dzpuis(-1) ;
766  xk.std_spectral_base() ;
767 
769 
770  Vector x_d_w = contract(xk, 0, d_w, 0) ;
771  x_d_w.dec_dzpuis() ;
772 
773  double lambda = double(1) / double(3) ;
774 
775  if ( mp.get_mg()->get_np(0) == 1 ) {
776  lambda = 0 ;
777  }
778 
779  beta = - (lambda+2)/2./(lambda+1) * w_shift
780  + (lambda/2./(lambda+1)) * (d_khi + x_d_w) ;
781 
782 }
783 
785 
786  if ( (beta(1).get_etat() == ETATZERO) && (beta(2).get_etat() == ETATZERO) ) {
787  tnphi = 0 ;
788  nphi = 0 ;
789  return ;
790  }
791 
792  // Computation of tnphi
793  // --------------------
794 
795  mp.comp_p_from_cartesian( -beta(1), -beta(2), tnphi ) ;
796 
797  // Computation of nphi
798  // -------------------
799 
800  nphi = tnphi ;
801  nphi.div_rsint() ;
802 
803 }
804 
805 }
virtual double mass_g() const
Gravitational mass.
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition: star.C:319
Vector ssjm1_wshift
Effective source at the previous step for the resolution of the vector Poisson equation for ...
Definition: star_rot.h:240
Scalar dzeta
Metric potential .
Definition: star_rot.h:149
virtual double mean_radius() const
Mean star radius from the area .
Scalar ssjm1_dzeta
Effective source at the previous step for the resolution of the Poisson equation for dzeta ...
Definition: star_rot.h:218
Scalar a_car
Square of the metric factor A.
Definition: star_rot.h:119
Map & mp
Mapping associated with the star.
Definition: star.h:180
double * p_lspec_isco
Specific angular momentum of a particle on the ISCO.
Definition: star_rot.h:264
double * p_r_isco
Circumferential radius of the ISCO.
Definition: star_rot.h:259
Scalar nuf
Part of the Metric potential = logn generated by the matter terms.
Definition: star_rot.h:141
virtual double r_circ_merid() const
Crcumferential meridional radius.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:481
double * p_f_eq
Orbital frequency at the equator.
Definition: star_rot.h:265
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
double * p_r_circ
Circumferential radius (equator)
Definition: star_rot.h:251
Scalar khi_shift
Scalar used in the decomposition of shift , following Shibata&#39;s prescription [Prog.
Definition: star_rot.h:175
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one. ...
Definition: star_rot.h:109
const Tbl & domain(int l) const
Read-only of the value in a given domain.
Definition: scalar.h:637
Scalar tnphi
Component of the shift vector.
Definition: star_rot.h:133
double * p_mom_quad
Quadrupole moment.
Definition: star_rot.h:258
Scalar bbb
Metric factor B.
Definition: star_rot.h:122
Lorene prototypes.
Definition: app_hor.h:67
const Eos & eos
Equation of state of the stellar matter.
Definition: star.h:185
Standard units of space, time and mass.
Equation of state base class.
Definition: eos.h:209
virtual void comp_p_from_cartesian(const Scalar &v_x, const Scalar &v_y, Scalar &v_p) const =0
Computes the Spherical component (with respect to bvect_spher ) of a vector given by its cartesian c...
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:792
virtual double z_pole() const
Redshift factor at North pole.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
double * p_f_isco
Orbital frequency of the ISCO.
Definition: star_rot.h:260
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:399
virtual double grv2() const
Error on the virial identity GRV2.
Base class for coordinate mappings.
Definition: map.h:697
virtual double get_omega_c() const
Returns the central value of the rotation angular velocity ([f_unit] )
Definition: star_rot.C:671
virtual void del_deriv() const
Deletes all the derived quantities.
Definition: star_rot.C:313
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Definition: scalar.C:790
virtual void sauve(FILE *) const
Save in a binary file.
Definition: tensor.C:916
Scalar nuq
Part of the Metric potential = logn generated by the quadratic terms.
Definition: star_rot.h:146
double omega
Rotation angular velocity ([f_unit] )
Definition: star_rot.h:116
Scalar nbar
Baryon density in the fluid frame.
Definition: star.h:192
Scalar ent
Log-enthalpy.
Definition: star.h:190
Base class for stars.
Definition: star.h:175
Vector beta
Shift vector.
Definition: star.h:228
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Definition: scalar_deriv.C:401
Tensor field of valence 1.
Definition: vector.h:188
Tbl * p_radius_Morsink
Physical radius close to the definition of Morsink et al. (2007)
Definition: star_rot.h:269
const Metric_flat & flat_met_cart() const
Returns the flat metric associated with the Cartesian coordinates and with components expressed in th...
Definition: map.C:337
Tbl & set_domain(int l)
Read/write of the value in a given domain.
Definition: scalar.h:627
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Definition: cmp_math.C:507
virtual double area() const
Integrated surface area in .
double get_gam() const
Returns the adiabatic index (cf. Eq. (3))
Definition: eos_poly.C:271
Class for isolated rotating stars.
Definition: star_rot.h:101
Scalar ssjm1_tggg
Effective source at the previous step for the resolution of the Poisson equation for tggg ...
Definition: star_rot.h:223
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Definition: scalar.h:649
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
Definition: tensor.C:818
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition: star_rot.C:341
void operator=(const Star_rot &)
Assignment to another Star_rot.
Definition: star_rot.C:381
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: star_rot.C:450
void operator=(const Star &)
Assignment to another Star.
Definition: star.C:354
int nzet
Number of domains of *mp occupied by the star.
Definition: star.h:183
virtual ~Star_rot()
Destructor.
Definition: star_rot.C:303
virtual double r_isco(ostream *ost=0x0) const
Circumferential radius of the innermost stable circular orbit (ISCO).
Definition: star_rot_isco.C:74
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
Definition: star_rot.h:114
Coord sint
Definition: map.h:748
double * p_tsw
Ratio T/W.
Definition: star_rot.h:248
Scalar nphi
Metric coefficient .
Definition: star_rot.h:128
double * p_z_eqf
Forward redshift factor at equator.
Definition: star_rot.h:255
virtual void sauve(FILE *) const
Save in a file.
Definition: scalar.C:692
Scalar ener
Total energy density in the fluid frame.
Definition: star.h:193
double * p_grv2
Error on the virial identity GRV2.
Definition: star_rot.h:249
double * p_area
Integrated surface area.
Definition: star_rot.h:254
double * p_r_circ_merid
Circumferential radius (meridian)
Definition: star_rot.h:252
Scalar press
Fluid pressure.
Definition: star.h:194
virtual double mass_b() const
Baryon mass.
double * p_espec_isco
Specific energy of a particle on the ISCO.
Definition: star_rot.h:262
double get_kap() const
Returns the pressure coefficient (cf.
Definition: eos_poly.C:275
virtual void del_hydro_euler()
Sets to ETATNONDEF (undefined state) the hydrodynamical quantities relative to the Eulerian observer...
Definition: star_rot.C:367
virtual double f_isco() const
Orbital frequency at the innermost stable circular orbit (ISCO).
virtual double mom_quad() const
Quadrupole moment.
Scalar ssjm1_nuq
Effective source at the previous step for the resolution of the Poisson equation for nuq by means of ...
Definition: star_rot.h:213
virtual double angu_mom() const
Angular momentum.
double * p_z_pole
Redshift factor at North pole.
Definition: star_rot.h:257
Polytropic equation of state (relativistic case).
Definition: eos.h:812
virtual void display_poly(ostream &) const
Display in polytropic units.
Definition: star_rot.C:680
Star_rot(Map &mp_i, int nzet_i, bool relat, const Eos &eos_i)
Standard constructor.
Definition: star_rot.C:100
Coord sinp
Definition: map.h:750
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:467
double * p_grv3
Error on the virial identity GRV3.
Definition: star_rot.h:250
Sym_tensor tkij
Tensor related to the extrinsic curvature tensor by .
Definition: star_rot.h:182
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Definition: fwrite_be.C:73
virtual double r_circ() const
Circumferential equatorial radius.
double * p_angu_mom
Angular momentum.
Definition: star_rot.h:247
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
Tensor handling.
Definition: tensor.h:300
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Scalar logn
Logarithm of the lapse N .
Definition: star.h:222
Scalar b_car
Square of the metric factor B.
Definition: star_rot.h:125
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Definition: fread_be.C:72
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:471
double * p_aplat
Flatening r_pole/r_eq.
Definition: star_rot.h:253
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
Definition: tensor.C:1024
virtual void del_deriv() const
Deletes all the derived quantities.
Definition: star.C:301
virtual double z_eqb() const
Backward redshift factor at equator.
virtual void partial_display(ostream &) const
Printing of some informations, excluding all global quantities.
Definition: star_rot.C:618
virtual void del_hydro_euler()
Sets to ETATNONDEF (undefined state) the hydrodynamical quantities relative to the Eulerian observer...
Definition: star.C:333
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
Definition: map.h:818
virtual double grv3(ostream *ost=0x0) const
Error on the virial identity GRV3.
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Definition: tensor.C:664
Scalar nn
Lapse function N .
Definition: star.h:225
Coord y
y coordinate centered on the grid
Definition: map.h:754
Scalar ssjm1_khi
Effective source at the previous step for the resolution of the Poisson equation for the scalar by m...
Definition: star_rot.h:231
int get_taille() const
Gives the total size (ie dim.taille)
Definition: tbl.h:417
Scalar uuu
Norm of u_euler.
Definition: star_rot.h:136
Coord cosp
Definition: map.h:751
double ray_eq() const
Coordinate radius at , [r_unit].
Definition: star_global.C:111
Scalar ssjm1_nuf
Effective source at the previous step for the resolution of the Poisson equation for nuf by means of ...
Definition: star_rot.h:207
Coord x
x coordinate centered on the grid
Definition: map.h:753
void div_rsint()
Division by everywhere; dzpuis is not changed.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: star.C:420
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
Definition: tensor.C:529
virtual void sauve(FILE *) const
Save in a file.
Definition: star_rot.C:423
virtual void sauve(FILE *) const
Save in a file.
Definition: star.C:400
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
Definition: tensor.C:507
Basic array class.
Definition: tbl.h:164
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:476
Scalar & set(int)
Read/write access to a component.
Definition: vector.C:302
Scalar tggg
Metric potential .
Definition: star_rot.h:152
void fait_nphi()
Computes tnphi and nphi from the Cartesian components of the shift, stored in shift ...
Definition: star_rot.C:784
Scalar ak_car
Scalar .
Definition: star_rot.h:201
virtual double aplat() const
Flatening r_pole/r_eq.
Tbl * p_surf_grav
Surface gravity (along the theta direction)
Definition: star_rot.h:267
Coord z
z coordinate centered on the grid
Definition: map.h:755
Vector w_shift
Vector used in the decomposition of shift , following Shibata&#39;s prescription [Prog.
Definition: star_rot.h:165
virtual double z_eqf() const
Forward redshift factor at equator.
void fait_shift()
Computes shift from w_shift and khi_shift according to Shibata&#39;s prescription [Prog.
Definition: star_rot.C:735
virtual double tsw() const
Ratio T/W.
double * p_z_eqb
Backward redshift factor at equator.
Definition: star_rot.h:256
Coord cost
Definition: map.h:749