Debian Codegraph @

Codes/Magnetstar/magnetstar.C

raw
1 /*
2 * Main code for computing magnetized axisymmetric stars without deformations.
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: magnetstar.C,v 1.4 2014/10/13 08:53:57 j_novak Exp $
29 * $Log: magnetstar.C,v $
30 * Revision 1.4 2014/10/13 08:53:57 j_novak
31 * Lorene classes and functions now belong to the namespace Lorene.
32 *
33 * Revision 1.3 2014/10/06 15:09:45 j_novak
34 * Modified #include directives to use c++ syntax.
35 *
36 * Revision 1.2 2012/08/17 15:35:06 p_cerda
37 * Small changes to match the paper
38 *
39 * Revision 1.1 2012/08/12 17:57:41 p_cerda
40 * Magnetstar code
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/Magnetstar/magnetstar.C,v 1.4 2014/10/13 08:53:57 j_novak Exp $
54 *
55 */
56
57 // headers C
58 #include <cstdlib>
59 #include <cmath>
60 #include <cstring>
61
62 // headers Lorene
63 #include "et_rot_mag.h"
64 #include "eos.h"
65 #include "utilitaires.h"
66 #include "graphique.h"
67 #include "nbr_spx.h"
68 #include "unites.h"
69 #include "metric.h"
70
71 namespace Lorene{
72 // Local prototype (for drawings only)
73 Cmp raccord_c1(const Cmp& uu, int l1) ;
74 }
75
76 using namespace Lorene ;
77 // Definition de f_j et de M_j
78
79 Cmp f_j(const Cmp& x, double a_j){
80 Cmp resu(x.get_mp() ) ;
81 resu = a_j ;
82 return resu ;
83 }
84 Cmp M_j(const Cmp& x, double a_j){
85 return - a_j*x ;
86 }
87
88 Cmp fn_j(const Cmp& x, const Tbl an_j){
89 Cmp resu(x.get_mp() ) ;
90 Cmp xsign(x.get_mp() ) ;
91 resu = 0.;
92 assert ( an_j.get_dim(0) == 7);
93
94 xsign = x / sqrt(x*x);
95
96 // M = a0 * x + a1 * x^2 + a2 * x^3 ...
97 // f = dM/dx = a0 + 2 * a1 * x + 3 * a2 * x^2 ...
98 resu = resu + an_j(0);
99 resu = resu + 2 * an_j(1) * x;
100 resu = resu + 3 * an_j(2) * x * x;
101
102 // M = c0_j * log (1 + x / rc0_j)
103 // f = dM/dx = c0_j / (1 + x/rc0_j) / rc0_j
104 resu = resu + an_j (3) / (1.0 + x / an_j (4)) / an_j (4);
105
106 // M = c1_j * rc1_j * (x/rc1_j - atan(x / rc1_j))
107 // f = dM/dx = c1_j * (1 - 1 / (1 + (x/rc1_j)^2))
108 resu = resu + an_j (5) * (1.0 - 1.0 / (x*x/an_j(6)/an_j(6) + 1.0));
109
110
111 return resu ;
112 }
113 Cmp Mn_j(const Cmp& x, const Tbl an_j){
114 Cmp resu(x.get_mp() ) ;
115 resu = 0.;
116 assert ( an_j.get_dim(0) == 7);
117
118 // M = a0 * x + a1 * x^2 + a2 * x^3 ...
119 resu = resu - an_j(0) * x;
120 resu = resu - an_j(1) * x * x ;
121 resu = resu - an_j(2) * x * x * x;
122
123 // M = c0_j * log (1 + x / rc0_j)
124 resu = resu - an_j (3)*log(1.0+x/an_j(4));
125
126 // M = c1_j * rc1_j * (x/rc1_j - atan(x / rc1_j))
127 resu = resu - an_j (5) * an_j (6) * ( (x/an_j (6)) - atan(x/an_j(6)));
128
129 return resu ;
130 }
131
132 Cmp gn_j(const Cmp& x, const Tbl bn_j){
133 Cmp resu(x.get_mp() ) ;
134 Cmp N(x.get_mp() ) ;
135 Cmp dNdx(x.get_mp() ) ;
136
137 N = 0.;
138 N = N + bn_j(0) * x ;
139 N = N + bn_j(1) * x * x ;
140 N = N + bn_j(2) * x * x * x;
141
142 dNdx= 0.;
143 dNdx = dNdx + bn_j (0);
144 dNdx = dNdx + 2. * bn_j (1) * x;
145 dNdx = dNdx + 3. * bn_j (2) * x * x;
146
147 resu = N*dNdx;
148 return resu ;
149 }
150 Cmp Nn_j(const Cmp& x, const Tbl bn_j){
151 Cmp resu(x.get_mp() ) ;
152
153 resu = 0.;
154 resu = resu + bn_j(0) * x ;
155 resu = resu + bn_j(1) * x * x ;
156 resu = resu + bn_j(2) * x * x * x;
157
158 return resu ;
159 }
160
161
162
163 //******************************************************************************
164
165 int main(){
166
167 using namespace Unites_mag ;
168
169 // Identification of all the subroutines called by the code :
170
171 system("ident magnetstar > identif.d") ;
172
173 // For the display :
174 // char display_bold[]="x[1m" ; display_bold[0] = 27 ;
175
176 //------------------------------------------------------------------
177 // Parameters of the computation
178 //------------------------------------------------------------------
179
180 char blabla[120] ;
181
182 int relat_i, mer_max, mer_rot, mer_change_omega, mer_fix_omega,
183 delta_mer_kep, mer_mass, mermax_poisson, graph, nz, nzet, nzadapt,
184 nt, np ;
185 double ent_c, freq_si, fact_omega, mbar_wanted, precis, freq_ini_si,
186 thres_adapt, aexp_mass, relax, relax_poisson, precis_adapt ;
187
188 double m_max;
189 double a0_j, a1_j, a2_j, b0_j, b1_j, b2_j, c0_j, c1_j;
190 double rc0_j, rc1_j;
191
192 double relax_mag;
193 int initial_j;
194
195 ifstream fich("parrot.d") ;
196 fich.getline(blabla, 120) ;
197 fich >> relat_i ; fich.getline(blabla, 120) ;
198 bool relat = (relat_i == 1) ;
199 fich >> ent_c ; fich.getline(blabla, 120) ;
200 fich >> freq_si ; fich.getline(blabla, 120) ;
201 fich >> fact_omega ; fich.getline(blabla, 120) ;
202 fich >> mbar_wanted ; fich.getline(blabla, 120) ;
203 mbar_wanted *= msol ;
204 fich.getline(blabla, 120) ;
205 fich >> m_max ; fich.getline(blabla,120) ;
206 fich >> a0_j ; fich.getline(blabla,120) ;
207 fich >> a1_j ; fich.getline(blabla,120) ;
208 fich >> a2_j ; fich.getline(blabla,120) ;
209 fich >> c0_j ; fich.getline(blabla,120) ;
210 fich >> rc0_j ; fich.getline(blabla,120) ;
211 // fich >> c1_j ; fich.getline(blabla,120) ;
212 // fich >> rc1_j ; fich.getline(blabla,120) ;
213 c1_j = 0.;
214 rc1_j = 1.;
215 fich >> b0_j ; fich.getline(blabla,120);
216 fich >> b1_j ; fich.getline(blabla,120);
217 fich >> b2_j ; fich.getline(blabla,120);
218 fich >> relax_mag ; fich.getline(blabla,120);
219 fich >> initial_j ; fich.getline(blabla,120);
220 fich.getline(blabla,120);
221 fich >> mer_max ; fich.getline(blabla, 120) ;
222 fich >> precis ; fich.getline(blabla, 120) ;
223 fich >> mer_rot ; fich.getline(blabla, 120) ;
224 fich >> freq_ini_si ; fich.getline(blabla, 120) ;
225 fich >> mer_change_omega ; fich.getline(blabla, 120) ;
226 fich >> mer_fix_omega ; fich.getline(blabla, 120) ;
227 fich >> delta_mer_kep ; fich.getline(blabla, 120) ;
228 fich >> thres_adapt ; fich.getline(blabla, 120) ;
229 fich >> mer_mass ; fich.getline(blabla, 120) ;
230 fich >> aexp_mass ; fich.getline(blabla, 120) ;
231 fich >> relax ; fich.getline(blabla, 120) ;
232 fich >> mermax_poisson ; fich.getline(blabla, 120) ;
233 fich >> relax_poisson ; fich.getline(blabla, 120) ;
234 fich >> precis_adapt ; fich.getline(blabla, 120) ;
235 fich >> graph ; fich.getline(blabla, 120) ;
236 fich.getline(blabla, 120) ;
237 fich >> nz ; fich.getline(blabla, 120) ;
238 fich >> nzet; fich.getline(blabla, 120) ;
239 fich >> nzadapt; fich.getline(blabla, 120) ;
240 fich >> nt; fich.getline(blabla, 120) ;
241 fich >> np; fich.getline(blabla, 120) ;
242
243 int* nr = new int[nz];
244 int* nt_tab = new int[nz];
245 int* np_tab = new int[nz];
246 double* bornes = new double[nz+1];
247
248 fich.getline(blabla, 120);
249 for (int l=0; l<nz; l++) {
250 fich >> nr[l];
251 fich >> bornes[l]; fich.getline(blabla, 120) ;
252 np_tab[l] = np ;
253 nt_tab[l] = nt ;
254 }
255 bornes[nz] = __infinity ;
256
257 Tbl ent_limit(nzet) ;
258 ent_limit.set_etat_qcq() ;
259 ent_limit.set(nzet-1) = 0 ; // enthalpy at the stellar surface
260 for (int l=0; l<nzet-1; l++) {
261 fich >> ent_limit.set(l) ; fich.getline(blabla, 120) ;
262 }
263
264
265 fich.close();
266
267 Tbl an_j (7);
268 an_j.set_etat_qcq();
269 an_j.set(0) = a0_j*m_max;
270 an_j.set(1) = a1_j*m_max;
271 an_j.set(2) = a2_j*m_max;
272 an_j.set(3) = c0_j*m_max;
273 an_j.set(4) = rc0_j;
274 an_j.set(5) = c1_j*m_max;
275 an_j.set(6) = rc1_j;
276
277 Tbl bn_j (3);
278 bn_j.set_etat_qcq();
279 bn_j.set(0) = b0_j;
280 bn_j.set(1) = b1_j;
281 bn_j.set(2) = b2_j;
282
283
284
285 // Particular cases
286 // ----------------
287
288 // Initial frequency = final frequency
289 if ( freq_ini_si < 0 ) {
290 freq_ini_si = freq_si ;
291 mer_change_omega = mer_rot ;
292 mer_fix_omega = mer_rot + 1 ;
293 }
294
295
296 //-----------------------------------------------------------------------
297 // Equation of state
298 //-----------------------------------------------------------------------
299
300 fich.open("par_eos.d") ;
301
302 Eos* peos = Eos::eos_from_file(fich) ;
303 Eos& eos = *peos ;
304
305 fich.close() ;
306
307
308 // Special treatment of crust - liquid core boundary in the case
309 // of Eos_strange
310 if (eos.identify() == 6) {
311 assert( nzet == 2 ) ;
312 const Eos_strange_cr* peos_cr = dynamic_cast<const Eos_strange_cr*>(peos) ;
313 if (peos_cr == 0x0) {
314 cout << "rotstar: problem : peos is not of type Eos_strange_cr !" << endl ;
315 abort() ;
316 }
317
318 ent_limit.set(0) = peos_cr->get_ent_nd() ; // enthalpy at core/crust transition
319
320 }
321
322 //-----------------------------------------------------------------------
323 // Construction of the multi-grid and the mapping
324 //-----------------------------------------------------------------------
325
326 // Rescale of bornes in the case where there more than 1 domain inside
327 // the star
328
329 for (int l=0; l<nzet-1; l++) {
330
331 bornes[l+1] = bornes[nzet] * sqrt(1 - ent_limit(l) / ent_c) ;
332
333 }
334
335 // Type of r sampling :
336 int* type_r = new int[nz];
337 type_r[0] = RARE ;
338 for (int l=1; l<nz-1; l++) {
339 type_r[l] = FIN ;
340 }
341 type_r[nz-1] = UNSURR ;
342
343 // Type of sampling in theta and phi :
344 int type_t;
345 if ( initial_j == 2 ) {
346 type_t = NONSYM ;
347 }else{
348 type_t = SYM ;
349 }
350 int type_p = SYM ;
351
352 Mg3d mg(nz, nr, type_r, nt_tab, type_t, np_tab, type_p) ;
353
354 Map_et mp(mg, bornes) ;
355
356 // Cleaning
357 // --------
358
359 delete [] nr ;
360 delete [] nt_tab ;
361 delete [] np_tab ;
362 delete [] type_r ;
363 delete [] bornes ;
364
365
366
367 cout << endl
368 << "==========================================================" << endl
369 << " Physical parameters " << endl
370 << "=========================================================="
371 << endl ;
372 cout << endl ;
373
374 cout << endl << "Equation of state : "
375 << endl << "================= " << endl ;
376 cout << eos << endl ;
377
378 cout << "Central enthalpy : " << ent_c << " c^2" << endl ;
379 cout << "Rotation frequency : " << freq_si << " Hz" << endl ;
380 if ( abs(mer_mass) < mer_max ) {
381 cout << "Required Baryon mass [M_sol] : "
382 << mbar_wanted / msol << endl ;
383 }
384 cout << endl
385 << "==========================================================" << endl
386 << " Computational parameters " << endl
387 << "=========================================================="
388 << endl << endl ;
389
390 cout << "Maximum number of steps in the main iteration : "
391 << mer_max << endl ;
392 cout << "Relaxation factor in the main iteration : "
393 << relax << endl ;
394 cout << "Threshold on the enthalpy relative change for ending the computation : "
395 << precis << endl ;
396 cout << "Maximum number of steps in Map_et::poisson : "
397 << mermax_poisson << endl ;
398 cout << "Relaxation factor in Map_et::poisson : "
399 << relax_poisson << endl ;
400 cout << "Step from which the baryon mass is forced to converge : "
401 << mer_mass << endl ;
402 cout << "Exponent for the increase factor of the central enthalpy : "
403 << aexp_mass << endl ;
404 cout <<
405 "Threshold on |dH/dr|_eq / |dH/dr|_pole for the adaptation of the mapping"
406 << endl << thres_adapt << endl ;
407
408
409 cout << endl << "Multi-grid : "
410 << endl << "==========" << endl << mg << endl ;
411 cout << "Mapping : "
412 << endl << "=======" << endl << mp << endl ;
413
414
415 //-----------------------------------------------------------------------
416 // Construction of the star
417 //-----------------------------------------------------------------------
418
419 Et_rot_mag star(mp, nzet, relat, eos, 1) ;
420
421 if ( star.is_relativistic() ) {
422 cout << "========================" << endl ;
423 cout << "Relativistic computation" << endl ;
424 cout << "========================" << endl ;
425 }
426 else {
427 cout << "=====================" << endl ;
428 cout << "Newtonian computation" << endl ;
429 cout << "=====================" << endl ;
430 }
431
432 //-----------------------------------------------------------------------
433 // Initialization of the enthalpy field
434 //-----------------------------------------------------------------------
435
436
437 const Coord& r = mp.r ;
438 double ray0 = mp.val_r(nzet-1, 1., 0., 0.) ;
439 Cmp ent0(mp) ;
440 ent0 = ent_c * ( 1 - r*r / (ray0*ray0) ) ;
441 ent0.annule(nz-1) ;
442 ent0.std_base_scal() ;
443 star.set_enthalpy(ent0) ;
444
445 // Initialization of (n,e,p) from H
446 star.equation_of_state() ;
447
448 // Initialization of (E,S,U,etc...) (quantities relative to the Eulerian obs)
449 star.hydro_euler() ;
450
451 // Initialization of eulerian electromagnetic quantities.
452 star.MHD_comput() ;
453
454
455 cout << endl << "Initial star : "
456 << endl << "============ " << endl ;
457
458 cout << star << endl ;
459
460 //-----------------------------------------------------------------------
461 // Computation of the rotating equilibrium
462 //-----------------------------------------------------------------------
463
464 double omega = 2 * M_PI * freq_si / f_unit ;
465 double omega_ini = 2 * M_PI * freq_ini_si / f_unit ;
466
467 Itbl icontrol(10) ;
468 icontrol.set_etat_qcq() ;
469 icontrol.set(0) = mer_max ;
470 icontrol.set(1) = mer_rot ;
471 icontrol.set(2) = mer_change_omega ;
472 icontrol.set(3) = mer_fix_omega ;
473 icontrol.set(4) = mer_mass ;
474 icontrol.set(5) = mermax_poisson ;
475 icontrol.set(6) = delta_mer_kep ;
476 icontrol.set(7) = 0 ;
477 icontrol.set(8) = 0 ;
478 icontrol.set(9)= 1 ;
479
480 Tbl control(8) ;
481 control.set_etat_qcq() ;
482 control.set(0) = precis ;
483 control.set(1) = omega_ini ;
484 control.set(2) = relax ;
485 control.set(3) = relax_poisson ;
486 control.set(4) = thres_adapt ;
487 control.set(5) = precis_adapt ;
488 control.set(6) = 0. ;
489 control.set(7) = 0. ;
490
491 Tbl diff(1) ;
492
493
494 star.equilibrium_mag(ent_c, omega, fact_omega, nzadapt, ent_limit,
495 icontrol, control, mbar_wanted, aexp_mass, diff,
496 0., 0., &f_j, &M_j) ;
497
498 cout << endl << "Non-magnetized star : "
499 << endl << "========== " << endl ;
500
501
502 star.equilibrium_mag_plus(icontrol, control, diff, initial_j, an_j, &fn_j, &Mn_j, bn_j, &gn_j, &Nn_j,
503 relax_mag) ;
504
505
506 cout << endl << "Final star : "
507 << endl << "========== " << endl ;
508
509 cout.precision(10) ;
510 cout << star << endl ;
511
512 const Base_vect_spher& bspher = mp.get_bvect_spher() ;
513 Sym_tensor gij(mp, COV, bspher) ;
514 gij.set_etat_zero() ;
515 gij.set(1,1) = star.get_a_car()() ;
516 gij.set(2,2) = star.get_a_car()() ;
517 gij.set(3,3) = star.get_b_car()() ;
518 Metric gam(gij) ;
519
520 Scalar fac = sqrt(star.get_a_car()()) ;
521 fac.std_spectral_base() ;
522 Vector Bmag(mp, CON, bspher) ;
523 Bmag.set(1) = Scalar(star.Magn()(0)) / fac ;
524 Bmag.set(1).dec_dzpuis(2) ;
525 Bmag.set(2) = Scalar(star.Magn()(1)) / fac ;
526 Bmag.set(2).dec_dzpuis(2) ;
527 Bmag.set(3) = 0 ;
528 Tbl maxB = 0.5*(max(abs(Bmag(1))) + max(abs(Bmag(2)))) ;
529 cout << "max(B) in each domain : " << maxB ;
530 cout << "div(B) / max(B) in each domain : " << max(abs(Bmag.divergence(gam))) / maxB ;
531
532 //-----------------------------------------------
533 // General features of the final configuration
534 // saved in a file
535 //-----------------------------------------------
536
537 ofstream fichfinal("calcul.d") ;
538 fichfinal.precision(10) ;
539
540 if ( star.is_relativistic() ) {
541 fichfinal << "Relativistic computation" << endl ;
542 }
543 else {
544 fichfinal << "Newtonian computation" << endl ;
545 }
546
547 fichfinal << star.get_eos() << endl ;
548
549 fichfinal << endl << "Total CPU time : " << endl ;
550 fichfinal << "Memory size : " << endl << endl ;
551
552 fichfinal << endl << endl ;
553 fichfinal << "Grid : " << endl ;
554 fichfinal << "------ " << endl ;
555 fichfinal << *(star.get_mp().get_mg()) << endl ;
556 fichfinal << endl << "Physical characteristics : " << endl ;
557 fichfinal << "-------------------------" << endl ;
558 fichfinal << star << endl ;
559
560 fichfinal << endl <<
561 "==================================================================="
562 << endl ;
563 fichfinal << "Diff_ent : " << diff(0) << endl ;
564 fichfinal << "Relative error on the virial theorem GRV2 : "
565 << star.grv2() << endl ;
566 fichfinal << "Relative error on the virial theorem GRV3 : "
567 << star.grv3() << endl ;
568
569 fichfinal << endl <<
570 "================================================================" << endl ;
571 fichfinal <<
572 " PARAMETERS USED FOR THE COMPUTATION (file parrot.d) : " << endl ;
573 fichfinal <<
574 "================================================================" << endl ;
575 fichfinal.close() ;
576 system("cat parrot.d >> calcul.d") ;
577
578 fichfinal.open("calcul.d", ios::app) ;
579 fichfinal << endl <<
580 "================================================================" << endl ;
581 fichfinal <<
582 " EOS PARAMETERS (file par_eos.d) : " << endl ;
583 fichfinal <<
584 "================================================================" << endl ;
585 fichfinal.close() ;
586 system("cat par_eos.d >> calcul.d") ;
587
588 // Identification du code et de ses sous-routines (no. de version RCS) :
589 fichfinal.open("calcul.d", ios::app) ;
590 fichfinal << endl <<
591 "================================================================" << endl ;
592 fichfinal << " IDENTIFICATION OF THE CODE : " << endl ;
593 fichfinal <<
594 "================================================================" << endl ;
595 fichfinal.close() ;
596 system("ident magnetstar >> calcul.d") ;
597
598
599 // Saveguard of the whole configuration
600 // ------------------------------------
601
602 FILE* fresu = fopen("resu.d", "w") ;
603
604 star.get_mp().get_mg()->sauve(fresu) ; // writing of the grid
605 star.get_mp().sauve(fresu) ; // writing of the mapping
606 star.get_eos().sauve(fresu) ; // writing of the EOS
607 star.sauve(fresu) ; // writing of the star
608
609 fclose(fresu) ;
610
611
612
613 // Drawings
614 // --------
615
616 if (graph == 1) {
617
618
619 // Cmp defining the surface of the star (via the enthalpy field)
620 Cmp surf = star.get_ent()() ;
621 Cmp surf_ext(mp) ;
622 surf_ext = - 0.2 * surf(0, 0, 0, 0) ;
623 surf_ext.annule(0, star.get_nzet()-1) ;
624 surf.annule(star.get_nzet(), mg.get_nzone()-1) ;
625 surf = surf + surf_ext ;
626 surf = raccord_c1(surf, star.get_nzet()) ;
627
628 // int nzdes = star.get_nzet() ;
629
630 // des_coupe_y(star.get_At(), 0., nzdes, "A\\dt\\u Potential", &surf,
631 // 2.) ;
632 /*
633 for (int i = 1; i<mg.get_nzone()-1; i++) {
634 double rmin = mp.val_r_jk(i, 1, 0, 0);
635 cout <<"rmin " << rmin << endl ;
636 des_coupe_y(star.get_Aphi(), 0., i, "Magnetic field", 0x0, rmin, true, 20,100,100) ;
637 }
638 */
639
640 des_coupe_y(star.get_Aphi(), 0., 1, "Magnetic field lines (A_phi)", 0x0, 1.2, true, 20,100,100) ;
641 des_coupe_y(star.get_jphi(), 0., 1, "Current", 0x0, 1.2, true, 20,100,100) ;
642 des_coupe_y(star.get_Bphi(), 0., 1, "Toroidal magnetic field", 0x0, 1.2, true, 20,100,100) ;
643
644 // des_coupe_y(star.get_ent()(), 0., nzdes, "Enthalpy", &surf) ;
645
646 //strcpy(title, "Gravitational potential \\gn") ;
647
648 //des_coupe_y(star.get_logn()(), 0., nzdes, title, &surf) ;
649
650 //char title[80] ;
651
652 //strcpy(title, "Azimuthal shift N\\u\\gf") ;
653 //des_coupe_y(star.get_nphi()(), 0., nzdes, title, &surf) ;
654
655 //strcpy(title, "Metric potential \\gz") ;
656 //des_coupe_y(star.get_dzeta()(), 0., nzdes, title, &surf) ;
657
658 //strcpy(title, "Metric potential (NB-1) r sin\\gh") ;
659 //des_coupe_y(star.get_tggg()(), 0., nzdes, title, &surf) ;
660
661 //strcpy(title, "A\\u2\\dK\\uij\\dK\\dij\\u") ;
662 //des_coupe_y(star.get_ak_car()(), 0., nzdes, title, &surf) ;
663
664 //output of function M
665 if(1)
666 {
667
668 Tbl maxA_phi = max(abs(star.get_Aphi()));
669 Cmp A_phi_scaled = star.get_Aphi() / maxA_phi.set(0);
670
671 des_coupe_y(-Mn_j(A_phi_scaled, an_j), 0.,
672 1, "deformation M", 0x0, 1.2, true, 20,100,100) ;
673
674 /*
675 FILE* opf_M;
676 double rr, theta, phi;
677 int ii, jj;
678 opf_M=fopen("M.dat","w");
679 cout << maxA_phi.set(0) << endl;
680 for(ii=1;ii<=100;ii++)
681 {
682 for(jj=0;jj<=50;jj++)
683 {
684 rr = 1.2e0 * ii/ 100.0;
685 theta = 3.14 * jj / 50.0;
686 phi = 0.0;
687 fprintf(opf_M,"%e %e %e\n",rr*sin(theta),rr*cos(theta),
688 -float(Mn_j(A_phi_scaled,an_j).val_point(rr, theta, phi)));
689 }
690 fprintf(opf_M,"\n");
691 }
692 fclose(opf_M);
693 */
694 }
695
696 }
697
698
699 // Cleaning
700 // --------
701
702 delete peos ;
703
704 exit(EXIT_SUCCESS) ;
705
706 return EXIT_SUCCESS ;
707
708 }