LORENE
et_rot_mag.h
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 
143 class Et_rot_mag : public Etoile_rot {
144 
145  // Data :
146  // -----
147  protected:
148 
150  Cmp A_t ;
156 
160 
162 
168 
171 
174 
179  double Q ;
180  double a_j ;
181  int conduc ;
182 
183  // Constructors - Destructor
184  // -------------------------
185  public:
186 
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& ) ;
193 
194 
203  Et_rot_mag(Map& mp_i, const Eos& eos_i, FILE* fich, int withbphi=0) ;
204 
205 
206  virtual ~Et_rot_mag() ;
207 
208 
209  // Memory management
210  // -----------------
211  protected:
212 
214  virtual void del_deriv() const ;
215 
217  virtual void set_der_0x0() const ;
218 
222  virtual void del_hydro_euler() ;
223 
224 
225  // Mutators / assignment
226  // ---------------------
227  public:
228 
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:
241  bool is_conduct() const {return (conduc==1) ;} ;
246  const Cmp& get_At() const {return A_t ; } ;
251  const Cmp& get_Aphi() const {return A_phi ;} ;
252 
254  const Cmp& get_Bphi() const {return B_phi ;} ;
256  const Cmp& get_jt() const {return j_t ; } ;
258  const Cmp& get_jphi() const {return j_phi ;} ;
260  const Tenseur& get_Eem() const {return E_em ; } ;
261 
265  const Tenseur& get_Jpem() const {return Jp_em ;} ;
266 
271  const Tenseur& get_Srrem() const {return Srr_em ; } ;
272 
276  const Tenseur& get_Sppem() const {return Spp_em ;} ;
277 
282  double get_Q() const {return Q ;} ;
284  double get_a_j() const {return a_j ;} ;
285 
286  // Outputs
287  // -------
288  public:
289  virtual void sauve(FILE* ) const ;
290 
292  virtual ostream& operator>>(ostream& ) const ;
293 
294  // Global quantities
295  // -----------------
296  public:
298  Tenseur Elec() const ;
300  Tenseur Magn() const ;
302  virtual void MHD_comput() ;
303  virtual double mass_g() const ;
304  virtual double angu_mom() const ;
305  virtual double grv2() const ;
306  virtual double tsw() const ;
307  double MagMom() const ;
308  double Q_comput() const;
310 
314  double Q_int() const;
315 
317  double GyroMag() const ;
318 
330  virtual double grv3(ostream* ost = 0x0) const ;
331 
339  virtual double mom_quad_old() const ;
340 
341  // Computational routines
342  // ----------------------
343  public:
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 
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 
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 
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 
617  bool use_B_in_eos ;
618 
621 
623 
625 
628 
631 
632  // Constructors - Destructor
633  // -------------------------
634  public:
635 
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 
642 
643 
651  Et_magnetisation(Map& mp_i, const Eos& eos_i, FILE* fich) ;
652 
653  virtual ~Et_magnetisation() ;
654 
655  // Mutators / assignment
656  // ---------------------
657  public:
658 
660  void operator=(const Et_magnetisation&) ;
661 
665  virtual void equation_of_state() ;
666 
667  // Accessors
668  // ---------
669  public:
671  bool B_in_eos() const {return use_B_in_eos;};
672 
674  bool use_magnetisation() const {return include_magnetisation;} ;
675 
677  const Scalar& get_magnetisation() const {return xmag;} ;
678 
680  const Scalar& get_E_I() const {return E_I;} ;
681 
683  const Vector& get_J_I() const {return J_I;} ;
684 
686  const Sym_tensor& get_Sij_I() const {return Sij_I;} ;
687 
688  // Outputs
689  // -------
690  public:
691  virtual void sauve(FILE* ) const ;
692 
694  virtual ostream& operator>>(ostream& ) const ;
695 
696  // Global quantities
697  // -----------------
698  public:
699  virtual double mass_g() const ;
700  virtual double angu_mom() const ;
701  virtual double grv2() const ;
702 
714  virtual double grv3(ostream* ost = 0x0) const ;
715 
723  virtual double mom_quad_old() const ;
724 
731  virtual double mom_quad_Bo() const ;
732 
733  // Computational routines
734  // ----------------------
735  public:
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 
762  virtual void MHD_comput() ;
763 
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 
const Cmp & get_Aphi() const
Returns the component of the electromagnetic potential divided by .
Definition: et_rot_mag.h:251
virtual double mom_quad_Bo() const
Part of the quadrupole moment.
virtual double grv3(ostream *ost=0x0) const
Error on the virial identity GRV3.
Tenseur E_em
electromagnetic energy density in the Eulerian frame
Definition: et_rot_mag.h:161
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
bool B_in_eos() const
Public accessor to the use_B_in_eos flag.
Definition: et_rot_mag.h:671
double GyroMag() const
Gyromagnetic ratio .
virtual double angu_mom() const
Angular momentum.
Et_magnetisation(Map &mp_i, int nzet_i, bool relat, const Eos &eos_i, bool include_mag=true, bool use_B=true)
Standard constructor.
const Scalar & get_E_I() const
Accessor to the interaction energy density.
Definition: et_rot_mag.h:680
double Q
In the case of a perfect conductor, the requated baryonic charge.
Definition: et_rot_mag.h:179
virtual void magnet_comput_plus(const int adapt_flag, const int initial_j, const Tbl an_j, Cmp(*f_j)(const Cmp &x, const Tbl), const Tbl bn_j, Cmp(*g_j)(const Cmp &x, const Tbl), Cmp(*N_j)(const Cmp &x, const Tbl), Param &par_poisson_At, Param &par_poisson_Avect)
Computes the electromagnetic quantities solving the Maxwell equations (6) and (7) of [Bocquet...
Lorene prototypes.
Definition: app_hor.h:67
const Tenseur & get_Eem() const
Returns the electromagnetic energy density in the Eulerian frame.
Definition: et_rot_mag.h:260
Scalar E_I
Interaction (magnetisation) energy density.
Definition: et_rot_mag.h:624
Equation of state base class.
Definition: eos.h:209
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
Base class for coordinate mappings.
Definition: map.h:688
Class for isolated rotating stars *** DEPRECATED : use class Star_rot instead ***.
Definition: etoile.h:1499
virtual double mass_g() const
Gravitational mass.
Tenseur Magn() const
Computes the magnetic field spherical components in Lorene's units.
const Scalar & get_magnetisation() const
Accessor to the magnetisation scalar field.
Definition: et_rot_mag.h:677
Basic integer array class.
Definition: itbl.h:122
virtual ~Et_rot_mag()
Destructor.
Definition: et_rot_mag.C:252
virtual void del_hydro_euler()
Sets to ETATNONDEF (undefined state) the hydrodynamical quantities relative to the Eulerian observer...
Definition: et_rot_mag.C:276
Tensor field of valence 1.
Definition: vector.h:188
Cmp A_phi
-component of the electromagnetic potential 1-form divided by .
Definition: et_rot_mag.h:155
void equilibrium_mag(double ent_c, double omega0, double fact_omega, int nzadapt, const Tbl &ent_limit, const Itbl &icontrol, const Tbl &control, double mbar_wanted, double aexp_mass, Tbl &diff, const double Q0, const double a_j0, Cmp(*f_j)(const Cmp &x, const double), Cmp(*M_j)(const Cmp &x, const double))
Computes an equilibrium configuration.
const Cmp & get_jphi() const
Returns the component of the current 4-vector.
Definition: et_rot_mag.h:258
const Cmp & get_Bphi() const
Returns the component of the magnetic field.
Definition: et_rot_mag.h:254
const Cmp & get_At() const
Returns the t component of the electromagnetic potential, divided by .
Definition: et_rot_mag.h:246
virtual double angu_mom() const
Angular momentum.
const Tenseur & get_Srrem() const
Returns the rr-component of the electromagnetic stress 3-tensor, as measured in the Eulerian frame...
Definition: et_rot_mag.h:271
virtual double grv2() const
Error on the virial identity GRV2.
const Tenseur & get_Sppem() const
Returns the component of the electromagnetic stress 3-tensor, as measured in the Eulerian frame...
Definition: et_rot_mag.h:276
const Vector & get_J_I() const
Accessor to the interaction momentum vector.
Definition: et_rot_mag.h:683
Tenseur Srr_em
rr component of the electromagnetic stress 3-tensor, as measured in the Eulerian frame. (not used and set to 0, should be supressed)
Definition: et_rot_mag.h:170
void magnet_comput(const int adapt_flag, Cmp(*f_j)(const Cmp &x, const double), Param &par_poisson_At, Param &par_poisson_Avect)
Computes the electromagnetic quantities solving the Maxwell equations (6) and (7) of [Bocquet...
void operator=(const Et_rot_mag &)
Assignment to another Et_rot_mag.
Definition: et_rot_mag.C:286
double a_j
Amplitude of the curent/charge function.
Definition: et_rot_mag.h:180
void equilibrium_mag_plus(const Itbl &icontrol, const Tbl &control, Tbl &diff, const int initial_j, const Tbl an_j, Cmp(*f_j)(const Cmp &x, const Tbl), Cmp(*M_j)(const Cmp &x, const Tbl), const Tbl bn_j, Cmp(*g_j)(const Cmp &x, const Tbl), Cmp(*N_j)(const Cmp &x, const Tbl), const double relax_mag)
Computes an equilibrium configuration.
bool is_conduct() const
Tells if the star is made of conducting or isolating material.
Definition: et_rot_mag.h:241
Vector J_I
Interaction momentum density 3-vector.
Definition: et_rot_mag.h:627
double get_Q() const
Returns the requested electric charge in the case of a perfect conductor and the charge/baryon for an...
Definition: et_rot_mag.h:282
Scalar xmag
The magnetisation scalar.
Definition: et_rot_mag.h:622
bool use_B_in_eos
Flag : true if the value of the magnetic field is used in the Eos.
Definition: et_rot_mag.h:617
Class for magnetized (isolator or perfect conductor), rigidly rotating stars.
Definition: et_rot_mag.h:143
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: et_rot_mag.C:339
bool include_magnetisation
Flag : true if magnetisation terms are included in the equations.
Definition: et_rot_mag.h:620
Parameter storage.
Definition: param.h:125
bool use_magnetisation() const
Public accessor to the include_magnetisation flag.
Definition: et_rot_mag.h:674
Et_rot_mag(Map &mp_i, int nzet_i, bool relat, const Eos &eos_i, const int cond)
Standard constructor.
Definition: et_rot_mag.C:134
virtual void sauve(FILE *) const
Save in a file.
virtual void del_deriv() const
Deletes all the derived quantities.
Definition: et_rot_mag.C:261
void operator=(const Et_magnetisation &)
Assignment to another Et_rot_mag.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Cmp j_phi
-component of the current 4-vector
Definition: et_rot_mag.h:159
double get_a_j() const
Returns the amplitude of the current/charge function.
Definition: et_rot_mag.h:284
virtual double mom_quad_old() const
Part of the quadrupole moment.
virtual double grv2() const
Error on the virial identity GRV2.
Cmp j_t
t-component of the current 4-vector
Definition: et_rot_mag.h:158
virtual double tsw() const
Ratio T/W.
void equilibrium_mag(double ent_c, double omega0, double fact_omega, int nzadapt, const Tbl &ent_limit, const Itbl &icontrol, const Tbl &control, double mbar_wanted, double magmom_wanted, double aexp_mass, Tbl &diff, double Q0, double a_j0, Cmp(*f_j)(const Cmp &x, const double), Cmp(*M_j)(const Cmp &x, const double))
Computes an equilibrium configuration.
double Q_int() const
Computed charge from the integration of charge density over the star (i.e.
virtual void sauve(FILE *) const
Save in a file.
Definition: et_rot_mag.C:314
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition: et_rot_mag.C:270
virtual void magnet_comput(const int adapt_flag, Cmp(*f_j)(const Cmp &x, const double), Param &par_poisson_At, Param &par_poisson_Avect)
Computes the electromagnetic quantities solving the Maxwell equations (6) and (7) of [Bocquet...
Sym_tensor Sij_I
Interaction stress 3-tensor.
Definition: et_rot_mag.h:630
Tenseur Elec() const
Computes the electric field spherical components in Lorene&#39;s units.
virtual double mass_g() const
Gravitational mass.
Cmp A_t
t-component of the elecctromagnetic potential 1-form, divided by .
Definition: et_rot_mag.h:150
virtual void MHD_comput()
Computes the electromagnetic part of the stress-energy tensor.
virtual double grv3(ostream *ost=0x0) const
Error on the virial identity GRV3.
const Cmp & get_jt() const
Returns the t component of the current 4-vector.
Definition: et_rot_mag.h:256
const Tenseur & get_Jpem() const
Returns the -component of the electromagnetic momentum density 3-vector, as measured in the Eulerian ...
Definition: et_rot_mag.h:265
Basic array class.
Definition: tbl.h:164
virtual void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
int conduc
Flag: conduc=0->isolator, 1->perfect conductor.
Definition: et_rot_mag.h:181
double Q_comput() const
Computed charge deduced from the asymptotic behaviour of At [SI units].
virtual ~Et_magnetisation()
Destructor.
double MagMom() const
Magnetic Momentum in SI units.
Cmp B_phi
-component of the magnetic field
Definition: et_rot_mag.h:157
virtual double mom_quad_old() const
Part of the quadrupole moment.
Class intended to describe valence-2 symmetric tensors.
Definition: sym_tensor.h:226
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
Tenseur Jp_em
component of the electromagnetic momentum density 3-vector, as measured in the Eulerian frame...
Definition: et_rot_mag.h:167
Tenseur Spp_em
component of the electromagnetic stress 3-tensor, as measured in the Eulerian frame.
Definition: et_rot_mag.h:173
const Sym_tensor & get_Sij_I() const
Accessor to the interaction stress tensor.
Definition: et_rot_mag.h:686
virtual void MHD_comput()
Computes the electromagnetic part of the stress-energy tensor.