30char etoile_equil_spher_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Etoile/etoile_equil_spher.C,v 1.6 2014/10/13 08:52:59 j_novak Exp $" ;
101 int i_b = mg->
get_nr(l_b) - 1 ;
102 int j_b = mg->
get_nt(l_b) - 1 ;
142 double diff_ent = 1 ;
151 for(
int mer=0 ; (diff_ent > precis) && (mer<mermax) ; mer++ ) {
153 cout <<
"-----------------------------------------------" << endl ;
154 cout <<
"step: " << mer << endl ;
155 cout <<
"alpha_r: " << alpha_r << endl ;
156 cout <<
"diff_ent = " << diff_ent << endl ;
171 (source.
set()).set_dzpuis(4) ;
186 mpaff.
dsdr(logn(), dlogn) ;
189 source = - dlogn * dbeta ;
193 mpaff.
poisson(source(), par_nul, logn_quad.
set()) ;
204 double nu_mat0_b =
logn_auto()(l_b, k_b, j_b, i_b) ;
205 double nu_mat0_c =
logn_auto()(0, 0, 0, 0) ;
207 double nu_quad0_b = logn_quad()(l_b, k_b, j_b, i_b) ;
208 double nu_quad0_c = logn_quad()(0, 0, 0, 0) ;
210 double alpha_r2 = ( ent_c - ent_b - nu_quad0_b + nu_quad0_c )
211 / ( qpig*(nu_mat0_b - nu_mat0_c) ) ;
213 alpha_r =
sqrt(alpha_r2) ;
233 double logn_c = logn()(0, 0, 0, 0) ;
234 ent = ent_c - logn() + logn_c ;
249 int nz_search =
nzet + 1 ;
257 double precis_adapt = 1.e-14 ;
259 double reg_map = 1. ;
261 par_adapt.
add_int(nitermax, 0) ;
263 par_adapt.
add_int(nzadapt, 1) ;
266 par_adapt.
add_int(nz_search, 2) ;
268 par_adapt.
add_int(adapt_flag, 3) ;
289 if (pent_limit != 0x0) ent_limit = *pent_limit ;
291 par_adapt.
add_tbl(ent_limit, 0) ;
294 double* bornes =
new double[nz+1] ;
297 for(
int l=0; l<nz; l++) {
302 bornes[nz] = __infinity ;
311 double alphal, betal ;
313 for(
int l=0; l<nz; l++) {
325 int num_r1 = mg->
get_nr(0) - 1;
327 cout <<
"Pressure difference:" <<
get_press()()(0,0,0,num_r1) -
get_press()()(1,0,0,0) << endl ;
328 cout <<
"Difference in enthalpies at the domain boundary:" << endl ;
329 cout <<
get_ent()()(0,0,0,num_r1) << endl ;
330 cout <<
get_ent()()(1,0,0,0) << endl ;
332 cout <<
"Enthalpy difference: " <<
get_ent()()(0,0,0,num_r1) -
get_ent()()(1,0,0,0) << endl ;
353 mpaff.
dsdr(logn(), dlogn) ;
359 - 0.5 * ( dlogn * dlogn + dbeta * dbeta ) ;
418 <<
"Characteristics of the star obtained by Etoile::equilibrium_spher : "
420 <<
"-----------------------------------------------------------------"
423 double ray =
mp.
val_r(l_b, 1., M_PI/2., 0) ;
424 cout <<
"Coordinate radius : " << ray / km <<
" km" << endl ;
426 double rcirc = ray *
sqrt(
a_car()(l_b, k_b, j_b, i_b) ) ;
428 double compact = qpig/(4.*M_PI) *
mass_g() / rcirc ;
430 cout <<
"Circumferential radius R : " << rcirc/km <<
" km" << endl ;
431 cout <<
"Baryon mass : " <<
mass_b()/msol <<
" Mo" << endl ;
432 cout <<
"Gravitational mass M : " <<
mass_g()/msol <<
" Mo" << endl ;
433 cout <<
"Compacity parameter GM/(c^2 R) : " << compact << endl ;
444 double vir_mat = source().integrale() ;
450 source = - ( logn().dsdr() * logn().dsdr()
455 double vir_grav = source().integrale() ;
459 double grv3 = ( vir_mat + vir_grav ) / vir_mat ;
461 cout <<
"Virial theorem GRV3 : " << endl ;
462 cout <<
" 3P term : " << vir_mat << endl ;
463 cout <<
" grav. term : " << vir_grav << endl ;
464 cout <<
" relative error : " << grv3 << endl ;
469 for (
int ltrans = 0; ltrans <
nzet-1; ltrans++) {
470 cout << endl <<
"Values at boundary between domains no. " << ltrans <<
" and " << ltrans+1 <<
" for theta = pi/2 and phi = 0 :" << endl ;
472 double rt1 =
mp.
val_r(ltrans, 1., M_PI/2, 0.) ;
473 double rt2 =
mp.
val_r(ltrans+1, -1., M_PI/2, 0.) ;
474 cout <<
" Coord. r [km] (left, right, rel. diff) : "
475 << rt1 / km <<
" " << rt2 / km <<
" " << (rt2 - rt1)/rt1 << endl ;
477 int ntm1 = mg->
get_nt(ltrans) - 1;
478 int nrm1 = mg->
get_nr(ltrans) - 1 ;
479 double ent1 =
ent()(ltrans, 0, ntm1, nrm1) ;
480 double ent2 =
ent()(ltrans+1, 0, ntm1, 0) ;
481 cout <<
" Enthalpy (left, right, rel. diff) : "
482 << ent1 <<
" " << ent2 <<
" " << (ent2-ent1)/ent1 << endl ;
484 double press1 =
press()(ltrans, 0, ntm1, nrm1) ;
485 double press2 =
press()(ltrans+1, 0, ntm1, 0) ;
486 cout <<
" Pressure (left, right, rel. diff) : "
487 << press1 <<
" " << press2 <<
" " << (press2-press1)/press1 << endl ;
489 double nb1 =
nbar()(ltrans, 0, ntm1, nrm1) ;
490 double nb2 =
nbar()(ltrans+1, 0, ntm1, 0) ;
491 cout <<
" Baryon density (left, right, rel. diff) : "
492 << nb1 <<
" " << nb2 <<
" " << (nb2-nb1)/nb1 << endl ;
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
const Cmp & dsdr() const
Returns of *this .
virtual void equilibrium_spher(double ent_c, double precis=1.e-14, const Tbl *ent_limit=0x0)
Computes a spherical static configuration.
int nzet
Number of domains of *mp occupied by the star.
Tenseur nnn
Total lapse function.
Tenseur logn_auto
Total of the logarithm of the part of the lapse N generated principaly by the star.
Tenseur nbar
Baryon density in the fluid frame.
virtual void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
Tenseur u_euler
Fluid 3-velocity with respect to the Eulerian observer.
Tenseur gam_euler
Lorentz factor between the fluid and Eulerian observers.
Map & mp
Mapping associated with the star.
const Tenseur & get_ent() const
Returns the enthalpy field.
virtual double mass_b() const
Baryon mass.
Tenseur ener
Total energy density in the fluid frame.
Tenseur press
Fluid pressure.
virtual double mass_g() const
Gravitational mass.
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one.
Tenseur ener_euler
Total energy density in the Eulerian frame.
Tenseur shift
Total shift vector.
Tenseur s_euler
Trace of the stress tensor in the Eulerian frame.
Tenseur ent
Log-enthalpy (relativistic case) or specific enthalpy (Newtonian case)
Tenseur beta_auto
Logarithm of the part of the product AN generated principaly by by the star.
const Tenseur & get_press() const
Returns the fluid pressure.
Tenseur a_car
Total conformal factor .
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
const double * get_beta() const
Returns the pointer on the array beta.
const double * get_alpha() const
Returns the pointer on the array alpha.
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
virtual void homothetie(double lambda)
Sets a new radial scale.
virtual void poisson(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation.
virtual void dsdr(const Cmp &ci, Cmp &resu) const
Computes of a Cmp.
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
Radial mapping of rather general form.
const double * get_alpha() const
Returns a pointer on the array alpha (values of in each domain)
const double * get_beta() const
Returns a pointer on the array beta (values of in each domain)
virtual void adapt(const Cmp &ent, const Param &par, int nbr_filtre=0)
Adaptation of the mapping to a given scalar field.
virtual double val_r(int l, double xi, double theta, double pphi) const =0
Returns the value of the radial coordinate r for a given in a given domain.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_nzone() const
Returns the number of domains.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
void add_tbl(const Tbl &ti, int position=0)
Adds the address of a new Tbl to the list.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void annule(int l)
Sets the Tenseur to zero in a given domain.
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Cmp sqrt(const Cmp &)
Square root.
Cmp exp(const Cmp &)
Exponential.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Standard units of space, time and mass.