Debian Codegraph @

C++/Include/et_rot_diff.h

raw symbols SCIP
1 /*
2 * Definition of Lorene class Et_rot_diff
3 *
4 */
5
6 /*
7 * Copyright (c) 2001 Eric Gourgoulhon
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 #ifndef __ET_ROT_DIFF_H_
29 #define __ET_ROT_DIFF_H_
30
31 /*
32 * $Id: et_rot_diff.h,v 1.5 2014/10/13 08:52:34 j_novak Exp $
33 * $Log: et_rot_diff.h,v $
34 * Revision 1.5 2014/10/13 08:52:34 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.4 2005/10/05 15:14:47 j_novak
38 * Added a Param* as parameter of Etoile_rot::equilibrium
39 *
40 * Revision 1.3 2004/03/22 13:12:41 j_novak
41 * Modification of comments to use doxygen instead of doc++
42 *
43 * Revision 1.2 2002/09/13 09:17:33 j_novak
44 * Modif. commentaires
45 *
46 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
47 * LORENE
48 *
49 * Revision 1.2 2001/10/25 09:20:35 eric
50 * Ajout de la fonction virtuelle display_poly.
51 *
52 * Revision 1.1 2001/10/19 08:17:59 eric
53 * Initial revision
54 *
55 *
56 * $Header: /cvsroot/Lorene/C++/Include/et_rot_diff.h,v 1.5 2014/10/13 08:52:34 j_novak Exp $
57 *
58 */
59
60 // Headers Lorene
61 #include "etoile.h"
62
63 namespace Lorene {
64 /**
65 * Class for differentially rotating stars. \ingroup (star)
66 *
67 *
68 */
69
70 class Et_rot_diff : public Etoile_rot {
71
72 // Data :
73 // -----
74 protected:
75 /** Function \f$F(\Omega)\f$ defining the rotation profile.
76 * This function is linked to the components of the fluid 4-velocity
77 * by
78 * \f[
79 * F(\Omega) = u^t u_\varphi \ .
80 * \f]
81 * The first argument of \c frot must be \f$\Omega\f$; the second
82 * argument contains the parameters, the first of which being
83 * necessarily the central value of \f$\Omega\f$.
84 */
85 double (*frot)(double, const Tbl&) ;
86
87 /** Primitive of the function \f$F(\Omega)\f$, which vanishes at the
88 * stellar center.
89 * The first argument of \c primfrot must be \f$\Omega\f$; the second
90 * argument contains the parameters, the first of which being
91 * necessarily the central value of \f$\Omega\f$.
92 */
93 double (*primfrot)(double, const Tbl&) ;
94
95 /** Parameters of the function \f$F(\Omega)\f$.
96 *
97 * To be used as the second argument of functions \c frot
98 * and \c primfrot .
99 * The parameter \c par_frot(0) must always be the central angular
100 * velocity.
101 */
102 Tbl par_frot ;
103
104 /// Field \f$\Omega(r,\theta)\f$
105 Tenseur omega_field ;
106
107 double omega_min ; ///< Minimum value of \f$\Omega\f$
108 double omega_max ; ///< Maximum value of \f$\Omega\f$
109
110 /// Field \f$\int_{\Omega_{\rm c}}^\Omega F(\Omega') \, d\Omega' \f$
111 Tenseur prim_field ;
112
113 // Constructors - Destructor
114 // -------------------------
115 public:
116 /** Standard constructor.
117 *
118 * @param mp_i Mapping on which the star will be defined
119 * @param nzet_i Number of domains occupied by the star
120 * @param relat should be \c true for a relativistic
121 * star, \c false for a Newtonian one
122 * @param eos_i Equation of state of the stellar matter
123 * @param frot_i Function \f$F(\Omega)\f$ defining the rotation profile.
124 * @param primfrot_i Primitive of \f$F(\Omega)\f$ which vanishes at the
125 * stellar center
126 * @param par_frot_i Parameters of functions \c frot_i
127 * and \c primfrot_i ,
128 * \c par_frot_i(0) being the central value of
129 * \f$\Omega\f$.
130 */
131 Et_rot_diff(Map& mp_i, int nzet_i, bool relat, const Eos& eos_i,
132 double (*frot_i)(double, const Tbl&),
133 double (*primfrot_i)(double, const Tbl&),
134 const Tbl& par_frot_i) ;
135
136 Et_rot_diff(const Et_rot_diff& ) ; ///< Copy constructor
137
138 /** Constructor from a file (see \c sauve(FILE*) ).
139 *
140 * @param mp_i Mapping on which the star will be defined
141 * @param eos_i Equation of state of the stellar matter
142 * @param fich input file (must have been created by the function
143 * \c sauve )
144 * @param frot_i Function \f$F(\Omega)\f$ defining the rotation profile.
145 * @param primfrot_i Primitive of \f$F(\Omega)\f$ which vanishes at the
146 * stellar center
147 */
148 Et_rot_diff(Map& mp_i, const Eos& eos_i, FILE* fich,
149 double (*frot_i)(double, const Tbl&),
150 double (*primfrot_i)(double, const Tbl&) ) ;
151
152 virtual ~Et_rot_diff() ; ///< Destructor
153
154
155 // Memory management
156 // -----------------
157
158 // Everything is inherited from Etoile_rot
159
160 // Mutators / assignment
161 // ---------------------
162 public:
163 /// Assignment to another \c Et_rot_diff
164 void operator=(const Et_rot_diff& ) ;
165
166 // Accessors
167 // ---------
168 public:
169 /// Returns the angular velocity field \f$\Omega\f$
170 const Tenseur& get_omega_field() const {return omega_field;} ;
171
172 /** Returns the central value of the rotation angular velocity
173 * (\c [f_unit] )
174 */
175 virtual double get_omega_c() const ;
176
177 // Outputs
178 // -------
179 public:
180 virtual void sauve(FILE *) const ; ///< Save in a file
181
182 /// Display in polytropic units
183 virtual void display_poly(ostream& ) const ;
184
185 protected:
186 /// Operator >> (virtual function called by the operator <<).
187 virtual ostream& operator>>(ostream& ) const ;
188
189
190 // Computational routines
191 // ----------------------
192 public:
193
194 virtual double tsw() const ; ///< Ratio T/W
195
196 /** Computes the hydrodynamical quantities relative to the Eulerian
197 * observer from those in the fluid frame.
198 *
199 * The calculation is performed starting from the quantities
200 * \c omega_field , \c ent , \c ener , \c press ,
201 * and \c a_car ,
202 * which are supposed to be up to date.
203 * From these, the following fields are updated:
204 * \c gam_euler , \c u_euler , \c ener_euler , \c s_euler .
205 *
206 */
207 virtual void hydro_euler() ;
208
209 /** Computes \f$\Omega(r,\theta)\f$ (member \c omega_field ).
210 *
211 * The computation amounts to solving the equation
212 * \f[
213 * F(\Omega) - {B^2 r^2\sin^2\theta (\Omega - N^\varphi)
214 * \over N^2 - B^2 r^2 \sin^2(\Omega-N^\varphi)^2} = 0
215 * \f]
216 * for \f$\Omega\f$.
217 *
218 * @param omeg_min [input] Lower bound of the interval for
219 * searching omega
220 * @param omeg_max [input] Higher bound of the interval for
221 * searching omega
222 * @param precis [input] Required precision in the determination of
223 * the zero by the secant method
224 * @param nitermax [input] Maximum number of iterations in the secant
225 * method to compute the zero.
226 */
227 void fait_omega_field(double omeg_min, double omeg_max,
228 double precis, int nitermax) ;
229
230 /// Computes the member \c prim_field from \c omga_field .
231 void fait_prim_field() ;
232
233 /** Evaluates \f$F(\Omega)\f$, where \e F is the function
234 * defining the rotation profile.
235 * This function is linked to the components of the fluid 4-velocity
236 * by
237 * \f[
238 * F(\Omega) = u^t u_\varphi \ .
239 * \f]
240 *
241 * \c funct_omega calls \c frot with the parameters
242 * \c par_frot .
243 *
244 * @param omeg [input] value of \f$\Omega\f$
245 * @return value of \f$F(\Omega)\f$
246 *
247 */
248 double funct_omega(double omeg) const ;
249
250 /** Evaluates the primitive of \f$F(\Omega)\f$, where \e F is the function
251 * defining the rotation profile.
252 *
253 * @param omeg [input] value of \f$\Omega\f$
254 * @return value of
255 * \f$\int_{\Omega_{\rm c}}^\Omega F(\Omega') \, d\Omega' \f$
256 *
257 */
258 double prim_funct_omega(double omeg) const ;
259
260 /** Computes an equilibrium configuration.
261 *
262 * @param ent_c [input] Central enthalpy
263 * @param omega0 [input] Requested central angular velocity
264 * (if \c fact_omega=1. )
265 * @param fact_omega [input] 1.01 = search for the Keplerian frequency,
266 * 1. = otherwise.
267 * @param nzadapt [input] Number of (inner) domains where the mapping
268 * adaptation to an iso-enthalpy surface
269 * should be performed
270 * @param ent_limit [input] 1-D \c Tbl of dimension \c nzet which
271 * defines the enthalpy at the outer boundary
272 * of each domain
273 * @param icontrol [input] Set of integer parameters (stored as a
274 * 1-D \c Itbl of size 8) to control the
275 * iteration:
276 * \li \c icontrol(0) = mer_max : maximum number of steps
277 * \li \c icontrol(1) = mer_rot : step at which the rotation is
278 * switched on
279 * \li \c icontrol(2) = mer_change_omega : step at which the rotation
280 * velocity is changed to reach the final one
281 * \li \c icontrol(3) = mer_fix_omega : step at which the final
282 * rotation velocity must have been reached
283 * \li \c icontrol(4) = mer_mass : the absolute value of
284 * \c mer_mass is the step from which the
285 * baryon mass is forced to converge,
286 * by varying the central enthalpy
287 * (\c mer_mass > 0 ) or the angular
288 * velocity (\c mer_mass < 0 )
289 * \li \c icontrol(5) = mermax_poisson : maximum number of steps in
290 * \c Map_et::poisson
291 * \li \c icontrol(6) = mer_triax : step at which the 3-D
292 * perturbation is switched on
293 * \li \c icontrol(7) = delta_mer_kep : number of steps
294 * after \c mer_fix_omega when \c omega
295 * starts to be increased by \c fact_omega
296 * to search for the Keplerian velocity
297 *
298 * @param control [input] Set of parameters (stored as a
299 * 1-D \c Tbl of size 7) to control the
300 * iteration:
301 * \li \c control(0) = precis : threshold on the enthalpy relative
302 * change for ending the computation
303 * \li \c control(1) = omega_ini : initial central angular velocity,
304 * switched on only if \c mer_rot < 0 ,
305 * otherwise 0 is used
306 * \li \c control(2) = relax : relaxation factor in the main
307 * iteration
308 * \li \c control(3) = relax_poisson : relaxation factor in
309 * \c Map_et::poisson
310 * \li \c control(4) = thres_adapt : threshold on dH/dr for
311 * freezing the adaptation of the mapping
312 * \li \c control(5) = ampli_triax : relative amplitude of
313 * the 3-D perturbation
314 * \li \c control(6) = precis_adapt : precision for
315 * \c Map_et::adapt
316 *
317 * @param mbar_wanted [input] Requested baryon mass (effective only
318 * if \c mer_mass > mer_max )
319 * @param aexp_mass [input] Exponent for the increase factor of the
320 * central enthalpy to converge to the
321 * requested baryon mass
322 * @param diff [output] 1-D \c Tbl of size 7 for the storage of
323 * some error indicators :
324 * \li \c diff(0) : Relative change in the enthalpy field
325 * between two successive steps
326 * \li \c diff(1) : Relative error in the resolution of the
327 * Poisson equation for \c nuf
328 * \li \c diff(2) : Relative error in the resolution of the
329 * Poisson equation for \c nuq
330 * \li \c diff(3) : Relative error in the resolution of the
331 * Poisson equation for \c dzeta
332 * \li \c diff(4) : Relative error in the resolution of the
333 * Poisson equation for \c tggg
334 * \li \c diff(5) : Relative error in the resolution of the
335 * equation for \c shift (x comp.)
336 * \li \c diff(6) : Relative error in the resolution of the
337 * equation for \c shift (y comp.)
338 */
339 virtual void equilibrium(double ent_c, double omega0, double fact_omega,
340 int nzadapt, const Tbl& ent_limit,
341 const Itbl& icontrol, const Tbl& control,
342 double mbar_wanted, double aexp_mass,
343 Tbl& diff, Param* = 0x0) ;
344
345 };
346
347 }
348 #endif