File: et_bin_nsbh.C

package info (click to toggle)
lorene 0.0.0~cvs20161116%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, stretch
  • size: 26,444 kB
  • ctags: 13,953
  • sloc: cpp: 212,946; fortran: 21,645; makefile: 1,750; sh: 4
file content (449 lines) | stat: -rw-r--r-- 13,087 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
/*
 *  Methods for the class Et_bin_nsbh
 *
 *    (see file et_bin_nsbh.h for documentation).
 *
 */

/*
 *   Copyright (c) 2003 Keisuke Taniguchi
 *
 *   This file is part of LORENE.
 *
 *   LORENE is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License version 2
 *   as published by the Free Software Foundation.
 *
 *   LORENE is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with LORENE; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

char et_bin_nsbh_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_nsbh.C,v 1.12 2014/10/13 08:52:56 j_novak Exp $" ;

/*
 * $Id: et_bin_nsbh.C,v 1.12 2014/10/13 08:52:56 j_novak Exp $
 * $Log: et_bin_nsbh.C,v $
 * Revision 1.12  2014/10/13 08:52:56  j_novak
 * Lorene classes and functions now belong to the namespace Lorene.
 *
 * Revision 1.11  2014/10/06 15:13:08  j_novak
 * Modified #include directives to use c++ syntax.
 *
 * Revision 1.10  2006/09/25 10:01:49  p_grandclement
 * Addition of N-dimensional Tbl
 *
 * Revision 1.9  2006/06/01 12:47:53  p_grandclement
 * update of the Bin_ns_bh project
 *
 * Revision 1.8  2005/08/29 15:10:16  p_grandclement
 * Addition of things needed :
 *   1) For BBH with different masses
 *   2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
 *   WORKING YET !!!
 *
 * Revision 1.7  2004/06/09 06:39:35  k_taniguchi
 * Introduce set_n_auto() and set_confpsi_auto().
 *
 * Revision 1.6  2004/03/25 10:29:04  j_novak
 * All LORENE's units are now defined in the namespace Unites (in file unites.h).
 *
 * Revision 1.5  2003/12/16 05:30:18  k_taniguchi
 * Some changes in the constructor from file and the saving to file.
 *
 * Revision 1.4  2003/11/28 04:30:22  k_taniguchi
 * Add the output operator.
 *
 * Revision 1.3  2003/10/24 12:30:58  k_taniguchi
 * Add some derivative terms
 *
 * Revision 1.2  2003/10/22 08:12:46  k_taniguchi
 * Supress some terms in Et_bin_nsbh::sauve.
 *
 * Revision 1.1  2003/10/21 11:50:38  k_taniguchi
 * Methods for class Et_bin_nsbh
 *
 *
 * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_nsbh.C,v 1.12 2014/10/13 08:52:56 j_novak Exp $
 *
 */

// C headers
#include <cmath>

// Lorene headers
#include "et_bin_nsbh.h"
#include "etoile.h"
#include "eos.h"
#include "utilitaires.h"
#include "param.h"
#include "unites.h"

                            //--------------//
                            // Constructors //
                            //--------------//

