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 char star_rot_dirac_diff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_rot_dirac_diff.C,v 1.2 2008/05/30 08:27:38 j_novak Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <math.h>
00038 #include <assert.h>
00039
00040
00041 #include "star_rot_dirac_diff.h"
00042 #include "unites.h"
00043 #include "utilitaires.h"
00044
00045
00046
00047
00048
00049
00050
00051
00052 Star_rot_Dirac_diff::Star_rot_Dirac_diff(Map& mpi, int nzet_i, const Eos& eos_i,
00053 double (*frot_i)(double, const Tbl&),
00054 double (*primfrot_i)(double, const Tbl&),
00055 const Tbl& par_frot_i)
00056 :Star_rot_Dirac(mpi, nzet_i, eos_i),
00057 frot(frot_i),
00058 primfrot(primfrot_i),
00059 par_frot(par_frot_i),
00060 omega_field(mpi),
00061 prim_field(mpi)
00062 {
00063
00064
00065 omega_field = 0 ;
00066 prim_field = 0 ;
00067 omega_min = 0 ;
00068 omega_max = 0 ;
00069
00070 }
00071
00072
00073
00074
00075 Star_rot_Dirac_diff::Star_rot_Dirac_diff(const Star_rot_Dirac_diff& star)
00076 : Star_rot_Dirac(star),
00077 frot(star.frot),
00078 primfrot(star.primfrot),
00079 par_frot(star.par_frot),
00080 omega_field(star.omega_field),
00081 omega_min(star.omega_min),
00082 omega_max(star.omega_max),
00083 prim_field(star.prim_field)
00084 {}
00085
00086
00087
00088
00089 Star_rot_Dirac_diff::Star_rot_Dirac_diff(Map& mpi, const Eos& eos_i, FILE* fich,
00090 double (*frot_i)(double, const Tbl&),
00091 double (*primfrot_i)(double, const Tbl&) )
00092 : Star_rot_Dirac(mpi, eos_i, fich),
00093 frot(frot_i),
00094 primfrot(primfrot_i),
00095 par_frot(fich),
00096 omega_field(mpi),
00097 prim_field(mpi)
00098 {
00099
00100 Scalar omega_field_file(mp, *(mp.get_mg()), fich) ;
00101 omega_field = omega_field_file ;
00102 fait_prim_field() ;
00103
00104
00105 fread_be(&omega_min, sizeof(double), 1, fich) ;
00106 fread_be(&omega_max, sizeof(double), 1, fich) ;
00107
00108 }
00109
00110
00111
00112
00113
00114
00115 Star_rot_Dirac_diff::~Star_rot_Dirac_diff(){}
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 void Star_rot_Dirac_diff::operator=(const Star_rot_Dirac_diff& star) {
00126
00127
00128
00129 Star_rot_Dirac::operator=(star) ;
00130
00131
00132 frot = star.frot ;
00133 primfrot = star.primfrot ;
00134 par_frot = star.par_frot ;
00135 omega_field = star.omega_field ;
00136 prim_field = star.prim_field ;
00137 omega_min = star.omega_min ;
00138 omega_max = star.omega_max ;
00139
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 void Star_rot_Dirac_diff::sauve(FILE* fich) const {
00151
00152 Star::sauve(fich) ;
00153
00154 par_frot.sauve(fich) ;
00155
00156 omega_field.sauve(fich) ;
00157
00158 fwrite_be(&omega_min, sizeof(double), 1, fich) ;
00159 fwrite_be(&omega_max, sizeof(double), 1, fich) ;
00160
00161
00162
00163 }
00164
00165
00166
00167
00168
00169 ostream& Star_rot_Dirac_diff::operator>>(ostream& ost) const {
00170
00171 using namespace Unites ;
00172
00173 Star::operator>>(ost) ;
00174
00175 ost << "Differentially rotating star in Dirac gauge" << '\n';
00176
00177
00178 ost << '\n';
00179 ost << "Differentially rotating star" << '\n';
00180 ost << "-----------------------" << '\n';
00181
00182 ost << '\n'<< "Parameters of F(Omega) : " << '\n';
00183 ost << par_frot << '\n';
00184
00185 ost << "Min, Max of Omega/(2pi) : " << omega_min / (2*M_PI) * f_unit
00186 << " Hz, " << omega_max / (2*M_PI) * f_unit << " Hz" << '\n';
00187 int lsurf = nzet - 1;
00188 int nt = mp.get_mg()->get_nt(lsurf) ;
00189 int nr = mp.get_mg()->get_nr(lsurf) ;
00190 ost << "Central, equatorial value of Omega: "
00191 << omega_field.val_grid_point(0, 0, 0, 0) * f_unit
00192 << " rad/s, "
00193 << omega_field.val_grid_point(nzet-1, 0, nt-1, nr-1) * f_unit
00194 << " rad/s" << '\n';
00195
00196 ost << "Central, equatorial value of Omega/(2 Pi): "
00197 << omega_field.val_grid_point(0, 0, 0, 0) * f_unit / (2*M_PI)
00198 << " Hz, "
00199 << omega_field.val_grid_point(nzet-1, 0, nt-1, nr-1) *
00200 f_unit / (2*M_PI)
00201 << " Hz" << '\n';
00202
00203 ost << "Error on the virial identity GRV2 : " << '\n';
00204 ost << "GRV2 = " << grv2() << '\n';
00205 ost << "Error on the virial identity GRV3 : " << '\n';
00206 ost << "GRV3 = " << grv3() << '\n';
00207
00208 ost << "Angular momentum J : "
00209 << angu_mom()/( qpig / (4*M_PI) *msol*msol) << " G M_sol^2 / c"
00210 << '\n';
00211 ost << "c J / (G M^2) : "
00212 << angu_mom()/( qpig / (4*M_PI) * pow(mass_g(), 2.) ) << '\n';
00213
00214 if (omega != 0.) {
00215 double mom_iner = angu_mom() / omega ;
00216 double mom_iner_38si = mom_iner * rho_unit * (pow(r_unit, double(5.))
00217 / double(1.e38) ) ;
00218 ost << "Moment of inertia: " << mom_iner_38si << " 10^38 kg m^2"
00219 << '\n';
00220 }
00221
00222 ost << "Ratio T/W : " << tsw() << '\n';
00223
00224
00225
00226 ost << "Circumferential equatorial radius R_circ : "
00227 << r_circ()/km << " km" << '\n';
00228 ost << "Circumferential polar radius Rp_circ : "
00229 << rp_circ()/km << " km" << endl ;
00230 ost << "Coordinate equatorial radius r_eq : " << ray_eq()/km << " km"
00231 << endl ;
00232 ost << "Flattening r_pole/r_eq : " << aplat() << endl ;
00233 ost << "Ellipticity sqrt(1-(Rp_circ/R_circ)^2) : " << ellipt() << endl ;
00234 double compact = qpig/(4.*M_PI) * mass_g() / r_circ() ;
00235 ost << "Compaction parameter M_g / R_circ : " << compact << '\n';
00236
00237
00238
00239
00240 return ost ;
00241
00242 }
00243
00244
00245
00246
00247
00248
00249 double Star_rot_Dirac_diff::funct_omega(double omeg) const {
00250
00251 return frot(omeg, par_frot) ;
00252
00253 }
00254
00255 double Star_rot_Dirac_diff::prim_funct_omega(double omeg) const {
00256
00257 return primfrot(omeg, par_frot) ;
00258
00259 }
00260
00261 double Star_rot_Dirac_diff::get_omega_c() const {
00262
00263 return omega_field.val_grid_point(0, 0, 0, 0) ;
00264
00265 }