30 #include "hot_star_rot_cfc.h" 32 #include "utilitaires.h" 37 double fact_omega,
int ,
const Tbl& ent_limit,
38 const Itbl& icontrol,
const Tbl& control,
39 double mbar_wanted,
double aexp_mass,
Tbl& diff){
48 char display_bold[]=
"x[1m" ; display_bold[0] = 27 ;
49 char display_normal[] =
"x[0m" ; display_normal[0] = 27 ;
60 assert( ( type_t == SYM) || (type_t == NONSYM) ) ;
62 int i_b = mg->
get_nr(l_b) - 1 ;
63 int j_b = (type_t == SYM ? mg->
get_nt(l_b) - 1 : mg->
get_nt(l_b)/2 ) ;
67 double ent_b = ent_limit(
nzet-1) ;
72 int mer_max = icontrol(0) ;
73 int mer_rot = icontrol(1) ;
74 int mer_change_omega = icontrol(2) ;
75 int mer_fix_omega = icontrol(3) ;
76 int mer_mass = icontrol(4) ;
77 int delta_mer_kep = icontrol(5) ;
80 if (mer_change_omega < mer_rot) {
81 cout <<
"Hot_star_rot_CFC::equilibrium: mer_change_omega < mer_rot !" 83 cout <<
" mer_change_omega = " << mer_change_omega << endl ;
84 cout <<
" mer_rot = " << mer_rot << endl ;
87 if (mer_fix_omega < mer_change_omega) {
88 cout <<
"Hot_star_rot_CFC::equilibrium: mer_fix_omega < mer_change_omega !" 90 cout <<
" mer_fix_omega = " << mer_fix_omega << endl ;
91 cout <<
" mer_change_omega = " << mer_change_omega << endl ;
97 bool change_ent = true ;
100 mer_mass =
abs(mer_mass) ;
104 double precis = control(0) ;
105 double omega_ini = control(1) ;
106 double relax = control(2) ;
107 double relax_prev = double(1) - relax ;
113 double& diff_ent = diff.
set(0) ;
123 double accrois_omega = (omega0 - omega_ini) /
124 double(mer_fix_omega - mer_change_omega) ;
145 ofstream fichconv(
"convergence.d") ;
146 fichconv <<
"# diff_ent GRV2 max_triax vit_triax" << endl ;
148 ofstream fichfreq(
"frequency.d") ;
149 fichfreq <<
"# f [Hz]" << endl ;
151 ofstream fichevol(
"evolution.d") ;
153 "# |dH/dr_eq/dH/dr_pole| r_pole/r_eq ent_c" 157 double err_grv2 = 1 ;
165 for(
int mer=0 ; (diff_ent > precis) && (mer<mer_max) ; mer++) {
167 cout <<
"-----------------------------------------------" << endl ;
168 cout <<
"step: " << mer << endl ;
169 cout <<
"diff_ent = " << display_bold << diff_ent << display_normal
171 cout <<
"err_grv2 = " << err_grv2 << endl ;
178 if (mer >= mer_rot) {
180 if (mer < mer_change_omega) {
184 if (mer <= mer_fix_omega) {
185 omega = omega_ini + accrois_omega *
186 (mer - mer_change_omega) ;
232 if (mer > mer_fix_omega + delta_mer_kep) {
234 omega *= fact_omega ;
237 bool omega_trop_grand = false ;
244 bool superlum = true ;
273 for (
int l=0; l<
nzet; l++) {
274 for (
int i=0; i<mg->
get_nr(l); i++) {
279 cout <<
"U > c for l, i : " << l <<
" " << i
280 <<
" U = " <<
sqrt( u2 ) << endl ;
285 cout <<
"**** VELOCITY OF LIGHT REACHED ****" << endl ;
286 omega /= fact_omega ;
287 cout <<
"New rotation frequency : " 288 <<
omega/(2.*M_PI) * f_unit <<
" Hz" << endl ;
289 omega_trop_grand = true ;
313 Scalar prim_entropy = expmHT ;
317 prim_entropy = prim_entropy.
primr(
false) ;
323 double prim_entr_b = prim_entropy.
val_grid_point(l_b, k_b, j_b, i_b) ;
328 double mlngamma_c = 0 ;
333 double alpha_r2 = ( ent_c - ent_b + mlngamma_c - mlngamma_b
334 - prim_entr_c + prim_entr_b + ln_q_c - ln_q_b) / ( ln_f_b - ln_f_c ) ;
336 alpha_r =
sqrt(alpha_r2) ;
338 cout <<
"alpha_r = " << alpha_r << endl ;
347 logn = alpha_r2 * ln_f_new + ln_q_new ;
354 ent = (ent_c + logn_c + mlngamma_c - prim_entr_c) -
logn - mlngamma + prim_entropy ;
369 for (
int l=0; l<
nzet; l++) {
370 int imax = mg->
get_nr(l) - 1 ;
371 if (l == l_b) imax-- ;
372 for (
int i=0; i<imax; i++) {
375 cout <<
"ent < 0 for l, i : " << l <<
" " << i
382 cout <<
"**** KEPLERIAN VELOCITY REACHED ****" << endl ;
383 omega /= fact_omega ;
384 cout <<
"New rotation frequency : " 385 <<
omega/(2.*M_PI) * f_unit <<
" Hz" << endl ;
386 omega_trop_grand = true ;
391 if ( omega_trop_grand ) {
393 fact_omega =
sqrt( fact_omega ) ;
394 cout <<
"**** New fact_omega : " << fact_omega << endl ;
414 logn = relax *
logn + relax_prev * logn_prev ;
416 psi = relax * psi_new + relax_prev * psi_prev ;
430 fichfreq <<
" " <<
omega / (2*M_PI) * f_unit ;
431 fichevol <<
" " << ent_c ;
438 if (mer > mer_mass) {
441 if (mbar_wanted > 0.) {
442 xx =
mass_b() / mbar_wanted - 1. ;
443 cout <<
"Discrep. baryon mass <-> wanted bar. mass : " << xx
447 xx =
mass_g() / fabs(mbar_wanted) - 1. ;
448 cout <<
"Discrep. grav. mass <-> wanted grav. mass : " << xx
451 double xprog = ( mer > 2*mer_mass) ? 1. :
452 double(mer-mer_mass)/double(mer_mass) ;
454 double ax = .5 * ( 2. + xx ) / (1. + xx ) ;
455 double fact =
pow(ax, aexp_mass) ;
456 cout <<
" xprog, xx, ax, fact : " << xprog <<
" " <<
457 xx <<
" " << ax <<
" " << fact << endl ;
463 if (mer%4 == 0)
omega *= fact ;
474 diff_ent = diff_ent_tbl(0) ;
475 for (
int l=1; l<
nzet; l++) {
476 diff_ent += diff_ent_tbl(l) ;
480 fichconv <<
" " <<
log10( fabs(diff_ent) + 1.e-16 ) ;
481 fichconv <<
" " <<
log10( fabs(err_grv2) + 1.e-16 ) ;
void solve_shift(Vector &shift_new) const
Solution of the shift equation for rotating stars in CFC.
Cmp log(const Cmp &)
Neperian logarithm.
Scalar temp
Temperature field (in MeV)
Cmp exp(const Cmp &)
Exponential.
Scalar psi
Conformal factor .
Cmp sqrt(const Cmp &)
Square root.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Standard units of space, time and mass.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
double & set(int i)
Read/write of a particular element (index i) (1D case)
virtual double grv2() const
Error on the virial identity GRV2.
Tensor field of valence 0 (or component of a tensorial field).
void solve_logn_q(Scalar &ln_q_new) const
Solution of the quadratic part of the Poisson equation for the lapse for rotating stars in CFC...
void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
Scalar primr(bool null_infty=true) const
Computes the radial primitive which vanishes for .
int get_type_t() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the equatorial pl...
Basic integer array class.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Scalar entropy
Entropy per baryon field (in $k_B$)
Scalar nn
Lapse function N .
Tensor field of valence 1.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
void solve_logn_f(Scalar &ln_f_new) const
Solution of the `‘matter’' part of the Poisson equation for the lapse for rotating stars in CFC...
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Scalar logn
Logarithm of the lapse N .
int nzet
Number of domains of *mp occupied by the star.
virtual double mass_b() const
Baryonic mass.
virtual void hydro_euler()
Computes the hydrodynamical quantities relative to the Eulerian observer from those in the fluid fram...
virtual void homothetie(double lambda)=0
Sets a new radial scale.
double omega
Rotation angular velocity ([f_unit] )
void equilibrium(double ent_c, double omega0, double fact_omega, int nzadapt, const Tbl &ent_limit, const Itbl &icontrol, const Tbl &control, double mbar_wanted, double aexp_mass, Tbl &diff)
Computes an equilibrium configuration.
int get_nzone() const
Returns the number of domains.
Scalar gam_euler
Lorentz factor between the fluid and Eulerian observers.
virtual double mass_g() const
Gravitational mass.
Map & mp
Mapping associated with the star.
void solve_psi(Scalar &psi_new)
Solution of the equations for the conformal factor for rotating stars in CFC.
void mult_rsint()
Multiplication by everywhere; dzpuis is not changed.
Cmp pow(const Cmp &, int)
Power .
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Cmp log10(const Cmp &)
Basis 10 logarithm.
Cmp abs(const Cmp &)
Absolute value.
void update_metric()
Computes metric quantities from known potentials.
const Scalar & dsdr() const
Returns of *this .
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Scalar & set(int)
Read/write access to a component.
void update_entropy()
Updates the part of the entropy from entropy_param.
void annule_hard()
Sets the Tbl to zero in a hard way.
Vector u_euler
Fluid 3-velocity with respect to the Eulerian observer.