// Standard constructor
// --------------------
namespace Lorene {
Et_bin_nsbh::Et_bin_nsbh(Map& mp_i, int nzet_i, bool relat, const Eos& eos_i,
			 bool irrot, const Base_vect& ref_triad_i)
    : Etoile_bin(mp_i, nzet_i, relat, eos_i, irrot, ref_triad_i),
      n_auto(mp_i),
      n_comp(mp_i),
      d_n_auto(mp_i, 1, COV, ref_triad_i),
      d_n_comp(mp_i, 1, COV, ref_triad_i),
      confpsi(mp_i),
      confpsi_auto(mp_i),
      confpsi_comp(mp_i),
      d_confpsi_auto(mp_i, 1, COV, ref_triad_i),
      d_confpsi_comp(mp_i, 1, COV, ref_triad_i),
      taij_auto(mp_i, 2, CON, ref_triad_i) ,
      taij_comp(mp_i, 2, CON, ref_triad_i),
      taij_tot(mp_i, 2, CON, ref_triad_i) ,
      tkij_auto(mp_i, 2, CON, ref_triad_i),
      tkij_tot(mp_i, 2, CON, ref_triad_i),
      ssjm1_lapse(mp_i),
      ssjm1_confpsi(mp_i) {

    // Pointers of derived quantities initialized to zero :
    set_der_0x0() ;

    // The metric is initialized to the flat one :
    n_auto = 0.5 ;
    n_auto.set_std_base() ;
    n_comp = 0.5 ;
    n_comp.set_std_base() ;
    d_n_auto = 0 ;
    d_n_comp = 0 ;
    confpsi = 1 ;
    confpsi.set_std_base() ;
    confpsi_auto = 0.5 ;
    confpsi_auto.set_std_base() ;
    confpsi_comp = 0.5 ;
    confpsi_comp.set_std_base() ;
    d_confpsi_auto = 0 ;
    d_confpsi_comp = 0 ;

    taij_auto.set_etat_zero() ;
    taij_comp.set_etat_zero() ;
    taij_tot.set_etat_zero() ;
    tkij_auto.set_etat_zero() ;
    tkij_tot.set_etat_zero() ;

    ssjm1_lapse.set_etat_qcq() ;
    ssjm1_lapse = 0. ;
    ssjm1_confpsi.set_etat_qcq() ;
    ssjm1_confpsi = 0. ;

}

// Copy constructor
// ----------------
Et_bin_nsbh::Et_bin_nsbh(const Et_bin_nsbh& et)
    : Etoile_bin(et),
      n_auto(et.n_auto),
      n_comp(et.n_comp),
      d_n_auto(et.d_n_auto),
      d_n_comp(et.d_n_comp),
      confpsi(et.confpsi),
      confpsi_auto(et.confpsi_auto),
      confpsi_comp(et.confpsi_comp),
      d_confpsi_auto(et.d_confpsi_auto),
      d_confpsi_comp(et.d_confpsi_comp),
      taij_auto(et.taij_auto),
      taij_comp(et.taij_comp),
      taij_tot(et.taij_tot),
      tkij_auto(et.tkij_auto),
      tkij_tot(et.tkij_tot),
      ssjm1_lapse(et.ssjm1_lapse),
      ssjm1_confpsi(et.ssjm1_confpsi) {

    set_der_0x0() ;
}

// Constructor from a file
// -----------------------
Et_bin_nsbh::Et_bin_nsbh(Map& mp_i, const Eos& eos_i,
			 const Base_vect& ref_triad_i, FILE* fich, bool old)
    : Etoile_bin(mp_i, eos_i, ref_triad_i, fich),
      n_auto(mp_i),
      n_comp(mp_i),
      d_n_auto(mp_i, 1, COV, ref_triad_i),
      d_n_comp(mp_i, 1, COV, ref_triad_i ),
      confpsi(mp_i),
      confpsi_auto(mp_i),
      confpsi_comp(mp_i),
      d_confpsi_auto(mp_i, 1, COV, ref_triad_i),
      d_confpsi_comp(mp_i, 1, COV, ref_triad_i),
      taij_auto(mp_i, 2, CON, ref_triad_i),
      taij_comp(mp_i, 2, CON, ref_triad_i),
      taij_tot(mp_i, 2, CON, ref_triad_i),
      tkij_auto(mp_i, 2, CON, ref_triad_i),
      tkij_tot(mp_i, 2, CON, ref_triad_i),
      ssjm1_lapse(mp_i),
      ssjm1_confpsi(mp_i) {
    
    // Construct from data in Etoile_bin
    Cmp n_from_file (mp_i, *(mp_i.get_mg()), fich) ;
    n_auto.set_etat_qcq() ;
    n_auto.set() = n_from_file ;
    
    Cmp psi_from_file (mp_i, *(mp_i.get_mg()), fich) ;
    confpsi_auto.set_etat_qcq() ;
    confpsi_auto.set() = psi_from_file ;
    
    if (!old) {
    	Tenseur shift_auto_file (mp, ref_triad_i, fich) ;
    	shift_auto = shift_auto_file ;
    }
    
    // All other fields are initialized to zero or some constants :
    // ----------------------------------------------------------
    n_comp = 0.5 ;
    n_comp.set_std_base() ;
    d_n_auto = 0 ;
    d_n_comp = 0 ;
    confpsi = 1 ;
    confpsi.set_std_base() ;
    confpsi_comp = 0.5 ;
    confpsi_comp.set_std_base() ;
    d_confpsi_auto = 0 ;
    d_confpsi_comp = 0 ;
    taij_auto.set_etat_zero() ;
    taij_comp.set_etat_zero() ;
    taij_tot.set_etat_zero() ;
    tkij_auto.set_etat_zero() ;
    tkij_tot.set_etat_zero() ;
 
    // Read of the saved fields :
    Cmp ssjm1_lapse_file(mp_i, *(mp_i.get_mg()), fich) ;
    ssjm1_lapse = ssjm1_lapse_file ;
   
    Cmp ssjm1_confpsi_file(mp_i, *(mp_i.get_mg()), fich) ;
    ssjm1_confpsi = ssjm1_confpsi_file ;
    
    // Pointers of derived quantities initialized to zero
    // --------------------------------------------------
    set_der_0x0() ;
}

