| 1 |
/* |
| 2 |
* Main code for computing magnetized stationary axisymmetric rotating stars. |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 2002 Jerome Novak & Emanuel Marcq |
| 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 as published by |
| 13 |
* the Free Software Foundation; either version 2 of the License, or |
| 14 |
* (at your option) any later version. |
| 15 |
* |
| 16 |
* LORENE is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with LORENE; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
/* |
| 28 |
* $Id: magstar.C,v 1.14 2014/10/13 08:53:57 j_novak Exp $ |
| 29 |
* $Log: magstar.C,v $ |
| 30 |
* Revision 1.14 2014/10/13 08:53:57 j_novak |
| 31 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 32 |
* |
| 33 |
* Revision 1.13 2014/09/03 15:34:02 j_novak |
| 34 |
* Filtering of Maxwell sources is now optional. |
| 35 |
* |
| 36 |
* Revision 1.12 2014/07/04 12:42:41 j_novak |
| 37 |
* Parameter file for mass-shedding configurations. |
| 38 |
* |
| 39 |
* Revision 1.11 2012/08/10 12:52:42 j_novak |
| 40 |
* Minor changes. |
| 41 |
* |
| 42 |
* Revision 1.10 2006/03/09 08:11:59 j_novak |
| 43 |
* Output of the divergence of B at the end of the iteration. |
| 44 |
* |
| 45 |
* Revision 1.9 2004/03/25 12:35:42 j_novak |
| 46 |
* now using namespace Unites |
| 47 |
* |
| 48 |
* Revision 1.8 2003/05/14 20:06:09 e_gourgoulhon |
| 49 |
* Suppressed the qualifier ios::nocreate in call to fstream::open |
| 50 |
* (not supported by gcc 3.2). |
| 51 |
* |
| 52 |
* |
| 53 |
* $Header: /cvsroot/Lorene/Codes/Magstar/magstar.C,v 1.14 2014/10/13 08:53:57 j_novak Exp $ |
| 54 |
* |
| 55 |
*/ |
| 56 |
|
| 57 |
// headers C |
| 58 |
#include <cmath> |
| 59 |
|
| 60 |
// headers Lorene |
| 61 |
#include "et_rot_mag.h" |
| 62 |
#include "eos.h" |
| 63 |
#include "utilitaires.h" |
| 64 |
#include "graphique.h" |
| 65 |
#include "nbr_spx.h" |
| 66 |
#include "unites.h" |
| 67 |
#include "metric.h" |
| 68 |
|
| 69 |
namespace Lorene{ |
| 70 |
// Local prototype (for drawings only) |
| 71 |
Cmp raccord_c1(const Cmp& uu, int l1) ; |
| 72 |
} |
| 73 |
|
| 74 |
using namespace Lorene ; |
| 75 |
|
| 76 |
// Definition de f_j et de M_j |
| 77 |
Cmp f_j(const Cmp& x, double a_j){ |
| 78 |
Cmp resu(x.get_mp() ) ; |
| 79 |
resu = a_j ; |
| 80 |
return resu ; |
| 81 |
} |
| 82 |
Cmp M_j(const Cmp& x, double a_j){ |
| 83 |
return - a_j*x ; |
| 84 |
} |
| 85 |
//****************************************************************************** |
| 86 |
|
| 87 |
int main(){ |
| 88 |
|
| 89 |
using namespace Unites_mag ; |
| 90 |
|
| 91 |
// Identification of all the subroutines called by the code : |
| 92 |
|
| 93 |
int res = system("ident magstar > identif.d") ; |
| 94 |
if (res==-1) { |
| 95 |
cout << "Problem in shell command:" << endl ; |
| 96 |
cout << "ident magstar > identif.d" << endl ; |
| 97 |
cout << "identif.d may be altered." << endl ; |
| 98 |
} |
| 99 |
|
| 100 |
//------------------------------------------------------------------ |
| 101 |
// Parameters of the computation |
| 102 |
//------------------------------------------------------------------ |
| 103 |
|
| 104 |
char blabla[120] ; |
| 105 |
|
| 106 |
int relat_i, mer_max, mer_rot, mer_change_omega, mer_fix_omega, |
| 107 |
delta_mer_kep, mer_mass, mermax_poisson, graph, nz, nzet, nzadapt, |
| 108 |
nt, np ; |
| 109 |
double ent_c, freq_si, fact_omega, mbar_wanted, precis, freq_ini_si, |
| 110 |
thres_adapt, aexp_mass, relax, relax_poisson, precis_adapt ; |
| 111 |
|
| 112 |
double Q0, a_j0, Q_ini, a_j_ini ; |
| 113 |
int mer_mag, mer_change_mag, mer_fix_mag, mag_filter, conduct ; |
| 114 |
|
| 115 |
ifstream fich("parrot.d") ; |
| 116 |
fich.getline(blabla, 120) ; |
| 117 |
fich >> relat_i ; fich.getline(blabla, 120) ; |
| 118 |
bool relat = (relat_i == 1) ; |
| 119 |
fich >> ent_c ; fich.getline(blabla, 120) ; |
| 120 |
fich >> freq_si ; fich.getline(blabla, 120) ; |
| 121 |
fich >> fact_omega ; fich.getline(blabla, 120) ; |
| 122 |
fich >> mbar_wanted ; fich.getline(blabla, 120) ; |
| 123 |
mbar_wanted *= msol ; |
| 124 |
fich >> conduct ; fich.getline(blabla, 120) ; |
| 125 |
fich.getline(blabla, 120) ; |
| 126 |
fich >> Q0 ; fich.getline(blabla,120) ; |
| 127 |
fich >> a_j0 ; fich.getline(blabla,120) ; |
| 128 |
fich >> Q_ini; fich.getline(blabla,120) ; |
| 129 |
fich >> a_j_ini ; fich.getline(blabla,120) ; |
| 130 |
fich >> mer_mag ; fich.getline(blabla,120) ; |
| 131 |
fich >> mer_change_mag ; fich.getline(blabla,120) ; |
| 132 |
fich >> mer_fix_mag ; fich.getline(blabla,120); |
| 133 |
fich >> mag_filter ; fich.getline(blabla,120) ; |
| 134 |
fich.getline(blabla,120); |
| 135 |
fich >> mer_max ; fich.getline(blabla, 120) ; |
| 136 |
fich >> precis ; fich.getline(blabla, 120) ; |
| 137 |
fich >> mer_rot ; fich.getline(blabla, 120) ; |
| 138 |
fich >> freq_ini_si ; fich.getline(blabla, 120) ; |
| 139 |
fich >> mer_change_omega ; fich.getline(blabla, 120) ; |
| 140 |
fich >> mer_fix_omega ; fich.getline(blabla, 120) ; |
| 141 |
fich >> delta_mer_kep ; fich.getline(blabla, 120) ; |
| 142 |
fich >> thres_adapt ; fich.getline(blabla, 120) ; |
| 143 |
fich >> mer_mass ; fich.getline(blabla, 120) ; |
| 144 |
fich >> aexp_mass ; fich.getline(blabla, 120) ; |
| 145 |
fich >> relax ; fich.getline(blabla, 120) ; |
| 146 |
fich >> mermax_poisson ; fich.getline(blabla, 120) ; |
| 147 |
fich >> relax_poisson ; fich.getline(blabla, 120) ; |
| 148 |
fich >> precis_adapt ; fich.getline(blabla, 120) ; |
| 149 |
fich >> graph ; fich.getline(blabla, 120) ; |
| 150 |
fich.getline(blabla, 120) ; |
| 151 |
fich >> nz ; fich.getline(blabla, 120) ; |
| 152 |
fich >> nzet; fich.getline(blabla, 120) ; |
| 153 |
fich >> nzadapt; fich.getline(blabla, 120) ; |
| 154 |
fich >> nt; fich.getline(blabla, 120) ; |
| 155 |
fich >> np; fich.getline(blabla, 120) ; |
| 156 |
|
| 157 |
int* nr = new int[nz]; |
| 158 |
int* nt_tab = new int[nz]; |
| 159 |
int* np_tab = new int[nz]; |
| 160 |
double* bornes = new double[nz+1]; |
| 161 |
|
| 162 |
fich.getline(blabla, 120); |
| 163 |
for (int l=0; l<nz; l++) { |
| 164 |
fich >> nr[l]; |
| 165 |
fich >> bornes[l]; fich.getline(blabla, 120) ; |
| 166 |
np_tab[l] = np ; |
| 167 |
nt_tab[l] = nt ; |
| 168 |
} |
| 169 |
bornes[nz] = __infinity ; |
| 170 |
|
| 171 |
Tbl ent_limit(nzet) ; |
| 172 |
ent_limit.set_etat_qcq() ; |
| 173 |
ent_limit.set(nzet-1) = 0 ; // enthalpy at the stellar surface |
| 174 |
for (int l=0; l<nzet-1; l++) { |
| 175 |
fich >> ent_limit.set(l) ; fich.getline(blabla, 120) ; |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
fich.close(); |
| 180 |
|
| 181 |
// Particular cases |
| 182 |
// ---------------- |
| 183 |
|
| 184 |
// Initial frequency = final frequency |
| 185 |
if ( freq_ini_si < 0 ) { |
| 186 |
freq_ini_si = freq_si ; |
| 187 |
mer_change_omega = mer_rot ; |
| 188 |
mer_fix_omega = mer_rot + 1 ; |
| 189 |
} |
| 190 |
|
| 191 |
|
| 192 |
//----------------------------------------------------------------------- |
| 193 |
// Equation of state |
| 194 |
//----------------------------------------------------------------------- |
| 195 |
|
| 196 |
fich.open("par_eos.d") ; |
| 197 |
|
| 198 |
Eos* peos = Eos::eos_from_file(fich) ; |
| 199 |
Eos& eos = *peos ; |
| 200 |
|
| 201 |
fich.close() ; |
| 202 |
|
| 203 |
|
| 204 |
// Special treatment of crust - liquid core boundary in the case |
| 205 |
// of Eos_strange |
| 206 |
if (eos.identify() == 6) { |
| 207 |
assert( nzet == 2 ) ; |
| 208 |
const Eos_strange_cr* peos_cr = dynamic_cast<const Eos_strange_cr*>(peos) ; |
| 209 |
if (peos_cr == 0x0) { |
| 210 |
cout << "rotstar: problem : peos is not of type Eos_strange_cr !" << endl ; |
| 211 |
abort() ; |
| 212 |
} |
| 213 |
|
| 214 |
ent_limit.set(0) = peos_cr->get_ent_nd() ; // enthalpy at core/crust transition |
| 215 |
|
| 216 |
} |
| 217 |
|
| 218 |
//----------------------------------------------------------------------- |
| 219 |
// Construction of the multi-grid and the mapping |
| 220 |
//----------------------------------------------------------------------- |
| 221 |
|
| 222 |
// Rescale of bornes in the case where there more than 1 domain inside |
| 223 |
// the star |
| 224 |
|
| 225 |
for (int l=0; l<nzet-1; l++) { |
| 226 |
|
| 227 |
bornes[l+1] = bornes[nzet] * sqrt(1 - ent_limit(l) / ent_c) ; |
| 228 |
|
| 229 |
} |
| 230 |
|
| 231 |
// Type of r sampling : |
| 232 |
int* type_r = new int[nz]; |
| 233 |
type_r[0] = RARE ; |
| 234 |
for (int l=1; l<nz-1; l++) { |
| 235 |
type_r[l] = FIN ; |
| 236 |
} |
| 237 |
type_r[nz-1] = UNSURR ; |
| 238 |
|
| 239 |
// Type of sampling in theta and phi : |
| 240 |
int type_t = SYM ; |
| 241 |
int type_p = SYM ; |
| 242 |
|
| 243 |
Mg3d mg(nz, nr, type_r, nt_tab, type_t, np_tab, type_p) ; |
| 244 |
|
| 245 |
Map_et mp(mg, bornes) ; |
| 246 |
|
| 247 |
// Cleaning |
| 248 |
// -------- |
| 249 |
|
| 250 |
delete [] nr ; |
| 251 |
delete [] nt_tab ; |
| 252 |
delete [] np_tab ; |
| 253 |
delete [] type_r ; |
| 254 |
delete [] bornes ; |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
cout << endl |
| 259 |
<< "==========================================================" << endl |
| 260 |
<< " Physical parameters " << endl |
| 261 |
<< "==========================================================" |
| 262 |
<< endl ; |
| 263 |
cout << endl ; |
| 264 |
|
| 265 |
cout << endl << "Equation of state : " |
| 266 |
<< endl << "================= " << endl ; |
| 267 |
cout << eos << endl ; |
| 268 |
|
| 269 |
cout << "Central enthalpy : " << ent_c << " c^2" << endl ; |
| 270 |
cout << "Rotation frequency : " << freq_si << " Hz" << endl ; |
| 271 |
if ( abs(mer_mass) < mer_max ) { |
| 272 |
cout << "Required Baryon mass [M_sol] : " |
| 273 |
<< mbar_wanted / msol << endl ; |
| 274 |
} |
| 275 |
cout << endl |
| 276 |
<< "==========================================================" << endl |
| 277 |
<< " Computational parameters " << endl |
| 278 |
<< "==========================================================" |
| 279 |
<< endl << endl ; |
| 280 |
|
| 281 |
cout << "Maximum number of steps in the main iteration : " |
| 282 |
<< mer_max << endl ; |
| 283 |
cout << "Relaxation factor in the main iteration : " |
| 284 |
<< relax << endl ; |
| 285 |
cout << "Threshold on the enthalpy relative change for ending the computation : " |
| 286 |
<< precis << endl ; |
| 287 |
cout << "Maximum number of steps in Map_et::poisson : " |
| 288 |
<< mermax_poisson << endl ; |
| 289 |
cout << "Relaxation factor in Map_et::poisson : " |
| 290 |
<< relax_poisson << endl ; |
| 291 |
cout << "Step from which the baryon mass is forced to converge : " |
| 292 |
<< mer_mass << endl ; |
| 293 |
cout << "Exponent for the increase factor of the central enthalpy : " |
| 294 |
<< aexp_mass << endl ; |
| 295 |
cout << |
| 296 |
"Threshold on |dH/dr|_eq / |dH/dr|_pole for the adaptation of the mapping" |
| 297 |
<< endl << thres_adapt << endl ; |
| 298 |
|
| 299 |
|
| 300 |
cout << endl << "Multi-grid : " |
| 301 |
<< endl << "==========" << endl << mg << endl ; |
| 302 |
cout << "Mapping : " |
| 303 |
<< endl << "=======" << endl << mp << endl ; |
| 304 |
|
| 305 |
|
| 306 |
//----------------------------------------------------------------------- |
| 307 |
// Construction of the star |
| 308 |
//----------------------------------------------------------------------- |
| 309 |
|
| 310 |
Et_rot_mag star(mp, nzet, relat, eos, conduct) ; |
| 311 |
|
| 312 |
if ( star.is_relativistic() ) { |
| 313 |
cout << "========================" << endl ; |
| 314 |
cout << "Relativistic computation" << endl ; |
| 315 |
cout << "========================" << endl ; |
| 316 |
} |
| 317 |
else { |
| 318 |
cout << "=====================" << endl ; |
| 319 |
cout << "Newtonian computation" << endl ; |
| 320 |
cout << "=====================" << endl ; |
| 321 |
} |
| 322 |
|
| 323 |
//----------------------------------------------------------------------- |
| 324 |
// Initialization of the enthalpy field |
| 325 |
//----------------------------------------------------------------------- |
| 326 |
|
| 327 |
|
| 328 |
const Coord& r = mp.r ; |
| 329 |
double ray0 = mp.val_r(nzet-1, 1., 0., 0.) ; |
| 330 |
Cmp ent0(mp) ; |
| 331 |
ent0 = ent_c * ( 1 - r*r / (ray0*ray0) ) ; |
| 332 |
ent0.annule(nz-1) ; |
| 333 |
ent0.std_base_scal() ; |
| 334 |
star.set_enthalpy(ent0) ; |
| 335 |
|
| 336 |
// Initialization of (n,e,p) from H |
| 337 |
star.equation_of_state() ; |
| 338 |
|
| 339 |
// Initialization of (E,S,U,etc...) (quantities relative to the Eulerian obs) |
| 340 |
star.hydro_euler() ; |
| 341 |
|
| 342 |
// Initialization of eulerian electromagnetic quantities. |
| 343 |
star.MHD_comput() ; |
| 344 |
|
| 345 |
|
| 346 |
cout << endl << "Initial star : " |
| 347 |
<< endl << "============ " << endl ; |
| 348 |
|
| 349 |
cout << star << endl ; |
| 350 |
|
| 351 |
//----------------------------------------------------------------------- |
| 352 |
// Computation of the rotating equilibrium |
| 353 |
//----------------------------------------------------------------------- |
| 354 |
|
| 355 |
double omega = 2 * M_PI * freq_si / f_unit ; |
| 356 |
double omega_ini = 2 * M_PI * freq_ini_si / f_unit ; |
| 357 |
|
| 358 |
Itbl icontrol(11) ; |
| 359 |
icontrol.set_etat_qcq() ; |
| 360 |
icontrol.set(0) = mer_max ; |
| 361 |
icontrol.set(1) = mer_rot ; |
| 362 |
icontrol.set(2) = mer_change_omega ; |
| 363 |
icontrol.set(3) = mer_fix_omega ; |
| 364 |
icontrol.set(4) = mer_mass ; |
| 365 |
icontrol.set(5) = mermax_poisson ; |
| 366 |
icontrol.set(6) = delta_mer_kep ; |
| 367 |
icontrol.set(7) = mer_mag ; |
| 368 |
icontrol.set(8) = mer_change_mag ; |
| 369 |
icontrol.set(9) = mer_fix_mag ; |
| 370 |
icontrol.set(10) = mag_filter ; |
| 371 |
|
| 372 |
Tbl control(8) ; |
| 373 |
control.set_etat_qcq() ; |
| 374 |
control.set(0) = precis ; |
| 375 |
control.set(1) = omega_ini ; |
| 376 |
control.set(2) = relax ; |
| 377 |
control.set(3) = relax_poisson ; |
| 378 |
control.set(4) = thres_adapt ; |
| 379 |
control.set(5) = precis_adapt ; |
| 380 |
control.set(6) = Q_ini ; |
| 381 |
control.set(7) = a_j_ini ; |
| 382 |
|
| 383 |
Tbl diff(1) ; |
| 384 |
|
| 385 |
star.equilibrium_mag(ent_c, omega, fact_omega, nzadapt, ent_limit, |
| 386 |
icontrol, control, mbar_wanted, aexp_mass, diff, |
| 387 |
Q0, a_j0, &f_j, &M_j) ; |
| 388 |
|
| 389 |
|
| 390 |
cout << endl << "Final star : " |
| 391 |
<< endl << "========== " << endl ; |
| 392 |
|
| 393 |
cout.precision(10) ; |
| 394 |
cout << star << endl ; |
| 395 |
|
| 396 |
const Base_vect_spher& bspher = mp.get_bvect_spher() ; |
| 397 |
Sym_tensor gij(mp, COV, bspher) ; |
| 398 |
gij.set_etat_zero() ; |
| 399 |
gij.set(1,1) = star.get_a_car()() ; |
| 400 |
gij.set(2,2) = star.get_a_car()() ; |
| 401 |
gij.set(3,3) = star.get_b_car()() ; |
| 402 |
Metric gam(gij) ; |
| 403 |
|
| 404 |
Scalar fac = sqrt(star.get_a_car()()) ; |
| 405 |
fac.std_spectral_base() ; |
| 406 |
Vector Bmag(mp, CON, bspher) ; |
| 407 |
Bmag.set(1) = Scalar(star.Magn()(0)) / fac ; |
| 408 |
Bmag.set(1).dec_dzpuis(2) ; |
| 409 |
Bmag.set(2) = Scalar(star.Magn()(1)) / fac ; |
| 410 |
Bmag.set(2).dec_dzpuis(2) ; |
| 411 |
Bmag.set(3) = 0 ; |
| 412 |
Tbl maxB = 0.5*(max(abs(Bmag(1))) + max(abs(Bmag(2)))) ; |
| 413 |
cout << maxB ; |
| 414 |
cout << "div(B) / max(B) in each domain : " << max(abs(Bmag.divergence(gam))) / maxB ; |
| 415 |
|
| 416 |
//----------------------------------------------- |
| 417 |
// General features of the final configuration |
| 418 |
// saved in a file |
| 419 |
//----------------------------------------------- |
| 420 |
|
| 421 |
ofstream fichfinal("calcul.d") ; |
| 422 |
fichfinal.precision(10) ; |
| 423 |
|
| 424 |
if ( star.is_relativistic() ) { |
| 425 |
fichfinal << "Relativistic computation" << endl ; |
| 426 |
} |
| 427 |
else { |
| 428 |
fichfinal << "Newtonian computation" << endl ; |
| 429 |
} |
| 430 |
|
| 431 |
fichfinal << star.get_eos() << endl ; |
| 432 |
|
| 433 |
fichfinal << endl << "Total CPU time : " << endl ; |
| 434 |
fichfinal << "Memory size : " << endl << endl ; |
| 435 |
|
| 436 |
fichfinal << endl << endl ; |
| 437 |
fichfinal << "Grid : " << endl ; |
| 438 |
fichfinal << "------ " << endl ; |
| 439 |
fichfinal << *(star.get_mp().get_mg()) << endl ; |
| 440 |
fichfinal << endl << "Physical characteristics : " << endl ; |
| 441 |
fichfinal << "-------------------------" << endl ; |
| 442 |
fichfinal << star << endl ; |
| 443 |
|
| 444 |
fichfinal << endl << |
| 445 |
"===================================================================" |
| 446 |
<< endl ; |
| 447 |
fichfinal << "Diff_ent : " << diff(0) << endl ; |
| 448 |
fichfinal << "Relative error on the virial theorem GRV2 : " |
| 449 |
<< star.grv2() << endl ; |
| 450 |
fichfinal << "Relative error on the virial theorem GRV3 : " |
| 451 |
<< star.grv3() << endl ; |
| 452 |
|
| 453 |
fichfinal << endl << |
| 454 |
"================================================================" << endl ; |
| 455 |
fichfinal << |
| 456 |
" PARAMETERS USED FOR THE COMPUTATION (file parrot.d) : " << endl ; |
| 457 |
fichfinal << |
| 458 |
"================================================================" << endl ; |
| 459 |
fichfinal.close() ; |
| 460 |
res = system("cat parrot.d >> calcul.d") ; |
| 461 |
if (res==-1) { |
| 462 |
cout << "Problem in shell command:" << endl ; |
| 463 |
cout << "cat parrot.d >> calcul.d" << endl ; |
| 464 |
cout << "calcul.d may be altered." << endl ; |
| 465 |
} |
| 466 |
|
| 467 |
fichfinal.open("calcul.d", ios::app) ; |
| 468 |
fichfinal << endl << |
| 469 |
"================================================================" << endl ; |
| 470 |
fichfinal << |
| 471 |
" EOS PARAMETERS (file par_eos.d) : " << endl ; |
| 472 |
fichfinal << |
| 473 |
"================================================================" << endl ; |
| 474 |
fichfinal.close() ; |
| 475 |
res = system("cat par_eos.d >> calcul.d") ; |
| 476 |
if (res==-1) { |
| 477 |
cout << "Problem in shell command:" << endl ; |
| 478 |
cout << "cat par_eos.d >> calcul.d" << endl ; |
| 479 |
cout << "calcul.d may be altered." << endl ; |
| 480 |
} |
| 481 |
|
| 482 |
// Identification du code et de ses sous-routines (no. de version RCS) : |
| 483 |
fichfinal.open("calcul.d", ios::app) ; |
| 484 |
fichfinal << endl << |
| 485 |
"================================================================" << endl ; |
| 486 |
fichfinal << " IDENTIFICATION OF THE CODE : " << endl ; |
| 487 |
fichfinal << |
| 488 |
"================================================================" << endl ; |
| 489 |
fichfinal.close() ; |
| 490 |
res = system("ident magstar >> calcul.d") ; |
| 491 |
if (res==-1) { |
| 492 |
cout << "Problem in shell command:" << endl ; |
| 493 |
cout << "ident magstar >> calcul.d" << endl ; |
| 494 |
cout << "calcul.d may be altered." << endl ; |
| 495 |
} |
| 496 |
|
| 497 |
|
| 498 |
// Saveguard of the whole configuration |
| 499 |
// ------------------------------------ |
| 500 |
|
| 501 |
FILE* fresu = fopen("resu.d", "w") ; |
| 502 |
|
| 503 |
star.get_mp().get_mg()->sauve(fresu) ; // writing of the grid |
| 504 |
star.get_mp().sauve(fresu) ; // writing of the mapping |
| 505 |
star.get_eos().sauve(fresu) ; // writing of the EOS |
| 506 |
star.sauve(fresu) ; // writing of the star |
| 507 |
|
| 508 |
fclose(fresu) ; |
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
// Drawings |
| 513 |
// -------- |
| 514 |
|
| 515 |
if (graph == 1) { |
| 516 |
|
| 517 |
char title[80] ; |
| 518 |
|
| 519 |
// Cmp defining the surface of the star (via the enthalpy field) |
| 520 |
Cmp surf = star.get_ent()() ; |
| 521 |
Cmp surf_ext(mp) ; |
| 522 |
surf_ext = - 0.2 * surf(0, 0, 0, 0) ; |
| 523 |
surf_ext.annule(0, star.get_nzet()-1) ; |
| 524 |
surf.annule(star.get_nzet(), mg.get_nzone()-1) ; |
| 525 |
surf = surf + surf_ext ; |
| 526 |
surf = raccord_c1(surf, star.get_nzet()) ; |
| 527 |
|
| 528 |
int nzdes = star.get_nzet() ; |
| 529 |
|
| 530 |
des_coupe_y(star.get_At(), 0., nzdes, "A\\dt\\u Potential", &surf) ; |
| 531 |
des_coupe_y(star.get_Aphi(), 0., nzdes, "Magnetic field", &surf) ; |
| 532 |
des_coupe_y(star.get_ent()(), 0., nzdes, "Enthalpy", &surf) ; |
| 533 |
|
| 534 |
strcpy(title, "Gravitational potential \\gn") ; |
| 535 |
|
| 536 |
des_coupe_y(star.get_logn()(), 0., nzdes, title, &surf) ; |
| 537 |
|
| 538 |
|
| 539 |
strcpy(title, "Azimuthal shift N\\u\\gf") ; |
| 540 |
des_coupe_y(star.get_nphi()(), 0., nzdes, title, &surf) ; |
| 541 |
|
| 542 |
strcpy(title, "Metric potential \\gz") ; |
| 543 |
des_coupe_y(star.get_dzeta()(), 0., nzdes, title, &surf) ; |
| 544 |
|
| 545 |
strcpy(title, "Metric potential (NB-1) r sin\\gh") ; |
| 546 |
des_coupe_y(star.get_tggg()(), 0., nzdes, title, &surf) ; |
| 547 |
|
| 548 |
strcpy(title, "A\\u2\\dK\\uij\\dK\\dij\\u") ; |
| 549 |
des_coupe_y(star.get_ak_car()(), 0., nzdes, title, &surf) ; |
| 550 |
|
| 551 |
} |
| 552 |
|
| 553 |
|
| 554 |
// Cleaning |
| 555 |
// -------- |
| 556 |
|
| 557 |
delete peos ; |
| 558 |
|
| 559 |
exit(EXIT_SUCCESS) ; |
| 560 |
|
| 561 |
return EXIT_SUCCESS ; |
| 562 |
|
| 563 |
} |