| 1 |
/* |
| 2 |
* Computes the equilibrium configuration of a binary system |
| 3 |
* in XCTS formalism |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 2010 Michal Bejger |
| 8 |
* |
| 9 |
* This file is part of LORENE. |
| 10 |
* |
| 11 |
* LORENE is free software; you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License version 2 |
| 13 |
* as published by the Free Software Foundation. |
| 14 |
* |
| 15 |
* LORENE is distributed in the hope that it will be useful, |
| 16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
* GNU General Public License for more details. |
| 19 |
* |
| 20 |
* You should have received a copy of the GNU General Public License |
| 21 |
* along with LORENE; if not, write to the Free Software |
| 22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 |
* |
| 24 |
*/ |
| 25 |
|
| 26 |
char xcoal_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_star_xcts/xcoal.C,v 1.4 2014/10/13 08:53:54 j_novak Exp $" ; |
| 27 |
|
| 28 |
/* |
| 29 |
* $Id: xcoal.C,v 1.4 2014/10/13 08:53:54 j_novak Exp $ |
| 30 |
* $Log: xcoal.C,v $ |
| 31 |
* Revision 1.4 2014/10/13 08:53:54 j_novak |
| 32 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 33 |
* |
| 34 |
* Revision 1.3 2014/10/06 15:09:43 j_novak |
| 35 |
* Modified #include directives to use c++ syntax. |
| 36 |
* |
| 37 |
* Revision 1.2 2011/03/29 14:08:07 m_bejger |
| 38 |
* Changing the name from coal to xcoal in the output, ident call etc. |
| 39 |
* |
| 40 |
* Revision 1.1 2011/03/29 13:47:59 m_bejger |
| 41 |
* Renaming coal.C to xcoal.C in order to avoid confusion with previous codes |
| 42 |
* |
| 43 |
* Revision 1.10 2011/03/28 17:43:56 m_bejger |
| 44 |
* Formatting of the output to calcul.d; other minor modifications; metric is not updated after the first step |
| 45 |
* |
| 46 |
* Revision 1.9 2010/12/20 15:46:41 m_bejger |
| 47 |
* lin_mom, virial errors added to the final cout |
| 48 |
* |
| 49 |
* Revision 1.8 2010/12/09 10:49:36 m_bejger |
| 50 |
* *** empty log message *** |
| 51 |
* |
| 52 |
* Revision 1.7 2010/10/26 18:44:29 m_bejger |
| 53 |
* Added table fact_resize for Star_bin_xcts::equilibrium for domain resizing |
| 54 |
* |
| 55 |
* Revision 1.6 2010/10/18 21:20:12 m_bejger |
| 56 |
* Initial version for the 'elusive' many-domains-inside-the-star calculations |
| 57 |
* |
| 58 |
* Revision 1.5 2010/07/20 19:57:31 m_bejger |
| 59 |
* Tidy up output file names |
| 60 |
* |
| 61 |
* Revision 1.4 2010/07/16 17:08:28 m_bejger |
| 62 |
* Suppressing monitoring plots after metric update |
| 63 |
* |
| 64 |
* Revision 1.3 2010/06/23 20:45:51 m_bejger |
| 65 |
* Suppressed Psi_comp, chi_comp and pot_centri initialisation to 0 on initial step, added graphical diagnostics after metric updates |
| 66 |
* |
| 67 |
* Revision 1.2 2010/06/17 15:15:11 m_bejger |
| 68 |
* Changed definitions; initialisations |
| 69 |
* |
| 70 |
* Revision 1.1 2010/06/15 07:53:58 m_bejger |
| 71 |
* Initial version |
| 72 |
* |
| 73 |
* |
| 74 |
* $Header: /cvsroot/Lorene/Codes/Bin_star_xcts/xcoal.C,v 1.4 2014/10/13 08:53:54 j_novak Exp $ |
| 75 |
* |
| 76 |
*/ |
| 77 |
|
| 78 |
// headers C |
| 79 |
#include <cstdlib> |
| 80 |
#include <cmath> |
| 81 |
#include <ctime> |
| 82 |
|
| 83 |
// headers Lorene |
| 84 |
#include "unites.h" |
| 85 |
#include "cmp.h" |
| 86 |
#include "tenseur.h" |
| 87 |
#include "binary_xcts.h" |
| 88 |
#include "eos.h" |
| 89 |
#include "utilitaires.h" |
| 90 |
#include "graphique.h" |
| 91 |
#include "param.h" |
| 92 |
#include "nbr_spx.h" |
| 93 |
|
| 94 |
|
| 95 |
namespace Lorene { |
| 96 |
// Local prototype |
| 97 |
Cmp raccord_c1(const Cmp& uu, int l1) ; |
| 98 |
} |
| 99 |
using namespace Lorene ; |
| 100 |
|
| 101 |
int main() { |
| 102 |
|
| 103 |
// Identification of all the subroutines called by the code : |
| 104 |
|
| 105 |
int system_status ; |
| 106 |
system_status = system("ident xcoal > identif.d") ; |
| 107 |
|
| 108 |
// For the display : |
| 109 |
char display_bold[]="x[1m" ; display_bold[0] = 27 ; |
| 110 |
char display_normal[] = "x[0m" ; display_normal[0] = 27 ; |
| 111 |
|
| 112 |
using namespace Unites ; |
| 113 |
|
| 114 |
//------------------------------------------------------------------ |
| 115 |
// Parameters of the computation |
| 116 |
//------------------------------------------------------------------ |
| 117 |
|
| 118 |
char nomini[80] ; |
| 119 |
int mermax, mermax_eqb, prompt, graph, fmer_stop, fmer_save, mermax_poisson ; |
| 120 |
int mermax_potvit, mer_masse, fmer_upd_met, ind_rel_met ; |
| 121 |
double seuil, relax_poisson, relax_potvit, relax, aexp_masse ; |
| 122 |
double mbar_voulue[2], fact_separ, relax_met, relax_omeg ; |
| 123 |
double fact_omeg_min, fact_omeg_max, thres_adapt[2], reduce_shift ; |
| 124 |
|
| 125 |
ifstream fpar("parcoal.d") ; |
| 126 |
if ( !fpar.good() ) { |
| 127 |
cout << "Problem with opening the file parcoal.d ! " << endl ; |
| 128 |
abort() ; |
| 129 |
} |
| 130 |
fpar.ignore(1000, '\n') ; |
| 131 |
fpar.ignore(1000, '\n') ; |
| 132 |
fpar.getline(nomini, 80) ; |
| 133 |
fpar >> fact_separ ; fpar.ignore(1000, '\n'); |
| 134 |
fpar >> mbar_voulue[0] ; fpar.ignore(1000, '\n') ; |
| 135 |
fpar >> mbar_voulue[1] ; fpar.ignore(1000, '\n') ; |
| 136 |
mbar_voulue[0] *= msol ; |
| 137 |
mbar_voulue[1] *= msol ; |
| 138 |
fpar.ignore(1000, '\n') ; |
| 139 |
fpar >> mermax ; fpar.ignore(1000, '\n') ; |
| 140 |
fpar >> relax ; fpar.ignore(1000, '\n') ; |
| 141 |
fpar >> mermax_eqb ; fpar.ignore(1000, '\n') ; |
| 142 |
fpar >> prompt ; fpar.ignore(1000, '\n') ; |
| 143 |
fpar >> graph ; fpar.ignore(1000, '\n') ; |
| 144 |
fpar >> seuil ; fpar.ignore(1000, '\n') ; |
| 145 |
fpar >> fmer_stop ; fpar.ignore(1000, '\n') ; |
| 146 |
fpar >> fmer_save ; fpar.ignore(1000, '\n') ; |
| 147 |
fpar >> mermax_poisson ; fpar.ignore(1000, '\n') ; |
| 148 |
fpar >> relax_poisson ; fpar.ignore(1000, '\n') ; |
| 149 |
fpar >> mermax_potvit ; fpar.ignore(1000, '\n') ; |
| 150 |
fpar >> relax_potvit ; fpar.ignore(1000, '\n') ; |
| 151 |
fpar >> mer_masse ; fpar.ignore(1000, '\n') ; |
| 152 |
fpar >> aexp_masse ; fpar.ignore(1000, '\n') ; |
| 153 |
fpar >> fmer_upd_met ; fpar.ignore(1000, '\n'); |
| 154 |
fpar >> ind_rel_met ; fpar.ignore(1000, '\n'); |
| 155 |
fpar >> relax_met ; fpar.ignore(1000, '\n'); |
| 156 |
if (ind_rel_met == 0) relax_met = 1. ; |
| 157 |
fpar >> relax_omeg ; fpar.ignore(1000, '\n'); |
| 158 |
fpar >> fact_omeg_min ; fpar.ignore(1000, '\n'); |
| 159 |
fpar >> fact_omeg_max ; fpar.ignore(1000, '\n'); |
| 160 |
fpar >> thres_adapt[0] ; fpar.ignore(1000, '\n'); |
| 161 |
fpar >> thres_adapt[1] ; fpar.ignore(1000, '\n'); |
| 162 |
fpar >> reduce_shift ; |
| 163 |
if ( ! fpar.good() ) { // to ensure compatibility with old |
| 164 |
reduce_shift = 0.6 ; // parcoal.d files which did not had |
| 165 |
} // the reduce_shift line |
| 166 |
fpar.close() ; |
| 167 |
|
| 168 |
|
| 169 |
cout << endl |
| 170 |
<< "==========================================================" << endl |
| 171 |
<< " Physical parameters " << endl |
| 172 |
<< "==========================================================" |
| 173 |
<< endl ; |
| 174 |
cout << endl << endl ; |
| 175 |
cout << "File containing the initial conditions : " << nomini << endl ; |
| 176 |
cout << "Factor by which the initial separation will be multiplied : " |
| 177 |
<< fact_separ << endl ; |
| 178 |
if ( abs(mer_masse) < mermax ) { |
| 179 |
cout << "Baryon mass required for star 1 [M_sol] : " |
| 180 |
<< mbar_voulue[0] / msol << endl ; |
| 181 |
cout << "Baryon mass required for star 2 [M_sol] : " |
| 182 |
<< mbar_voulue[1] / msol << endl ; |
| 183 |
} |
| 184 |
cout << endl |
| 185 |
<< "==========================================================" << endl |
| 186 |
<< " Parameters of the computation " << endl |
| 187 |
<< "==========================================================" |
| 188 |
<< endl ; |
| 189 |
cout << "Maximum number of steps in the main iteration : " |
| 190 |
<< mermax << endl ; |
| 191 |
cout << "Relaxation factor in the main iteration : " |
| 192 |
<< relax << endl ; |
| 193 |
cout << "Maximum number of steps in Star_bin::equilibrium : " |
| 194 |
<< mermax_eqb << endl ; |
| 195 |
cout << "Threshold on the enthalpy relative change for ending the computation : " |
| 196 |
<< seuil << endl ; |
| 197 |
cout << "Step interval between safeguards of the whole configuration : " |
| 198 |
<< fmer_save << endl ; |
| 199 |
cout << "Maximum number of steps in Map_et::poisson : " |
| 200 |
<< mermax_poisson << endl ; |
| 201 |
cout << "Relaxation factor in Map_et::poisson : " |
| 202 |
<< relax_poisson << endl ; |
| 203 |
cout << "Maximum number of steps in Map_radial::poisson_compact : " |
| 204 |
<< mermax_potvit << endl ; |
| 205 |
cout << "Relaxation factor in Map_radial::poisson_compact : " |
| 206 |
<< relax_potvit << endl ; |
| 207 |
cout << "Step from which the baryon mass is forced to converge : " |
| 208 |
<< mer_masse << endl ; |
| 209 |
cout << "Exponent for the increase factor of the central enthalpy : " |
| 210 |
<< aexp_masse << endl ; |
| 211 |
cout << "Step interval between metric updates : " |
| 212 |
<< fmer_upd_met << endl ; |
| 213 |
if (ind_rel_met == 1) { |
| 214 |
cout << "Relaxation factor of the metric : " |
| 215 |
<< relax_met << endl ; |
| 216 |
} |
| 217 |
else { |
| 218 |
cout << "No relaxation on the metric" << endl ; |
| 219 |
} |
| 220 |
cout << "Relaxation factor on Omega (orbital angular velocity) : " |
| 221 |
<< relax_omeg << endl ; |
| 222 |
cout << "Relative low bound in the omega search : " |
| 223 |
<< fact_omeg_min << endl ; |
| 224 |
cout << "Relative high bound in the omega search : " |
| 225 |
<< fact_omeg_max << endl ; |
| 226 |
cout << |
| 227 |
"Threshold on |dH/dr|_eq / |dH/dr|_pole for the adaptation of the mapping for star 1" |
| 228 |
<< endl << thres_adapt[0] << endl ; |
| 229 |
cout << |
| 230 |
"Threshold on |dH/dr|_eq / |dH/dr|_pole for the adaptation of the mapping for star 2" |
| 231 |
<< endl << thres_adapt[1] << endl ; |
| 232 |
cout << "Factor by which the initial analytical shift is reduced : " |
| 233 |
<< reduce_shift << endl ; |
| 234 |
|
| 235 |
//------------------------------------------------------------------ |
| 236 |
// Read of the initial conditions |
| 237 |
//------------------------------------------------------------------ |
| 238 |
|
| 239 |
FILE* fich = fopen(nomini, "r") ; |
| 240 |
if (fich == 0x0) { |
| 241 |
cout << "Problem in opening the file " << nomini << " ! " << endl ; |
| 242 |
perror(" reason") ; |
| 243 |
abort() ; |
| 244 |
} |
| 245 |
|
| 246 |
int mer_ini; |
| 247 |
system_status = fread(&mer_ini, sizeof(int), 1, fich) ; |
| 248 |
|
| 249 |
Mg3d mg1(fich) ; |
| 250 |
Map_et mp1(mg1, fich) ; |
| 251 |
Eos* peos1 = Eos::eos_from_file(fich) ; |
| 252 |
|
| 253 |
Mg3d mg2(fich) ; |
| 254 |
Map_et mp2(mg2, fich) ; |
| 255 |
Eos* peos2 = Eos::eos_from_file(fich) ; |
| 256 |
|
| 257 |
Binary_xcts star(mp1, *peos1, mp2, *peos2, fich) ; |
| 258 |
fclose(fich) ; |
| 259 |
|
| 260 |
//------------------------------------------------------------------ |
| 261 |
// Tables with values of enthalpy at the borders of domains |
| 262 |
//------------------------------------------------------------------ |
| 263 |
|
| 264 |
int nzet1 = star(1).get_nzet() ; |
| 265 |
int nzet2 = star(2).get_nzet() ; |
| 266 |
|
| 267 |
Tbl ent_limit1(nzet1) ; |
| 268 |
Tbl ent_limit2(nzet2) ; |
| 269 |
|
| 270 |
ent_limit1.set_etat_qcq() ; |
| 271 |
ent_limit2.set_etat_qcq() ; |
| 272 |
|
| 273 |
for(int j=0; j<nzet1; j++) |
| 274 |
ent_limit1.set(j) = star(1).get_ent().val_grid_point(j+1,0,0,0) ; |
| 275 |
|
| 276 |
for(int j=0; j<nzet2; j++) |
| 277 |
ent_limit2.set(j) = star(2).get_ent().val_grid_point(j+1,0,0,0) ; |
| 278 |
|
| 279 |
Tbl* pent_limit[2] ; |
| 280 |
pent_limit[0] = &ent_limit1 ; |
| 281 |
pent_limit[1] = &ent_limit2 ; |
| 282 |
|
| 283 |
//------------------------------------------------------------------ |
| 284 |
// Modification of the separation between the two stars |
| 285 |
//------------------------------------------------------------------ |
| 286 |
|
| 287 |
double distance = 0. ; |
| 288 |
for (int i=1 ; i<=2 ; i++) { |
| 289 |
|
| 290 |
double ori_x = (star(i).get_mp()).get_ori_x() ; |
| 291 |
distance += fabs(ori_x) ; |
| 292 |
|
| 293 |
ori_x *= fact_separ ; |
| 294 |
((star.set(i)).set_mp()).set_ori(ori_x, 0., 0.) ; |
| 295 |
} |
| 296 |
|
| 297 |
// distance in km |
| 298 |
distance *= 10. * fact_separ ; |
| 299 |
|
| 300 |
//------------------------------------------------------------------ |
| 301 |
// Update of the initial conditions |
| 302 |
//------------------------------------------------------------------ |
| 303 |
|
| 304 |
for (int i=1; i<=2; i++) |
| 305 |
(star.set(i)).update_metric(star(3-i)) ; |
| 306 |
|
| 307 |
// Initialisation of gradients of companion potentials |
| 308 |
// --------------------------------------------------- |
| 309 |
|
| 310 |
for (int i=1; i<=2; i++) |
| 311 |
(star.set(i)).update_metric_der_comp(star(3-i)) ; |
| 312 |
|
| 313 |
// Initialisation of hydro quantities |
| 314 |
// ---------------------------------- |
| 315 |
|
| 316 |
for (int i=1; i<=2; i++) { |
| 317 |
(star.set(i)).equation_of_state() ; |
| 318 |
(star.set(i)).kinematics(star.get_omega(), star.get_x_axe()) ; |
| 319 |
(star.set(i)).fait_d_psi() ; |
| 320 |
(star.set(i)).hydro_euler() ; |
| 321 |
} |
| 322 |
|
| 323 |
// New initial of value Omega (taking into account the fact |
| 324 |
// that the separation has changed) |
| 325 |
|
| 326 |
star.analytical_omega() ; |
| 327 |
|
| 328 |
// If the shift vector has not been set previously, it is set to |
| 329 |
// some analytical value |
| 330 |
// ------------------------------------------------------------- |
| 331 |
|
| 332 |
star.analytical_shift() ; |
| 333 |
|
| 334 |
for (int i=1; i<=2; i++) |
| 335 |
star.set(i).set_beta_auto() = reduce_shift*star(i).get_beta_auto() ; |
| 336 |
|
| 337 |
// A second call to update_metric must be performed to update |
| 338 |
// beta_comp, haij_auto and hacar_auto. |
| 339 |
for (int i=1; i<=2; i++) |
| 340 |
(star.set(i)).update_metric(star(3-i)) ; |
| 341 |
|
| 342 |
// Second update of gradients of companion potentials |
| 343 |
|
| 344 |
for (int i=1; i<=2; i++) |
| 345 |
(star.set(i)).update_metric_der_comp(star(3-i)) ; |
| 346 |
|
| 347 |
// Second update of hydro quantities |
| 348 |
|
| 349 |
for (int i=1; i<=2; i++) { |
| 350 |
(star.set(i)).equation_of_state() ; |
| 351 |
(star.set(i)).kinematics(star.get_omega(), star.get_x_axe()) ; |
| 352 |
(star.set(i)).fait_d_psi() ; |
| 353 |
(star.set(i)).hydro_euler() ; |
| 354 |
|
| 355 |
} |
| 356 |
|
| 357 |
char name[40] ; |
| 358 |
sprintf(name, "resu_%.3f.d", distance) ; |
| 359 |
FILE* fresu = fopen(name, "w") ; |
| 360 |
|
| 361 |
int mer1 = 0 ; |
| 362 |
fwrite(&mer1, sizeof(int), 1, fresu) ; // mer |
| 363 |
|
| 364 |
star(1).get_mp().get_mg()->sauve(fresu) ; |
| 365 |
star(1).get_mp().sauve(fresu) ; |
| 366 |
star(1).get_eos().sauve(fresu) ; |
| 367 |
|
| 368 |
star(2).get_mp().get_mg()->sauve(fresu) ; |
| 369 |
star(2).get_mp().sauve(fresu) ; |
| 370 |
star(2).get_eos().sauve(fresu) ; |
| 371 |
|
| 372 |
star.sauve(fresu) ; |
| 373 |
fclose(fresu) ; |
| 374 |
|
| 375 |
cout << endl |
| 376 |
<< "==========================================================" << endl |
| 377 |
<< " Initial conditions " << endl |
| 378 |
<< "==========================================================" |
| 379 |
<< endl ; |
| 380 |
cout << star << endl ; |
| 381 |
|
| 382 |
//------------------------------------------------------------------ |
| 383 |
// Auxiliary quantities |
| 384 |
//------------------------------------------------------------------ |
| 385 |
|
| 386 |
double ent_c[2] ; // Central enthalpy in each star |
| 387 |
|
| 388 |
// Resizing factor of the first shell |
| 389 |
Tbl fact_resize[] = {Tbl(2), Tbl(2)} ; |
| 390 |
fact_resize[0].set_etat_qcq() ; |
| 391 |
fact_resize[1].set_etat_qcq() ; |
| 392 |
|
| 393 |
// Error indicators in each star |
| 394 |
Tbl differ[] = {Tbl(7), Tbl(7)} ; |
| 395 |
differ[0].set_etat_qcq() ; |
| 396 |
differ[1].set_etat_qcq() ; |
| 397 |
|
| 398 |
for (int i=1 ; i<=2 ; i++) { |
| 399 |
ent_c[i-1] = star(i).get_ent().val_grid_point(0, 0, 0, 0) ; |
| 400 |
differ[i-1].set(0) = 1 ; // diff_ent = 1 |
| 401 |
differ[i-1].set(1) = 1 ; // err_psi = 1 |
| 402 |
differ[i-1].set(2) = 1 ; // err_Psi = 1 |
| 403 |
differ[i-1].set(3) = 1 ; // err_chi = 1 |
| 404 |
differ[i-1].set(4) = 1 ; // err_beta_x = 1 |
| 405 |
differ[i-1].set(5) = 1 ; // err_beta_y = 1 |
| 406 |
differ[i-1].set(6) = 1 ; // err_beta_z = 1 |
| 407 |
} |
| 408 |
|
| 409 |
double relax_jm1 = 1. - relax ; |
| 410 |
double relax_omeg_jm1 = 1. - relax_omeg ; |
| 411 |
|
| 412 |
//------------------------------------------------------------------ |
| 413 |
// Binary system at the previous step (for the relaxation) |
| 414 |
//------------------------------------------------------------------ |
| 415 |
|
| 416 |
Binary_xcts star_jm1 = star ; |
| 417 |
double omega_jm1 = star_jm1.get_omega() ; |
| 418 |
|
| 419 |
//------------------------------------------------------------------ |
| 420 |
// chi_comp, Psi_comp and pot_centri |
| 421 |
// are initialized to 0 on star_jm1 : |
| 422 |
//------------------------------------------------------------------ |
| 423 |
for (int i=1 ; i<=2 ; i++) { |
| 424 |
star_jm1.set(i).set_Psi_comp() = 0 ; |
| 425 |
star_jm1.set(i).set_chi_comp() = 0 ; |
| 426 |
star_jm1.set(i).set_pot_centri() = 0 ; |
| 427 |
} |
| 428 |
|
| 429 |
//------------------------------------------------------------------ |
| 430 |
// Openning of log files |
| 431 |
//------------------------------------------------------------------ |
| 432 |
|
| 433 |
sprintf(name, "resglob_%.3f.d", distance) ; |
| 434 |
ofstream fichresu(name) ; fichresu.precision(16) ; |
| 435 |
|
| 436 |
sprintf(name, "resrota_%.3f.d", distance) ; |
| 437 |
ofstream fichrota(name) ; fichrota.precision(16) ; |
| 438 |
|
| 439 |
sprintf(name, "resdiffm_%.3f.d", distance) ; |
| 440 |
ofstream fichvir("resdiffm.d") ; fichvir.precision(16) ; |
| 441 |
|
| 442 |
ofstream fichconv[2] ; |
| 443 |
sprintf(name, "resconv1_%.3f.d", distance) ; |
| 444 |
fichconv[0].open(name) ; fichconv[0].precision(16) ; |
| 445 |
sprintf(name, "resconv2_%.3f.d", distance) ; |
| 446 |
fichconv[1].open(name) ; fichconv[1].precision(16) ; |
| 447 |
|
| 448 |
ofstream fichet[2] ; |
| 449 |
sprintf(name, "resstar1_%.3f.d", distance) ; |
| 450 |
fichet[0].open(name) ; fichet[0].precision(16) ; |
| 451 |
sprintf(name, "resstar2_%.3f.d", distance) ; |
| 452 |
fichet[1].open(name) ; fichet[1].precision(16) ; |
| 453 |
|
| 454 |
fichrota << |
| 455 |
"# Omega [rad/s] x_axe [km] x_g (et 0) [km] x_g (et 1) [km] M_grav [M_sol] J [ G M_sol^2 / c]" |
| 456 |
<< endl ; |
| 457 |
|
| 458 |
fichvir << |
| 459 |
"# diff_mass" |
| 460 |
<< endl ; |
| 461 |
|
| 462 |
for (int i=1; i<=2; i++) { |
| 463 |
fichconv[i-1] << |
| 464 |
"# diff_ent err_psi err_logn err_lnq err_beta_x err_beta_y err_beta_z" |
| 465 |
<< endl ; |
| 466 |
|
| 467 |
fichet[i-1] << |
| 468 |
"# ori_x [km] ent_c M_bar [M_sol] R(theta=0) [km] R(pi/2, 0) [km] R(pi/2, pi/2) [km] R(pi/2, pi) [km]" |
| 469 |
<< endl ; |
| 470 |
} |
| 471 |
|
| 472 |
double omega_kep, diff_mass ; |
| 473 |
int mer ; |
| 474 |
|
| 475 |
//====================================================================== |
| 476 |
// Start of iteration |
| 477 |
//====================================================================== |
| 478 |
|
| 479 |
for (mer=0; (differ[0](0) > seuil) && (mer < mermax); mer++) { |
| 480 |
|
| 481 |
cout << |
| 482 |
"==========================================================================" |
| 483 |
<< endl ; |
| 484 |
cout << "step = " << mer << " diff_ent (1) (2) (1)<->(2) : " |
| 485 |
<< differ[0](0) << " " << differ[1](0) << " " |
| 486 |
<< differ[0](0) - differ[1](0) << endl ; |
| 487 |
cout << |
| 488 |
"==========================================================================" |
| 489 |
<< endl ; |
| 490 |
|
| 491 |
fichresu << mer; |
| 492 |
fichresu << " step" << endl ; |
| 493 |
|
| 494 |
fichrota << mer ; |
| 495 |
fichvir << mer ; |
| 496 |
fichconv[0] << mer ; |
| 497 |
fichconv[1] << mer ; |
| 498 |
fichet[0] << mer ; |
| 499 |
fichet[1] << mer ; |
| 500 |
|
| 501 |
//------------------------------------------------------------------ |
| 502 |
// Computation of the metric coefficients |
| 503 |
//------------------------------------------------------------------ |
| 504 |
|
| 505 |
if ( (mer % fmer_upd_met) == 0) { |
| 506 |
|
| 507 |
for (int i=1; i<=2; i++) |
| 508 |
(star.set(i)).update_metric(star(3-i), star_jm1(i), relax_met) ; |
| 509 |
|
| 510 |
for (int i=1; i<=2; i++) |
| 511 |
(star.set(i)).update_metric_der_comp(star(3-i)) ; |
| 512 |
|
| 513 |
} |
| 514 |
|
| 515 |
//------------------------------------------------------------------ |
| 516 |
// Computation of the orbital angular velocity Omega |
| 517 |
//------------------------------------------------------------------ |
| 518 |
|
| 519 |
double xgg[2] ; |
| 520 |
|
| 521 |
star.orbit(fact_omeg_min, fact_omeg_max, xgg[0], xgg[1]) ; |
| 522 |
|
| 523 |
//------------------------------------------------------------------ |
| 524 |
// Translation of the stars in order to set the origin |
| 525 |
// of the absolute frame on the rotation axis |
| 526 |
//------------------------------------------------------------------ |
| 527 |
|
| 528 |
double x_rot = star.get_x_axe() ; |
| 529 |
|
| 530 |
for (int i=1 ; i<=2 ; i++) { |
| 531 |
double ori_x_old = (star(i).get_mp()).get_ori_x() ; |
| 532 |
double ori_x_new = ori_x_old - x_rot ; |
| 533 |
((star.set(i)).set_mp()).set_ori(ori_x_new, 0., 0.) ; |
| 534 |
|
| 535 |
} |
| 536 |
|
| 537 |
star.set_x_axe() = 0. ; |
| 538 |
|
| 539 |
//------------------------------------------------------------------ |
| 540 |
// Relaxation on the orbital velocity |
| 541 |
// ----------------------------------------------------------------- |
| 542 |
|
| 543 |
double omega_j = star.get_omega() ; |
| 544 |
omega_j = relax_omeg * omega_j + relax_omeg_jm1 * omega_jm1 ; |
| 545 |
omega_jm1 = omega_j ; |
| 546 |
|
| 547 |
star.set_omega() = omega_j ; |
| 548 |
|
| 549 |
cout << display_bold << "New orbital velocity Omega : " |
| 550 |
<< star.get_omega() * f_unit << " rad/s" |
| 551 |
<< display_normal << endl ; |
| 552 |
|
| 553 |
// Keplerian velocity (for comparison only) |
| 554 |
// ---------------------------------------- |
| 555 |
omega_kep = sqrt( g_si/g_unit * (star(1).mass_g() + star(2).mass_g()) |
| 556 |
/ pow( star.separation(), 3.) ) ; |
| 557 |
|
| 558 |
cout << "``Keplerian'' velocity (for comparison only) : " |
| 559 |
<< omega_kep * f_unit << " rad/s" << endl ; |
| 560 |
cout << "New X coordinate of the rotation axis : " |
| 561 |
<< star.get_x_axe() / km << " km" << endl ; |
| 562 |
|
| 563 |
|
| 564 |
fichresu << star.get_x_axe() / km ; |
| 565 |
fichresu << " abscidia of the rotation axis [km] " << endl ; |
| 566 |
|
| 567 |
fichresu << star.get_omega() * f_unit ; |
| 568 |
fichresu << " Orbital frequency Omega [rad/s] " << endl ; |
| 569 |
|
| 570 |
fichresu << xgg[0] / km ; |
| 571 |
fichresu << " Abscidia ``center of mass'' star 1 [km] " << endl ; |
| 572 |
|
| 573 |
fichresu << xgg[1] / km ; |
| 574 |
fichresu << " Abscidia ``center of mass'' star 2 [km] " << endl ; |
| 575 |
|
| 576 |
fichrota << " " << star.get_omega() * f_unit ; |
| 577 |
fichrota << " " << star.get_x_axe() / km ; |
| 578 |
fichrota << " " << xgg[0] / km ; |
| 579 |
fichrota << " " << xgg[1] / km ; |
| 580 |
|
| 581 |
//------------------------------------------------------------------ |
| 582 |
// Computation of B^i/N (bsn) and pot_centri in each star |
| 583 |
//------------------------------------------------------------------ |
| 584 |
|
| 585 |
for (int i=1; i<=2; i++) |
| 586 |
(star.set(i)).kinematics( star.get_omega(), star.get_x_axe() ) ; |
| 587 |
|
| 588 |
//------------------------------------------------------------------ |
| 589 |
// Computation of gam_euler, u_euler, ener_euler, s_euler, |
| 590 |
// wit_w and loggam in each star |
| 591 |
//------------------------------------------------------------------ |
| 592 |
|
| 593 |
for (int i=1; i<=2; i++) { |
| 594 |
|
| 595 |
(star.set(i)).fait_d_psi() ; |
| 596 |
(star.set(i)).hydro_euler() ; |
| 597 |
|
| 598 |
} |
| 599 |
|
| 600 |
//------------------------------------------------------------------ |
| 601 |
// Computation of the stellar equilibrium configurations |
| 602 |
//------------------------------------------------------------------ |
| 603 |
|
| 604 |
for (int i=1; i<=2; i++) { |
| 605 |
|
| 606 |
// Computation of the resizing factor |
| 607 |
double ray_eq_auto = star(i).ray_eq() ; |
| 608 |
double ray_eq_comp = star(3-i).ray_eq() ; |
| 609 |
double ray_eq_pi_comp = star(3-i).ray_eq_pi() ; |
| 610 |
|
| 611 |
int num_resize ; |
| 612 |
|
| 613 |
if (mg1.get_nzone() > 3) { |
| 614 |
assert( mg2.get_nzone() == mg1.get_nzone() ) ; |
| 615 |
num_resize = mg1.get_nzone() - 3 ; |
| 616 |
|
| 617 |
} else num_resize = star(i).get_nzet() ; |
| 618 |
|
| 619 |
|
| 620 |
double lambda_resize = 0.95 * |
| 621 |
(star.separation() - ray_eq_comp)/ray_eq_auto ; |
| 622 |
fact_resize[i-1].set(0) = |
| 623 |
(lambda_resize < 2.*num_resize) ? lambda_resize : 2.*num_resize ; |
| 624 |
|
| 625 |
fact_resize[i-1].set(1) = 1.05 * |
| 626 |
(star.separation() + ray_eq_pi_comp)/ray_eq_auto ; |
| 627 |
|
| 628 |
} |
| 629 |
|
| 630 |
for (int i=1; i<=2; i++) { |
| 631 |
|
| 632 |
// Relaxation on Psi_comp and chi_comp (only if it has not been |
| 633 |
// done by update_metric) |
| 634 |
// -------------------------------------------------------- |
| 635 |
if ( (ind_rel_met == 0) || ( (mer % fmer_upd_met) != 0 ) ) { |
| 636 |
|
| 637 |
star.set(i).set_Psi_comp() = relax * star(i).get_Psi_comp() |
| 638 |
+ relax_jm1 * star_jm1(i).get_Psi_comp() ; |
| 639 |
|
| 640 |
star.set(i).set_chi_comp() = relax * star(i).get_chi_comp() |
| 641 |
+ relax_jm1 * star_jm1(i).get_chi_comp() ; |
| 642 |
|
| 643 |
} |
| 644 |
|
| 645 |
// Relaxation on pot_centri |
| 646 |
// ------------------------ |
| 647 |
star.set(i).set_pot_centri() = relax * star(i).get_pot_centri() |
| 648 |
+ relax_jm1 * star_jm1(i).get_pot_centri() ; |
| 649 |
|
| 650 |
// Call to Etoile_bin::equilibrium |
| 651 |
// -------------------------------- |
| 652 |
(star.set(i)).equilibrium(ent_c[i-1], mermax_eqb, mermax_potvit, |
| 653 |
mermax_poisson, relax_poisson, |
| 654 |
relax_potvit, thres_adapt[i-1], |
| 655 |
fact_resize[i-1], pent_limit[i-1], |
| 656 |
differ[i-1]) ; |
| 657 |
|
| 658 |
} |
| 659 |
|
| 660 |
//------------------------------------------------------------------ |
| 661 |
// Relaxations |
| 662 |
//------------------------------------------------------------------ |
| 663 |
|
| 664 |
for (int i=1; i<=2; i++) { |
| 665 |
|
| 666 |
star.set(i).relaxation( star_jm1(i), relax, relax_met, mer, |
| 667 |
fmer_upd_met ) ; |
| 668 |
|
| 669 |
star.set(i).hydro_euler() ; |
| 670 |
} |
| 671 |
|
| 672 |
//------------------------------------------------------------------ |
| 673 |
// Change in the central enthalpy to get a fixed baryon mass |
| 674 |
//------------------------------------------------------------------ |
| 675 |
|
| 676 |
if (mer >= mer_masse) { |
| 677 |
|
| 678 |
for (int i=1; i<=2; i++) { |
| 679 |
|
| 680 |
double xx = star(i).mass_b() / mbar_voulue[i-1] - 1. ; |
| 681 |
|
| 682 |
cout << "Discrepancy M_b / wanted M_b : " << xx << endl ; |
| 683 |
|
| 684 |
double xprog = ( mer > 2*mer_masse) ? 1. : |
| 685 |
double(mer-mer_masse)/double(mer_masse) ; |
| 686 |
xx *= xprog ; |
| 687 |
double ax = .5 * ( 2. + xx ) / (1. + xx ) ; |
| 688 |
|
| 689 |
double fact_ent = pow(ax, aexp_masse) ; |
| 690 |
|
| 691 |
cout << " xprog, xx, ax, fact : " << xprog << " " << |
| 692 |
xx << " " << ax << " " << fact_ent << endl ; |
| 693 |
|
| 694 |
ent_c[i-1] *= fact_ent ; |
| 695 |
|
| 696 |
} |
| 697 |
} |
| 698 |
|
| 699 |
// Updates for the next step |
| 700 |
// ------------------------- |
| 701 |
|
| 702 |
star_jm1 = star ; |
| 703 |
|
| 704 |
cout << star << endl ; |
| 705 |
|
| 706 |
|
| 707 |
//------------------------------------------------------------------ |
| 708 |
// The whole configuration is saved in a file |
| 709 |
//------------------------------------------------------------------ |
| 710 |
|
| 711 |
if ( (mer % fmer_save) == 0 ) { |
| 712 |
|
| 713 |
sprintf(name, "resu_%.3f.d", distance) ; |
| 714 |
FILE* fresu2 = fopen(name, "w") ; |
| 715 |
|
| 716 |
fwrite(&mer, sizeof(int), 1, fresu2) ; // mer |
| 717 |
|
| 718 |
star(1).get_mp().get_mg()->sauve(fresu2) ; |
| 719 |
star(1).get_mp().sauve(fresu2) ; |
| 720 |
star(1).get_eos().sauve(fresu2) ; |
| 721 |
|
| 722 |
star(2).get_mp().get_mg()->sauve(fresu2) ; |
| 723 |
star(2).get_mp().sauve(fresu2) ; |
| 724 |
star(2).get_eos().sauve(fresu2) ; |
| 725 |
|
| 726 |
star.sauve(fresu2) ; |
| 727 |
|
| 728 |
fclose(fresu2) ; |
| 729 |
} |
| 730 |
|
| 731 |
//-------------------------------------------- |
| 732 |
// Writing of global quantities in log files |
| 733 |
//-------------------------------------------- |
| 734 |
for (int i=1 ; i<=2 ; i++) { |
| 735 |
fichresu << star(i).mass_b() / msol ; |
| 736 |
fichresu << " Baryon mass of star " << i << " [M_sol] " << endl ; |
| 737 |
fichresu << differ[i-1](0) ; |
| 738 |
fichresu << " relative variation enth. star " << i << endl ; |
| 739 |
|
| 740 |
fichresu << star(i).ray_pole() / km ; |
| 741 |
fichresu << " R(theta=0) [km] " << endl ; |
| 742 |
fichresu << star(i).ray_eq() / km ; |
| 743 |
fichresu << " R(theta=pi/2, phi=0) [km] " << endl ; |
| 744 |
fichresu << star(i).ray_eq_pis2() / km ; |
| 745 |
fichresu << " R(theta=pi/2, phi=pi/2) [km] " << endl ; |
| 746 |
fichresu << star(i).ray_eq_pi() / km ; |
| 747 |
fichresu << " R(theta=pi/2, phi=pi) [km] " << endl ; |
| 748 |
|
| 749 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](0)) + 1.e-16 ) ; |
| 750 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](1)) + 1.e-16 ) ; |
| 751 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](2)) + 1.e-16 ) ; |
| 752 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](3)) + 1.e-16 ) ; |
| 753 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](4)) + 1.e-16 ) ; |
| 754 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](5)) + 1.e-16 ) ; |
| 755 |
fichconv[i-1] << " " << log10( fabs(differ[i-1](6)) + 1.e-16 ) ; |
| 756 |
|
| 757 |
fichet[i-1] << " " << star(i).get_mp().get_ori_x() / km ; |
| 758 |
fichet[i-1] << " " << ent_c[i-1] ; |
| 759 |
fichet[i-1] << " " << star(i).mass_b() / msol ; |
| 760 |
fichet[i-1] << " " << star(i).ray_pole() / km ; |
| 761 |
fichet[i-1] << " " << star(i).ray_eq() / km ; |
| 762 |
fichet[i-1] << " " << star(i).ray_eq_pis2() / km ; |
| 763 |
fichet[i-1] << " " << star(i).ray_eq_pi() / km ; |
| 764 |
|
| 765 |
} // End of loop on the stars |
| 766 |
|
| 767 |
diff_mass = ( star(2).mass_b() - star(1).mass_b() ) |
| 768 |
/ star(1).mass_b() ; |
| 769 |
cout << "Relative difference between the baryon masses: " |
| 770 |
<< diff_mass << endl ; |
| 771 |
fichresu << diff_mass ; |
| 772 |
fichresu << " Relative difference between the baryon masses" << endl ; |
| 773 |
|
| 774 |
fichvir << " " << log10( fabs(diff_mass) + 1.e-16 ) ; |
| 775 |
|
| 776 |
|
| 777 |
fichresu << " " << endl ; fichresu.flush() ; |
| 778 |
fichrota << " " << endl ; fichrota.flush() ; |
| 779 |
fichvir << " " << endl ; fichvir.flush() ; |
| 780 |
fichconv[0] << " " << endl ; fichconv[0].flush() ; |
| 781 |
fichconv[1] << " " << endl ; fichconv[1].flush() ; |
| 782 |
fichet[0] << " " << endl ; fichet[0].flush() ; |
| 783 |
fichet[1] << " " << endl ; fichet[1].flush() ; |
| 784 |
|
| 785 |
} // End of the main loop (mer) |
| 786 |
|
| 787 |
//============================================================================ |
| 788 |
// End of iteration |
| 789 |
//============================================================================ |
| 790 |
|
| 791 |
fichresu.close() ; |
| 792 |
fichrota.close() ; |
| 793 |
fichvir.close() ; |
| 794 |
fichconv[0].close() ; |
| 795 |
fichconv[1].close() ; |
| 796 |
fichet[0].close() ; |
| 797 |
fichet[1].close() ; |
| 798 |
|
| 799 |
//----------------------------------------------- |
| 800 |
// General features of the final configuration |
| 801 |
// saved in a file |
| 802 |
//----------------------------------------------- |
| 803 |
|
| 804 |
ofstream fichfinal("calcul.d") ; |
| 805 |
fichfinal.precision(6) ; |
| 806 |
|
| 807 |
time_t rawtime = time(0x0) ; |
| 808 |
fichfinal << "Date: " << asctime( localtime( &rawtime ) ) << endl ; |
| 809 |
char* hostname = getenv("HOST") ; |
| 810 |
if (hostname != 0x0) { |
| 811 |
fichfinal << "Computer: " << hostname << endl ; |
| 812 |
} |
| 813 |
fichfinal << |
| 814 |
"===================================================================" |
| 815 |
<< endl << endl ; |
| 816 |
|
| 817 |
fichfinal << "Relativistic computation" ; |
| 818 |
|
| 819 |
if ( star(1).is_irrotational() ) |
| 820 |
fichfinal << " Irrotational" << endl ; |
| 821 |
else |
| 822 |
fichfinal << " Co-rotating" << endl ; |
| 823 |
|
| 824 |
fichfinal << star(1).get_eos() << endl ; |
| 825 |
|
| 826 |
fichfinal << "Omega = " << star.get_omega() * f_unit << " rad/s" |
| 827 |
<< " Orbital frequency f = " |
| 828 |
<< star.get_omega() / (2*M_PI) * f_unit << " Hz" << endl ; |
| 829 |
fichfinal << "Omega_kepler = " << omega_kep * f_unit << " rad/s" << endl ; |
| 830 |
fichfinal << "Coordinate separation : " << star.separation() / km |
| 831 |
<< " km" << endl ; |
| 832 |
fichfinal << "1/2 ADM mass : " << 0.5 * star.mass_adm() / msol |
| 833 |
<< " Mo" << endl ; |
| 834 |
fichfinal << "1/2 ADM mass (vol) : " << 0.5 * star.mass_adm_vol() / msol |
| 835 |
<< " Mo" << endl ; |
| 836 |
fichfinal << "Total angular momentum : " |
| 837 |
<< star.angu_mom()(2)/ ( qpig / (4* M_PI) * msol*msol) |
| 838 |
<< " G M_sol^2 / c" << endl ; |
| 839 |
|
| 840 |
|
| 841 |
cout << "Virial error: " << star.virial() << endl ; |
| 842 |
cout << "Virial error (vol): " << star.virial_vol() << endl ; |
| 843 |
cout << "1/2 ADM mass : " << 0.5 * star.mass_adm() / msol |
| 844 |
<< " Mo" << endl ; |
| 845 |
cout << "1/2 ADM mass (vol) : " << 0.5 * star.mass_adm_vol() / msol |
| 846 |
<< " Mo" << endl ; |
| 847 |
cout << "1/2 Komar mass : " << 0.5 * star.mass_kom() / msol |
| 848 |
<< " Mo" << endl ; |
| 849 |
cout << "1/2 Komar mass (vol): " << 0.5 * star.mass_kom_vol() / msol |
| 850 |
<< " Mo" << endl ; |
| 851 |
cout << "Total angular momentum : " |
| 852 |
<< star.angu_mom()(2)/ ( qpig / (4* M_PI) * msol*msol) |
| 853 |
<< " G M_sol^2 / c" << endl ; |
| 854 |
|
| 855 |
cout << "Total linear momentum : " << endl |
| 856 |
<< star.lin_mom()(0) << " " |
| 857 |
<< star.lin_mom()(1) << " " |
| 858 |
<< star.lin_mom()(2) << endl ; |
| 859 |
|
| 860 |
fichfinal << endl << "Number of steps : " << mer << endl ; |
| 861 |
|
| 862 |
for (int i=1 ; i<=2; i++) { |
| 863 |
fichfinal << endl << |
| 864 |
"===================================================================" |
| 865 |
<< endl ; |
| 866 |
fichfinal << " Star no. " << i << endl ; |
| 867 |
fichfinal << |
| 868 |
"===================================================================" |
| 869 |
<< endl ; |
| 870 |
fichfinal << "Grid : " << endl ; |
| 871 |
fichfinal << "------ " << endl ; |
| 872 |
fichfinal << *(star(i).get_mp().get_mg()) << endl ; |
| 873 |
fichfinal << endl << "Physical characteristics : " << endl ; |
| 874 |
fichfinal << "-------------------------" << endl ; |
| 875 |
fichfinal << star(i) << endl ; |
| 876 |
} |
| 877 |
fichfinal << endl ; |
| 878 |
|
| 879 |
star.display_poly(fichfinal) ; // Reduced quantities for polytropic EOS |
| 880 |
|
| 881 |
fichfinal << endl << |
| 882 |
"===================================================================" |
| 883 |
<< endl ; |
| 884 |
|
| 885 |
fichfinal << "Diff_ent : star 1 : " |
| 886 |
<< differ[0](0) << " star 2 : " |
| 887 |
<< differ[1](0) << endl ; |
| 888 |
fichfinal << |
| 889 |
"Relative difference between the baryon masses of the two stars : " |
| 890 |
<< diff_mass << endl ; |
| 891 |
|
| 892 |
fichfinal << "dH/dx at r = 0 : star 1 : " |
| 893 |
<< star(1).get_ent().dsdx().val_grid_point(0, 0, 0, 0) |
| 894 |
<< " star 2 : " |
| 895 |
<< star(2).get_ent().dsdx().val_grid_point(0, 0, 0, 0) |
| 896 |
<< endl ; |
| 897 |
|
| 898 |
fichfinal << "Relative error on the virial theorem : " << endl ; |
| 899 |
fichfinal << " VE(M)= " << star.virial() ; |
| 900 |
fichfinal << " VE(M)_vol= " << star.virial_vol() ; |
| 901 |
|
| 902 |
fichfinal << endl << |
| 903 |
"================================================================" << endl ; |
| 904 |
fichfinal << " PARAMETERS USED FOR THE COMPUTATION : " << endl ; |
| 905 |
fichfinal << |
| 906 |
"================================================================" << endl ; |
| 907 |
fichfinal.close() ; |
| 908 |
|
| 909 |
system_status = system("cat parcoal.d >> calcul.d") ; |
| 910 |
|
| 911 |
// Identification du code et de ses sous-routines (no. de version RCS) : |
| 912 |
fichfinal.open("calcul.d", ios::app ) ; |
| 913 |
fichfinal << endl << |
| 914 |
"================================================================" << endl ; |
| 915 |
fichfinal << " IDENTIFICATION OF THE CODE : " << endl ; |
| 916 |
fichfinal << |
| 917 |
"================================================================" << endl ; |
| 918 |
fichfinal.close() ; |
| 919 |
system_status = system("ident xcoal >> calcul.d") ; |
| 920 |
|
| 921 |
// Preparation for CPU infos printing : |
| 922 |
fichfinal.open("calcul.d", ios::app ) ; |
| 923 |
fichfinal << endl << |
| 924 |
"================================================================" << endl ; |
| 925 |
fichfinal << " CPU TIME and MEMORY infos : " << endl ; |
| 926 |
fichfinal << |
| 927 |
"================================================================" << endl ; |
| 928 |
fichfinal << endl ; |
| 929 |
fichfinal.close() ; |
| 930 |
|
| 931 |
|
| 932 |
//----------------------------------------------- |
| 933 |
// General features of the final configuration |
| 934 |
// saved in a file with scientific notation and |
| 935 |
// 14 digits for further reading by a code |
| 936 |
//----------------------------------------------- |
| 937 |
|
| 938 |
sprintf(name, "resformat_%.3f.d", distance) ; |
| 939 |
ofstream seqfich(name) ; |
| 940 |
if ( !seqfich.good() ) { |
| 941 |
cout << "xcoal : problem with opening the file resformat.d !" << endl ; |
| 942 |
abort() ; |
| 943 |
} |
| 944 |
star.write_global(seqfich) ; |
| 945 |
seqfich.close() ; |
| 946 |
|
| 947 |
// Cleaning |
| 948 |
// -------- |
| 949 |
|
| 950 |
|
| 951 |
delete peos1 ; |
| 952 |
delete peos2 ; |
| 953 |
|
| 954 |
return EXIT_SUCCESS ; |
| 955 |
|
| 956 |
} |