                            //------------//
                            // Destructor //
                            //------------//

Et_bin_nsbh::~Et_bin_nsbh(){

    del_deriv() ;

}

                            //--------------//
                            //  Assignment  //
                            //--------------//

// Assignment to another Et_bin_nsbh
// ---------------------------------
void Et_bin_nsbh::operator=(const Et_bin_nsbh& et) {

    // Assignment of quantities common to the derived classes of Etoile_bin
    Etoile_bin::operator=(et) ;

    n_auto = et.n_auto ;
    n_comp = et.n_comp ;
    d_n_auto = et.d_n_auto ;
    d_n_comp = et.d_n_comp ;
    confpsi = et.confpsi ;
    confpsi_auto = et.confpsi_auto ;
    confpsi_comp = et.confpsi_comp ;
    d_confpsi_auto = et.d_confpsi_auto ;
    d_confpsi_comp = et.d_confpsi_comp ;
    taij_auto = et.taij_auto ;
    taij_comp = et.taij_comp ;
    taij_tot = et.taij_tot ;
    tkij_auto = et.tkij_auto ;
    tkij_tot = et.tkij_tot ;
    ssjm1_lapse = et.ssjm1_lapse ;
    ssjm1_confpsi = et.ssjm1_confpsi ;

    del_deriv() ;  // Deletes all derived quantities
}

Tenseur& Et_bin_nsbh::set_n_auto() {

    del_deriv() ;	// sets to 0x0 all the derived quantities
    return n_auto ;

}

Tenseur& Et_bin_nsbh::set_n_comp() {

    del_deriv() ;	// sets to 0x0 all the derived quantities
    return n_comp ;

}

Tenseur& Et_bin_nsbh::set_confpsi_auto() {

    del_deriv() ;	// sets to 0x0 all the derived quantities
    return confpsi_auto ;

}

Tenseur& Et_bin_nsbh::set_confpsi_comp() {

    del_deriv() ;	// sets to 0x0 all the derived quantities
    return confpsi_comp ;

}

