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_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_rot_dirac.C,v 1.7 2008/05/30 08:27:38 j_novak Exp $" ;
00029
00030
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
00064
00065
00066
00067
00068 #include <math.h>
00069 #include <assert.h>
00070
00071
00072 #include "star_rot_dirac.h"
00073 #include "unites.h"
00074 #include "utilitaires.h"
00075
00076
00077
00078
00079
00080
00081
00082
00083 Star_rot_Dirac::Star_rot_Dirac(Map& mpi, int nzet_i, const Eos& eos_i, int filter)
00084 : Star(mpi, nzet_i, eos_i),
00085 spectral_filter(filter),
00086 psi4(mpi),
00087 psi2(mpi),
00088 qqq(mpi),
00089 ln_psi(mpi),
00090 j_euler(mpi, CON, mpi.get_bvect_spher()),
00091 v2(mpi),
00092 flat(mpi.flat_met_spher()),
00093 tgamma(flat),
00094 aa(mpi, CON, mpi.get_bvect_spher()),
00095 taa(mpi, COV, mpi.get_bvect_spher()),
00096 aa_quad(mpi),
00097 hh(mpi, mpi.get_bvect_spher(), flat)
00098 {
00099 assert (spectral_filter>=0) ;
00100 assert (spectral_filter<1000) ;
00101
00102
00103 omega = 0 ;
00104 v2 = 0 ;
00105
00106
00107 j_euler.set_etat_zero() ;
00108
00109
00110 psi4 = 1 ;
00111 psi2 = 1 ;
00112 qqq = 1 ;
00113 ln_psi = 0 ;
00114 aa.set_etat_zero() ;
00115 taa.set_etat_zero() ;
00116 aa_quad = 0 ;
00117 hh.set_etat_zero() ;
00118
00119
00120 set_der_0x0() ;
00121
00122 }
00123
00124
00125
00126
00127 Star_rot_Dirac::Star_rot_Dirac(const Star_rot_Dirac& star)
00128 : Star(star),
00129 spectral_filter(star.spectral_filter),
00130 psi4(star.psi4),
00131 psi2(star.psi2),
00132 qqq(star.qqq),
00133 ln_psi(star.ln_psi),
00134 j_euler(star.j_euler),
00135 v2(star.v2),
00136 flat(star.flat),
00137 tgamma(star.tgamma),
00138 aa(star.aa),
00139 taa(star.taa),
00140 aa_quad(star.aa_quad),
00141 hh(star.hh)
00142 {
00143
00144 omega = star.omega ;
00145
00146
00147 set_der_0x0() ;
00148
00149 }
00150
00151
00152
00153
00154 Star_rot_Dirac::Star_rot_Dirac(Map& mpi, const Eos& eos_i, FILE* fich)
00155 : Star(mpi, eos_i, fich),
00156 psi4(mpi),
00157 psi2(mpi),
00158 qqq(mpi, *(mpi.get_mg()), fich),
00159 ln_psi(mpi),
00160 j_euler(mpi, CON, mpi.get_bvect_spher()),
00161 v2(mpi),
00162 flat(mpi.flat_met_spher()),
00163 tgamma(flat),
00164 aa(mpi, CON, mpi.get_bvect_spher()),
00165 taa(mpi, COV, mpi.get_bvect_spher()),
00166 aa_quad(mpi),
00167 hh(mpi, mpi.get_bvect_spher(), flat, fich)
00168 {
00169
00170
00171
00172 set_der_0x0() ;
00173
00174 fread_be(&spectral_filter, sizeof(int), 1, fich) ;
00175
00176
00177 fread_be(&omega, sizeof(double), 1, fich) ;
00178 Vector shift_tmp(mpi, mpi.get_bvect_spher(), fich) ;
00179 beta = shift_tmp ;
00180
00181 update_metric() ;
00182
00183 equation_of_state() ;
00184
00185 hydro_euler() ;
00186
00187
00188
00189
00190 }
00191
00192
00193
00194
00195
00196
00197 Star_rot_Dirac::~Star_rot_Dirac(){
00198
00199 Star_rot_Dirac::del_deriv() ;
00200
00201 }
00202
00203
00204
00205
00206
00207
00208 void Star_rot_Dirac::del_deriv() const {
00209
00210 if (p_angu_mom != 0x0) delete p_angu_mom ;
00211 if (p_grv2 != 0x0) delete p_grv2 ;
00212 if (p_grv3 != 0x0) delete p_grv3 ;
00213 if (p_tsw != 0x0) delete p_tsw ;
00214 if (p_r_circ != 0x0) delete p_r_circ ;
00215 if (p_rp_circ != 0x0) delete p_rp_circ ;
00216
00217 set_der_0x0() ;
00218
00219 Star::del_deriv() ;
00220
00221 }
00222
00223
00224 void Star_rot_Dirac::set_der_0x0() const {
00225
00226 p_angu_mom = 0x0 ;
00227 p_grv2 = 0x0 ;
00228 p_grv3 = 0x0 ;
00229 p_tsw = 0x0 ;
00230 p_r_circ = 0x0 ;
00231 p_rp_circ = 0x0 ;
00232
00233 }
00234
00235
00236 void Star_rot_Dirac::del_hydro_euler() {
00237
00238 j_euler.set_etat_nondef() ;
00239 v2.set_etat_nondef() ;
00240
00241 del_deriv() ;
00242
00243 Star::del_hydro_euler() ;
00244
00245 }
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 void Star_rot_Dirac::operator=(const Star_rot_Dirac& star) {
00257
00258
00259 Star::operator=(star) ;
00260
00261
00262 spectral_filter = star.spectral_filter ;
00263 omega = star.omega ;
00264 psi4 = star.psi4 ;
00265 psi2 = star.psi2 ;
00266 qqq = star.qqq ;
00267 ln_psi = star.ln_psi ;
00268 j_euler = star.j_euler ;
00269 v2 = star.v2 ;
00270 tgamma = star.tgamma ;
00271 aa = star.aa ;
00272 aa_quad = star.aa_quad ;
00273 hh = star.hh ;
00274
00275 assert(&flat == &star.flat) ;
00276
00277 del_deriv() ;
00278
00279 }
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 void Star_rot_Dirac::sauve(FILE* fich) const {
00290
00291 Star::sauve(fich) ;
00292
00293 qqq.sauve(fich) ;
00294 hh.sauve(fich) ;
00295 fwrite_be(&spectral_filter, sizeof(int), 1, fich) ;
00296 fwrite_be(&omega, sizeof(double), 1, fich) ;
00297 beta.sauve(fich) ;
00298
00299 }
00300
00301
00302
00303
00304
00305 ostream& Star_rot_Dirac::operator>>(ostream& ost) const {
00306
00307 using namespace Unites ;
00308
00309 Star::operator>>(ost) ;
00310
00311 ost << "Rotating star in Dirac gauge" << endl ;
00312
00313
00314 ost << endl ;
00315 ost << "Uniformly rotating star" << endl ;
00316 ost << "-----------------------" << endl ;
00317 if (spectral_filter > 0)
00318 ost << "hydro sources of equations are filtered\n"
00319 << "with " << spectral_filter << "-order exponential filter" << endl ;
00320
00321 double freq = omega/ (2.*M_PI) ;
00322 ost << "Omega : " << omega * f_unit
00323 << " rad/s f : " << freq * f_unit << " Hz" << endl ;
00324 ost << "Rotation period : " << 1000. / (freq * f_unit) << " ms"
00325 << endl ;
00326
00327 ost << "Error on the virial identity GRV2 : " << endl ;
00328 ost << "GRV2 = " << grv2() << endl ;
00329 ost << "Error on the virial identity GRV3 : " << endl ;
00330 ost << "GRV3 = " << grv3() << endl ;
00331
00332 ost << "Angular momentum J : "
00333 << angu_mom()/( qpig / (4*M_PI) *msol*msol) << " G M_sol^2 / c"
00334 << endl ;
00335 ost << "c J / (G M^2) : "
00336 << angu_mom()/( qpig / (4*M_PI) * pow(mass_g(), 2.) ) << endl ;
00337
00338 if (omega != 0.) {
00339 double mom_iner = angu_mom() / omega ;
00340 double mom_iner_38si = mom_iner * rho_unit * (pow(r_unit, double(5.))
00341 / double(1.e38) ) ;
00342 ost << "Moment of inertia: " << mom_iner_38si << " 10^38 kg m^2"
00343 << endl ;
00344 }
00345
00346 ost << "Ratio T/W : " << tsw() << endl ;
00347 ost << "Circumferential equatorial radius R_circ : "
00348 << r_circ()/km << " km" << endl ;
00349 ost << "Circumferential polar radius Rp_circ : "
00350 << rp_circ()/km << " km" << endl ;
00351 ost << "Coordinate equatorial radius r_eq : " << ray_eq()/km << " km"
00352 << endl ;
00353 ost << "Flattening r_pole/r_eq : " << aplat() << endl ;
00354 ost << "Ellipticity sqrt(1-(Rp_circ/R_circ)^2) : " << ellipt() << endl ;
00355
00356 double compact = qpig/(4.*M_PI) * mass_g() / r_circ() ;
00357 ost << "Compaction parameter M_g / R_circ : " << compact << endl ;
00358
00359
00360
00361
00362 return ost ;
00363
00364 }