00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 char et_rot_diff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_rot_diff.C,v 1.3 2004/03/25 10:29:05 j_novak Exp $" ;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 #include "math.h"
00064
00065
00066 #include "et_rot_diff.h"
00067 #include "eos.h"
00068 #include "nbr_spx.h"
00069 #include "utilitaires.h"
00070 #include "unites.h"
00071
00072
00073
00074
00075
00076
00077
00078 Et_rot_diff::Et_rot_diff(Map& mp_i, int nzet_i, bool relat, const Eos& eos_i,
00079 double (*frot_i)(double, const Tbl&),
00080 double (*primfrot_i)(double, const Tbl&),
00081 const Tbl& par_frot_i)
00082 : Etoile_rot(mp_i, nzet_i, relat, eos_i),
00083 frot(frot_i),
00084 primfrot(primfrot_i),
00085 par_frot(par_frot_i),
00086 omega_field(mp_i),
00087 prim_field(mp_i)
00088 {
00089
00090
00091 omega = __infinity ;
00092
00093
00094 omega_field = 0 ;
00095 prim_field = 0 ;
00096 omega_min = 0 ;
00097 omega_max = 0 ;
00098
00099 }
00100
00101
00102
00103 Et_rot_diff::Et_rot_diff(const Et_rot_diff& et)
00104 : Etoile_rot(et),
00105 frot(et.frot),
00106 primfrot(et.primfrot),
00107 par_frot(et.par_frot),
00108 omega_field(et.omega_field),
00109 omega_min(et.omega_min),
00110 omega_max(et.omega_max),
00111 prim_field(et.prim_field)
00112 {}
00113
00114
00115
00116
00117 Et_rot_diff::Et_rot_diff(Map& mp_i, const Eos& eos_i, FILE* fich,
00118 double (*frot_i)(double, const Tbl&),
00119 double (*primfrot_i)(double, const Tbl&) )
00120 : Etoile_rot(mp_i, eos_i, fich),
00121 frot(frot_i),
00122 primfrot(primfrot_i),
00123 par_frot(fich),
00124 omega_field(mp_i),
00125 prim_field(mp_i)
00126 {
00127
00128 Tenseur omega_field_file(mp, fich) ;
00129 omega_field = omega_field_file ;
00130 fait_prim_field() ;
00131
00132
00133 fread_be(&omega_min, sizeof(double), 1, fich) ;
00134 fread_be(&omega_max, sizeof(double), 1, fich) ;
00135
00136 }
00137
00138
00139
00140
00141
00142
00143 Et_rot_diff::~Et_rot_diff(){}
00144
00145
00146
00147
00148
00149
00150
00151
00152 void Et_rot_diff::operator=(const Et_rot_diff& et) {
00153
00154
00155 Etoile_rot::operator=(et) ;
00156
00157
00158 frot = et.frot ;
00159 primfrot = et.primfrot ;
00160 par_frot = et.par_frot ;
00161 omega_field = et.omega_field ;
00162 prim_field = et.prim_field ;
00163 omega_min = et.omega_min ;
00164 omega_max = et.omega_max ;
00165
00166 }
00167
00168
00169
00170
00171
00172
00173
00174
00175 void Et_rot_diff::sauve(FILE* fich) const {
00176
00177 Etoile_rot::sauve(fich) ;
00178
00179 par_frot.sauve(fich) ;
00180
00181 omega_field.sauve(fich) ;
00182
00183 fwrite_be(&omega_min, sizeof(double), 1, fich) ;
00184 fwrite_be(&omega_max, sizeof(double), 1, fich) ;
00185
00186 }
00187
00188
00189
00190
00191
00192 ostream& Et_rot_diff::operator>>(ostream& ost) const {
00193
00194 using namespace Unites ;
00195
00196 Etoile_rot::operator>>(ost) ;
00197
00198 ost << endl ;
00199 ost << "Differentially rotating star" << endl ;
00200 ost << "-----------------------------" << endl ;
00201
00202 ost << endl << "Parameters of F(Omega) : " << endl ;
00203 ost << par_frot << endl ;
00204
00205 ost << "Min, Max of Omega/(2pi) : " << omega_min / (2*M_PI) * f_unit
00206 << " Hz, " << omega_max / (2*M_PI) * f_unit << " Hz" << endl ;
00207 int lsurf = nzet - 1;
00208 int nt = mp.get_mg()->get_nt(lsurf) ;
00209 int nr = mp.get_mg()->get_nr(lsurf) ;
00210 ost << "Central, equatorial value of Omega: "
00211 << omega_field()(0, 0, 0, 0) * f_unit << " rad/s, "
00212 << omega_field()(nzet-1, 0, nt-1, nr-1) * f_unit << " rad/s" << endl ;
00213
00214 ost << "Central, equatorial value of Omega/(2 Pi): "
00215 << omega_field()(0, 0, 0, 0) * f_unit / (2*M_PI) << " Hz, "
00216 << omega_field()(nzet-1, 0, nt-1, nr-1) * f_unit / (2*M_PI)
00217 << " Hz" << endl ;
00218
00219 double nbar_max = max( max( nbar() ) ) ;
00220 double ener_max = max( max( ener() ) ) ;
00221 double press_max = max( max( press() ) ) ;
00222 ost << "Max prop. bar. dens. : " << nbar_max
00223 << " x 0.1 fm^-3 = " << nbar_max / nbar()(0, 0, 0, 0) << " central"
00224 << endl ;
00225 ost << "Max prop. ener. dens. (e_max) : " << ener_max
00226 << " rho_nuc c^2 = " << ener_max / ener()(0, 0, 0, 0) << " central"
00227 << endl ;
00228 ost << "Max pressure : " << press_max
00229 << " rho_nuc c^2 = " << press_max / press()(0, 0, 0, 0) << " central"
00230 << endl ;
00231
00232
00233 double len_rho = 1. / sqrt( ggrav * ener_max ) ;
00234 ost << endl << "Value of A = par_frot(1) in units of e_max^{1/2} : " <<
00235 par_frot(1) / len_rho << endl ;
00236
00237 ost << "Value of A / r_eq : " <<
00238 par_frot(1) / ray_eq() << endl ;
00239
00240 ost << "r_p/r_eq : " << aplat() << endl ;
00241 ost << "KEH l^2 = (c/G^2)^{2/3} J^2 e_max^{1/3} M_B^{-10/3} : " <<
00242 angu_mom() * angu_mom() / pow(len_rho, 0.6666666666666666)
00243 / pow(mass_b(), 3.3333333333333333)
00244 / pow(ggrav, 1.3333333333333333) << endl ;
00245
00246 ost << "M e_max^{1/2} : " << ggrav * mass_g() / len_rho << endl ;
00247
00248 ost << "r_eq e_max^{1/2} : " << ray_eq() / len_rho << endl ;
00249
00250 ost << "T/W : " << tsw() << endl ;
00251
00252 ost << "Omega_c / e_max^{1/2} : " << get_omega_c() * len_rho << endl ;
00253
00254 display_poly(ost) ;
00255
00256 return ost ;
00257
00258
00259 }
00260
00261
00262
00263
00264 void Et_rot_diff::display_poly(ostream& ost) const {
00265
00266 using namespace Unites ;
00267
00268 Etoile_rot::display_poly( ost ) ;
00269
00270 const Eos_poly* p_eos_poly = dynamic_cast<const Eos_poly*>( &eos ) ;
00271
00272 if (p_eos_poly != 0x0) {
00273
00274 double kappa = p_eos_poly->get_kap() ;
00275 double gamma = p_eos_poly->get_gam() ; ;
00276
00277
00278 double kap_ns2 = pow( kappa, 0.5 /(gamma-1) ) ;
00279
00280
00281 double r_poly = kap_ns2 / sqrt(ggrav) ;
00282
00283
00284 double t_poly = r_poly ;
00285
00286
00287 double rho_poly = 1. / (ggrav * r_poly * r_poly) ;
00288
00289 ost.precision(10) ;
00290 ost << " n_max : " << max( max( nbar() ) ) / rho_poly << endl ;
00291 ost << " e_max : " << max( max( ener() ) ) / rho_poly << endl ;
00292 ost << " P_min : " << 2.*M_PI / omega_max / t_poly << endl ;
00293 ost << " P_max : " << 2.*M_PI / omega_min / t_poly << endl ;
00294
00295 int lsurf = nzet - 1;
00296 int nt = mp.get_mg()->get_nt(lsurf) ;
00297 int nr = mp.get_mg()->get_nr(lsurf) ;
00298 ost << " P_eq : " << 2.*M_PI /
00299 omega_field()(nzet-1, 0, nt-1, nr-1) / t_poly << endl ;
00300
00301 }
00302
00303 }
00304
00305
00306
00307
00308
00309
00310
00311 double Et_rot_diff::funct_omega(double omeg) const {
00312
00313 return frot(omeg, par_frot) ;
00314
00315 }
00316
00317 double Et_rot_diff::prim_funct_omega(double omeg) const {
00318
00319 return primfrot(omeg, par_frot) ;
00320
00321 }
00322
00323 double Et_rot_diff::get_omega_c() const {
00324
00325 return omega_field()(0, 0, 0, 0) ;
00326
00327 }
00328
00329
00330