                            //--------------//
                            //    Outputs   //
                            //--------------//

// Save in a file
// --------------
void Et_bin_nsbh::sauve(FILE* fich) const {

    Etoile_bin::sauve(fich) ;

    n_auto().sauve(fich) ;
    confpsi_auto().sauve(fich) ;
    shift_auto.sauve(fich) ;
    
    ssjm1_lapse.sauve(fich) ;
    ssjm1_confpsi.sauve(fich) ;
}


// Printing
// --------

ostream& Et_bin_nsbh::operator>>(ostream& ost) const {

  using namespace Unites ;

    Etoile::operator>>(ost) ;

    ost << endl ;
    ost << "Neutron star in a binary system" << endl ;
    ost << "-------------------------------" << endl ;

    if (irrotational) {
      ost << "irrotational configuration" << endl ;
    }
    else {
      ost << "corotating configuration" << endl ;
    }

    ost << "Absolute abscidia of the stellar center: " <<
      mp.get_ori_x() / km << " km" << endl ;

    ost << "Absolute abscidia of the barycenter of the baryon density : " <<
      xa_barycenter() / km << " km" << endl ;

    double r_0 = 0.5 * ( ray_eq() + ray_eq_pi() ) ;
    double d_ns = fabs( mp.get_ori_x() ) + ray_eq_pi() - r_0 ;
    double d_tilde = 2 * d_ns / r_0 ;

    ost << "d_tilde : " << d_tilde << endl ;

    ost << "Orientation with respect to the absolute frame : " <<
      mp.get_rot_phi() << " rad" << endl ;

    ost << "Central value of gam_euler : "
	<< gam_euler()(0, 0, 0, 0)  << endl ;

    ost << "Central u_euler (U^X, U^Y, U^Z) [c] : "
	<< u_euler(0)(0, 0, 0, 0) << "  "
	<< u_euler(1)(0, 0, 0, 0) << "  "
	<< u_euler(2)(0, 0, 0, 0) << endl ;

    if (irrotational) {
      ost << "Central d_psi (X, Y, Z) [c] :         "
	  << d_psi(0)(0, 0, 0, 0) << "  "
	  << d_psi(1)(0, 0, 0, 0) << "  "
	  << d_psi(2)(0, 0, 0, 0) << endl ;

      ost << "Central vel. / co-orb. (W^X, W^Y, W^Z) [c] : "
	  << wit_w(0)(0, 0, 0, 0) << "  "
	  << wit_w(1)(0, 0, 0, 0) << "  "
	  << wit_w(2)(0, 0, 0, 0) << endl ;

      ost << "Max vel. / co-orb. (W^X, W^Y, W^Z) [c] : "
	  << max(max(wit_w(0))) << "  "
	  << max(max(wit_w(1))) << "  "
	  << max(max(wit_w(2))) << endl ;

      ost << "Min vel. / co-orb. (W^X, W^Y, W^Z) [c] : "
	  << min(min(wit_w(0))) << "  "
	  << min(min(wit_w(1))) << "  "
	  << min(min(wit_w(2))) << endl ;

      double r_surf = mp.val_r(0,1.,M_PI/4,M_PI/4) ;

      ost << "Velocity at (r_surf,pi/4,pi/4) / co-orb. [c] : "
	  << wit_w(0).val_point(r_surf,M_PI/4,M_PI/4) << "  "
	  << wit_w(1).val_point(r_surf,M_PI/4,M_PI/4) << "  "
	  << wit_w(2).val_point(r_surf,M_PI/4,M_PI/4) << endl ;

      ost << "Central value of loggam : "
	  << loggam()(0, 0, 0, 0)  << endl ;
    }

    ost << "Central value of lapse(N) auto :             "
	<< n_auto()(0, 0, 0, 0) << endl ;

    ost << "Central value of confpsi auto :              "
	<< confpsi_auto()(0, 0, 0, 0) << endl ;

    ost << "Central value of shift (N^X, N^Y, N^Z) [c] : "
	<< shift(0)(0, 0, 0, 0) << "  "
	<< shift(1)(0, 0, 0, 0) << "  "
	<< shift(2)(0, 0, 0, 0) << endl ;

    ost << "  ... shift_auto part of it [c] :            "
	<< shift_auto(0)(0, 0, 0, 0) << "  "
	<< shift_auto(1)(0, 0, 0, 0) << "  "
	<< shift_auto(2)(0, 0, 0, 0) << endl ;

    ost << "  ... shift_comp part of it [c] :            "
	<< shift_comp(0)(0, 0, 0, 0) << "  "
	<< shift_comp(1)(0, 0, 0, 0) << "  "
	<< shift_comp(2)(0, 0, 0, 0) << endl ;

    ost << "  ... w_shift (NB: components in the star Cartesian frame) [c] :  "
	<< endl
	<< w_shift(0)(0, 0, 0, 0) << "  "
	<< w_shift(1)(0, 0, 0, 0) << "  "
	<< w_shift(2)(0, 0, 0, 0) << endl ;

    ost << "Central value of khi_shift [km c] : "
        << khi_shift()(0, 0, 0, 0) / km << endl ;

    ost << endl << "Central value of (B^X, B^Y, B^Z)/N [c] : "
	<< bsn(0)(0, 0, 0, 0) << "  "
	<< bsn(1)(0, 0, 0, 0) << "  "
	<< bsn(2)(0, 0, 0, 0) << endl ;

    ost << endl <<
      "Central (d/dX,d/dY,d/dZ)(logn_auto) [km^{-1}] : "
	<< d_n_auto(0)(0, 0, 0, 0) * km << "  "
	<< d_n_auto(1)(0, 0, 0, 0) * km << "  "
	<< d_n_auto(2)(0, 0, 0, 0) * km << endl ;

    ost << endl <<
      "Central (d/dX,d/dY,d/dZ)(beta_auto) [km^{-1}] : "
	<< d_confpsi_auto(0)(0, 0, 0, 0) * km << "  "
	<< d_confpsi_auto(1)(0, 0, 0, 0) * km << "  "
	<< d_confpsi_auto(2)(0, 0, 0, 0) * km << endl ;

    return ost ;
}
}