Debian Codegraph @

C++/Include/et_rot_mag.h

raw symbols SCIP
1 /*
2 * Definition of Lorene class Et_rot_mag
3 *
4 */
5
6 /*
7 * Copyright (c) 2002 Emmanuel Marcq
8 * Copyright (c) 2002,2013 Jerome Novak
9 * Copyright (c) 2013 Deberati Chatterjee
10 *
11 * This file is part of LORENE.
12 *
13 * LORENE is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * LORENE is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with LORENE; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 */
28
29
30 #ifndef __ET_ROT_MAG_H_
31 #define __ET_ROT_MAG_H_
32
33 /*
34 * $Id: et_rot_mag.h,v 1.26 2015/06/12 12:38:24 j_novak Exp $
35 * $Log: et_rot_mag.h,v $
36 * Revision 1.26 2015/06/12 12:38:24 j_novak
37 * Implementation of the corrected formula for the quadrupole momentum.
38 *
39 * Revision 1.25 2014/10/21 09:23:53 j_novak
40 * Addition of global functions mass_g(), angu_mom(), grv2/3() and mom_quad().
41 *
42 * Revision 1.24 2014/10/13 08:52:34 j_novak
43 * Lorene classes and functions now belong to the namespace Lorene.
44 *
45 * Revision 1.23 2014/05/27 12:32:28 j_novak
46 * Added possibility to converge to a given magnetic moment.
47 *
48 * Revision 1.22 2014/05/13 10:06:12 j_novak
49 * Change of magnetic units, to make the Lorene unit system coherent. Magnetic field is now expressed in Lorene units. Improvement on the comments on units.
50 *
51 * Revision 1.21 2014/04/29 13:46:06 j_novak
52 * Addition of switches 'use_B_in_eos' and 'include_magnetisation' to control the model.
53 *
54 * Revision 1.20 2014/04/28 12:48:12 j_novak
55 * Minor modifications.
56 *
57 * Revision 1.19 2013/12/13 16:36:51 j_novak
58 * Addition and computation of magnetisation terms in the Einstein equations.
59 *
60 * Revision 1.18 2013/11/25 13:52:11 j_novak
61 * New class Et_magnetisation to include magnetization terms in the stress energy tensor.
62 *
63 * Revision 1.17 2012/08/12 17:48:36 p_cerda
64 * Magnetstar: New classes for magnetstar. Allowing for non-equatorial symmetry in Etoile et al. Adding B_phi in Et_rot_mag.
65 *
66 * Revision 1.16 2011/10/06 14:55:36 j_novak
67 * equation_of_state() is now virtual to be able to call to the magnetized
68 * Eos_mag.
69 *
70 * Revision 1.15 2005/06/02 11:35:27 j_novak
71 * Added members for sving to a file and reading from it.
72 *
73 * Revision 1.14 2004/03/22 13:12:41 j_novak
74 * Modification of comments to use doxygen instead of doc++
75 *
76 * Revision 1.13 2002/10/11 11:47:35 j_novak
77 * Et_rot_mag::MHD_comput is now virtual.
78 * Use of standard constructor for Tenseur mtmp in Et_rot_mag::equilibrium_mag
79 *
80 * Revision 1.12 2002/10/09 07:54:29 j_novak
81 * Et_rot_bifluid and Et_rot_mag inheritate virtually from Etoile_rot
82 *
83 * Revision 1.11 2002/08/02 15:07:41 j_novak
84 * Member function determinant has been added to the class Metrique.
85 * A better handling of spectral bases is now implemented for the class Tenseur.
86 *
87 * Revision 1.10 2002/06/05 15:15:59 j_novak
88 * The case of non-adapted mapping is treated.
89 * parmag.d and parrot.d have been merged.
90 *
91 * Revision 1.9 2002/06/03 13:23:16 j_novak
92 * The case when the mapping is not adapted is now treated
93 *
94 * Revision 1.8 2002/06/03 13:00:45 e_marcq
95 *
96 * conduc parameter read in parmag.d
97 *
98 * Revision 1.7 2002/05/30 16:06:30 j_novak
99 * added the right et_rot_mag.h
100 *
101 * Revision 1.6 2002/05/20 08:27:59 j_novak
102 * *** empty log message ***
103 *
104 * Revision 1.5 2002/05/17 15:08:01 e_marcq
105 *
106 * Rotation progressive plug-in, units corrected, Q and a_j new member data
107 *
108 * Revision 1.4 2002/05/15 09:53:59 j_novak
109 * First operational version
110 *
111 * Revision 1.3 2002/05/14 13:38:36 e_marcq
112 *
113 *
114 * Unit update, new outputs
115 *
116 * Revision 1.1 2002/05/10 09:26:51 j_novak
117 * Added new class Et_rot_mag for magnetized rotating neutron stars (under development)
118 *
119 *
120 * $Header: /cvsroot/Lorene/C++/Include/et_rot_mag.h,v 1.26 2015/06/12 12:38:24 j_novak Exp $
121 *
122 */
123
124 // Headers Lorene
125
126 #include "etoile.h"
127 #include "tensor.h"
128
129 namespace Lorene {
130
131 // Local prototype (for determining the surface)
132 Cmp prolonge_c1(const Cmp& uu, const int nzet) ;
133
134 /**
135 * Class for magnetized (isolator or perfect conductor),
136 * rigidly rotating stars. \ingroup (star)
137 *
138 * This is a child class of \c Etoile_rot , with the same metric
139 * and overloaded member functions. Triaxial pertubrations are not
140 * operational.
141 *
142 */
143 class Et_rot_mag : public Etoile_rot {
144
145 // Data :
146 // -----
147 protected:
148
149 ///t-component of the elecctromagnetic potential 1-form, divided by \f$\mu_0\f$.
150 Cmp A_t ;
151 /**
152 * \f$\varphi\f$-component of the electromagnetic potential 1-form
153 * divided by \f$\mu_0\f$.
154 */
155 Cmp A_phi;
156
157 Cmp B_phi; ///< \f$\varphi\f$-component of the magnetic field
158 Cmp j_t; ///< t-component of the current 4-vector
159 Cmp j_phi; ///< \f$\varphi\f$-component of the current 4-vector
160
161 Tenseur E_em; ///< electromagnetic energy density in the Eulerian frame
162
163 /**
164 * \f$\varphi\f$ component of the electromagnetic momentum density 3-vector,
165 * as measured in the Eulerian frame.
166 */
167 Tenseur Jp_em;
168
169 ///rr component of the electromagnetic stress 3-tensor, as measured in the Eulerian frame. (not used and set to 0, should be supressed)
170 Tenseur Srr_em;
171
172 ///\f$\varphi \varphi\f$ component of the electromagnetic stress 3-tensor, as measured in the Eulerian frame.
173 Tenseur Spp_em;
174
175 /**
176 * In the case of a perfect conductor, the requated baryonic charge.
177 * For an isolator, the charge/baryon.
178 */
179 double Q ;
180 double a_j ; ///<Amplitude of the curent/charge function
181 int conduc ; ///<Flag: conduc=0->isolator, 1->perfect conductor
182
183 // Constructors - Destructor
184 // -------------------------
185 public:
186
187 /// Standard constructor
188 Et_rot_mag(Map& mp_i, int nzet_i, bool relat, const Eos& eos_i,
189 const int cond);
190
191
192 Et_rot_mag(const Et_rot_mag& ) ; ///< Copy constructor
193
194
195 /** Constructor from a file (see \c sauve(FILE*) ).
196 *
197 * @param mp_i Mapping on which the star will be defined
198 * @param eos_i Equation of state of the stellar matter
199 * @param fich input file (must have been created by the function
200 * \c sauve )
201 * @param withbphi flag to create classes with toroidal field
202 */
203 Et_rot_mag(Map& mp_i, const Eos& eos_i, FILE* fich, int withbphi=0) ;
204
205
206 virtual ~Et_rot_mag() ; ///< Destructor
207
208
209 // Memory management
210 // -----------------
211 protected:
212
213 /// Deletes all the derived quantities
214 virtual void del_deriv() const ;
215
216 /// Sets to \c 0x0 all the pointers on derived quantities
217 virtual void set_der_0x0() const ;
218
219 /** Sets to \c ETATNONDEF (undefined state) the hydrodynamical
220 * quantities relative to the Eulerian observer.
221 */
222 virtual void del_hydro_euler() ;
223
224
225 // Mutators / assignment
226 // ---------------------
227 public:
228
229 /// Assignment to another Et_rot_mag
230 void operator=(const Et_rot_mag&) ;
231
232 /* /\** Computes the proper baryon and energy density, as well as */
233 /* * pressure from the enthalpy. */
234 /* *\/ */
235 /* virtual void equation_of_state() ; */
236
237 // Accessors
238 // ---------
239 public:
240 /// Tells if the star is made of conducting or isolating material
241 bool is_conduct() const {return (conduc==1) ;} ;
242 /**
243 * Returns the t component of the electromagnetic potential,
244 * divided by \f$\mu_0\f$.
245 */
246 const Cmp& get_At() const {return A_t ; } ;
247 /**
248 * Returns the \f$\varphi\f$ component of the electromagnetic potential
249 * divided by \f$\mu_0\f$.
250 */
251 const Cmp& get_Aphi() const {return A_phi ;} ;
252
253 ///Returns the \f$\varphi\f$ component of the magnetic field
254 const Cmp& get_Bphi() const {return B_phi ;} ;
255 ///Returns the t component of the current 4-vector
256 const Cmp& get_jt() const {return j_t ; } ;
257 ///Returns the \f$\varphi\f$ component of the current 4-vector
258 const Cmp& get_jphi() const {return j_phi ;} ;
259 ///Returns the electromagnetic energy density in the Eulerian frame
260 const Tenseur& get_Eem() const {return E_em ; } ;
261
262 /** Returns the \f$\varphi\f$-component of the electromagnetic momentum
263 * density 3-vector, as measured in the Eulerian frame.
264 */
265 const Tenseur& get_Jpem() const {return Jp_em ;} ;
266
267 /** Returns the rr-component of the electromagnetic stress 3-tensor,
268 * as measured in the Eulerian frame. (not used and always equal to 0,
269 * should be supressed)
270 */
271 const Tenseur& get_Srrem() const {return Srr_em ; } ;
272
273 /** Returns the \f$\varphi \varphi\f$ component of the electromagnetic
274 * stress 3-tensor, as measured in the Eulerian frame.
275 */
276 const Tenseur& get_Sppem() const {return Spp_em ;} ;
277
278 /**
279 * Returns the requested electric charge in the case of a perfect conductor
280 * and the charge/baryon for an isolator.
281 */
282 double get_Q() const {return Q ;} ;
283 ///Returns the amplitude of the current/charge function
284 double get_a_j() const {return a_j ;} ;
285
286 // Outputs
287 // -------
288 public:
289 virtual void sauve(FILE* ) const ; ///< Save in a file
290
291 /// Operator >> (virtual function called by the operator <<).
292 virtual ostream& operator>>(ostream& ) const ;
293
294 // Global quantities
295 // -----------------
296 public:
297 /// Computes the electric field spherical components in Lorene's units
298 Tenseur Elec() const ;
299 /// Computes the magnetic field spherical components in Lorene's units
300 Tenseur Magn() const ;
301 /// Computes the electromagnetic part of the stress-energy tensor
302 virtual void MHD_comput() ;
303 virtual double mass_g() const ; ///< Gravitational mass
304 virtual double angu_mom() const ; ///< Angular momentum
305 virtual double grv2() const ; ///< Error on the virial identity GRV2
306 virtual double tsw() const ; ///< Ratio T/W
307 double MagMom() const ; ///< Magnetic Momentum \f$\cal M\f$ in SI units
308 /// Computed charge deduced from the asymptotic behaviour of At [SI units].
309 double Q_comput() const;
310
311 /** Computed charge from the integration of charge density over the star
312 * (i.e. without surface charge) [SI units].
313 */
314 double Q_int() const;
315
316 /// Gyromagnetic ratio \f$\sigma = \frac{2{\cal M}M}{QJ}\f$.
317 double GyroMag() const ;
318
319 /** Error on the virial identity GRV3.
320 * The error is computed as the integral defined
321 * by Eq. (43) of [Gourgoulhon and Bonazzola,
322 * \a Class. \a Quantum \a Grav. \b 11 , 443 (1994)] divided by
323 * the integral of the matter terms.
324 *
325 * @param ost output stream to give details of the computation;
326 * if set to 0x0 [default value], no details will be
327 * given.
328 *
329 */
330 virtual double grv3(ostream* ost = 0x0) const ;
331
332 /** Part of the quadrupole moment.
333 * This term \f${\bar Q }\f$ is defined by Laarakkers and Poisson,
334 * \a Astrophys. \a J. \b 512 , 282 (1999). Note that \f${\bar Q }\f$
335 * is the negative of the (wrong) quadrupole moment defined in Eq. (7) of
336 * [Salgado, Bonazzola, Gourgoulhon and Haensel, \a Astron. \a Astrophys.
337 * \b 291 , 155 (1994)].
338 */
339 virtual double mom_quad_old() const ;
340
341 // Computational routines
342 // ----------------------
343 public:
344 /** Computes the electromagnetic quantities solving the Maxwell
345 * equations (6) and (7) of [Bocquet, Bonazzola, Gourgoulhon and
346 * Novak, \a Astron. \a Astrophys. \b 301 , 757 (1995)]. In the case
347 * of a perfect conductor, le electromagnetic potential may have
348 * a discontinuous derivative across star's surface.
349 *
350 * @param conduc [input] flag: 0 for an isolator, 1 for a perfect
351 * conductor
352 * @param adapt_flag [input] flag: if 0 the mapping is NOT adapted
353 * to star's surface
354 * @param f_j [input] current or charge coupling function
355 * (see Bocquet et al. 1995).
356 * @param par_poisson_At [input] parameters for controlling the
357 * solution of the Poisson equation
358 * for At potential (see file
359 * et_rot_mag_equil.C)
360 * @param par_poisson_Avect [input] parameters for controlling the
361 * solution of vector Poisson equation
362 * for magnetic potential (see file
363 * et_rot_mag_equil.C)
364 */
365 void magnet_comput(const int adapt_flag,
366 Cmp (*f_j)(const Cmp& x, const double),
367 Param& par_poisson_At, Param& par_poisson_Avect) ;
368
369
370 /** Computes the electromagnetic quantities solving the Maxwell
371 * equations (6) and (7) of [Bocquet, Bonazzola, Gourgoulhon and
372 * Novak, \a Astron. \a Astrophys. \b 301 , 757 (1995)]. In the case
373 * of a perfect conductor, le electromagnetic potential may have
374 * a discontinuous derivative across star's surface.
375 *
376 * @param adapt_flag [input] flag: if 0 the mapping is NOT adapted
377 * to star's surface
378 * @param initial_j [input] flag: initial current for the iteration:
379 * 0= no current, 1=dipolar-like current
380 * , 2= quadrupolar-like current
381 * @param a_j0 [input] amplitude of the non-force free current
382 * @param f_j [input] current coupling function (non-FF part)
383 * (see Bocquet et al. 1995).
384 * @param b_j0 [input] amplitude of the force free current
385 * @param g_j [input] current coupling function (FF-part)
386 * @param N_j [input] current coupling function (FF-part)
387 * @param par_poisson_At [input] parameters for controlling the
388 * solution of the Poisson equation
389 * for At potential (see file
390 * et_rot_mag_equil.C)
391 * @param par_poisson_Avect [input] parameters for controlling the
392 * solution of vector Poisson equation
393 * for magnetic potential (see file
394 * et_rot_mag_equil.C)
395 */
396 virtual void magnet_comput_plus(const int adapt_flag, const int initial_j,
397 const Tbl an_j,
398 Cmp (*f_j)(const Cmp& x, const Tbl),
399 const Tbl bn_j,
400 Cmp (*g_j)(const Cmp& x, const Tbl),
401 Cmp (*N_j)(const Cmp& x, const Tbl),
402 Param& par_poisson_At, Param& par_poisson_Avect) ;
403
404 /** Computes an equilibrium configuration.
405 *
406 * @param ent_c [input] Central enthalpy
407 * @param omega0 [input] Requested angular velocity
408 * (if \c fact_omega=1. )
409 * @param fact_omega [input] 1.01 = search for the Keplerian frequency,
410 * 1. = otherwise.
411 * @param nzadapt [input] Number of (inner) domains where the mapping
412 * adaptation to an iso-enthalpy surface
413 * should be performed
414 * @param ent_limit [input] 1-D \c Tbl of dimension \c nzet which
415 * defines the enthalpy at the outer boundary
416 * of each domain
417 * @param icontrol [input] Set of integer parameters (stored as a
418 * 1-D \c Itbl of size 8) to control the
419 * iteration:
420 * \li \c icontrol(0) = mer_max : maximum number of steps
421 * \li \c icontrol(1) = mer_rot : step at which the rotation is
422 * switched on
423 * \li \c icontrol(2) = mer_change_omega : step at which the rotation
424 * velocity is changed to reach the final one
425 * \li \c icontrol(3) = mer_fix_omega : step at which the final
426 * rotation velocity must have been reached
427 * \li \c icontrol(4) = mer_mass : the absolute value of
428 * \c mer_mass is the step from which the
429 * baryon mass is forced to converge,
430 * by varying the central enthalpy
431 * (\c mer_mass > 0 ) or the angular
432 * velocity (\c mer_mass < 0 )
433 * \li \c icontrol(5) = mermax_poisson : maximum number of steps in
434 * \c Map_et::poisson
435 * \li \c icontrol(6) = mer_triax : step at which the 3-D
436 * perturbation is switched on
437 * \li \c icontrol(7) = delta_mer_kep : number of steps
438 * after \c mer_fix_omega when \c omega
439 * starts to be increased by \c fact_omega
440 * to search for the Keplerian velocity
441 * \li \c icontrol(8) = mer_mag : step at which the electromagnetic
442 * part is switched on
443 * \li \c icontrol(9) = mer_change_mag : step at which the amplitude
444 * of the current/charge coupling function is changed
445 * to reach a_j0 or Q
446 * \li \c icontrol(10) = mer_fix_mag : step at which the final
447 * current/charge amplitude a_j0 or Q must have
448 * been reached
449 * \li \c icontrol(11) = conduc : flag 0 -> isolator material,
450 * 1 -> perfect conductor
451 *
452 * @param control [input] Set of parameters (stored as a
453 * 1-D \c Tbl of size 7) to control the
454 * iteration:
455 * \li \c control(0) = precis : threshold on the enthalpy relative
456 * change for ending the computation
457 * \li \c control(1) = omega_ini : initial angular velocity,
458 * switched on only if \c mer_rot < 0 ,
459 * otherwise 0 is used
460 * \li \c control(2) = relax : relaxation factor in the main
461 * iteration
462 * \li \c control(3) = relax_poisson : relaxation factor in
463 * \c Map_et::poisson
464 * \li \c control(4) = thres_adapt : threshold on dH/dr for
465 * freezing the adaptation of the mapping
466 * \li \c control(5) = ampli_triax : relative amplitude of
467 * the 3-D perturbation
468 * \li \c control(6) = precis_adapt : precision for
469 * \c Map_et::adapt
470 * \li \c control(7) = Q_ini : initial charge (total for the perfect
471 * conductor, per baryon for an isolator)
472 * \li \c control(8) = a_j_ini : initial amplitude for the coupling
473 * function
474 *
475 *
476 * @param mbar_wanted [input] Requested baryon mass (effective only
477 * if \c mer_mass>mer_max )
478 * @param aexp_mass [input] Exponent for the increase factor of the
479 * central enthalpy to converge to the
480 * requested baryon mass
481 * @param diff [output] 1-D \c Tbl of size 1 for the storage of
482 * some error indicators :
483 * \li \c diff(0) : Relative change in the enthalpy field
484 * between two successive steps
485 * @param Q0 [input] Requested electric charge for the case of a
486 * perfect conductor. Charge per baryon for the case
487 * of an isolator.
488 * @param a_j0 [input] Amplitude for the current/charge coupling function
489 *
490 * @param f_j [input] current or charge coupling function
491 * (see Bocquet et al. 1995).
492 *
493 * @param M_j [input] primitive (null for zero) of current/charge
494 * coupling function (see Bocquet et al. 1995)
495 * used for the first integral of stationary motion.
496 */
497 void equilibrium_mag(double ent_c, double omega0, double fact_omega,
498 int nzadapt, const Tbl& ent_limit, const Itbl& icontrol,
499 const Tbl& control, double mbar_wanted, double aexp_mass,
500 Tbl& diff, const double Q0, const double a_j0,
501 Cmp (*f_j)(const Cmp& x, const double),
502 Cmp (*M_j)(const Cmp& x,const double));
503
504
505 /** Computes an equilibrium configuration.
506 *
507 * @param ent_c [input] Central enthalpy
508 * @param omega0 [input] Requested angular velocity
509 * (if \c fact_omega=1. )
510 * @param fact_omega [input] 1.01 = search for the Keplerian frequency,
511 * 1. = otherwise.
512 * @param nzadapt [input] Number of (inner) domains where the mapping
513 * adaptation to an iso-enthalpy surface
514 * should be performed
515 * @param ent_limit [input] 1-D \c Tbl of dimension \c nzet which
516 * defines the enthalpy at the outer boundary
517 * of each domain
518 * @param icontrol [input] Set of integer parameters (stored as a
519 * 1-D \c Itbl of size 8) to control the
520 * iteration:
521 * \li \c icontrol(0) = mer_max : maximum number of steps
522 * \li \c icontrol(1) = mer_rot : step at which the rotation is
523 * switched on
524 * \li \c icontrol(2) = mer_change_omega : step at which the rotation
525 * velocity is changed to reach the final one
526 * \li \c icontrol(3) = mer_fix_omega : step at which the final
527 * rotation velocity must have been reached
528 * \li \c icontrol(4) = mer_mass : the absolute value of
529 * \c mer_mass is the step from which the
530 * baryon mass is forced to converge,
531 * by varying the central enthalpy
532 * (\c mer_mass > 0 ) or the angular
533 * velocity (\c mer_mass < 0 )
534 * \li \c icontrol(5) = mermax_poisson : maximum number of steps in
535 * \c Map_et::poisson
536 * \li \c icontrol(6) = mer_triax : step at which the 3-D
537 * perturbation is switched on
538 * \li \c icontrol(7) = delta_mer_kep : number of steps
539 * after \c mer_fix_omega when \c omega
540 * starts to be increased by \c fact_omega
541 * to search for the Keplerian velocity
542 * \li \c icontrol(8) = mer_mag : step at which the electromagnetic
543 * part is switched on
544 * \li \c icontrol(9) = mer_change_mag : step at which the amplitude
545 * of the current/charge coupling function is changed
546 * to reach a_j0 or Q
547 * \li \c icontrol(10) = mer_fix_mag : step at which the final
548 * current/charge amplitude a_j0 or Q must have
549 * been reached
550 * \li \c icontrol(11) = conduc : flag 0 -> isolator material,
551 * 1 -> perfect conductor
552 *
553 * @param control [input] Set of parameters (stored as a
554 * 1-D \c Tbl of size 7) to control the
555 * iteration:
556 * \li \c control(0) = precis : threshold on the enthalpy relative
557 * change for ending the computation
558 * \li \c control(1) = omega_ini : initial angular velocity,
559 * switched on only if \c mer_rot < 0 ,
560 * otherwise 0 is used
561 * \li \c control(2) = relax : relaxation factor in the main
562 * iteration
563 * \li \c control(3) = relax_poisson : relaxation factor in
564 * \c Map_et::poisson
565 * \li \c control(4) = thres_adapt : threshold on dH/dr for
566 * freezing the adaptation of the mapping
567 * \li \c control(5) = ampli_triax : relative amplitude of
568 * the 3-D perturbation
569 * \li \c control(6) = precis_adapt : precision for
570 * \c Map_et::adapt
571 * \li \c control(7) = Q_ini : initial charge (total for the perfect
572 * conductor, per baryon for an isolator)
573 * \li \c control(8) = a_j_ini : initial amplitude for the coupling
574 * function
575 *
576 *
577 * @param mbar_wanted [input] Requested baryon mass (effective only
578 * if \c mer_mass>mer_max )
579 * @param aexp_mass [input] Exponent for the increase factor of the
580 * central enthalpy to converge to the
581 * requested baryon mass
582 * @param diff [output] 1-D \c Tbl of size 1 for the storage of
583 * some error indicators :
584 * \li \c diff(0) : Relative change in the enthalpy field
585 * between two successive steps
586 * @param Q0 [input] Requested electric charge for the case of a
587 * perfect conductor. Charge per baryon for the case
588 * of an isolator.
589 * @param a_j0 [input] Amplitude for the current/charge coupling function
590 *
591 * @param f_j [input] current or charge coupling function
592 * (see Bocquet et al. 1995).
593 *
594 * @param M_j [input] primitive (null for zero) of current/charge
595 * coupling function (see Bocquet et al. 1995)
596 * used for the first integral of stationary motion.
597 */
598 void equilibrium_mag_plus( const Itbl& icontrol, const Tbl& control,
599 Tbl& diff,
600 const int initial_j,
601 const Tbl an_j,
602 Cmp (*f_j)(const Cmp& x, const Tbl),
603 Cmp (*M_j)(const Cmp& x,const Tbl),
604 const Tbl bn_j,
605 Cmp (*g_j)(const Cmp& x, const Tbl),
606 Cmp (*N_j)(const Cmp& x,const Tbl),
607 const double relax_mag);
608 };
609
610 class Et_magnetisation : public Et_rot_mag {
611
612 // Data :
613 // -----
614 protected:
615
616 ///Flag : true if the value of the magnetic field is used in the Eos.
617 bool use_B_in_eos ;
618
619 ///Flag : true if magnetisation terms are included in the equations.
620 bool include_magnetisation ;
621
622 Scalar xmag ; ///< The magnetisation scalar.
623
624 Scalar E_I; ///< Interaction (magnetisation) energy density.
625
626 ///Interaction momentum density 3-vector.
627 Vector J_I;
628
629 ///Interaction stress 3-tensor.
630 Sym_tensor Sij_I;
631
632 // Constructors - Destructor
633 // -------------------------
634 public:
635
636 /// Standard constructor
637 Et_magnetisation(Map& mp_i, int nzet_i, bool relat, const Eos& eos_i,
638 bool include_mag=true, bool use_B = true);
639
640
641 Et_magnetisation(const Et_magnetisation& ) ; ///< Copy constructor
642
643
644 /** Constructor from a file (see \c sauve(FILE*) ).
645 *
646 * @param mp_i Mapping on which the star will be defined
647 * @param eos_i Equation of state of the stellar matter
648 * @param fich input file (must have been created by the function
649 * \c sauve )
650 */
651 Et_magnetisation(Map& mp_i, const Eos& eos_i, FILE* fich) ;
652
653 virtual ~Et_magnetisation() ; ///< Destructor
654
655 // Mutators / assignment
656 // ---------------------
657 public:
658
659 /// Assignment to another Et_rot_mag
660 void operator=(const Et_magnetisation&) ;
661
662 /** Computes the proper baryon and energy density, as well as
663 * pressure from the enthalpy.
664 */
665 virtual void equation_of_state() ;
666
667 // Accessors
668 // ---------
669 public:
670 ///Public accessor to the \c use_B_in_eos flag.
671 bool B_in_eos() const {return use_B_in_eos;};
672
673 ///Public accessor to the \c include_magnetisation flag.
674 bool use_magnetisation() const {return include_magnetisation;} ;
675
676 ///Accessor to the magnetisation scalar field.
677 const Scalar& get_magnetisation() const {return xmag;} ;
678
679 ///Accessor to the interaction energy density.
680 const Scalar& get_E_I() const {return E_I;} ;
681
682 ///Accessor to the interaction momentum vector.
683 const Vector& get_J_I() const {return J_I;} ;
684
685 ///Accessor to the interaction stress tensor.
686 const Sym_tensor& get_Sij_I() const {return Sij_I;} ;
687
688 // Outputs
689 // -------
690 public:
691 virtual void sauve(FILE* ) const ; ///< Save in a file
692
693 /// Operator >> (virtual function called by the operator <<).
694 virtual ostream& operator>>(ostream& ) const ;
695
696 // Global quantities
697 // -----------------
698 public:
699 virtual double mass_g() const ; ///< Gravitational mass
700 virtual double angu_mom() const ; ///< Angular momentum
701 virtual double grv2() const ; ///< Error on the virial identity GRV2
702
703 /** Error on the virial identity GRV3.
704 * The error is computed as the integral defined
705 * by Eq. (43) of [Gourgoulhon and Bonazzola,
706 * \a Class. \a Quantum \a Grav. \b 11 , 443 (1994)] divided by
707 * the integral of the matter terms.
708 *
709 * @param ost output stream to give details of the computation;
710 * if set to 0x0 [default value], no details will be
711 * given.
712 *
713 */
714 virtual double grv3(ostream* ost = 0x0) const ;
715
716 /** Part of the quadrupole moment.
717 * This term \f${\bar Q }\f$ is defined by Laarakkers and Poisson,
718 * \a Astrophys. \a J. \b 512 , 282 (1999). Note that \f${\bar Q }\f$
719 * is the negative of the (wrong) quadrupole moment defined in Eq. (7) of
720 * [Salgado, Bonazzola, Gourgoulhon and Haensel, \a Astron. \a Astrophys.
721 * \b 291 , 155 (1994)].
722 */
723 virtual double mom_quad_old() const ;
724
725 /** Part of the quadrupole moment.
726 * \f$B_o\f$ is defined as \f$bM^2\f$, where \e b is given by Eq. (3.37) of
727 * [Friedman and Stergioulas, \a Rotating \a Relativistic \a Stars,
728 * Cambridge Monograph on mathematical physics] and \e M is the
729 * the gravitational mass of the star.
730 */
731 virtual double mom_quad_Bo() const ;
732
733 // Computational routines
734 // ----------------------
735 public:
736 /** Computes the electromagnetic quantities solving the Maxwell
737 * equations (6) and (7) of [Bocquet, Bonazzola, Gourgoulhon and
738 * Novak, \a Astron. \a Astrophys. \b 301 , 757 (1995)]. In the case
739 * of a perfect conductor, le electromagnetic potential may have
740 * a discontinuous derivative across star's surface.
741 *
742 * @param conduc [input] flag: 0 for an isolator, 1 for a perfect
743 * conductor
744 * @param adapt_flag [input] flag: if 0 the mapping is NOT adapted
745 * to star's surface
746 * @param f_j [input] current or charge coupling function
747 * (see Bocquet et al. 1995).
748 * @param par_poisson_At [input] parameters for controlling the
749 * solution of the Poisson equation
750 * for At potential (see file
751 * et_rot_mag_equil.C)
752 * @param par_poisson_Avect [input] parameters for controlling the
753 * solution of vector Poisson equation
754 * for magnetic potential (see file
755 * et_rot_mag_equil.C)
756 */
757 virtual void magnet_comput(const int adapt_flag,
758 Cmp (*f_j)(const Cmp& x, const double),
759 Param& par_poisson_At, Param& par_poisson_Avect) ;
760
761 /// Computes the electromagnetic part of the stress-energy tensor
762 virtual void MHD_comput() ;
763
764 /** Computes an equilibrium configuration.
765 *
766 * @param ent_c [input] Central enthalpy
767 * @param omega0 [input] Requested angular velocity
768 * (if \c fact_omega=1. )
769 * @param fact_omega [input] 1.01 = search for the Keplerian frequency,
770 * 1. = otherwise.
771 * @param nzadapt [input] Number of (inner) domains where the mapping
772 * adaptation to an iso-enthalpy surface
773 * should be performed
774 * @param ent_limit [input] 1-D \c Tbl of dimension \c nzet which
775 * defines the enthalpy at the outer boundary
776 * of each domain
777 * @param icontrol [input] Set of integer parameters (stored as a
778 * 1-D \c Itbl of size 11) to control the
779 * iteration:
780 * \li \c icontrol(0) = mer_max : maximum number of steps
781 * \li \c icontrol(1) = mer_rot : step at which the rotation is
782 * switched on
783 * \li \c icontrol(2) = mer_change_omega : step at which the rotation
784 * velocity is changed to reach the final one
785 * \li \c icontrol(3) = mer_fix_omega : step at which the final
786 * rotation velocity must have been reached
787 * \li \c icontrol(4) = mer_mass : the absolute value of
788 * \c mer_mass is the step from which the
789 * baryon mass is forced to converge,
790 * by varying the central enthalpy
791 * (\c mer_mass > 0 ) or the angular
792 * velocity (\c mer_mass < 0 )
793 * \li \c icontrol(5) = mermax_poisson : maximum number of steps in
794 * \c Map_et::poisson
795 * \li \c icontrol(6) = delta_mer_kep : number of steps
796 * after \c mer_fix_omega when \c omega
797 * starts to be increased by \c fact_omega
798 * to search for the Keplerian velocity
799 * \li \c icontrol(7) = mer_mag : step at which the electromagnetic
800 * part is switched on
801 * \li \c icontrol(8) = mer_change_mag : step at which the amplitude
802 * of the current/charge coupling function is changed
803 * to reach a_j0 or Q
804 * \li \c icontrol(9) = mer_fix_mag : step at which the final
805 * current/charge amplitude a_j0 or Q must have
806 * been reached
807 * \li \c icontrol(10) = mer_magmom : step from which the
808 * magnetic moment is forced to converge,
809 * by varying the current function amplitude.
810 *
811 * @param control [input] Set of parameters (stored as a
812 * 1-D \c Tbl of size 8) to control the
813 * iteration:
814 * \li \c control(0) = precis : threshold on the enthalpy relative
815 * change for ending the computation
816 * \li \c control(1) = omega_ini : initial angular velocity,
817 * switched on only if \c mer_rot < 0 ,
818 * otherwise 0 is used
819 * \li \c control(2) = relax : relaxation factor in the main
820 * iteration
821 * \li \c control(3) = relax_poisson : relaxation factor in
822 * \c Map_et::poisson
823 * \li \c control(4) = thres_adapt : threshold on dH/dr for
824 * freezing the adaptation of the mapping
825 * \li \c control(5) = precis_adapt : precision for
826 * \c Map_et::adapt
827 * \li \c control(6) = Q_ini : initial charge (total for the perfect
828 * conductor, per baryon for an isolator)
829 * \li \c control(7) = a_j_ini : initial amplitude for the coupling
830 * function
831 *
832 *
833 * @param mbar_wanted [input] Requested baryon mass (effective only
834 * if \c mer_mass>mer_max )
835 * @param aexp_mass [input] Exponent for the increase factor of the
836 * central enthalpy to converge to the
837 * requested baryon mass
838 * @param diff [output] 1-D \c Tbl of size 1 for the storage of
839 * some error indicators :
840 * \li \c diff(0) : Relative change in the enthalpy field
841 * between two successive steps
842 * @param Q0 [input] Requested electric charge for the case of a
843 * perfect conductor. Charge per baryon for the case
844 * of an isolator.
845 * @param a_j0 [input] Amplitude for the current/charge coupling function
846 *
847 * @param f_j [input] current or charge coupling function
848 * (see Bocquet et al. 1995).
849 *
850 * @param M_j [input] primitive (null for zero) of current/charge
851 * coupling function (see Bocquet et al. 1995)
852 * used for the first integral of stationary motion.
853 */
854 void equilibrium_mag(double ent_c, double omega0, double fact_omega,
855 int nzadapt, const Tbl& ent_limit, const Itbl& icontrol,
856 const Tbl& control, double mbar_wanted,
857 double magmom_wanted, double aexp_mass,
858 Tbl& diff, double Q0, double a_j0,
859 Cmp (*f_j)(const Cmp& x, const double),
860 Cmp (*M_j)(const Cmp& x,const double));
861
862 };
863
864 }
865 #endif
866